diff --git a/global/crt0.c b/global/crt0.c index 5f3ba44..777ec95 100644 --- a/global/crt0.c +++ b/global/crt0.c @@ -6,6 +6,8 @@ extern void _init(); void _start() { _init(); + unsigned long long zero = 0; + __asm__ __volatile__("movq %%rbp, %[input]" : : [input] "m" (zero) : ); int ex = Main(); Exit(ex); } \ No newline at end of file diff --git a/global/crt0.o b/global/crt0.o index af9b40e..d3aa69a 100644 Binary files a/global/crt0.o and b/global/crt0.o differ diff --git a/global/crt0.old b/global/crt0.old new file mode 100644 index 0000000..af9b40e Binary files /dev/null and b/global/crt0.old differ diff --git a/global/crt0.s b/global/crt0.s index d50d2cd..9b029e7 100644 --- a/global/crt0.s +++ b/global/crt0.s @@ -1,10 +1,22 @@ .section .text .global _start .global _init -.global main -.global _fini +.global Main +.global Exit .type _start, @function _start: + push %rbp + movq %rsp, %rbp + sub $0x10, %rsp + + xor %rax, %rax call _init - call main - call _fini \ No newline at end of file + + xor %rbp, %rbp + + xor %rax, %rax + call Main + + movq %rax, %rdi + call Exit + \ No newline at end of file