OpenCore
1.0.4
OpenCore Bootloader
|
#include <IndustryStandard/AppleMkext.h>
#include <Library/OcCpuLib.h>
#include <Library/OcMachoLib.h>
#include <Library/OcXmlLib.h>
#include <Protocol/SimpleFileSystem.h>
Go to the source code of this file.
Data Structures | |
struct | PRELINKED_CONTEXT |
struct | PATCHER_CONTEXT |
struct | PATCHER_GENERIC_PATCH |
struct | CACHELESS_CONTEXT |
struct | MKEXT_CONTEXT |
struct | KERNEL_QUIRK |
Typedefs | |
typedef enum KERNEL_CACHE_TYPE_ | KERNEL_CACHE_TYPE |
typedef EFI_STATUS | KERNEL_QUIRK_PATCH_FUNCTION(IN OUT PATCHER_CONTEXT *Patcher OPTIONAL, IN UINT32 KernelVersion) |
Functions | |
EFI_STATUS | KernelApplyQuirk (IN KERNEL_QUIRK_NAME Name, IN OUT PATCHER_CONTEXT *Patcher OPTIONAL, IN UINT32 KernelVersion) |
EFI_STATUS | ReadAppleKernel (IN EFI_FILE_PROTOCOL *File, IN BOOLEAN Prefer32Bit, OUT BOOLEAN *Is32Bit, OUT UINT8 **Kernel, OUT UINT32 *KernelSize, OUT UINT32 *AllocatedSize, IN UINT32 ReservedSize, OUT UINT8 *Digest OPTIONAL) |
EFI_STATUS | ReadAppleMkext (IN EFI_FILE_PROTOCOL *File, IN BOOLEAN Prefer32Bit, OUT UINT8 **Mkext, OUT UINT32 *MkextSize, OUT UINT32 *AllocatedSize, IN UINT32 ReservedSize, IN UINT32 NumReservedKexts) |
UINT32 | OcParseDarwinVersion (IN CONST CHAR8 *String) |
UINT32 | OcKernelReadDarwinVersion (IN CONST UINT8 *Kernel, IN UINT32 KernelSize) |
BOOLEAN | OcMatchDarwinVersion (IN UINT32 CurrentVersion OPTIONAL, IN UINT32 MinVersion OPTIONAL, IN UINT32 MaxVersion OPTIONAL) |
EFI_STATUS | PrelinkedContextInit (IN OUT PRELINKED_CONTEXT *Context, IN OUT UINT8 *Prelinked, IN UINT32 PrelinkedSize, IN UINT32 PrelinkedAllocSize, IN BOOLEAN Is32Bit) |
VOID | PrelinkedContextFree (IN OUT PRELINKED_CONTEXT *Context) |
EFI_STATUS | PrelinkedDependencyInsert (IN OUT PRELINKED_CONTEXT *Context, IN VOID *Buffer) |
EFI_STATUS | PrelinkedInjectPrepare (IN OUT PRELINKED_CONTEXT *Context, IN UINT32 LinkedExpansion, IN UINT32 ReservedExeSize) |
EFI_STATUS | PrelinkedInjectComplete (IN OUT PRELINKED_CONTEXT *Context) |
EFI_STATUS | PrelinkedReserveKextSize (IN OUT UINT32 *ReservedInfoSize, IN OUT UINT32 *ReservedExeSize, IN UINT32 InfoPlistSize, IN UINT8 *Executable OPTIONAL, IN UINT32 ExecutableSize OPTIONAL, IN BOOLEAN Is32Bit) |
EFI_STATUS | PrelinkedInjectKext (IN OUT PRELINKED_CONTEXT *Context, IN CONST CHAR8 *Identifier OPTIONAL, IN CONST CHAR8 *BundlePath, IN CONST CHAR8 *InfoPlist, IN UINT32 InfoPlistSize, IN CONST CHAR8 *ExecutablePath OPTIONAL, IN OUT CONST UINT8 *Executable OPTIONAL, IN UINT32 ExecutableSize OPTIONAL, OUT CHAR8 BundleVersion[MAX_INFO_BUNDLE_VERSION_KEY_SIZE] OPTIONAL) |
EFI_STATUS | PrelinkedContextApplyPatch (IN OUT PRELINKED_CONTEXT *Context, IN CONST CHAR8 *Identifier, IN PATCHER_GENERIC_PATCH *Patch) |
EFI_STATUS | PrelinkedContextApplyQuirk (IN OUT PRELINKED_CONTEXT *Context, IN KERNEL_QUIRK_NAME Quirk, IN UINT32 KernelVersion) |
EFI_STATUS | PrelinkedContextBlock (IN OUT PRELINKED_CONTEXT *Context, IN CONST CHAR8 *Identifier, IN BOOLEAN Exclude) |
EFI_STATUS | KcRebuildMachHeader (IN OUT PRELINKED_CONTEXT *Context) |
UINT32 | KcGetSegmentFixupChainsSize (IN UINT32 SegmentSize) |
EFI_STATUS | KcInitKextFixupChains (IN OUT PRELINKED_CONTEXT *Context, IN UINT32 SegChainSize, IN UINT32 ReservedSize) |
VOID | KcKextIndexFixups (IN OUT PRELINKED_CONTEXT *Context, IN OC_MACHO_CONTEXT *MachContext) |
UINT32 | KcGetKextSize (IN PRELINKED_CONTEXT *Context, IN UINT64 SourceAddress) |
EFI_STATUS | KcKextApplyFileDelta (IN PRELINKED_CONTEXT *PrelinkedContext, IN OUT OC_MACHO_CONTEXT *Context, IN UINT32 Delta) |
UINT64 | KcFixupValue (IN UINT64 Value, IN CONST CHAR8 *Name OPTIONAL) |
EFI_STATUS | PatcherInitContextFromPrelinked (IN OUT PATCHER_CONTEXT *Context, IN OUT PRELINKED_CONTEXT *Prelinked, IN CONST CHAR8 *Name) |
EFI_STATUS | PatcherInitContextFromMkext (IN OUT PATCHER_CONTEXT *Context, IN OUT MKEXT_CONTEXT *Mkext, IN CONST CHAR8 *Name) |
EFI_STATUS | PatcherInitContextFromBuffer (IN OUT PATCHER_CONTEXT *Context, IN OUT UINT8 *Buffer, IN UINT32 BufferSize, IN BOOLEAN Use32Bit) |
EFI_STATUS | PatcherGetSymbolAddress (IN OUT PATCHER_CONTEXT *Context, IN CONST CHAR8 *Name, IN OUT UINT8 **Address) |
EFI_STATUS | PatcherGetSymbolValue (IN OUT PATCHER_CONTEXT *Context, IN CONST CHAR8 *Name, IN OUT UINT64 *Value) |
EFI_STATUS | PatcherGetSymbolAddressValue (IN OUT PATCHER_CONTEXT *Context, IN CONST CHAR8 *Name, IN OUT UINT8 **Address, IN OUT UINT64 *Value) |
EFI_STATUS | PatcherApplyGenericPatch (IN OUT PATCHER_CONTEXT *Context, IN PATCHER_GENERIC_PATCH *Patch) |
EFI_STATUS | PatcherExcludePrelinkedKext (IN CONST CHAR8 *Identifier, IN OUT PATCHER_CONTEXT *PatcherContext, IN OUT PRELINKED_CONTEXT *PrelinkedContext) |
EFI_STATUS | PatcherExcludeMkextKext (IN OUT MKEXT_CONTEXT *MkextContext, IN CONST CHAR8 *Identifier) |
EFI_STATUS | PatcherBlockKext (IN OUT PATCHER_CONTEXT *Context) |
BOOLEAN | KextFindKmodAddress (IN OC_MACHO_CONTEXT *ExecutableContext, IN UINT64 LoadAddress, IN UINT32 Size, OUT UINT64 *Kmod) |
VOID | PatchSetApfsTimeout (IN UINT32 Timeout) |
VOID | PatchSetPciSerialDevice (IN UINTN RegisterBase, IN UINT32 RegisterStride) |
EFI_STATUS | PatchKernelCpuId (IN OUT PATCHER_CONTEXT *Patcher, IN OC_CPU_INFO *CpuInfo, IN UINT32 *Data, IN UINT32 *DataMask, IN UINT32 KernelVersion) |
EFI_STATUS | PatchProvideCurrentCpuInfo (IN OUT PATCHER_CONTEXT *Patcher, IN OC_CPU_INFO *CpuInfo, IN UINT32 KernelVersion) |
EFI_STATUS | CachelessContextInit (IN OUT CACHELESS_CONTEXT *Context, IN CONST CHAR16 *FileName, IN EFI_FILE_PROTOCOL *ExtensionsDir, IN UINT32 KernelVersion, IN BOOLEAN Is32Bit) |
VOID | CachelessContextFree (IN OUT CACHELESS_CONTEXT *Context) |
EFI_STATUS | CachelessContextAddKext (IN OUT CACHELESS_CONTEXT *Context, IN CONST CHAR8 *InfoPlist, IN UINT32 InfoPlistSize, IN UINT8 *Executable OPTIONAL, IN UINT32 ExecutableSize OPTIONAL, OUT CHAR8 BundleVersion[MAX_INFO_BUNDLE_VERSION_KEY_SIZE] OPTIONAL) |
EFI_STATUS | CachelessContextForceKext (IN OUT CACHELESS_CONTEXT *Context, IN CONST CHAR8 *Identifier) |
EFI_STATUS | CachelessContextAddPatch (IN OUT CACHELESS_CONTEXT *Context, IN CONST CHAR8 *Identifier, IN PATCHER_GENERIC_PATCH *Patch) |
EFI_STATUS | CachelessContextAddQuirk (IN OUT CACHELESS_CONTEXT *Context, IN KERNEL_QUIRK_NAME Quirk) |
EFI_STATUS | CachelessContextBlock (IN OUT CACHELESS_CONTEXT *Context, IN CONST CHAR8 *Identifier, IN BOOLEAN Exclude) |
EFI_STATUS | CachelessContextOverlayExtensionsDir (IN OUT CACHELESS_CONTEXT *Context, OUT EFI_FILE_PROTOCOL **File) |
EFI_STATUS | CachelessContextPerformInject (IN OUT CACHELESS_CONTEXT *Context, IN CONST CHAR16 *FileName, OUT EFI_FILE_PROTOCOL **VirtualFile) |
EFI_STATUS | CachelessContextHookBuiltin (IN OUT CACHELESS_CONTEXT *Context, IN CONST CHAR16 *FileName, IN EFI_FILE_PROTOCOL *File, OUT EFI_FILE_PROTOCOL **VirtualFile) |
EFI_STATUS | MkextDecompress (IN CONST UINT8 *Buffer, IN UINT32 BufferSize, IN UINT32 NumReservedKexts, IN OUT UINT8 *OutBuffer OPTIONAL, IN UINT32 OutBufferSize OPTIONAL, IN OUT UINT32 *OutMkextSize) |
BOOLEAN | MkextCheckCpuType (IN UINT8 *Mkext, IN UINT32 MkextSize, IN MACH_CPU_TYPE CpuType) |
EFI_STATUS | MkextContextInit (IN OUT MKEXT_CONTEXT *Context, IN OUT UINT8 *Mkext, IN UINT32 MkextSize, IN UINT32 MkextAllocSize) |
VOID | MkextContextFree (IN OUT MKEXT_CONTEXT *Context) |
EFI_STATUS | MkextReserveKextSize (IN OUT UINT32 *ReservedInfoSize, IN OUT UINT32 *ReservedExeSize, IN UINT32 InfoPlistSize, IN UINT8 *Executable OPTIONAL, IN UINT32 ExecutableSize OPTIONAL, IN BOOLEAN Is32Bit) |
EFI_STATUS | MkextInjectKext (IN OUT MKEXT_CONTEXT *Context, IN CONST CHAR8 *Identifier OPTIONAL, IN CONST CHAR8 *BundlePath, IN CONST CHAR8 *InfoPlist, IN UINT32 InfoPlistSize, IN UINT8 *Executable OPTIONAL, IN UINT32 ExecutableSize OPTIONAL, OUT CHAR8 BundleVersion[MAX_INFO_BUNDLE_VERSION_KEY_SIZE] OPTIONAL) |
EFI_STATUS | MkextContextApplyPatch (IN OUT MKEXT_CONTEXT *Context, IN CONST CHAR8 *Identifier, IN PATCHER_GENERIC_PATCH *Patch) |
EFI_STATUS | MkextContextApplyQuirk (IN OUT MKEXT_CONTEXT *Context, IN KERNEL_QUIRK_NAME Quirk, IN UINT32 KernelVersion) |
EFI_STATUS | MkextContextBlock (IN OUT MKEXT_CONTEXT *Context, IN CONST CHAR8 *Identifier, IN BOOLEAN Exclude) |
EFI_STATUS | MkextInjectPatchComplete (IN OUT MKEXT_CONTEXT *Context) |
Copyright (C) 2019, vit9696. All rights reserved.
All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Definition in file OcAppleKernelLib.h.
#define INFO_BUNDLE_COMPATIBLE_VERSION_KEY "OSBundleCompatibleVersion" |
Definition at line 50 of file OcAppleKernelLib.h.
#define INFO_BUNDLE_EXECUTABLE_KEY "CFBundleExecutable" |
Definition at line 46 of file OcAppleKernelLib.h.
#define INFO_BUNDLE_IDENTIFIER_KEY "CFBundleIdentifier" |
Definition at line 45 of file OcAppleKernelLib.h.
#define INFO_BUNDLE_LIBRARIES_64_KEY "OSBundleLibraries_x86_64" |
Definition at line 48 of file OcAppleKernelLib.h.
#define INFO_BUNDLE_LIBRARIES_KEY "OSBundleLibraries" |
Definition at line 47 of file OcAppleKernelLib.h.
#define INFO_BUNDLE_OS_BUNDLE_REQUIRED_KEY "OSBundleRequired" |
Definition at line 51 of file OcAppleKernelLib.h.
#define INFO_BUNDLE_VERSION_KEY "CFBundleVersion" |
Definition at line 49 of file OcAppleKernelLib.h.
#define KC_LINKEDIT_SEGMENT "__LINKEDIT" |
Definition at line 67 of file OcAppleKernelLib.h.
#define KC_MOSCOW_SEGMENT "__MOSCOW101" |
Definition at line 68 of file OcAppleKernelLib.h.
#define KC_REGION0_SEGMENT "__REGION0" |
Definition at line 65 of file OcAppleKernelLib.h.
#define KC_REGION_SEGMENT_PREFIX "__REGION" |
Definition at line 64 of file OcAppleKernelLib.h.
#define KC_TEXT_SEGMENT "__TEXT" |
Definition at line 66 of file OcAppleKernelLib.h.
#define KERNEL_VERSION | ( | A, | |
B, | |||
C ) |
Definition at line 112 of file OcAppleKernelLib.h.
#define KERNEL_VERSION_BIG_SUR 20 |
Definition at line 129 of file OcAppleKernelLib.h.
#define KERNEL_VERSION_BIG_SUR_MAX (KERNEL_VERSION_MONTEREY_MIN - 1) |
Definition at line 171 of file OcAppleKernelLib.h.
#define KERNEL_VERSION_BIG_SUR_MIN KERNEL_VERSION (KERNEL_VERSION_BIG_SUR, 0, 0) |
Definition at line 150 of file OcAppleKernelLib.h.
#define KERNEL_VERSION_CATALINA 19 |
Definition at line 128 of file OcAppleKernelLib.h.
#define KERNEL_VERSION_CATALINA_MAX (KERNEL_VERSION_BIG_SUR_MIN - 1) |
Definition at line 170 of file OcAppleKernelLib.h.
#define KERNEL_VERSION_CATALINA_MIN KERNEL_VERSION (KERNEL_VERSION_CATALINA, 0, 0) |
Definition at line 149 of file OcAppleKernelLib.h.
#define KERNEL_VERSION_EL_CAPITAN 15 |
Definition at line 124 of file OcAppleKernelLib.h.
#define KERNEL_VERSION_EL_CAPITAN_MAX (KERNEL_VERSION_SIERRA_MIN - 1) |
Definition at line 166 of file OcAppleKernelLib.h.
#define KERNEL_VERSION_EL_CAPITAN_MIN KERNEL_VERSION (KERNEL_VERSION_EL_CAPITAN, 0, 0) |
Definition at line 145 of file OcAppleKernelLib.h.
#define KERNEL_VERSION_HIGH_SIERRA 17 |
Definition at line 126 of file OcAppleKernelLib.h.
#define KERNEL_VERSION_HIGH_SIERRA_MAX (KERNEL_VERSION_MOJAVE_MIN - 1) |
Definition at line 168 of file OcAppleKernelLib.h.
#define KERNEL_VERSION_HIGH_SIERRA_MIN KERNEL_VERSION (KERNEL_VERSION_HIGH_SIERRA, 0, 0) |
Definition at line 147 of file OcAppleKernelLib.h.
#define KERNEL_VERSION_LEOPARD 9 |
Definition at line 118 of file OcAppleKernelLib.h.
#define KERNEL_VERSION_LEOPARD_MAX (KERNEL_VERSION_SNOW_LEOPARD_MIN - 1) |
Definition at line 160 of file OcAppleKernelLib.h.
#define KERNEL_VERSION_LEOPARD_MIN KERNEL_VERSION (KERNEL_VERSION_LEOPARD, 0, 0) |
Definition at line 139 of file OcAppleKernelLib.h.
#define KERNEL_VERSION_LION 11 |
Definition at line 120 of file OcAppleKernelLib.h.
#define KERNEL_VERSION_LION_MAX (KERNEL_VERSION_MOUNTAIN_LION_MIN - 1) |
Definition at line 162 of file OcAppleKernelLib.h.
#define KERNEL_VERSION_LION_MIN KERNEL_VERSION (KERNEL_VERSION_LION, 0, 0) |
Definition at line 141 of file OcAppleKernelLib.h.
#define KERNEL_VERSION_MAVERICKS 13 |
Definition at line 122 of file OcAppleKernelLib.h.
#define KERNEL_VERSION_MAVERICKS_MAX (KERNEL_VERSION_YOSEMITE_MIN - 1) |
Definition at line 164 of file OcAppleKernelLib.h.
#define KERNEL_VERSION_MAVERICKS_MIN KERNEL_VERSION (KERNEL_VERSION_MAVERICKS, 0, 0) |
Definition at line 143 of file OcAppleKernelLib.h.
#define KERNEL_VERSION_MOJAVE 18 |
Definition at line 127 of file OcAppleKernelLib.h.
#define KERNEL_VERSION_MOJAVE_MAX (KERNEL_VERSION_CATALINA_MIN - 1) |
Definition at line 169 of file OcAppleKernelLib.h.
#define KERNEL_VERSION_MOJAVE_MIN KERNEL_VERSION (KERNEL_VERSION_MOJAVE, 0, 0) |
Definition at line 148 of file OcAppleKernelLib.h.
#define KERNEL_VERSION_MONTEREY 21 |
Definition at line 130 of file OcAppleKernelLib.h.
#define KERNEL_VERSION_MONTEREY_MAX (KERNEL_VERSION_VENTURA_MIN - 1) |
Definition at line 172 of file OcAppleKernelLib.h.
#define KERNEL_VERSION_MONTEREY_MIN KERNEL_VERSION (KERNEL_VERSION_MONTEREY, 0, 0) |
Definition at line 151 of file OcAppleKernelLib.h.
#define KERNEL_VERSION_MOUNTAIN_LION 12 |
Definition at line 121 of file OcAppleKernelLib.h.
#define KERNEL_VERSION_MOUNTAIN_LION_MAX (KERNEL_VERSION_MAVERICKS_MIN - 1) |
Definition at line 163 of file OcAppleKernelLib.h.
#define KERNEL_VERSION_MOUNTAIN_LION_MIN KERNEL_VERSION (KERNEL_VERSION_MOUNTAIN_LION, 0, 0) |
Definition at line 142 of file OcAppleKernelLib.h.
#define KERNEL_VERSION_SEQUOIA 24 |
Definition at line 133 of file OcAppleKernelLib.h.
#define KERNEL_VERSION_SEQUOIA_MIN KERNEL_VERSION (KERNEL_VERSION_SEQUOIA, 0, 0) |
Definition at line 154 of file OcAppleKernelLib.h.
#define KERNEL_VERSION_SIERRA 16 |
Definition at line 125 of file OcAppleKernelLib.h.
#define KERNEL_VERSION_SIERRA_MAX (KERNEL_VERSION_HIGH_SIERRA_MIN - 1) |
Definition at line 167 of file OcAppleKernelLib.h.
#define KERNEL_VERSION_SIERRA_MIN KERNEL_VERSION (KERNEL_VERSION_SIERRA, 0, 0) |
Definition at line 146 of file OcAppleKernelLib.h.
#define KERNEL_VERSION_SNOW_LEOPARD 10 |
Definition at line 119 of file OcAppleKernelLib.h.
#define KERNEL_VERSION_SNOW_LEOPARD_MAX (KERNEL_VERSION_LION_MIN - 1) |
Definition at line 161 of file OcAppleKernelLib.h.
#define KERNEL_VERSION_SNOW_LEOPARD_MIN KERNEL_VERSION (KERNEL_VERSION_SNOW_LEOPARD, 0, 0) |
Definition at line 140 of file OcAppleKernelLib.h.
#define KERNEL_VERSION_SONOMA 23 |
Definition at line 132 of file OcAppleKernelLib.h.
#define KERNEL_VERSION_SONOMA_MAX (KERNEL_VERSION_SEQUOIA_MIN - 1) |
Definition at line 174 of file OcAppleKernelLib.h.
#define KERNEL_VERSION_SONOMA_MIN KERNEL_VERSION (KERNEL_VERSION_SONOMA, 0, 0) |
Definition at line 153 of file OcAppleKernelLib.h.
#define KERNEL_VERSION_TIGER 8 |
Definition at line 117 of file OcAppleKernelLib.h.
#define KERNEL_VERSION_TIGER_MAX (KERNEL_VERSION_LEOPARD_MIN - 1) |
Definition at line 159 of file OcAppleKernelLib.h.
#define KERNEL_VERSION_TIGER_MIN KERNEL_VERSION (KERNEL_VERSION_TIGER, 0, 0) |
Definition at line 138 of file OcAppleKernelLib.h.
#define KERNEL_VERSION_VENTURA 22 |
Definition at line 131 of file OcAppleKernelLib.h.
#define KERNEL_VERSION_VENTURA_MAX (KERNEL_VERSION_SONOMA_MIN - 1) |
Definition at line 173 of file OcAppleKernelLib.h.
#define KERNEL_VERSION_VENTURA_MIN KERNEL_VERSION (KERNEL_VERSION_VENTURA, 0, 0) |
Definition at line 152 of file OcAppleKernelLib.h.
#define KERNEL_VERSION_YOSEMITE 14 |
Definition at line 123 of file OcAppleKernelLib.h.
#define KERNEL_VERSION_YOSEMITE_MAX (KERNEL_VERSION_EL_CAPITAN_MIN - 1) |
Definition at line 165 of file OcAppleKernelLib.h.
#define KERNEL_VERSION_YOSEMITE_MIN KERNEL_VERSION (KERNEL_VERSION_YOSEMITE, 0, 0) |
Definition at line 144 of file OcAppleKernelLib.h.
#define MAX_INFO_BUNDLE_VERSION_KEY_SIZE 32 |
Definition at line 73 of file OcAppleKernelLib.h.
#define MKEXT_BUNDLE_PATH_KEY "_MKEXTBundlePath" |
Definition at line 57 of file OcAppleKernelLib.h.
#define MKEXT_EXECUTABLE_KEY "_MKEXTExecutable" |
Definition at line 59 of file OcAppleKernelLib.h.
#define MKEXT_EXECUTABLE_RELATIVE_PATH_KEY "_MKEXTExecutableRelativePath" |
Definition at line 58 of file OcAppleKernelLib.h.
#define MKEXT_INFO_DICTIONARIES_KEY "_MKEXTInfoDictionaries" |
Definition at line 56 of file OcAppleKernelLib.h.
#define MKEXT_INFO_INTEGER_ATTRIBUTES "size=\"32\"" |
Definition at line 62 of file OcAppleKernelLib.h.
#define OS_BUNDLE_REQUIRED_ROOT "Root" |
Definition at line 53 of file OcAppleKernelLib.h.
#define OS_BUNDLE_REQUIRED_SAFE_BOOT "Safe Boot" |
Definition at line 54 of file OcAppleKernelLib.h.
#define PLIST_EXPANSION_SIZE 512 |
Definition at line 107 of file OcAppleKernelLib.h.
#define PRELINK_INFO_BUNDLE_PATH_KEY "_PrelinkBundlePath" |
Definition at line 37 of file OcAppleKernelLib.h.
#define PRELINK_INFO_DICTIONARY_KEY "_PrelinkInfoDictionary" |
Definition at line 35 of file OcAppleKernelLib.h.
#define PRELINK_INFO_EXECUTABLE_LOAD_ADDR_KEY "_PrelinkExecutableLoadAddr" |
Definition at line 39 of file OcAppleKernelLib.h.
#define PRELINK_INFO_EXECUTABLE_RELATIVE_PATH_KEY "_PrelinkExecutableRelativePath" |
Definition at line 38 of file OcAppleKernelLib.h.
#define PRELINK_INFO_EXECUTABLE_SIZE_KEY "_PrelinkExecutableSize" |
Definition at line 41 of file OcAppleKernelLib.h.
#define PRELINK_INFO_EXECUTABLE_SOURCE_ADDR_KEY "_PrelinkExecutableSourceAddr" |
Definition at line 40 of file OcAppleKernelLib.h.
#define PRELINK_INFO_INTEGER_ATTRIBUTES "size=\"64\"" |
Definition at line 61 of file OcAppleKernelLib.h.
#define PRELINK_INFO_KMOD_INFO_KEY "_PrelinkKmodInfo" |
Definition at line 36 of file OcAppleKernelLib.h.
#define PRELINK_INFO_LINK_STATE_ADDR_KEY "_PrelinkLinkState" |
Definition at line 42 of file OcAppleKernelLib.h.
#define PRELINK_INFO_LINK_STATE_SIZE_KEY "_PrelinkLinkStateSize" |
Definition at line 43 of file OcAppleKernelLib.h.
#define PRELINK_INFO_RESERVE_SIZE (5U * 1024U * 1024U) |
Definition at line 101 of file OcAppleKernelLib.h.
#define PRELINK_INFO_SECTION "__info" |
Definition at line 28 of file OcAppleKernelLib.h.
#define PRELINK_INFO_SEGMENT "__PRELINK_INFO" |
Definition at line 27 of file OcAppleKernelLib.h.
#define PRELINK_KERNEL_IDENTIFIER "__kernel__" |
Definition at line 24 of file OcAppleKernelLib.h.
#define PRELINK_KPI_IDENTIFIER_PREFIX "com.apple.kpi." |
Definition at line 25 of file OcAppleKernelLib.h.
#define PRELINK_STATE_SECTION_KERNEL "__kernel" |
Definition at line 32 of file OcAppleKernelLib.h.
#define PRELINK_STATE_SECTION_KEXTS "__kexts" |
Definition at line 33 of file OcAppleKernelLib.h.
#define PRELINK_STATE_SEGMENT "__PRELINK_STATE" |
Definition at line 31 of file OcAppleKernelLib.h.
#define PRELINK_TEXT_SECTION "__text" |
Definition at line 30 of file OcAppleKernelLib.h.
#define PRELINK_TEXT_SEGMENT "__PRELINK_TEXT" |
Definition at line 29 of file OcAppleKernelLib.h.
#define PRELINKED_KEXTS_MAX_SIZE (BIT16 * MACHO_PAGE_SIZE) |
Definition at line 96 of file OcAppleKernelLib.h.
#define PRINT_KERNEL_CACHE_TYPE | ( | a | ) |
Definition at line 88 of file OcAppleKernelLib.h.
typedef enum KERNEL_CACHE_TYPE_ KERNEL_CACHE_TYPE |
typedef EFI_STATUS KERNEL_QUIRK_PATCH_FUNCTION(IN OUT PATCHER_CONTEXT *Patcher OPTIONAL, IN UINT32 KernelVersion) |
Kernel quirk patch function.
[in,out] | Patcher | A pointer to the patcher context. Only optional for kext patching. |
[in] | KernelVersion | Kernel version to be matched. |
Definition at line 642 of file OcAppleKernelLib.h.
enum KERNEL_CACHE_TYPE_ |
Enumerator | |
---|---|
CacheTypeNone | |
CacheTypeCacheless | |
CacheTypeMkext | |
CacheTypePrelinked |
Definition at line 78 of file OcAppleKernelLib.h.
enum KERNEL_QUIRK_NAME |
Definition at line 532 of file OcAppleKernelLib.h.
EFI_STATUS CachelessContextAddKext | ( | IN OUT CACHELESS_CONTEXT * | Context, |
IN CONST CHAR8 * | InfoPlist, | ||
IN UINT32 | InfoPlistSize, | ||
IN UINT8 *Executable | OPTIONAL, | ||
IN UINT32 ExecutableSize | OPTIONAL, | ||
OUT CHAR8 BundleVersion | OPTIONAL[MAX_INFO_BUNDLE_VERSION_KEY_SIZE] ) |
Add kext to cacheless context to be injected later on.
[in,out] | Context | Cacheless context. |
[in] | InfoPlist | Kext Info.plist. |
[in] | InfoPlistSize | Kext Info.plist size. |
[in] | Executable | Kext executable, optional. |
[in] | ExecutableSize | Kext executable size, optional. |
[out] | BundleVersion | Kext bundle version, optionally set on request. |
Definition at line 807 of file CachelessContext.c.
EFI_STATUS CachelessContextAddPatch | ( | IN OUT CACHELESS_CONTEXT * | Context, |
IN CONST CHAR8 * | Identifier, | ||
IN PATCHER_GENERIC_PATCH * | Patch ) |
Add patch to cacheless context to be applied later on.
[in,out] | Context | Cacheless context. |
[in] | Identifier | Kext bundle identifier. |
[in] | Patch | Patch to apply. |
Definition at line 1077 of file CachelessContext.c.
EFI_STATUS CachelessContextAddQuirk | ( | IN OUT CACHELESS_CONTEXT * | Context, |
IN KERNEL_QUIRK_NAME | Quirk ) |
Add kernel quirk to cacheless context to be applied later on.
[in,out] | Context | Cacheless context. |
[in] | Quirk | Quirk to apply. |
Definition at line 1091 of file CachelessContext.c.
EFI_STATUS CachelessContextBlock | ( | IN OUT CACHELESS_CONTEXT * | Context, |
IN CONST CHAR8 * | Identifier, | ||
IN BOOLEAN | Exclude ) |
Add block request to cacheless context to be applied later on.
[in,out] | Context | Cacheless context. |
[in] | Identifier | Kext bundle identifier. |
[in] | Exclude | TRUE to exclude kext from cacheless context. |
Definition at line 1102 of file CachelessContext.c.
EFI_STATUS CachelessContextForceKext | ( | IN OUT CACHELESS_CONTEXT * | Context, |
IN CONST CHAR8 * | Identifier ) |
Force built-in kext to load.
[in,out] | Context | Cacheless context. |
[in] | Identifier | Kext bundle identifier. |
Definition at line 1065 of file CachelessContext.c.
VOID CachelessContextFree | ( | IN OUT CACHELESS_CONTEXT * | Context | ) |
Frees cacheless context.
[in,out] | Context | Cacheless context. |
Definition at line 734 of file CachelessContext.c.
EFI_STATUS CachelessContextHookBuiltin | ( | IN OUT CACHELESS_CONTEXT * | Context, |
IN CONST CHAR16 * | FileName, | ||
IN EFI_FILE_PROTOCOL * | File, | ||
OUT EFI_FILE_PROTOCOL ** | VirtualFile ) |
Apply patches to built-in kexts.
[in,out] | Context | Prelinked context. |
[in] | FileName | Filename of kext file to be injected. |
[in] | File | EFI_FILE_PROTOCOL instance of kext file. |
[out] | VirtualFile | Newly created virtualised EFI_FILE_PROTOCOL instance. |
Definition at line 1390 of file CachelessContext.c.
EFI_STATUS CachelessContextInit | ( | IN OUT CACHELESS_CONTEXT * | Context, |
IN CONST CHAR16 * | FileName, | ||
IN EFI_FILE_PROTOCOL * | ExtensionsDir, | ||
IN UINT32 | KernelVersion, | ||
IN BOOLEAN | Is32Bit ) |
Initializes cacheless context for later modification. Must be freed with CachelessContextFree on success.
[in,out] | Context | Cacheless context. |
[in] | FileName | Extensions directory filename. |
[in] | ExtensionsDir | Extensions directory EFI_FILE_PROTOCOL. |
[in] | KernelVersion | Current kernel version. |
[in] | Is32Bit | TRUE if booting in 32-bit kernel mode. |
Definition at line 706 of file CachelessContext.c.
EFI_STATUS CachelessContextOverlayExtensionsDir | ( | IN OUT CACHELESS_CONTEXT * | Context, |
OUT EFI_FILE_PROTOCOL ** | File ) |
Creates virtual directory overlay EFI_FILE_PROTOCOL from cacheless context.
[in,out] | Context | Cacheless context. |
[out] | File | The virtual directory instance. |
Definition at line 1128 of file CachelessContext.c.
EFI_STATUS CachelessContextPerformInject | ( | IN OUT CACHELESS_CONTEXT * | Context, |
IN CONST CHAR16 * | FileName, | ||
OUT EFI_FILE_PROTOCOL ** | VirtualFile ) |
Perform kext injection.
[in,out] | Context | Prelinked context. |
[in] | FileName | Filename of kext file to be injected. |
[out] | VirtualFile | Newly created virtualised EFI_FILE_PROTOCOL instance. |
Definition at line 1211 of file CachelessContext.c.
UINT64 KcFixupValue | ( | IN UINT64 | Value, |
IN CONST CHAR8 *Name | OPTIONAL ) |
Update address or dyld fixup value to real address.
[in] | Value | Value or fixup. |
[in] | Name | Source name, optional. |
Definition at line 800 of file KernelCollection.c.
UINT32 KcGetKextSize | ( | IN PRELINKED_CONTEXT * | Context, |
IN UINT64 | SourceAddress ) |
Retrieves a KC KEXT's virtual size.
[in] | Context | Prelinked context. |
[in] | SourceAddress | The virtual address within the KC image of the KEXT. |
0 | An error has occured. |
other | The virtual size, in bytes, of the KEXT at SourceAddress. |
Definition at line 643 of file KernelCollection.c.
UINT32 KcGetSegmentFixupChainsSize | ( | IN UINT32 | SegmentSize | ) |
Returns the size required to store a segment's fixup chains information.
[in] | SegmentSize | The size, in bytes, of the segment to index. |
0 | The segment is too large to index with a single structure. |
other | The size, in bytes, required to store a segment's fixup chain information. |
Definition at line 270 of file KernelCollection.c.
EFI_STATUS KcInitKextFixupChains | ( | IN OUT PRELINKED_CONTEXT * | Context, |
IN UINT32 | SegChainSize, | ||
IN UINT32 | ReservedSize ) |
Initialises a structure that stores a segments's fixup chains information.
[out] | SegChain | The information structure to initialise. |
[in] | SegChainSize | The size, in bytes, available to SegChain. |
[in] | VmAddress | The virtual address of the segment to index. |
[in] | VmSize | The virtual size of the segment to index. |
Definition at line 287 of file KernelCollection.c.
EFI_STATUS KcKextApplyFileDelta | ( | IN PRELINKED_CONTEXT * | PrelinkedContext, |
IN OUT OC_MACHO_CONTEXT * | Context, | ||
IN UINT32 | Delta ) |
Apply the delta from KC header to the file's offsets.
[in] | PrelinkedContext | Prelinked context. |
[in,out] | Context | The context of the KEXT to rebase. |
[in] | Delta | The offset from KC header the KEXT starts at. |
EFI_SUCCESS | The file has beem rebased successfully. |
other | An error has occured. |
Definition at line 684 of file KernelCollection.c.
VOID KcKextIndexFixups | ( | IN OUT PRELINKED_CONTEXT * | Context, |
IN OC_MACHO_CONTEXT * | MachContext ) |
Indexes all relocations of MachContext into the kernel described by Context.
[in,out] | Context | Prelinked context. |
[in] | MachContext | The context of the Mach-O to index. It must have been prelinked by OcAppleKernelLib. The image must reside in Segment. |
Definition at line 559 of file KernelCollection.c.
EFI_STATUS KcRebuildMachHeader | ( | IN OUT PRELINKED_CONTEXT * | Context | ) |
Update Mach-O header with new commands.
@Param[in,out] Context Prelinked context.
EFI_SUCCESS | on success. |
Definition at line 189 of file KernelCollection.c.
EFI_STATUS KernelApplyQuirk | ( | IN KERNEL_QUIRK_NAME | Name, |
IN OUT PATCHER_CONTEXT *Patcher | OPTIONAL, | ||
IN UINT32 | KernelVersion ) |
Applies the specified quirk.
[in] | Name | KERNEL_QUIRK_NAME specifying the quirk name. |
[in,out] | Patcher | PATCHER_CONTEXT instance. Only optional for kext patching. |
[in] | KernelVersion | Current kernel version. |
Definition at line 2981 of file CommonPatches.c.
BOOLEAN KextFindKmodAddress | ( | IN OC_MACHO_CONTEXT * | ExecutableContext, |
IN UINT64 | LoadAddress, | ||
IN UINT32 | Size, | ||
OUT UINT64 * | Kmod ) |
Find kmod address.
[in] | ExecutableContext | Mach-O context. |
[in] | LoadAddress | Load address. |
[in] | Size | Executable size. |
[out] | Kmod | Pointer to kmod. |
Definition at line 790 of file KextPatcher.c.
BOOLEAN MkextCheckCpuType | ( | IN UINT8 * | Mkext, |
IN UINT32 | MkextSize, | ||
IN MACH_CPU_TYPE | CpuType ) |
Check if passed mkext is of desired CPU arch.
[in] | Mkext | Mkext buffer. |
[in] | MkextSize | Mkext buffer size. |
[in] | CpuType | Desired CPU arch. |
Definition at line 1008 of file MkextContext.c.
EFI_STATUS MkextContextApplyPatch | ( | IN OUT MKEXT_CONTEXT * | Context, |
IN CONST CHAR8 * | Identifier, | ||
IN PATCHER_GENERIC_PATCH * | Patch ) |
Apply kext patch to mkext.
[in,out] | Context | Mkext context. |
[in] | Identifier | Kext bundle identifier. |
[in] | Patch | Patch to apply. |
Definition at line 1574 of file MkextContext.c.
EFI_STATUS MkextContextApplyQuirk | ( | IN OUT MKEXT_CONTEXT * | Context, |
IN KERNEL_QUIRK_NAME | Quirk, | ||
IN UINT32 | KernelVersion ) |
Apply kext quirk to mkext.
[in,out] | Context | Mkext context. |
[in] | Quirk | Kext quirk to apply. |
[in] | KernelVersion | Current kernel version. |
Definition at line 1597 of file MkextContext.c.
EFI_STATUS MkextContextBlock | ( | IN OUT MKEXT_CONTEXT * | Context, |
IN CONST CHAR8 * | Identifier, | ||
IN BOOLEAN | Exclude ) |
Block kext in mkext.
[in,out] | Context | Mkext context. |
[in] | Identifier | Kext bundle identifier. |
[in] | Exclude | TRUE to exclude kext from mkext. |
Definition at line 1625 of file MkextContext.c.
VOID MkextContextFree | ( | IN OUT MKEXT_CONTEXT * | Context | ) |
Free resources consumed by mkext context.
[in,out] | Context | Mkext context. |
Definition at line 1203 of file MkextContext.c.
EFI_STATUS MkextContextInit | ( | IN OUT MKEXT_CONTEXT * | Context, |
IN OUT UINT8 * | Mkext, | ||
IN UINT32 | MkextSize, | ||
IN UINT32 | MkextAllocSize ) |
Construct mkext context for later modification. Must be freed with MkextContextFree on success. Note that MkextAllocSize never changes, and is to be estimated.
Mkext buffers cannot contain any compression, and should be run through MkextDecompress first.
[in,out] | Context | Mkext context. |
[in,out] | Mkext | Decompressed Mkext buffer. |
[in] | MkextSize | Decompressed Mkext buffer size. |
[in] | MkextAllocSize | Decompressed Mkext buffer allocated size. |
Definition at line 1040 of file MkextContext.c.
EFI_STATUS MkextDecompress | ( | IN CONST UINT8 * | Buffer, |
IN UINT32 | BufferSize, | ||
IN UINT32 | NumReservedKexts, | ||
IN OUT UINT8 *OutBuffer | OPTIONAL, | ||
IN UINT32 OutBufferSize | OPTIONAL, | ||
IN OUT UINT32 * | OutMkextSize ) |
Decompress mkext buffer while reserving space for injected kexts later on. Specifying zero for OutBufferSize will calculate the size of the buffer required for the decompressed mkext in OutMkextSize.
[in] | Buffer | Mkext buffer. |
[in] | BufferSize | Mkext buffer size. |
[in] | NumReservedKexts | Number of kext slots to reserve for injection. |
[in,out] | OutBuffer | Output buffer. Optional if OutBufferSize is zero. |
[in] | OutBufferSize | Total output buffer size. Specify zero to calculate output buffer size. |
[in,out] | OutMkextSize | Decompressed Mkext size. |
Definition at line 568 of file MkextContext.c.
EFI_STATUS MkextInjectKext | ( | IN OUT MKEXT_CONTEXT * | Context, |
IN CONST CHAR8 *Identifier | OPTIONAL, | ||
IN CONST CHAR8 * | BundlePath, | ||
IN CONST CHAR8 * | InfoPlist, | ||
IN UINT32 | InfoPlistSize, | ||
IN UINT8 *Executable | OPTIONAL, | ||
IN UINT32 ExecutableSize | OPTIONAL, | ||
OUT CHAR8 BundleVersion | OPTIONAL[MAX_INFO_BUNDLE_VERSION_KEY_SIZE] ) |
Perform mkext kext injection.
[in,out] | Context | Mkext context. |
[in] | Identifier | Kext bundle identifier. If a kext with this identifier already exists, the kext will not be injected. Optional. |
[in] | BundlePath | Kext bundle path (e.g. /L/E/mykext.kext). |
[in,out] | InfoPlist | Kext Info.plist. |
[in] | InfoPlistSize | Kext Info.plist size. |
[in,out] | Executable | Kext executable, optional. |
[in] | ExecutableSize | Kext executable size, optional. |
[out] | BundleVersion | Kext bundle version, optionally set on request. |
Definition at line 1274 of file MkextContext.c.
EFI_STATUS MkextInjectPatchComplete | ( | IN OUT MKEXT_CONTEXT * | Context | ) |
Refresh plist and checksum after kext injection and/or patching.
[in,out] | Context | Mkext context. |
Definition at line 1653 of file MkextContext.c.
EFI_STATUS MkextReserveKextSize | ( | IN OUT UINT32 * | ReservedInfoSize, |
IN OUT UINT32 * | ReservedExeSize, | ||
IN UINT32 | InfoPlistSize, | ||
IN UINT8 *Executable | OPTIONAL, | ||
IN UINT32 ExecutableSize | OPTIONAL, | ||
IN BOOLEAN | Is32Bit ) |
Updated required mkext reserve size to inject this kext.
[in,out] | ReservedInfoSize | Current reserved PLIST size, updated. |
[in,out] | ReservedExeSize | Current reserved KEXT size, updated. |
[in] | InfoPlistSize | Kext Info.plist size. |
[in] | Executable | Kext executable, optional. |
[in] | ExecutableSize | Kext executable size, optional. |
[in] | Is32Bit | TRUE to process 32-bit kext. |
Definition at line 1233 of file MkextContext.c.
UINT32 OcKernelReadDarwinVersion | ( | IN CONST UINT8 * | Kernel, |
IN UINT32 | KernelSize ) |
Read Apple kernel version in integer format.
[in] | Kernel | Apple kernel binary. |
[in] | KernelSize | Apple kernel size. |
Definition at line 116 of file KernelVersion.c.
BOOLEAN OcMatchDarwinVersion | ( | IN UINT32 CurrentVersion | OPTIONAL, |
IN UINT32 MinVersion | OPTIONAL, | ||
IN UINT32 MaxVersion | OPTIONAL ) |
Check whether min <= current <= max is true. When current or max are 0 they are considered infinite.
[in] | CurrentVersion | Current kernel version. |
[in] | MinVersion | Minimal kernel version. |
[in] | MaxVersion | Maximum kernel version. |
Definition at line 73 of file KernelVersion.c.
UINT32 OcParseDarwinVersion | ( | IN CONST CHAR8 * | String | ) |
Create Apple kernel version in integer format. See KERNEL_VERSION on how to build it from integers.
[in] | String | Apple kernel version. |
Definition at line 27 of file KernelVersion.c.
EFI_STATUS PatcherApplyGenericPatch | ( | IN OUT PATCHER_CONTEXT * | Context, |
IN PATCHER_GENERIC_PATCH * | Patch ) |
Apply generic patch.
[in,out] | Context | Patcher context. |
[in] | Patch | Patch description. |
Definition at line 310 of file KextPatcher.c.
EFI_STATUS PatcherBlockKext | ( | IN OUT PATCHER_CONTEXT * | Context | ) |
Block kext from loading.
[in,out] | Context | Patcher context. |
Definition at line 712 of file KextPatcher.c.
EFI_STATUS PatcherExcludeMkextKext | ( | IN OUT MKEXT_CONTEXT * | MkextContext, |
IN CONST CHAR8 * | Identifier ) |
Exclude kext from mkext.
[in,out] | MkextContext | Mkext context. |
[in] | Identifier | Kext identifier to be excluded. |
Definition at line 546 of file KextPatcher.c.
EFI_STATUS PatcherExcludePrelinkedKext | ( | IN CONST CHAR8 * | Identifier, |
IN OUT PATCHER_CONTEXT * | PatcherContext, | ||
IN OUT PRELINKED_CONTEXT * | PrelinkedContext ) |
Exclude kext from prelinked.
[in] | Identifier | Kext identifier to be excluded. |
[in,out] | PatcherContext | Patcher context. |
[in,out] | PrelinkedContext | Prelinked context. |
Definition at line 396 of file KextPatcher.c.
EFI_STATUS PatcherGetSymbolAddress | ( | IN OUT PATCHER_CONTEXT * | Context, |
IN CONST CHAR8 * | Name, | ||
IN OUT UINT8 ** | Address ) |
Get local symbol address.
[in,out] | Context | Patcher context. |
[in] | Name | Symbol name. |
[in,out] | Address | Returned symbol address in file. |
Definition at line 214 of file KextPatcher.c.
EFI_STATUS PatcherGetSymbolAddressValue | ( | IN OUT PATCHER_CONTEXT * | Context, |
IN CONST CHAR8 * | Name, | ||
IN OUT UINT8 ** | Address, | ||
IN OUT UINT64 * | Value ) |
Get local symbol address and symbol value.
[in,out] | Context | Patcher context. |
[in] | Name | Symbol name. |
[in,out] | Address | Returned symbol address in file. |
[in,out] | Value | Returned original symbol value. |
Definition at line 234 of file KextPatcher.c.
EFI_STATUS PatcherGetSymbolValue | ( | IN OUT PATCHER_CONTEXT * | Context, |
IN CONST CHAR8 * | Name, | ||
IN OUT UINT64 * | Value ) |
Get local symbol value.
[in,out] | Context | Patcher context. |
[in] | Name | Symbol name. |
[in,out] | Value | Returned original symbol value. |
Definition at line 224 of file KextPatcher.c.
EFI_STATUS PatcherInitContextFromBuffer | ( | IN OUT PATCHER_CONTEXT * | Context, |
IN OUT UINT8 * | Buffer, | ||
IN UINT32 | BufferSize, | ||
IN BOOLEAN | Use32Bit ) |
Initialize patcher from buffer for e.g. kernel patching.
[in,out] | Context | Patcher context. |
[in,out] | Buffer | Kernel buffer (could be prelinked). |
[in] | BufferSize | Kernel buffer size. |
[in] | Is32Bit | TRUE to use 32-bit. |
Definition at line 134 of file KextPatcher.c.
EFI_STATUS PatcherInitContextFromMkext | ( | IN OUT PATCHER_CONTEXT * | Context, |
IN OUT MKEXT_CONTEXT * | Mkext, | ||
IN CONST CHAR8 * | Name ) |
Initialize patcher from mkext context for kext patching.
[in,out] | Context | Patcher context. |
[in,out] | Mkext | Mkext context. |
[in] | Name | Kext bundle identifier. |
Definition at line 117 of file KextPatcher.c.
EFI_STATUS PatcherInitContextFromPrelinked | ( | IN OUT PATCHER_CONTEXT * | Context, |
IN OUT PRELINKED_CONTEXT * | Prelinked, | ||
IN CONST CHAR8 * | Name ) |
Initialize patcher from prelinked context for kext patching.
[in,out] | Context | Patcher context. |
[in,out] | Prelinked | Prelinked context. |
[in] | Name | Kext bundle identifier. |
Definition at line 99 of file KextPatcher.c.
EFI_STATUS PatchKernelCpuId | ( | IN OUT PATCHER_CONTEXT * | Patcher, |
IN OC_CPU_INFO * | CpuInfo, | ||
IN UINT32 * | Data, | ||
IN UINT32 * | DataMask, | ||
IN UINT32 | KernelVersion ) |
Apply modification to CPUID 1.
Patcher | Patcher context. |
CpuInfo | CPU information. |
Data | 4 32-bit integers with CPUID data. |
DataMask | 4 32-bit integers with CPUID enabled overrides data. |
KernelVersion | Current kernel version. |
Definition at line 879 of file CpuidPatches.c.
EFI_STATUS PatchProvideCurrentCpuInfo | ( | IN OUT PATCHER_CONTEXT * | Patcher, |
IN OC_CPU_INFO * | CpuInfo, | ||
IN UINT32 | KernelVersion ) |
Apply current CPU information patches.
Patcher | Patcher context. |
CpuInfo | CPU information. |
KernelVersion | Current kernel version. |
Definition at line 1557 of file CpuidPatches.c.
VOID PatchSetApfsTimeout | ( | IN UINT32 | Timeout | ) |
Set timeout value in microseconds for KernelQuirkSetApfsTrimTimeout quirk.
[in] | Timeout | Timeout in microseconds. |
Definition at line 2863 of file CommonPatches.c.
VOID PatchSetPciSerialDevice | ( | IN UINTN | RegisterBase, |
IN UINT32 | RegisterStride ) |
Set PCI serial device properties for KernelQuirkCustomPciSerialDevice quirk.
[in] | RegisterBase | PCI serial device regiser base. |
[in] | RegisterStride | PCI serial device regiser stride. |
Definition at line 1513 of file CommonPatches.c.
EFI_STATUS PrelinkedContextApplyPatch | ( | IN OUT PRELINKED_CONTEXT * | Context, |
IN CONST CHAR8 * | Identifier, | ||
IN PATCHER_GENERIC_PATCH * | Patch ) |
Apply kext patch to prelinked.
[in,out] | Context | Prelinked context. |
[in] | Identifier | Kext bundle identifier. |
[in] | Patch | Patch to apply. |
Definition at line 1260 of file PrelinkedContext.c.
EFI_STATUS PrelinkedContextApplyQuirk | ( | IN OUT PRELINKED_CONTEXT * | Context, |
IN KERNEL_QUIRK_NAME | Quirk, | ||
IN UINT32 | KernelVersion ) |
Apply kext quirk to prelinked.
[in,out] | Context | Prelinked context. |
[in] | Quirk | Kext quirk to apply. |
[in] | KernelVersion | Current kernel version. |
EFI_SUCCESS | on success. |
Definition at line 1283 of file PrelinkedContext.c.
EFI_STATUS PrelinkedContextBlock | ( | IN OUT PRELINKED_CONTEXT * | Context, |
IN CONST CHAR8 * | Identifier, | ||
IN BOOLEAN | Exclude ) |
Block kext in prelinked.
[in,out] | Context | Prelinked context. |
[in] | Identifier | Kext bundle identifier. |
[in] | Exclude | TRUE to exclude kext from prelinked. |
Definition at line 1311 of file PrelinkedContext.c.
VOID PrelinkedContextFree | ( | IN OUT PRELINKED_CONTEXT * | Context | ) |
Free resources consumed by prelinked context.
[in,out] | Context | Prelinked context. |
Definition at line 427 of file PrelinkedContext.c.
EFI_STATUS PrelinkedContextInit | ( | IN OUT PRELINKED_CONTEXT * | Context, |
IN OUT UINT8 * | Prelinked, | ||
IN UINT32 | PrelinkedSize, | ||
IN UINT32 | PrelinkedAllocSize, | ||
IN BOOLEAN | Is32Bit ) |
Construct prelinked context for later modification. Must be freed with PrelinkedContextFree on success. Note, that PrelinkedAllocSize never changes, and is to be estimated.
[in,out] | Context | Prelinked context. |
[in,out] | Prelinked | Unpacked prelinked buffer (Mach-O image). |
[in] | PrelinkedSize | Unpacked prelinked buffer size. |
[in] | PrelinkedAllocSize | Unpacked prelinked buffer allocated size. |
[in] | Is32Bit | TRUE if prelinked is 32-bit. |
Definition at line 208 of file PrelinkedContext.c.
EFI_STATUS PrelinkedDependencyInsert | ( | IN OUT PRELINKED_CONTEXT * | Context, |
IN VOID * | Buffer ) |
Insert pool-allocated buffer dependency with the same lifetime as prelinked context, so it gets freed with PrelinkedContextFree.
[in,out] | Context | Prelinked context. |
[in] | Buffer | Pool allocated buffer. |
Definition at line 491 of file PrelinkedContext.c.
EFI_STATUS PrelinkedInjectComplete | ( | IN OUT PRELINKED_CONTEXT * | Context | ) |
Insert current plist entry after kext injection.
[in,out] | Context | Prelinked context. |
Definition at line 757 of file PrelinkedContext.c.
EFI_STATUS PrelinkedInjectKext | ( | IN OUT PRELINKED_CONTEXT * | Context, |
IN CONST CHAR8 *Identifier | OPTIONAL, | ||
IN CONST CHAR8 * | BundlePath, | ||
IN CONST CHAR8 * | InfoPlist, | ||
IN UINT32 | InfoPlistSize, | ||
IN CONST CHAR8 *ExecutablePath | OPTIONAL, | ||
IN OUT CONST UINT8 *Executable | OPTIONAL, | ||
IN UINT32 ExecutableSize | OPTIONAL, | ||
OUT CHAR8 BundleVersion | OPTIONAL[MAX_INFO_BUNDLE_VERSION_KEY_SIZE] ) |
Perform kext injection.
[in,out] | Context | Prelinked context. |
[in] | Identifier | Kext bundle identifier. If a kext with this identifier already exists, the kext will not be injected. Optional. |
[in] | BundlePath | Kext bundle path (e.g. /L/E/mykext.kext). |
[in,out] | InfoPlist | Kext Info.plist. |
[in] | InfoPlistSize | Kext Info.plist size. |
[in,out] | ExecutablePath | Kext executable path (e.g. Contents/MacOS/mykext), optional. |
[in,out] | Executable | Kext executable, optional. |
[in] | ExecutableSize | Kext executable size, optional. |
[out] | BundleVersion | Kext bundle version, optionally set on request. |
EFI_STATUS PrelinkedInjectPrepare | ( | IN OUT PRELINKED_CONTEXT * | Context, |
IN UINT32 | LinkedExpansion, | ||
IN UINT32 | ReservedExeSize ) |
Drop current plist entry, required for kext injection. Ensure that prelinked text can grow with new kexts.
[in,out] | Context | Prelinked context. |
[in] | LinkedExpansion | Extra LINKEDIT size for KC required to hold DYLD chained fixups. |
EFI_SUCCESS | on success. |
Definition at line 526 of file PrelinkedContext.c.
EFI_STATUS PrelinkedReserveKextSize | ( | IN OUT UINT32 * | ReservedInfoSize, |
IN OUT UINT32 * | ReservedExeSize, | ||
IN UINT32 | InfoPlistSize, | ||
IN UINT8 *Executable | OPTIONAL, | ||
IN UINT32 ExecutableSize | OPTIONAL, | ||
IN BOOLEAN | Is32Bit ) |
Updated required reserve size to inject this kext.
[in,out] | ReservedInfoSize | Current reserved PLIST size, updated. |
[in,out] | ReservedExeSize | Current reserved KEXT size, updated. |
[in] | InfoPlistSize | Kext Info.plist size. |
[in] | Executable | Kext executable, optional. |
[in] | ExecutableSize | Kext executable size, optional. |
[in] | Is32Bit | TRUE to process 32-bit kext. |
Definition at line 903 of file PrelinkedContext.c.
EFI_STATUS ReadAppleKernel | ( | IN EFI_FILE_PROTOCOL * | File, |
IN BOOLEAN | Prefer32Bit, | ||
OUT BOOLEAN * | Is32Bit, | ||
OUT UINT8 ** | Kernel, | ||
OUT UINT32 * | KernelSize, | ||
OUT UINT32 * | AllocatedSize, | ||
IN UINT32 | ReservedSize, | ||
OUT UINT8 *Digest | OPTIONAL ) |
Read Apple kernel for target architecture (possibly decompressing) into pool allocated buffer. If CpuType does not exist in fat mkext, an error is returned.
[in] | File | File handle instance. |
[in] | Prefer32Bit | Prefer 32-bit in case of fat binary. |
[out] | Is32Bit | Whether resulting kernel is 32-bit or not. |
[in,out] | Kernel | Resulting non-fat kernel buffer from pool. |
[out] | KernelSize | Actual kernel size. |
[out] | AllocatedSize | Allocated kernel size (AllocatedSize >= KernelSize). |
[in] | ReservedSize | Allocated extra size for added kernel extensions. |
[out] | Digest | SHA-384 digest for the original kernel, optional. |
Definition at line 418 of file KernelReader.c.
EFI_STATUS ReadAppleMkext | ( | IN EFI_FILE_PROTOCOL * | File, |
IN BOOLEAN | Prefer32Bit, | ||
OUT UINT8 ** | Mkext, | ||
OUT UINT32 * | MkextSize, | ||
OUT UINT32 * | AllocatedSize, | ||
IN UINT32 | ReservedSize, | ||
IN UINT32 | NumReservedKexts ) |
Read mkext for target architecture (possibly decompressing) into pool allocated buffer. If CpuType does not exist in fat mkext, an error is returned.
[in] | File | File handle instance. |
[in] | Prefer32Bit | Prefer 32-bit in case of fat binary. |
[in,out] | Mkext | Resulting non-fat mkext buffer from pool. |
[out] | MkextSize | Actual mkext size. |
[out] | AllocatedSize | Allocated mkext size (AllocatedSize >= MkextSize). |
[in] | ReservedSize | Allocated extra size for added kernel extensions. |
[in] | NumReservedKexts | Number of kext slots to reserve in mkext. |
Definition at line 514 of file KernelReader.c.