OpenCore
1.0.4
OpenCore Bootloader
|
#include <Uefi.h>
#include <IndustryStandard/AppleCompressedBinaryImage.h>
#include <IndustryStandard/AppleFatBinaryImage.h>
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/BaseOverflowLib.h>
#include <Library/DebugLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/OcAppleKernelLib.h>
#include <Library/OcCompressionLib.h>
#include <Library/OcFileLib.h>
#include "PrelinkedInternal.h"
Go to the source code of this file.
Functions | |
STATIC UINTN | InternalKcGetKextFilesetSize (IN OUT PRELINKED_CONTEXT *Context) |
STATIC VOID | InternalKcWriteCommandHeaders (IN OUT PRELINKED_CONTEXT *Context, IN OUT MACH_HEADER_64 *MachHeader) |
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) |
STATIC VOID | InternalKcConvertRelocToFixup (IN OUT PRELINKED_CONTEXT *Context, IN OC_MACHO_CONTEXT *MachContext, IN CONST MACH_RELOCATION_INFO *RelocInfo, IN UINT64 RelocBase) |
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) |
Kernel collection support.
Copyright (c) 2020, vit9696. 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 KernelCollection.c.
STATIC VOID InternalKcConvertRelocToFixup | ( | IN OUT PRELINKED_CONTEXT * | Context, |
IN OC_MACHO_CONTEXT * | MachContext, | ||
IN CONST MACH_RELOCATION_INFO * | RelocInfo, | ||
IN UINT64 | RelocBase ) |
Definition at line 431 of file KernelCollection.c.
STATIC UINTN InternalKcGetKextFilesetSize | ( | IN OUT PRELINKED_CONTEXT * | Context | ) |
Definition at line 33 of file KernelCollection.c.
STATIC VOID InternalKcWriteCommandHeaders | ( | IN OUT PRELINKED_CONTEXT * | Context, |
IN OUT MACH_HEADER_64 * | MachHeader ) |
Definition at line 62 of file KernelCollection.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.