From f16be176ed6e4674080209e7e08178fb1fc555a2 Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Sun, 15 May 2022 10:10:36 +0100 Subject: [PATCH] Fix triple-fault when starting APs with program loaded above 16MB (issue #63). In a .code16 section, the default coding for the lgdt instruction only loads a 24 bit base address from the GDT descriptor. When loaded above 16MB, we need it to load the full 32 bits. --- boot/startup32.S | 2 +- boot/startup64.S | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/boot/startup32.S b/boot/startup32.S index 5059ba6..ca5535a 100644 --- a/boot/startup32.S +++ b/boot/startup32.S @@ -744,7 +744,7 @@ ap_trampoline: movl %edi, %eax addl $(gdt - startup), %eax movl %eax, (ap_gdt_descr - ap_trampoline + 2) - lgdt ap_gdt_descr - ap_trampoline +data32 lgdt ap_gdt_descr - ap_trampoline # Switch to protected mode and reload the segment registers. diff --git a/boot/startup64.S b/boot/startup64.S index d0cd704..a6f86d1 100644 --- a/boot/startup64.S +++ b/boot/startup64.S @@ -556,7 +556,7 @@ ap_trampoline: movl %ebx, %eax addl $(gdt - startup), %eax movl %eax, (ap_gdt_descr - ap_trampoline + 2) - lgdt ap_gdt_descr - ap_trampoline +data32 lgdt ap_gdt_descr - ap_trampoline # Set the page directory base address.