Skip to content

Commit acb6747

Browse files
committed
Restore updated implementation of arm32 coroutine code, but prefer ucontext.
1 parent ba17127 commit acb6747

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

configure.ac

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2272,6 +2272,9 @@ AS_CASE(["$rb_cv_fiber_coroutine"], [yes|''], [
22722272
[x64-mingw32], [
22732273
rb_cv_fiber_coroutine=win64
22742274
],
2275+
[armv7*-linux-*], [
2276+
rb_cv_fiber_coroutine=ucontext
2277+
],
22752278
[aarch64-linux], [
22762279
rb_cv_fiber_coroutine=arm64
22772280
],

coroutine/arm32/Context.S

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@
99

1010
.globl coroutine_transfer
1111
coroutine_transfer:
12-
stmia r1!, {r4-r11,sp,lr}
13-
ldmia r0!, {r4-r11,sp,pc}
14-
bx lr
12+
# Save caller state (8 registers + return address)
13+
push {r4-r11,lr}
14+
15+
# Save caller stack pointer
16+
str sp, [r0]
17+
18+
# Restore callee stack pointer
19+
ldr sp, [r1]
20+
21+
# Restore callee state (8 registers program counter)
22+
pop {r4-r11,pc}

coroutine/arm32/Context.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
#define COROUTINE __attribute__((noreturn)) void
1414

15-
enum {COROUTINE_REGISTERS = 9};
15+
enum {COROUTINE_REGISTERS = 8};
1616

1717
struct coroutine_context
1818
{

0 commit comments

Comments
 (0)