OpenCore  1.0.4
OpenCore Bootloader
1.0.4
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
RelocationBlock.c File Reference
#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>
#include "RelocationCallGate.h"

Go to the source code of this file.

Functions

EFI_STATUS AppleRelocationAllocatePages (IN OUT BOOT_COMPAT_CONTEXT *BootCompat, IN EFI_GET_MEMORY_MAP GetMemoryMap, IN EFI_ALLOCATE_PAGES AllocatePages, IN UINTN NumberOfPages, IN OUT EFI_PHYSICAL_ADDRESS *Memory)
 
EFI_STATUS AppleRelocationRelease (IN OUT BOOT_COMPAT_CONTEXT *BootCompat)
 
EFI_STATUS AppleRelocationVirtualize (IN OUT BOOT_COMPAT_CONTEXT *BootCompat, IN OUT OC_BOOT_ARGUMENTS *BA)
 
VOID AppleRelocationRebase (IN OUT BOOT_COMPAT_CONTEXT *BootCompat, IN OUT OC_BOOT_ARGUMENTS *BA)
 
VOID AppleRelocationCallGate64 (IN OUT UINTN *Args, IN BOOT_COMPAT_CONTEXT *BootCompat, IN KERNEL_CALL_GATE CallGate, IN UINTN *KcgArg1, IN UINTN KcgArg2)
 

Variables

STATIC CONST UINT8 mAsmRelocationCallGate []
 

Detailed Description

Copyright (C) 2013, dmazar. All rights reserved. Copyright (C) 2020, 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 RelocationBlock.c.

Function Documentation

◆ AppleRelocationAllocatePages()

EFI_STATUS AppleRelocationAllocatePages ( IN OUT BOOT_COMPAT_CONTEXT * BootCompat,
IN EFI_GET_MEMORY_MAP GetMemoryMap,
IN EFI_ALLOCATE_PAGES AllocatePages,
IN UINTN NumberOfPages,
IN OUT EFI_PHYSICAL_ADDRESS * Memory )

Allocate memory from a relocation block when zero slide is unavailable. EfiLoaderData at address.

Parameters
[in,out]BootCompatBoot compatibility context.
[in]GetMemoryMapUnmodified GetMemoryMap pointer, optional.
[in]AllocatePagesUnmodified AllocatePages pointer.
[in]NumberOfPagesNumber of pages to allocate.
[in,out]MemoryMemory address to allocate, may be updated.
Return values
EFI_SUCCESSon success.
EFI_UNSUPPORTEDwhen zero slide is available.

Definition at line 40 of file RelocationBlock.c.

◆ AppleRelocationCallGate64()

VOID AppleRelocationCallGate64 ( IN OUT UINTN * Args,
IN BOOT_COMPAT_CONTEXT * BootCompat,
IN KERNEL_CALL_GATE CallGate,
IN UINTN * KcgArg1,
IN UINTN KcgArg2 )

Boot Apple Kernel through relocation block.

Parameters
[in,out]ArgsOn input, the un-relocated kernel argument handle. On output, the relocated kernel argument handle.
[in]BootCompatBoot compatibility context.
[in]CallGateKernel call gate address.
[in]KcgArg1Pointer to the first kernel call gate argument.
[in]KcgArg2Second kernel call gate argument.

Definition at line 378 of file RelocationBlock.c.

◆ AppleRelocationRebase()

VOID AppleRelocationRebase ( IN OUT BOOT_COMPAT_CONTEXT * BootCompat,
IN OUT OC_BOOT_ARGUMENTS * BA )

Transition from relocation block address space to normal low memory address space in the relevant XNU areas.

Parameters
[in,out]BootCompatBoot compatibility context.
[in,out]BootArgsApple kernel boot arguments.

Definition at line 253 of file RelocationBlock.c.

◆ AppleRelocationRelease()

EFI_STATUS AppleRelocationRelease ( IN OUT BOOT_COMPAT_CONTEXT * BootCompat)

Release relocation block if present.

Parameters
[in,out]BootCompatBoot compatibility context.
Return values
EFI_SUCCESSon success.
EFI_UNSUPPORTEDwhen zero slide is available.

Definition at line 125 of file RelocationBlock.c.

◆ AppleRelocationVirtualize()

EFI_STATUS AppleRelocationVirtualize ( IN OUT BOOT_COMPAT_CONTEXT * BootCompat,
IN OUT OC_BOOT_ARGUMENTS * BA )

Transitions to virtual memory for the relocation block.

Parameters
[in,out]BootCompatBoot compatibility context.
[in,out]BootArgsApple kernel boot arguments.

Definition at line 154 of file RelocationBlock.c.

Variable Documentation

◆ mAsmRelocationCallGate

STATIC CONST UINT8 mAsmRelocationCallGate[]
Initial value:
= {
0xfa, 0xfc, 0x4c, 0x89, 0xc6, 0xbf, 0x00, 0x00, 0x10, 0x00, 0xf3, 0x48,
0xa5, 0x48, 0x89, 0xf4, 0x4c, 0x89, 0xc9, 0xe9, 0xe8, 0xfe, 0xff, 0xff
}

Definition at line 35 of file RelocationBlock.c.