Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

x86, boot: Move lldt/ltr out of 64bit code section

commit 08da5a2ca

x86_64: Early segment setup for VT

sets up LDT and TR into a valid state in order to speed up boot
decompression under VT.

Those code are put in code64, and it is using GDT that is only
loaded from code32 path.

That breaks booting with 64bit bootloader that does not go through
code32 path and jump to startup_64 directly, and it has different
GDT.

Move those lines into code32 after their GDT is loaded.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Link: http://lkml.kernel.org/r/1359058816-7615-21-git-send-email-yinghai@kernel.org
Cc: Zachary Amsden <zamsden@gmail.com>
Cc: Matt Fleming <matt.fleming@intel.com>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>

authored by

Yinghai Lu and committed by
H. Peter Anvin
d3c433bf 187a8a73

+6 -3
+6 -3
arch/x86/boot/compressed/head_64.S
··· 154 154 btsl $_EFER_LME, %eax 155 155 wrmsr 156 156 157 + /* After gdt is loaded */ 158 + xorl %eax, %eax 159 + lldt %ax 160 + movl $0x20, %eax 161 + ltr %ax 162 + 157 163 /* 158 164 * Setup for the jump to 64bit mode 159 165 * ··· 245 239 movl %eax, %ss 246 240 movl %eax, %fs 247 241 movl %eax, %gs 248 - lldt %ax 249 - movl $0x20, %eax 250 - ltr %ax 251 242 252 243 /* 253 244 * Compute the decompressed kernel start address. It is where