summaryrefslogtreecommitdiff
path: root/coroutine.c
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@lukeshu.com>2024-09-17 12:37:41 -0600
committerLuke T. Shumaker <lukeshu@lukeshu.com>2024-09-17 12:38:19 -0600
commit4412b908755c7b9899cf8cce4e0985aa6816121a (patch)
tree47b21bb34276ea603b70468e2f60504042dfb2a1 /coroutine.c
parent47b2f4c4982fb5f063e9e83c524b2e63abaa58c4 (diff)
wip
Diffstat (limited to 'coroutine.c')
-rw-r--r--coroutine.c13
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