Skip to content

Commit

Permalink
OcAppleKernelLib: Fix kext blocker exclude under 32-bit
Browse files Browse the repository at this point in the history
  • Loading branch information
Goldfish64 committed Jun 17, 2023
1 parent b3d7e9f commit c173a26
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
3 changes: 3 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
OpenCore Changelog
==================
#### v0.9.4
- Fixed kext blocker `Exclude` strategy for prelinked on 32-bit versions of macOS

#### v0.9.3
- Added `--force-codec` option to AudioDxe, thx @xCuri0
- Downgraded additional warning message in normal operation of emulated NVRAM to info
Expand Down
15 changes: 14 additions & 1 deletion Library/OcAppleKernelLib/KextPatcher.c
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@ PatcherExcludePrelinkedKext (
VOID *KextData;
UINT64 AddressMax;
UINT64 VirtualAddress;
UINT64 FileOffset;
UINT64 Size;
UINT64 MaxSize;

Expand Down Expand Up @@ -437,12 +438,24 @@ PatcherExcludePrelinkedKext (

MaxSize = AddressMax - PatcherContext->VirtualBase;

//
// Get file offset for 32-bit.
//
if (PatcherContext->Is32Bit) {
if (!GetTextBaseOffset(&PatcherContext->MachContext, &VirtualAddress, &FileOffset)) {
return EFI_UNSUPPORTED;
}
VirtualAddress += FileOffset;
} else {
VirtualAddress = PatcherContext->VirtualBase;
}

//
// Zero out kext memory through PatcherContext->MachContext.
//
KextData = MachoGetFilePointerByAddress (
&PatcherContext->MachContext,
PatcherContext->VirtualBase,
VirtualAddress,
NULL
);
if (KextData == NULL) {
Expand Down

0 comments on commit c173a26

Please sign in to comment.