Skip to content

Commit 329ade4

Browse files
committed
Disable EFI64 runtime APIs when -legacy is used on 32-bit kernels
1 parent 2ff83c6 commit 329ade4

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

Changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ Lilu Changelog
22
==============
33
#### v1.6.2
44
- Fixed KC segment name, which also fixed kernel panic on macOS 13 b3
5+
- Disable EFI64 runtime APIs when `-legacy` is used on 32-bit kernels
56

67
#### v1.6.1
78
- Allow loading on macOS 13 without `-lilubetaall`

Lilu/Sources/kern_efi.cpp

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,18 @@ void EfiRuntimeServices::activate() {
139139
if (efi) {
140140
auto abi = OSDynamicCast(OSData, efi->getProperty("firmware-abi"));
141141
if (abi && abi->isEqualTo("EFI64", sizeof("EFI64"))) {
142-
services = new EfiRuntimeServices;
143-
services->is32BitEFI = false;
144-
services->setRuntimeServices();
145-
146142
#if defined(__i386__)
143+
// If kernel is forced to pure 32-bit mode, do not load EFI64 services.
144+
if (!checkKernelArgument("-legacy")) {
145+
#endif
146+
services = new EfiRuntimeServices;
147+
services->is32BitEFI = false;
148+
services->setRuntimeServices();
149+
#if defined(__i386__)
150+
} else {
151+
SYSLOG("efi", "EFI64 not supported due to -legacy");
152+
}
153+
147154
} else if (abi && abi->isEqualTo("EFI32", sizeof("EFI32"))) {
148155
services = new EfiRuntimeServices;
149156
services->is32BitEFI = true;

0 commit comments

Comments
 (0)