fiber_continue_arm32.s 1.16 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13
	.arm
	.text
	.global	__fiber_continue
	.type	__fiber_continue, %function

__fiber_continue:
        /* Parameter List (in order)
        * r0 = pointer to continuation (should hold value of target stack will be filled with this continuation)
        *
        * Return
        * r0 = continuation that returned control back to the caller (null if fallthrough)
        *
        * Variables
14
        * r1 = temporary for the old stack pointer */
15 16 17 18 19 20 21 22 23 24

        /* ========== Save State ========== */
        /* store programm counter for later return */
        push {lr}
        /* store callee saved registers */
        push {r4-r12,lr}
        /* ========== Save State ========== */

        /* Perform change to new stack */
        /* Keep old stack as result from this function. */
25
        mov r1, sp
26 27 28 29 30 31 32 33 34 35 36
        /* Switch to new stack pointer. */
        mov sp, r0


        /* ========== Restore State ========== */
        /* restore callee saved registers */
        pop {r4-r12,lr}
        /* ========== Restore State ========== */

        /* Just return back from the call. */
        /* This is the end of a fiber, so we have no continuation. */
37
        mov r0, r1
38
        pop {pc}