summaryrefslogtreecommitdiff
path: root/arch/x86/machine/boot_asm.S
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2012-12-29 16:49:50 +0100
committerRichard Braun <rbraun@sceen.net>2012-12-29 16:49:50 +0100
commit1390e1961c26f4c305414a29e08948fd9c83e378 (patch)
tree94a96f6e63e27a68cc36cab0b5424b5d4ded8470 /arch/x86/machine/boot_asm.S
parentba8e0b06d2d61ea13d7295e91e337c73a5d8695a (diff)
x86/boot: move the boot stack to the .init section
A true kernel stack (at high addresses) is needed when switching to a user task, since low addresses won't be available any more after loading its pmap.
Diffstat (limited to 'arch/x86/machine/boot_asm.S')
-rw-r--r--arch/x86/machine/boot_asm.S11
1 files changed, 9 insertions, 2 deletions
diff --git a/arch/x86/machine/boot_asm.S b/arch/x86/machine/boot_asm.S
index 0d27b6f..0b08353 100644
--- a/arch/x86/machine/boot_asm.S
+++ b/arch/x86/machine/boot_asm.S
@@ -58,7 +58,7 @@ ASM_ENTRY(_start)
ljmp $8, $1f
1:
- movl $(boot_stack + BOOT_STACK_SIZE), %esp
+ movl $(boot_stack - KERNEL_OFFSET + BOOT_STACK_SIZE), %esp
movl %esp, %ebp
#ifdef __LP64__
@@ -84,13 +84,20 @@ ASM_ENTRY(_start)
call boot_setup_paging
movl %eax, %cr3
-#ifndef __LP64__
+#ifdef __LP64__
+ .code64
+ movq $(boot_stack + BOOT_STACK_SIZE), %rsp
+ movq %rsp, %rbp
+ .code32
+#else /* __LP64__ */
movl %cr0, %eax
orl $CPU_CR0_PG, %eax
movl %eax, %cr0
ljmp $8, $1f
1:
+ movl $(boot_stack + BOOT_STACK_SIZE), %esp
+ movl %esp, %ebp
#endif /* __LP64__ */
call boot_main