aboutsummaryrefslogtreecommitdiff
path: root/include/macros.s
diff options
context:
space:
mode:
authorMirek Kratochvil <exa.exa@gmail.com>2023-08-06 00:25:53 +0200
committerMirek Kratochvil <exa.exa@gmail.com>2023-08-06 00:25:53 +0200
commit74cad993376dc269e8389fbf150be9ecc36890c7 (patch)
tree32a2dbb382836ee0f1853fe5e63036d044fea77d /include/macros.s
parent46d84e91ebe48ade19bd3f5e18360bf853b53968 (diff)
downloaduskel-74cad993376dc269e8389fbf150be9ecc36890c7.tar.gz
uskel-74cad993376dc269e8389fbf150be9ecc36890c7.tar.bz2
fibs work
Diffstat (limited to 'include/macros.s')
-rw-r--r--include/macros.s43
1 files changed, 43 insertions, 0 deletions
diff --git a/include/macros.s b/include/macros.s
new file mode 100644
index 0000000..d915171
--- /dev/null
+++ b/include/macros.s
@@ -0,0 +1,43 @@
+
+.ifndef _macros_s_file
+_macros_s_file:
+
+.macro enter_rbp
+ jmp *(%rbp)
+.endm
+
+.macro enter x
+ mov \x, %rbp
+ enter_rbp
+.endm
+
+.macro cell x
+ .quad \x
+.endm
+
+.macro continue
+ mov %rsi, %rax
+ mov %rbp, %rsi
+ enter %rax
+.endm
+
+.macro thunkenv arg, dest
+ mov (8*(\arg+2))(%rbp), \dest
+.endm
+
+.macro enter_thunkenv arg
+ mov (8*(\arg+2))(%rbp), %rbp
+ jmp *(%rbp)
+.endm
+
+# this needs data.s
+.macro .thunkcode name
+ .align 8
+ __\name\()_info:
+ cell THU_evacuate
+ cell THU_scavenge
+ cell 0
+ \name:
+.endm
+
+.endif # _macros_s_file