OpenCore
1.0.4
OpenCore Bootloader
|
#include <Uefi.h>
#include <IndustryStandard/AppleCompressedBinaryImage.h>
#include <IndustryStandard/AppleFatBinaryImage.h>
#include <Library/BaseLib.h>
#include <Library/BaseOverflowLib.h>
#include <Library/DebugLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/OcAppleKernelLib.h>
#include <Library/OcCompressionLib.h>
#include <Library/OcCryptoLib.h>
#include <Library/OcFileLib.h>
Go to the source code of this file.
Macros | |
#define | KERNEL_HEADER_SIZE (EFI_PAGE_SIZE * 2) |
Enumerations | |
enum | KERNEL_ARCH { KernelArchUnknown , KernelArch32 , KernelArch64 } |
Functions | |
STATIC EFI_STATUS | ReplaceBuffer (IN UINT32 TargetSize, IN OUT UINT8 **Buffer, OUT UINT32 *AllocatedSize, IN UINT32 ReservedSize) |
STATIC EFI_STATUS | KernelGetFileData (IN EFI_FILE_PROTOCOL *File, IN UINT32 Position, IN UINT32 Size, OUT UINT8 *Buffer) |
STATIC EFI_STATUS | ParseFatArchitecture (IN EFI_FILE_PROTOCOL *File, IN BOOLEAN Prefer32Bit, IN UINT8 *Buffer, IN UINT32 BufferSize, OUT BOOLEAN *Is32Bit, OUT UINT32 *FatOffset, OUT UINT32 *FatSize) |
STATIC UINT32 | ParseCompressedHeader (IN EFI_FILE_PROTOCOL *File, IN OUT UINT8 **Buffer, IN UINT32 Offset, OUT UINT32 *AllocatedSize, IN UINT32 ReservedSize) |
STATIC EFI_STATUS | ReadAppleKernelImage (IN EFI_FILE_PROTOCOL *File, IN BOOLEAN Prefer32Bit, IN OUT KERNEL_ARCH *Arch, IN OUT UINT8 **Buffer, OUT UINT32 *KernelSize, OUT UINT32 *AllocatedSize, IN UINT32 ReservedSize, IN UINT32 Offset) |
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) |
Variables | |
STATIC SHA384_CONTEXT | mKernelDigestContext |
STATIC UINT32 | mKernelDigestPosition |
STATIC BOOLEAN | mNeedKernelDigest |
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 KernelReader.c.
#define KERNEL_HEADER_SIZE (EFI_PAGE_SIZE * 2) |
Definition at line 32 of file KernelReader.c.
enum KERNEL_ARCH |
Enumerator | |
---|---|
KernelArchUnknown | |
KernelArch32 | |
KernelArch64 |
Definition at line 38 of file KernelReader.c.
STATIC EFI_STATUS KernelGetFileData | ( | IN EFI_FILE_PROTOCOL * | File, |
IN UINT32 | Position, | ||
IN UINT32 | Size, | ||
OUT UINT8 * | Buffer ) |
Definition at line 77 of file KernelReader.c.
STATIC UINT32 ParseCompressedHeader | ( | IN EFI_FILE_PROTOCOL * | File, |
IN OUT UINT8 ** | Buffer, | ||
IN UINT32 | Offset, | ||
OUT UINT32 * | AllocatedSize, | ||
IN UINT32 | ReservedSize ) |
Definition at line 193 of file KernelReader.c.
STATIC EFI_STATUS ParseFatArchitecture | ( | IN EFI_FILE_PROTOCOL * | File, |
IN BOOLEAN | Prefer32Bit, | ||
IN UINT8 * | Buffer, | ||
IN UINT32 | BufferSize, | ||
OUT BOOLEAN * | Is32Bit, | ||
OUT UINT32 * | FatOffset, | ||
OUT UINT32 * | FatSize ) |
Definition at line 141 of file KernelReader.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.
STATIC EFI_STATUS ReadAppleKernelImage | ( | IN EFI_FILE_PROTOCOL * | File, |
IN BOOLEAN | Prefer32Bit, | ||
IN OUT KERNEL_ARCH * | Arch, | ||
IN OUT UINT8 ** | Buffer, | ||
OUT UINT32 * | KernelSize, | ||
OUT UINT32 * | AllocatedSize, | ||
IN UINT32 | ReservedSize, | ||
IN UINT32 | Offset ) |
Definition at line 269 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.
STATIC EFI_STATUS ReplaceBuffer | ( | IN UINT32 | TargetSize, |
IN OUT UINT8 ** | Buffer, | ||
OUT UINT32 * | AllocatedSize, | ||
IN UINT32 | ReservedSize ) |
Definition at line 46 of file KernelReader.c.
STATIC SHA384_CONTEXT mKernelDigestContext |
Definition at line 34 of file KernelReader.c.
STATIC UINT32 mKernelDigestPosition |
Definition at line 35 of file KernelReader.c.
STATIC BOOLEAN mNeedKernelDigest |
Definition at line 36 of file KernelReader.c.