OpenCore  1.0.4
OpenCore Bootloader
Loading...
Searching...
No Matches
OpenCoreKernel.c File Reference
#include <Base.h>
#include <Library/OcMainLib.h>
#include <Library/BaseLib.h>
#include <Library/DebugLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/OcAfterBootCompatLib.h>
#include <Library/OcAppleKernelLib.h>
#include <Library/OcMiscLib.h>
#include <Library/OcAppleImg4Lib.h>
#include <Library/OcStringLib.h>
#include <Library/OcVirtualFsLib.h>
#include <Library/PrintLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiRuntimeServicesTableLib.h>

Go to the source code of this file.

Functions

STATIC VOID OcKernelConfigureCapabilities (IN OUT EFI_LOADED_IMAGE_PROTOCOL *LoadedImage, IN UINT32 Capabilities)
 
STATIC VOID OcKernelLoadAndReserveKext (IN OC_KERNEL_ADD_ENTRY *Kext, IN UINT32 Index, IN BOOLEAN IsForced, IN EFI_FILE_PROTOCOL *RootFile, IN OC_STORAGE_CONTEXT *Storage, IN OC_GLOBAL_CONFIG *Config, IN KERNEL_CACHE_TYPE CacheType, IN BOOLEAN Is32Bit, IN OUT UINT32 *ReservedExeSize, IN OUT UINT32 *ReservedInfoSize, IN OUT UINT32 *NumReservedKexts)
 
STATIC EFI_STATUS OcKernelLoadKextsAndReserve (IN EFI_FILE_PROTOCOL *RootFile, IN OC_STORAGE_CONTEXT *Storage, IN OC_GLOBAL_CONFIG *Config, IN KERNEL_CACHE_TYPE CacheType, IN BOOLEAN Is32Bit, OUT UINT32 *ReservedExeSize, OUT UINT32 *ReservedInfoSize, OUT UINT32 *NumReservedKexts)
 
STATIC VOID OcKernelInjectKext (IN OC_KERNEL_ADD_ENTRY *Kext, IN UINT32 Index, IN BOOLEAN IsForced, IN KERNEL_CACHE_TYPE CacheType, IN VOID *Context, IN UINT32 DarwinVersion, IN BOOLEAN Is32Bit)
 
VOID OcKernelInjectKexts (IN OC_GLOBAL_CONFIG *Config, IN KERNEL_CACHE_TYPE CacheType, IN VOID *Context, IN UINT32 DarwinVersion, IN BOOLEAN Is32Bit, IN UINT32 LinkedExpansion, IN UINT32 ReservedExeSize)
 
EFI_STATUS OcKernelProcessPrelinked (IN OC_GLOBAL_CONFIG *Config, IN UINT32 DarwinVersion, IN BOOLEAN Is32Bit, IN OUT UINT8 *Kernel, IN UINT32 *KernelSize, IN UINT32 AllocatedSize, IN UINT32 LinkedExpansion, IN UINT32 ReservedExeSize)
 
STATIC EFI_STATUS OcKernelProcessMkext (IN OC_GLOBAL_CONFIG *Config, IN UINT32 DarwinVersion, IN BOOLEAN Is32Bit, IN OUT UINT8 *Mkext, IN OUT UINT32 *MkextSize, IN UINT32 AllocatedSize)
 
STATIC EFI_STATUS OcKernelInitCacheless (IN OC_GLOBAL_CONFIG *Config, IN CACHELESS_CONTEXT *Context, IN UINT32 DarwinVersion, IN BOOLEAN Is32Bit, IN CHAR16 *FileName, IN EFI_FILE_PROTOCOL *ExtensionsDir, OUT EFI_FILE_PROTOCOL **File)
 
STATIC EFI_STATUS OcKernelReadAppleKernel (IN EFI_FILE_PROTOCOL *RootFile, IN EFI_FILE_PROTOCOL *KernelFile, IN CHAR16 *FileName, IN BOOLEAN Is32Bit, IN OUT UINT32 *DarwinVersion, OUT UINT8 **Kernel, OUT UINT32 *KernelSize, OUT UINT32 *AllocatedSize, OUT UINT32 *ReservedExeSize, OUT UINT32 *LinkedExpansion, OUT UINT8 *Digest OPTIONAL)
 
STATIC EFI_STATUS OcKernelFuzzyMatch (IN EFI_FILE_PROTOCOL *RootFile, IN CHAR16 *FileName, IN UINT64 OpenMode, IN UINT64 Attributes, IN BOOLEAN Is32Bit, IN OUT UINT32 *DarwinVersion, OUT EFI_FILE_PROTOCOL **KernelFile, OUT UINT8 **Kernel, OUT UINT32 *KernelSize, OUT UINT32 *AllocatedSize, OUT UINT32 *ReservedExeSize, OUT UINT32 *LinkedExpansion, OUT UINT8 *Digest OPTIONAL)
 
STATIC EFI_STATUS EFIAPI OcKernelFileOpen (IN EFI_FILE_PROTOCOL *This, OUT EFI_FILE_PROTOCOL **NewHandle, IN CHAR16 *FileName, IN UINT64 OpenMode, IN UINT64 Attributes)
 
VOID OcLoadKernelSupport (IN OC_STORAGE_CONTEXT *Storage, IN OC_GLOBAL_CONFIG *Config, IN OC_CPU_INFO *CpuInfo)
 
VOID OcUnloadKernelSupport (VOID)
 

Variables

STATIC OC_STORAGE_CONTEXTmOcStorage
 
STATIC OC_GLOBAL_CONFIG * mOcConfiguration
 
STATIC OC_CPU_INFOmOcCpuInfo
 
STATIC UINT8 mKernelDigest [SHA384_DIGEST_SIZE]
 
STATIC UINT32 mOcDarwinVersion
 
STATIC BOOLEAN mUse32BitKernel
 
STATIC CACHELESS_CONTEXT mOcCachelessContext
 
STATIC BOOLEAN mOcCachelessInProgress
 
STATIC EFI_FILE_PROTOCOL * mCustomKernelDirectory
 
STATIC BOOLEAN mCustomKernelDirectoryInProgress
 

Detailed Description

OpenCore driver.

Copyright (c) 2019, 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 OpenCoreKernel.c.

Function Documentation

◆ OcKernelConfigureCapabilities()

STATIC VOID OcKernelConfigureCapabilities ( IN OUT EFI_LOADED_IMAGE_PROTOCOL * LoadedImage,
IN UINT32 Capabilities )

Definition at line 48 of file OpenCoreKernel.c.

◆ OcKernelFileOpen()

STATIC EFI_STATUS EFIAPI OcKernelFileOpen ( IN EFI_FILE_PROTOCOL * This,
OUT EFI_FILE_PROTOCOL ** NewHandle,
IN CHAR16 * FileName,
IN UINT64 OpenMode,
IN UINT64 Attributes )

Definition at line 1096 of file OpenCoreKernel.c.

◆ OcKernelFuzzyMatch()

STATIC EFI_STATUS OcKernelFuzzyMatch ( IN EFI_FILE_PROTOCOL * RootFile,
IN CHAR16 * FileName,
IN UINT64 OpenMode,
IN UINT64 Attributes,
IN BOOLEAN Is32Bit,
IN OUT UINT32 * DarwinVersion,
OUT EFI_FILE_PROTOCOL ** KernelFile,
OUT UINT8 ** Kernel,
OUT UINT32 * KernelSize,
OUT UINT32 * AllocatedSize,
OUT UINT32 * ReservedExeSize,
OUT UINT32 * LinkedExpansion,
OUT UINT8 *Digest OPTIONAL )

Definition at line 972 of file OpenCoreKernel.c.

◆ OcKernelInitCacheless()

STATIC EFI_STATUS OcKernelInitCacheless ( IN OC_GLOBAL_CONFIG * Config,
IN CACHELESS_CONTEXT * Context,
IN UINT32 DarwinVersion,
IN BOOLEAN Is32Bit,
IN CHAR16 * FileName,
IN EFI_FILE_PROTOCOL * ExtensionsDir,
OUT EFI_FILE_PROTOCOL ** File )

Definition at line 833 of file OpenCoreKernel.c.

◆ OcKernelInjectKext()

STATIC VOID OcKernelInjectKext ( IN OC_KERNEL_ADD_ENTRY * Kext,
IN UINT32 Index,
IN BOOLEAN IsForced,
IN KERNEL_CACHE_TYPE CacheType,
IN VOID * Context,
IN UINT32 DarwinVersion,
IN BOOLEAN Is32Bit )

Definition at line 550 of file OpenCoreKernel.c.

◆ OcKernelInjectKexts()

VOID OcKernelInjectKexts ( IN OC_GLOBAL_CONFIG * Config,
IN KERNEL_CACHE_TYPE CacheType,
IN VOID * Context,
IN UINT32 DarwinVersion,
IN BOOLEAN Is32Bit,
IN UINT32 LinkedExpansion,
IN UINT32 ReservedExeSize )

Inject kexts.

Definition at line 685 of file OpenCoreKernel.c.

◆ OcKernelLoadAndReserveKext()

STATIC VOID OcKernelLoadAndReserveKext ( IN OC_KERNEL_ADD_ENTRY * Kext,
IN UINT32 Index,
IN BOOLEAN IsForced,
IN EFI_FILE_PROTOCOL * RootFile,
IN OC_STORAGE_CONTEXT * Storage,
IN OC_GLOBAL_CONFIG * Config,
IN KERNEL_CACHE_TYPE CacheType,
IN BOOLEAN Is32Bit,
IN OUT UINT32 * ReservedExeSize,
IN OUT UINT32 * ReservedInfoSize,
IN OUT UINT32 * NumReservedKexts )

Definition at line 235 of file OpenCoreKernel.c.

◆ OcKernelLoadKextsAndReserve()

STATIC EFI_STATUS OcKernelLoadKextsAndReserve ( IN EFI_FILE_PROTOCOL * RootFile,
IN OC_STORAGE_CONTEXT * Storage,
IN OC_GLOBAL_CONFIG * Config,
IN KERNEL_CACHE_TYPE CacheType,
IN BOOLEAN Is32Bit,
OUT UINT32 * ReservedExeSize,
OUT UINT32 * ReservedInfoSize,
OUT UINT32 * NumReservedKexts )

Definition at line 471 of file OpenCoreKernel.c.

◆ OcKernelProcessMkext()

STATIC EFI_STATUS OcKernelProcessMkext ( IN OC_GLOBAL_CONFIG * Config,
IN UINT32 DarwinVersion,
IN BOOLEAN Is32Bit,
IN OUT UINT8 * Mkext,
IN OUT UINT32 * MkextSize,
IN UINT32 AllocatedSize )

Definition at line 800 of file OpenCoreKernel.c.

◆ OcKernelProcessPrelinked()

EFI_STATUS OcKernelProcessPrelinked ( IN OC_GLOBAL_CONFIG * Config,
IN UINT32 DarwinVersion,
IN BOOLEAN Is32Bit,
IN OUT UINT8 * Kernel,
IN UINT32 * KernelSize,
IN UINT32 AllocatedSize,
IN UINT32 LinkedExpansion,
IN UINT32 ReservedExeSize )

Process prelinked.

Definition at line 767 of file OpenCoreKernel.c.

◆ OcKernelReadAppleKernel()

STATIC EFI_STATUS OcKernelReadAppleKernel ( IN EFI_FILE_PROTOCOL * RootFile,
IN EFI_FILE_PROTOCOL * KernelFile,
IN CHAR16 * FileName,
IN BOOLEAN Is32Bit,
IN OUT UINT32 * DarwinVersion,
OUT UINT8 ** Kernel,
OUT UINT32 * KernelSize,
OUT UINT32 * AllocatedSize,
OUT UINT32 * ReservedExeSize,
OUT UINT32 * LinkedExpansion,
OUT UINT8 *Digest OPTIONAL )

Definition at line 867 of file OpenCoreKernel.c.

◆ OcLoadKernelSupport()

VOID OcLoadKernelSupport ( IN OC_STORAGE_CONTEXT * Storage,
IN OC_GLOBAL_CONFIG * Config,
IN OC_CPU_INFO * CpuInfo )

Load Kernel compatibility support like kexts.

Parameters
[in]StorageOpenCore storage.
[in]ConfigOpenCore configuration.
[in]CpuInfoCPU information.

Definition at line 1530 of file OpenCoreKernel.c.

◆ OcUnloadKernelSupport()

VOID OcUnloadKernelSupport ( VOID )

Cleanup Kernel compatibility support on failure.

Definition at line 1581 of file OpenCoreKernel.c.

Variable Documentation

◆ mCustomKernelDirectory

STATIC EFI_FILE_PROTOCOL* mCustomKernelDirectory

Definition at line 43 of file OpenCoreKernel.c.

◆ mCustomKernelDirectoryInProgress

STATIC BOOLEAN mCustomKernelDirectoryInProgress

Definition at line 44 of file OpenCoreKernel.c.

◆ mKernelDigest

STATIC UINT8 mKernelDigest[SHA384_DIGEST_SIZE]

Definition at line 35 of file OpenCoreKernel.c.

◆ mOcCachelessContext

STATIC CACHELESS_CONTEXT mOcCachelessContext

Definition at line 40 of file OpenCoreKernel.c.

◆ mOcCachelessInProgress

STATIC BOOLEAN mOcCachelessInProgress

Definition at line 41 of file OpenCoreKernel.c.

◆ mOcConfiguration

STATIC OC_GLOBAL_CONFIG* mOcConfiguration

Definition at line 33 of file OpenCoreKernel.c.

◆ mOcCpuInfo

STATIC OC_CPU_INFO* mOcCpuInfo

Definition at line 34 of file OpenCoreKernel.c.

◆ mOcDarwinVersion

STATIC UINT32 mOcDarwinVersion

Definition at line 37 of file OpenCoreKernel.c.

◆ mOcStorage

STATIC OC_STORAGE_CONTEXT* mOcStorage

Definition at line 32 of file OpenCoreKernel.c.

◆ mUse32BitKernel

STATIC BOOLEAN mUse32BitKernel

Definition at line 38 of file OpenCoreKernel.c.