From 857d82d45c2bbcaf5234b756736596b1e6a9d28a Mon Sep 17 00:00:00 2001 From: Miguel Date: Sat, 18 Aug 2018 20:04:32 +0200 Subject: cleaning up (Also for newlib) --- newlib/crt0.s | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 newlib/crt0.s (limited to 'newlib/crt0.s') 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 -- cgit v1.2.3