/* Copyright (c) Microsoft Corporation. All rights reserved. */
#include <arm_asm.h>

 * ARM assembly source file for machine dependent RPC... stuff

 * UINT strump(ADDRESS newsp, ADDRESS newpc)
 * Switches to a new stack and jumps to the RPC destination. Sets up 
 * in arguments before and out arguments after. Switches back to old 
 * stack.
 * newsp (r0): Address of the new stack 
 * newpc (r1): The value of the new program counter (RPC destination)
        stmdb   sp!,{r9-r10,lr} /* save register state on old stack */
        mov             r10,sp  /* save the old stack pointer */

        mov             sp,r0   /* switch to the new stack */
        mov             r9,r1   /* avoid clobbering the pc argument */

        ldmia   sp!,{r0-r3}     /* copy args to regs and pop off (new) stack*/ 

        mov             lr,pc   /* setup for returning after jump */
        mov             pc,r9   /* jump to new pc */

                                /* RPC return value now in r0 */
        mov             sp,r10  /* switch to the old stack */

        ldmia   sp!,{r9-r10,pc} /* restore registers and return */

/* Client side code that gets pointed to by proxy v-tables. See soapmd.s. */
        stmdb sp!, {r0-r3}      /* Pass args on stack */
        stmdb sp!, {lr}         /* Save *below* args */
        mov r0, ip
        mov r1, sp
        ldr ip, _L(interp)      /* bl ProxyInterPreter, 32 bit version... */
        mov lr, pc
        mov pc, ip
        ldr ip, [sp], #+20  /* Pop the 5 words saved above: ip gets saved lr */
        mov pc, ip              /* return */
        _DCD ProxyInterpreter

        ldr ip, _L(descr)
        b _L(ProxyCommonTemplate)  /* pc relative, must be adjusted */
        _DCD 0                  /* gets filled in with method descriptor ptr */