aboutsummaryrefslogtreecommitdiff
path: root/sys/rt/amd64/crti.s
diff options
context:
space:
mode:
Diffstat (limited to 'sys/rt/amd64/crti.s')
-rw-r--r--sys/rt/amd64/crti.s17
1 files changed, 17 insertions, 0 deletions
diff --git a/sys/rt/amd64/crti.s b/sys/rt/amd64/crti.s
new file mode 100644
index 0000000..eeba8b1
--- /dev/null
+++ b/sys/rt/amd64/crti.s
@@ -0,0 +1,17 @@
+global _init
+global _fini
+
+section .init
+_init:
+ ; call pushes an 8 byte return address on the stack
+ ; 64 bit ABI requires stack to be aligned to 16 bytes
+ ; we realign with another 8 byte address
+ push rbp
+ mov rbp, rsp
+ ;; compiler inserts the rest here
+
+section .fini
+_fini:
+ push rbp ; see above
+ mov rbp, rsp
+ ;; compiler inserts the rest here