Skip to content

Commit

Permalink
Support for El Capitan
Browse files Browse the repository at this point in the history
  • Loading branch information
SunnyKi authored and SunnyKi committed Oct 6, 2015
1 parent a7f2d8a commit ed29415
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 4 deletions.
36 changes: 34 additions & 2 deletions Library/BdsDxe/GenericBds/macosx/kernel_patcher.c
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,11 @@ UINT8 KBEYSearch[] =
UINT8 KBEYReplace[] =
{ 0xC6, 0xE8, 0x25, 0x00, 0x00, 0x00, 0x90, 0x90, 0xE8, 0xCE, 0x02 };

UINT8 KBEEntitlementSearch[] =
{ 0xC3, 0x48, 0x85, 0xDB, 0x74, 0x70, 0x48, 0x8B, 0x03, 0x48, 0x89, 0xDF, 0xFF, 0x50, 0x28, 0x48 };
UINT8 KBEEntitlementReplace[] =
{ 0xC3, 0x48, 0x85, 0xDB, 0xEB, 0x12, 0x48, 0x8B, 0x03, 0x48, 0x89, 0xDF, 0xFF, 0x50, 0x28, 0x48 };

VOID
EFIAPI
KernelBooterExtensionsPatch (
Expand All @@ -439,6 +444,7 @@ KernelBooterExtensionsPatch (
(CHAR8 *) KBESLReplace_1080_X64,
1
);
goto Exit;
} else if (AsciiStrnCmp (KernVersion, "10", 2) == 0) {
Num = SearchAndReplace (
(UINT8 *) (UINTN) addr,
Expand All @@ -448,6 +454,7 @@ KernelBooterExtensionsPatch (
(CHAR8 *) KBESLReplace_X64,
1
);
goto Exit;
}
if (AsciiStrnCmp (KernVersion, "11", 2) == 0) {
Num = SearchAndReplace (
Expand All @@ -458,6 +465,7 @@ KernelBooterExtensionsPatch (
(CHAR8 *) KBELionReplace_X64,
1
);
goto Exit;
}
if ((AsciiStrnCmp (KernVersion, "12", 2) == 0) ||
(AsciiStrnCmp (KernVersion, "13", 2) == 0)) {
Expand All @@ -469,8 +477,20 @@ KernelBooterExtensionsPatch (
(CHAR8 *) KBEMLReplace,
1
);
goto Exit;
}
if (AsciiStrnCmp (KernVersion, "14", 2) == 0) {
Num = SearchAndReplace (
(UINT8 *) (UINTN) addr,
size,
(CHAR8 *) KBEYSearch,
sizeof (KBEYSearch),
(CHAR8 *) KBEYReplace,
1
);
goto Exit;
}
if ((AsciiStrnCmp (KernVersion, "14", 2) == 0) ||
if ((AsciiStrnCmp (KernVersion, "14.4", 4) == 0) ||
(AsciiStrnCmp (KernVersion, "15", 2) == 0)) {
Num = SearchAndReplace (
(UINT8 *) (UINTN) addr,
Expand All @@ -480,6 +500,15 @@ KernelBooterExtensionsPatch (
(CHAR8 *) KBEYReplace,
1
);
Num += SearchAndReplace (
(UINT8 *) (UINTN) addr,
size,
(CHAR8 *) KBEEntitlementSearch,
sizeof (KBEEntitlementSearch),
(CHAR8 *) KBEEntitlementReplace,
1
);
goto Exit;
}
} else {
if (AsciiStrnCmp (KernVersion, "10", 2) == 0) {
Expand All @@ -491,6 +520,7 @@ KernelBooterExtensionsPatch (
(CHAR8 *) KBESLReplace_i386,
1
);
goto Exit;
}
if (AsciiStrnCmp (KernVersion, "11", 2) == 0) {
Num = SearchAndReplace (
Expand All @@ -501,9 +531,11 @@ KernelBooterExtensionsPatch (
(CHAR8 *) KBELionReplace_i386,
1
);
goto Exit;
}
}


Exit:
DBG ("%a: SearchAndReplace %d times.\n", __FUNCTION__, Num);
#ifdef KERNEL_PATCH_DEBUG
Print (L"%a: SearchAndReplace %d times.\n", __FUNCTION__, Num);
Expand Down
9 changes: 7 additions & 2 deletions Library/BdsDxe/GenericBds/macosx/kext_inject.c
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,13 @@ GetExtraKextsDir (
else if (AsciiStrnCmp (OSVersion, "10.9", 4) == 0) {
OSTypeStr = L"10.9";
}
else if ((AsciiStrLen (OSVersion) >= 5) && (AsciiStrnCmp (OSVersion, "10.10", 5) == 0)) {
OSTypeStr = L"10.10";
else if (AsciiStrLen (OSVersion) >= 5) {
if (AsciiStrnCmp (OSVersion, "10.10", 5) == 0) {
OSTypeStr = L"10.10";
}
if (AsciiStrnCmp (OSVersion, "10.11", 5) == 0) {
OSTypeStr = L"10.11";
}
}
} else {
OSTypeStr = L"other";
Expand Down

0 comments on commit ed29415

Please sign in to comment.