diff --git a/Changelog.md b/Changelog.md index 5b51c2e2..72d3097f 100644 --- a/Changelog.md +++ b/Changelog.md @@ -2,6 +2,7 @@ Lilu Changelog ============== #### v1.6.2 - Fixed KC segment name, which also fixed kernel panic on macOS 13 b3 +- Disable EFI64 runtime APIs when `-legacy` is used on 32-bit kernels #### v1.6.1 - Allow loading on macOS 13 without `-lilubetaall` diff --git a/Lilu/Sources/kern_efi.cpp b/Lilu/Sources/kern_efi.cpp index 008730fc..1005522b 100644 --- a/Lilu/Sources/kern_efi.cpp +++ b/Lilu/Sources/kern_efi.cpp @@ -139,11 +139,18 @@ void EfiRuntimeServices::activate() { if (efi) { auto abi = OSDynamicCast(OSData, efi->getProperty("firmware-abi")); if (abi && abi->isEqualTo("EFI64", sizeof("EFI64"))) { - services = new EfiRuntimeServices; - services->is32BitEFI = false; - services->setRuntimeServices(); - #if defined(__i386__) + // If kernel is forced to pure 32-bit mode, do not load EFI64 services. + if (!checkKernelArgument("-legacy")) { +#endif + services = new EfiRuntimeServices; + services->is32BitEFI = false; + services->setRuntimeServices(); +#if defined(__i386__) + } else { + SYSLOG("efi", "EFI64 not supported due to -legacy"); + } + } else if (abi && abi->isEqualTo("EFI32", sizeof("EFI32"))) { services = new EfiRuntimeServices; services->is32BitEFI = true;