summaryrefslogtreecommitdiffstats
path: root/lib/crt/x86_64/crt0.s
diff options
context:
space:
mode:
authorJon Santmyer <jon@jonsantmyer.com>2024-03-11 21:40:28 -0400
committerJon Santmyer <jon@jonsantmyer.com>2024-03-11 21:40:28 -0400
commit50392995d6e7f3a10fb74bb2f9073a4790f8933c (patch)
treec89b067b3bacf35e092af5c31fb6e6a08921f31c /lib/crt/x86_64/crt0.s
downloadjove-env-50392995d6e7f3a10fb74bb2f9073a4790f8933c.tar.gz
jove-env-50392995d6e7f3a10fb74bb2f9073a4790f8933c.tar.bz2
jove-env-50392995d6e7f3a10fb74bb2f9073a4790f8933c.zip
simple env with basic test init programHEADmaster
Diffstat (limited to 'lib/crt/x86_64/crt0.s')
-rw-r--r--lib/crt/x86_64/crt0.s22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/crt/x86_64/crt0.s b/lib/crt/x86_64/crt0.s
new file mode 100644
index 0000000..c5a0ba9
--- /dev/null
+++ b/lib/crt/x86_64/crt0.s
@@ -0,0 +1,22 @@
+.section .text
+.global _start
+_start:
+ #Setup start of stack frame
+ xorq %rbp, %rbp
+ pushq %rbp
+ pushq %rbp
+ movq %rsp, %rbp
+
+ #Save arguments passed to main
+ pushq %rdi
+ pushq %rsi
+
+ #Setup libc and call global constructors
+
+ #Call main
+ call main
+
+ #Exit
+ movq %rax, %rdi
+ call exit
+.size _start, . - _start