summaryrefslogtreecommitdiff
path: root/coroutine
diff options
context:
space:
mode:
Diffstat (limited to 'coroutine')
-rw-r--r--coroutine/arm32/Context.S14
-rw-r--r--coroutine/arm32/Context.h2
2 files changed, 12 insertions, 4 deletions
diff --git a/coroutine/arm32/Context.S b/coroutine/arm32/Context.S
index c2b93d0a34..4308e1d1d2 100644
--- a/coroutine/arm32/Context.S
+++ b/coroutine/arm32/Context.S
@@ -9,6 +9,14 @@
.globl coroutine_transfer
coroutine_transfer:
- stmia r1!, {r4-r11,sp,lr}
- ldmia r0!, {r4-r11,sp,pc}
- bx lr
+ # Save caller state (8 registers + return address)
+ push {r4-r11,lr}
+
+ # Save caller stack pointer
+ str sp, [r0]
+
+ # Restore callee stack pointer
+ ldr sp, [r1]
+
+ # Restore callee state (8 registers program counter)
+ pop {r4-r11,pc}
diff --git a/coroutine/arm32/Context.h b/coroutine/arm32/Context.h
index d6d3c7f313..27f97908bc 100644
--- a/coroutine/arm32/Context.h
+++ b/coroutine/arm32/Context.h
@@ -12,7 +12,7 @@
#define COROUTINE __attribute__((noreturn)) void
-enum {COROUTINE_REGISTERS = 9};
+enum {COROUTINE_REGISTERS = 8};
struct coroutine_context
{