summaryrefslogtreecommitdiff
path: root/src/user/lib/crt0.s
diff options
context:
space:
mode:
Diffstat (limited to 'src/user/lib/crt0.s')
-rw-r--r--src/user/lib/crt0.s18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/user/lib/crt0.s b/src/user/lib/crt0.s
new file mode 100644
index 0000000..dd9ab1b
--- /dev/null
+++ b/src/user/lib/crt0.s
@@ -0,0 +1,18 @@
+.section .text
+.global _start
+.type _start, @function
+.weak _start
+_start:
+ mov %rsp, %rbp
+ and $~0xF, %rsp
+ call elf_selfreloc
+
+ mov %rbp, %rsp
+ /* pushed by _freejmp */
+ pop %rdi
+ pop %rsi
+ pop %rdx
+ and $~0xF, %rsp
+ call main
+ mov %rax, %rdi
+ jmp exit