From 0079179f054ea9c5e2c091311e5220ab10816989 Mon Sep 17 00:00:00 2001 From: Alexander Boettcher Date: Wed, 10 Jul 2013 14:34:20 +0200 Subject: [PATCH] base: store initial ax and di registers in crt0.s The values are used by a follow up commit by nova to get the boot CPU number. Issue #814 --- base/src/platform/x86_32/crt0.s | 8 +++++++- base/src/platform/x86_64/crt0.s | 12 +++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/base/src/platform/x86_32/crt0.s b/base/src/platform/x86_32/crt0.s index 2952f173e..47afb98b0 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 4d1edc74a..898faa6c9 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