Adjust the crt0 file to insert a null stack frame before calling the kernel. Provides a solid base for the stack unwinding.
This commit is contained in:
parent
39c1956819
commit
a9c0fcdfde
|
@ -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);
|
||||
}
|
BIN
global/crt0.o
BIN
global/crt0.o
Binary file not shown.
BIN
global/crt0.old
Normal file
BIN
global/crt0.old
Normal file
Binary file not shown.
|
@ -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
|
||||
|
||||
xor %rbp, %rbp
|
||||
|
||||
xor %rax, %rax
|
||||
call Main
|
||||
|
||||
movq %rax, %rdi
|
||||
call Exit
|
||||
|
Loading…
Reference in New Issue
Block a user