kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH kvm-unit-tests v2] x86: setup segment registers before percpu areas
@ 2020-06-25 11:13 Paolo Bonzini
  0 siblings, 0 replies; only message in thread
From: Paolo Bonzini @ 2020-06-25 11:13 UTC (permalink / raw)
  To: kvm; +Cc: nadav.amit

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(-)

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
-- 
2.26.2


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-06-25 11:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-25 11:13 [PATCH kvm-unit-tests v2] x86: setup segment registers before percpu areas Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).