OpenCore
1.0.4
OpenCore Bootloader
|
#include "BootCompatInternal.h"
#include <Guid/OcVariable.h>
#include <IndustryStandard/AppleHibernate.h>
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
#include <Library/OcBootManagementLib.h>
#include <Library/OcDeviceTreeLib.h>
#include <Library/OcMachoLib.h>
#include <Library/OcMemoryLib.h>
#include <Library/OcMiscLib.h>
#include <Library/OcStringLib.h>
#include <Library/PrintLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiLib.h>
#include <Library/UefiRuntimeServicesTableLib.h>
Go to the source code of this file.
Functions | |
STATIC VOID | ProtectRtMemoryFromRelocation (IN OUT RT_RELOC_PROTECT_DATA *RtReloc, IN UINTN MemoryMapSize, IN UINTN DescriptorSize, IN OUT EFI_MEMORY_DESCRIPTOR *MemoryMap, IN EFI_PHYSICAL_ADDRESS SysTableArea, IN UINTN SysTableAreaSize) |
STATIC EFI_STATUS | PerformRtMemoryVirtualMapping (IN OUT KERNEL_SUPPORT_STATE *KernelState, IN UINTN MemoryMapSize, IN UINTN DescriptorSize, IN UINT32 DescriptorVersion, IN EFI_MEMORY_DESCRIPTOR *MemoryMap) |
STATIC VOID | RestoreProtectedRtMemoryTypes (IN RT_RELOC_PROTECT_DATA *RtReloc, IN UINTN MemoryMapSize, IN UINTN DescriptorSize, IN OUT EFI_MEMORY_DESCRIPTOR *MemoryMap) |
VOID | AppleMapPrepareForBooting (IN OUT BOOT_COMPAT_CONTEXT *BootCompat, IN OUT VOID *BootArgs) |
VOID | AppleMapPrepareForHibernateWake (IN OUT BOOT_COMPAT_CONTEXT *BootCompat, IN UINTN ImageHeaderPage) |
VOID | AppleMapPrepareMemoryPool (IN OUT BOOT_COMPAT_CONTEXT *BootCompat) |
VOID | AppleMapPrepareBooterState (IN OUT BOOT_COMPAT_CONTEXT *BootCompat, IN OUT EFI_LOADED_IMAGE *LoadedImage, IN EFI_GET_MEMORY_MAP GetMemoryMap OPTIONAL) |
EFI_STATUS | AppleMapPrepareMemState (IN OUT BOOT_COMPAT_CONTEXT *BootCompat, IN UINTN MemoryMapSize, IN UINTN DescriptorSize, IN UINT32 DescriptorVersion, IN EFI_MEMORY_DESCRIPTOR *MemoryMap) |
Copyright (C) 2013, dmazar. All rights reserved. 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 KernelSupport.c.
VOID AppleMapPrepareBooterState | ( | IN OUT BOOT_COMPAT_CONTEXT * | BootCompat, |
IN OUT EFI_LOADED_IMAGE * | LoadedImage, | ||
IN EFI_GET_MEMORY_MAP GetMemoryMap | OPTIONAL ) |
Prepare environment for Apple UEFI bootloader. See more details inside.
[in,out] | BootCompat | Boot compatibility context. |
[in,out] | LoadedImage | UEFI loaded image protocol instance. |
[in] | GetMemoryMap | Unmodified GetMemoryMap pointer, optional. |
Definition at line 542 of file KernelSupport.c.
VOID AppleMapPrepareForBooting | ( | IN OUT BOOT_COMPAT_CONTEXT * | BootCompat, |
IN OUT VOID * | BootArgs ) |
Prepare environment for normal booting. Called when boot.efi jumps to kernel.
[in,out] | BootCompat | Boot compatibility context. |
[in,out] | BootArgs | Apple kernel boot arguments. |
Definition at line 325 of file KernelSupport.c.
VOID AppleMapPrepareForHibernateWake | ( | IN OUT BOOT_COMPAT_CONTEXT * | BootCompat, |
IN UINTN | ImageHeaderPage ) |
Prepare environment for hibernate wake. Called when boot.efi jumps to kernel.
[in,out] | BootCompat | Boot compatibility context. |
[in,out] | ImageHeaderPage | Apple hibernate image page number. |
Definition at line 436 of file KernelSupport.c.
VOID AppleMapPrepareMemoryPool | ( | IN OUT BOOT_COMPAT_CONTEXT * | BootCompat | ) |
Prepare virtual memory management environment for later usage.
[in,out] | BootCompat | Boot compatibility context. |
Definition at line 518 of file KernelSupport.c.
EFI_STATUS AppleMapPrepareMemState | ( | IN OUT BOOT_COMPAT_CONTEXT * | BootCompat, |
IN UINTN | MemoryMapSize, | ||
IN UINTN | DescriptorSize, | ||
IN UINT32 | DescriptorVersion, | ||
IN EFI_MEMORY_DESCRIPTOR * | MemoryMap ) |
Prepare memory state and perform virtual address translation.
[in,out] | BootCompat | Boot compatibility context. |
[in] | MemoryMapSize | SetVirtualAddresses memory map size argument. |
[in] | DescriptorSize | SetVirtualAddresses descriptor size argument. |
[in] | DescriptorVersion | SetVirtualAddresses descriptor version argument. |
[in] | MemoryMap | SetVirtualAddresses memory map argument. |
Definition at line 608 of file KernelSupport.c.
STATIC EFI_STATUS PerformRtMemoryVirtualMapping | ( | IN OUT KERNEL_SUPPORT_STATE * | KernelState, |
IN UINTN | MemoryMapSize, | ||
IN UINTN | DescriptorSize, | ||
IN UINT32 | DescriptorVersion, | ||
IN EFI_MEMORY_DESCRIPTOR * | MemoryMap ) |
Copy RT flagged areas to separate memmap, define virtual to physical address mapping, and call SetVirtualAddressMap() only with that partial memmap.
[in,out] | KernelState | Kernel support state. |
[in] | MemoryMapSize | Memory map size. |
[in] | DescriptorSize | Memory map descriptor size. |
[in] | DescriptorVersion | Memor map descriptor version. |
[in,out] | MemoryMap | Complete memory map with all entries. |
EFI_SUCCESS | on success. |
Definition at line 143 of file KernelSupport.c.
STATIC VOID ProtectRtMemoryFromRelocation | ( | IN OUT RT_RELOC_PROTECT_DATA * | RtReloc, |
IN UINTN | MemoryMapSize, | ||
IN UINTN | DescriptorSize, | ||
IN OUT EFI_MEMORY_DESCRIPTOR * | MemoryMap, | ||
IN EFI_PHYSICAL_ADDRESS | SysTableArea, | ||
IN UINTN | SysTableAreaSize ) |
Protect RT data from boot.efi relocation by marking them MemMapIO. See more details in the function definition.
[in,out] | RtReloc | Relocation entry list to store entry types. |
[in] | MemoryMapSize | Memory map size. |
[in] | DescriptorSize | Memory map descriptor size. |
[in,out] | MemoryMap | MemoryMap to protect entries in. |
[in] | SysTableArea | Special address that should not be protected. |
Definition at line 47 of file KernelSupport.c.
STATIC VOID RestoreProtectedRtMemoryTypes | ( | IN RT_RELOC_PROTECT_DATA * | RtReloc, |
IN UINTN | MemoryMapSize, | ||
IN UINTN | DescriptorSize, | ||
IN OUT EFI_MEMORY_DESCRIPTOR * | MemoryMap ) |
Revert RT data protected types to let XNU kernel kernel properly map data.
[in] | RtReloc | Relocated entry list with entry types. |
[in] | MemoryMapSize | Memory map size. |
[in] | DescriptorSize | Memory map descriptor size. |
[in,out] | MemoryMap | MemoryMap to restore protected entries in. |
Definition at line 270 of file KernelSupport.c.