[kvm-unit-tests,v2] x86: setup segment registers before percpu areas
diff mbox series

Message ID 20200625111327.1509-1-pbonzini@redhat.com
State New
Headers show
Series
  • [kvm-unit-tests,v2] x86: setup segment registers before percpu areas
Related show

Commit Message

Paolo Bonzini June 25, 2020, 11:13 a.m. UTC
The base of the percpu area is stored in the %gs base, and writing
to %gs destroys it.  Move setup_segments earlier, before the %gs
base is written, and keep setup_percpu_area close so that the base
is updated close to the selector.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 x86/cstart.S | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Patch
diff mbox series

diff --git a/x86/cstart.S b/x86/cstart.S
index 6b5004e..deb08b7 100644
--- a/x86/cstart.S
+++ b/x86/cstart.S
@@ -109,21 +109,21 @@  MSR_GS_BASE = 0xc0000101
 
 .globl start
 start:
+        lgdtl gdt32_descr
+        setup_segments
         mov $stacktop, %esp
+        setup_percpu_area
+
         push %ebx
         call setup_multiboot
         call setup_libcflat
         mov mb_cmdline(%ebx), %eax
         mov %eax, __args
         call __setup_args
-        setup_percpu_area
         call prepare_32
         jmpl $8, $start32
 
 prepare_32:
-        lgdtl gdt32_descr
-	setup_segments
-
 	mov %cr4, %eax
 	bts $4, %eax  // pse
 	mov %eax, %cr4