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() {
|
void _start() {
|
||||||
_init();
|
_init();
|
||||||
|
unsigned long long zero = 0;
|
||||||
|
__asm__ __volatile__("movq %%rbp, %[input]" : : [input] "m" (zero) : );
|
||||||
int ex = Main();
|
int ex = Main();
|
||||||
Exit(ex);
|
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
|
.section .text
|
||||||
.global _start
|
.global _start
|
||||||
.global _init
|
.global _init
|
||||||
.global main
|
.global Main
|
||||||
.global _fini
|
.global Exit
|
||||||
.type _start, @function
|
.type _start, @function
|
||||||
_start:
|
_start:
|
||||||
|
push %rbp
|
||||||
|
movq %rsp, %rbp
|
||||||
|
sub $0x10, %rsp
|
||||||
|
|
||||||
|
xor %rax, %rax
|
||||||
call _init
|
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