Hi,

I had been looking into booting a 32-bit kernel with efiboot and the
first thing I stumbled upon is that when we jump back into 32-bit mode
we don't disable the Long Mode Extension.  Thus when the i386 kernel
turns on paging, LME goes active as well and "weird things happen".

Not sure this path is worth pursuing, but this diff at least resets
EFER correctly.

Opinions? ok?

Patrick

diff --git a/sys/arch/amd64/stand/efiboot/run_i386.S 
b/sys/arch/amd64/stand/efiboot/run_i386.S
index 1c70f8d4610..63d6f1f1dca 100644
--- a/sys/arch/amd64/stand/efiboot/run_i386.S
+++ b/sys/arch/amd64/stand/efiboot/run_i386.S
@@ -88,6 +88,12 @@ start32a:
        andl    $(~CR4_PAE), %eax
        movl    %eax, %cr4
 
+       /* Disable LME */
+       movl    $MSR_EFER, %ecx
+       rdmsr
+       xor     %eax, %eax
+       wrmsr
+
        jmp     start32b
 start32b:
        .code32

Reply via email to