diff --git a/base/src/platform/x86_32/crt0.s b/base/src/platform/x86_32/crt0.s index 2952f173e6..47afb98b0c 100644 --- a/base/src/platform/x86_32/crt0.s +++ b/base/src/platform/x86_32/crt0.s @@ -17,6 +17,8 @@ _start: mov %esp, __initial_sp + mov %eax, __initial_ax + mov %edi, __initial_di /* XXX Switch to our own stack. */ leal _stack_high, %esp @@ -52,6 +54,10 @@ _stack_low: .global _stack_high _stack_high: - /* initial value of the ESP register */ + /* initial value of the ESP, EAX and EDI register */ .globl __initial_sp + .globl __initial_ax + .globl __initial_di __initial_sp: .space 4 +__initial_ax: .space 4 +__initial_di: .space 4 diff --git a/base/src/platform/x86_64/crt0.s b/base/src/platform/x86_64/crt0.s index 4d1edc74a6..898faa6c9e 100644 --- a/base/src/platform/x86_64/crt0.s +++ b/base/src/platform/x86_64/crt0.s @@ -17,6 +17,12 @@ _start: + movq __initial_ax@GOTPCREL(%rip), %rbx + movq %rax, (%rbx) + + movq __initial_di@GOTPCREL(%rip), %rbx + movq %rdi, (%rbx) + movq __initial_sp@GOTPCREL(%rip), %rax movq %rsp, (%rax) @@ -55,6 +61,10 @@ _stack_low: .global _stack_high _stack_high: - /* initial value of the RSP register */ + /* initial value of the RSP, RAX and RDI register */ .globl __initial_sp + .globl __initial_ax + .globl __initial_di __initial_sp: .space 8 +__initial_ax: .space 8 +__initial_di: .space 8