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@xxxxxxxxxx> --- 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