1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Restore updated implementation of arm32 coroutine code, but prefer ucontext.

This commit is contained in:
Samuel Williams 2019-06-26 22:02:19 +12:00
parent ba17127e99
commit acb67472c7
3 changed files with 15 additions and 4 deletions

View file

@ -2272,6 +2272,9 @@ AS_CASE(["$rb_cv_fiber_coroutine"], [yes|''], [
[x64-mingw32], [ [x64-mingw32], [
rb_cv_fiber_coroutine=win64 rb_cv_fiber_coroutine=win64
], ],
[armv7*-linux-*], [
rb_cv_fiber_coroutine=ucontext
],
[aarch64-linux], [ [aarch64-linux], [
rb_cv_fiber_coroutine=arm64 rb_cv_fiber_coroutine=arm64
], ],

View file

@ -9,6 +9,14 @@
.globl coroutine_transfer .globl coroutine_transfer
coroutine_transfer: coroutine_transfer:
stmia r1!, {r4-r11,sp,lr} # Save caller state (8 registers + return address)
ldmia r0!, {r4-r11,sp,pc} push {r4-r11,lr}
bx 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}

View file

@ -12,7 +12,7 @@
#define COROUTINE __attribute__((noreturn)) void #define COROUTINE __attribute__((noreturn)) void
enum {COROUTINE_REGISTERS = 9}; enum {COROUTINE_REGISTERS = 8};
struct coroutine_context struct coroutine_context
{ {