summaryrefslogtreecommitdiff
path: root/newlib/crt0.s
diff options
context:
space:
mode:
authorMiguel <m.i@gmx.at>2018-08-18 20:04:32 +0200
committerMiguel <m.i@gmx.at>2018-08-18 20:04:32 +0200
commit857d82d45c2bbcaf5234b756736596b1e6a9d28a (patch)
treeaef00d48c5de7fb7cbbc278cd22a98c6a60e14d8 /newlib/crt0.s
parent18d1aa2593003680b0d6f59a36e5dad2821134b2 (diff)
cleaning up (Also for newlib)
Diffstat (limited to 'newlib/crt0.s')
-rw-r--r--newlib/crt0.s19
1 files changed, 19 insertions, 0 deletions
diff --git a/newlib/crt0.s b/newlib/crt0.s
new file mode 100644
index 0000000..e8f0405
--- /dev/null
+++ b/newlib/crt0.s
@@ -0,0 +1,19 @@
+.global _start
+
+_start:
+
+# environment adress was passed on stack
+pop %eax
+mov %eax, environ
+
+# call main (argc and argv are on the stack)
+call main
+
+# push exit code and pass to _exit syscall
+push %eax
+call _exit
+
+# this should never be reached!
+.wait:
+ hlt
+jmp .wait