diff options
-rw-r--r-- | coroutine.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/coroutine.c b/coroutine.c index 13a747a..3062ad9 100644 --- a/coroutine.c +++ b/coroutine.c @@ -67,3 +67,16 @@ void coroutine_task(void) { exit(1); _coroutine_table[_cur_cid].fn(_coroutine_table[_cur_cid].stack); } + +// arm32 +mov r0, coroutine_table[_cur_cid].arg +mov _saved_stack sp +mov sp, coroutine_table[_cur_cid].stack +bl coroutine_table[_cur_cid].fn +mov _saved_stack sp +// x86-64 +movl coroutine_table[_cur_cid].arg %edi +movq %rsp _saved_stack +movq coroutine_table[_cur_cid].stack %rsp +call coroutine_table[_cur_cid].fn +movq _saved_stack %rsp |