aboutsummaryrefslogtreecommitdiff
path: root/exit_123.s
diff options
context:
space:
mode:
authorMirek Kratochvil <exa.exa@gmail.com>2023-08-12 15:12:03 +0200
committerMirek Kratochvil <exa.exa@gmail.com>2023-08-12 15:12:03 +0200
commit6be5a28bb90b391a5842a8ce3dfc7c154100ab68 (patch)
tree22e04a263e68d983c6bf5d1fdebd662e66915e96 /exit_123.s
parent5184299c7dfddeba4d2d2ba95d390040368f9736 (diff)
downloaduskel-6be5a28bb90b391a5842a8ce3dfc7c154100ab68.tar.gz
uskel-6be5a28bb90b391a5842a8ce3dfc7c154100ab68.tar.bz2
make a macro for pushing out thunks
Diffstat (limited to 'exit_123.s')
-rw-r--r--exit_123.s28
1 files changed, 4 insertions, 24 deletions
diff --git a/exit_123.s b/exit_123.s
index ed96ad1..1e7ba23 100644
--- a/exit_123.s
+++ b/exit_123.s
@@ -5,30 +5,10 @@
# || -> cont
.thunkcode main
- # push a new integer
- pushq $100
- pushq $INT_code
- mov %rsp, %r11 # backup first arg
-
- # push another new integer
- pushq $23
- pushq $INT_code
- mov %rsp, %r12 # backup second arg
-
- # push the plus
- push %r12
- push %r11
- pushq $2
- pushq $plus
- mov %rsp, %r13 # backup plus
-
- # push a cont thunk for main_exit
- push %rsi
- pushq $1
- pushq $main_exit
-
- # evaluate into main_exit
- mov %rsp, %rsi
+ thunkto %r11, $INT_code, $100
+ thunkto %r12, $INT_code, $23
+ thunkto %r13, $plus, $2, %r11, %r12
+ thunkto %rsi, $main_exit, $1
enter %r13
.include "include/main_exit.s"