diff mbox

[kvm-unit-tests] x86: load 64-bit segments into the segment registers

Message ID 1437635844-38294-1-git-send-email-pbonzini@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Paolo Bonzini July 23, 2015, 7:17 a.m. UTC
kvm-unit-tests was keeping DS/ES/FS/GS loaded with the segment descriptors
provided by the multiboot boot loader (which are 32-bit), and instead loading
SS with 0.  The vmx.flat test failed because KVM did not like doing writes
into such an SS.

Load again the segment registers after entering 64-bit mode, for both
the BSP and the APs.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 x86/cstart64.S | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/x86/cstart64.S b/x86/cstart64.S
index 8d0d95d..8d5ee2d 100644
--- a/x86/cstart64.S
+++ b/x86/cstart64.S
@@ -213,7 +213,11 @@  idt_descr:
 
 load_tss:
 	lidtq idt_descr
-	mov $0, %eax
+	mov $0x10, %eax
+	mov %ax, %ds
+	mov %ax, %es
+	mov %ax, %fs
+	mov %ax, %gs
 	mov %ax, %ss
 	mov $(APIC_DEFAULT_PHYS_BASE + APIC_ID), %eax
 	mov (%rax), %eax