On 24/06/20 21:58, Nadav Amit wrote: > From: Nadav Amit <namit@xxxxxxxxxx> > Date: Wed, 24 Jun 2020 19:50:36 +0000 > Subject: [PATCH] x86: load gdt while loading segments > > Signed-off-by: Nadav Amit <namit@xxxxxxxxxx> > --- > x86/cstart.S | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/x86/cstart.S b/x86/cstart.S > index dd33d4d..1d8b8ac 100644 > --- a/x86/cstart.S > +++ b/x86/cstart.S > @@ -95,6 +95,8 @@ MSR_GS_BASE = 0xc0000101 > .endm > > .macro setup_segments > + lgdtl gdt32_descr > + > mov $0x10, %ax > mov %ax, %ds > mov %ax, %es > @@ -106,6 +108,8 @@ MSR_GS_BASE = 0xc0000101 > .globl start > start: > mov $stacktop, %esp > + setup_segments > + > push %ebx > call setup_multiboot > call setup_libcflat > @@ -117,9 +121,6 @@ start: > jmpl $8, $start32 > > prepare_32: > - lgdtl gdt32_descr > - setup_segments > - > mov %cr4, %eax > bts $4, %eax // pse > mov %eax, %cr4 > -- The GDT is already loaded elsewhere for APs, but the gist of the patch is good. I'll send v2 Paolo