summaryrefslogtreecommitdiffstats
path: root/purgatory
diff options
context:
space:
mode:
authorMagnus Damm <magnus@valinux.co.jp>2006-08-23 12:51:21 +0900
committerSimon Horman <horms@verge.net.au>2006-10-06 12:44:15 +0900
commit0d5e71fbcb114b5a67ef7277dbad206915a20df2 (patch)
tree0e074374e44190fada6eb00a38d363cdb79d1319 /purgatory
parent8251f7dd3fe02995f92dd0db6efdf34b0988e644 (diff)
downloadkexec-tools-0d5e71fbcb114b5a67ef7277dbad206915a20df2.tar.gz
x86_64: Setup CS when booting vmlinux
The purgatory code in kexec-tools does not currently setup CS when booting a 64-bit ELF file such as a vmlinux file. This together with the fact that the Linux kernel doesn't reload CS properly if booted from the 64-bit entry point means that booting a vmlinux may fail under certain conditions. The only known combination that triggers this problem is when kexec-tools and kexec are used to load a x86_64 vmlinux under a dom0 Linux running under the Xen hypervisor. This patch is needed for sure to reload kernels with version <= 2.6.17. There are fixes for this problem in the URL below, but if a fix will be included in 2.6.18 or not is unknown at this time. http://permalink.gmane.org/gmane.linux.kernel/438998 Signed-off-by: Magnus Damm <magnus@valinux.co.jp> Removed some trailing whitespace Signed-off-by: Simon Horman <horms@verge.net.au>
Diffstat (limited to 'purgatory')
-rw-r--r--purgatory/arch/x86_64/entry64.S10
1 files changed, 8 insertions, 2 deletions
diff --git a/purgatory/arch/x86_64/entry64.S b/purgatory/arch/x86_64/entry64.S
index 1ed67863..666023c6 100644
--- a/purgatory/arch/x86_64/entry64.S
+++ b/purgatory/arch/x86_64/entry64.S
@@ -37,7 +37,11 @@ entry64:
movl %eax, %fs
movl %eax, %gs
- /* In 64bit mode the code segment is meaningless */
+ movq $stack_init, %rsp
+ pushq $0x10 /* CS */
+ pushq $new_cs_exit
+ lretq
+new_cs_exit:
/* Load the registers */
movq rax(%rip), %rax
@@ -93,8 +97,10 @@ gdt: /* 0x00 unusable segment
.word 0, 0, 0
/* 0x10 4GB flat code segment */
- .word 0xFFFF, 0x0000, 0x9A00, 0x00CF
+ .word 0xFFFF, 0x0000, 0x9A00, 0x00AF
/* 0x18 4GB flat data segment */
.word 0xFFFF, 0x0000, 0x9200, 0x00CF
gdt_end:
+stack: .quad 0, 0
+stack_init: