Skip to content

Commit

Permalink
Disable EFI64 runtime APIs when -legacy is used on 32-bit kernels
Browse files Browse the repository at this point in the history
  • Loading branch information
Goldfish64 committed Jul 27, 2022
1 parent 2ff83c6 commit 329ade4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
15 changes: 11 additions & 4 deletions Lilu/Sources/kern_efi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 329ade4

Please sign in to comment.