[FREELDR] Fix UEFI IA-32 boot (#8886)

The PAE flag might be enabled on some x86-32 UEFI platforms, causing a crash in the kernel.
```
Assertion C:\reactos-master\reactos\ntoskrnl\mm\ARM3\miarm.h(971): PointerPte->u.Hard.Valid == 0
nt!MI_WRITE_VALID_PTE+0x28:
822d1d08 cd2c            int     2Ch
```

Tested using qemu with `OVMF32_CODE_4M.fd` firmware, and with 32bit UEFI in VMware.
This commit is contained in:
Daniel Victor
2026-04-30 18:56:19 -03:00
committed by GitHub
parent 8727bfd634
commit 54422db2b8

View File

@@ -455,6 +455,12 @@ WinLdrSetProcessorContext(
/* Re-initialize EFLAGS */
__writeeflags(0);
/* Disable paging first before disabling PAE to avoid crash
* because UEFI might have enabled paged mode with PAE.
* Our kernel doesn't support PAE, so disable it. */
__writecr0(__readcr0() & ~CR0_PG);
__writecr4(__readcr4() & ~CR4_PAE);
/* Set the PDBR */
__writecr3((ULONG_PTR)PDE);