mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2025-02-17 01:11:36 +01:00
initialize variables
Signed-off-by: SergeySlice <sergey.slice@gmail.com>
This commit is contained in:
parent
6dbdf12257
commit
abc8d3cab3
@ -24,40 +24,40 @@ typedef struct OC_ABC_SETTINGS_ {
|
||||
/// (date and time, NVRAM, power control, etc.) support on many firmwares.
|
||||
/// Needed basically by everyone that uses SMM implementation of variable services.
|
||||
///
|
||||
BOOLEAN AvoidRuntimeDefrag;
|
||||
BOOLEAN AvoidRuntimeDefrag; //1
|
||||
///
|
||||
/// Setup virtual memory mapping after SetVirtualAddresses call. This fixes crashes in many
|
||||
/// firmwares at early boot as they accidentally access virtual addresses after ExitBootServices.
|
||||
///
|
||||
BOOLEAN SetupVirtualMap;
|
||||
BOOLEAN SetupVirtualMap; //1
|
||||
///
|
||||
/// Provide custom Apple KASLR slide calculation for firmwares with polluted low memory ranges.
|
||||
/// This also ensures that slide= argument is never passed to the operating system.
|
||||
///
|
||||
BOOLEAN ProvideCustomSlide;
|
||||
BOOLEAN ProvideCustomSlide; //1
|
||||
///
|
||||
/// Provide max KASLR slide for firmwares with polluted higher memory ranges.
|
||||
///
|
||||
UINT8 ProvideMaxSlide;
|
||||
UINT8 ProvideMaxSlide; //0
|
||||
///
|
||||
/// Remove runtime flag from MMIO areas and prevent virtual address assignment for known
|
||||
/// MMIO regions. This may improve the amount of slides available, but may not work on
|
||||
/// unknown configurations.
|
||||
///
|
||||
BOOLEAN DevirtualiseMmio;
|
||||
BOOLEAN DevirtualiseMmio; //0
|
||||
///
|
||||
/// Disable passing -s to operating system through key presses, to simulate T2 Mac behaviour.
|
||||
/// Ref: https://support.apple.com/HT201573
|
||||
///
|
||||
BOOLEAN DisableSingleUser;
|
||||
BOOLEAN DisableSingleUser; //0
|
||||
///
|
||||
/// Discard UEFI memory map after waking from hibernation and preserve the original mapping.
|
||||
///
|
||||
BOOLEAN DiscardHibernateMap;
|
||||
BOOLEAN DiscardHibernateMap; //0
|
||||
///
|
||||
/// Try to patch Apple bootloader to have KASLR enabled even in SafeMode.
|
||||
///
|
||||
BOOLEAN EnableSafeModeSlide;
|
||||
BOOLEAN EnableSafeModeSlide; //1
|
||||
///
|
||||
/// Attempt to protect certain memory regions from being incorrectly mapped:
|
||||
/// - CSM region could get used by the kernel due to being BS data,
|
||||
@ -65,36 +65,36 @@ typedef struct OC_ABC_SETTINGS_ {
|
||||
/// - MMIO regions can be marked as reserved memory and be thus unmapped,
|
||||
/// which caused boot failures when accessing NVRAM.
|
||||
///
|
||||
BOOLEAN ProtectMemoryRegions;
|
||||
BOOLEAN ProtectMemoryRegions; //0
|
||||
///
|
||||
/// Rebuild memory map to be compatible with Apple kernel.
|
||||
/// - Apply memory attributes and split RT entries into code and data.
|
||||
/// - Reduce memory map entries through grouping to fit into 4KB.
|
||||
///
|
||||
BOOLEAN RebuildAppleMemoryMap;
|
||||
BOOLEAN RebuildAppleMemoryMap; //0
|
||||
///
|
||||
/// Ensure that ExitBootServices call succeeds even with outdated MemoryMap key.
|
||||
///
|
||||
BOOLEAN ForceExitBootServices;
|
||||
BOOLEAN ForceExitBootServices; //0
|
||||
///
|
||||
/// Disable NVRAM variable write support to protect from malware or to prevent
|
||||
/// buggy NVRAM implementations cause system issues.
|
||||
///
|
||||
BOOLEAN DisableVariableWrite;
|
||||
BOOLEAN DisableVariableWrite; //0
|
||||
///
|
||||
/// Protect secure boot variables.
|
||||
///
|
||||
BOOLEAN ProtectSecureBoot;
|
||||
BOOLEAN ProtectSecureBoot; //0
|
||||
///
|
||||
/// Permit writing to executable memory in UEFI runtime services. Fixes crashes
|
||||
/// on many APTIO V firmwares.
|
||||
///
|
||||
BOOLEAN EnableWriteUnprotector;
|
||||
BOOLEAN EnableWriteUnprotector; //1
|
||||
///
|
||||
/// Signal OSInfo protocol that every loaded non-macOS OS is macOS.
|
||||
/// Works around disabled IGPU in Windows and Linux on Apple laptops.
|
||||
///
|
||||
BOOLEAN SignalAppleOS;
|
||||
BOOLEAN SignalAppleOS; //0
|
||||
///
|
||||
/// CoreImage may update and restore GetMemoryMap during loading (see InsertImageRecord)
|
||||
/// as it needs this for segment splitting. Unfortunately it assumes nobody else
|
||||
@ -105,27 +105,27 @@ typedef struct OC_ABC_SETTINGS_ {
|
||||
/// may show "Your Mac OS guest might run unreliably with more than one virtual core."
|
||||
/// message when running OpenCore.
|
||||
///
|
||||
BOOLEAN ProtectUefiServices;
|
||||
BOOLEAN ProtectUefiServices; //0
|
||||
///
|
||||
/// Fix OpenRuntime permissions in the memory map and memory attributes.
|
||||
///
|
||||
BOOLEAN SyncRuntimePermissions;
|
||||
BOOLEAN SyncRuntimePermissions; //1
|
||||
///
|
||||
/// List of physical addresses to not be devirtualised by DevirtualiseMmio.
|
||||
///
|
||||
EFI_PHYSICAL_ADDRESS *MmioWhitelist;
|
||||
EFI_PHYSICAL_ADDRESS *MmioWhitelist; //null
|
||||
///
|
||||
/// Size of list of physical addresses to not be devirtualised by DevirtualiseMmio.
|
||||
///
|
||||
UINTN MmioWhitelistSize;
|
||||
UINTN MmioWhitelistSize; //0
|
||||
///
|
||||
/// List of NULL-terminated handlers for TPL_APPLICATION execution within ExitBootServices.
|
||||
///
|
||||
EFI_EVENT_NOTIFY *ExitBootServicesHandlers;
|
||||
EFI_EVENT_NOTIFY *ExitBootServicesHandlers; //null
|
||||
///
|
||||
/// List of handler contexts for ExitBootServicesHandlers.
|
||||
///
|
||||
VOID **ExitBootServicesHandlerContexts;
|
||||
VOID **ExitBootServicesHandlerContexts; //null
|
||||
} OC_ABC_SETTINGS;
|
||||
|
||||
/**
|
||||
|
@ -233,13 +233,13 @@ ShouldUseCustomSlideOffset (
|
||||
)
|
||||
{
|
||||
EFI_PHYSICAL_ADDRESS AllocatedMapPages;
|
||||
UINTN MemoryMapSize;
|
||||
EFI_MEMORY_DESCRIPTOR *MemoryMap;
|
||||
UINTN MemoryMapSize = NULL;
|
||||
EFI_MEMORY_DESCRIPTOR *MemoryMap = NULL;
|
||||
EFI_MEMORY_DESCRIPTOR *Desc;
|
||||
UINTN MapKey;
|
||||
UINTN MapKey = 0;
|
||||
EFI_STATUS Status;
|
||||
UINTN DescriptorSize;
|
||||
UINT32 DescriptorVersion;
|
||||
UINTN DescriptorSize = 0;
|
||||
UINT32 DescriptorVersion = 0;
|
||||
OC_CPU_GENERATION CpuGeneration;
|
||||
UINTN Index;
|
||||
UINTN Slide;
|
||||
@ -578,9 +578,9 @@ HideSlideFromOs (
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
DTEntry Chosen;
|
||||
CHAR8 *ArgsStr;
|
||||
UINT32 ArgsSize;
|
||||
DTEntry Chosen = 0;
|
||||
CHAR8 *ArgsStr = NULL;
|
||||
UINT32 ArgsSize = 0;
|
||||
|
||||
//
|
||||
// First, there is a BootArgs entry for XNU.
|
||||
|
@ -456,7 +456,7 @@ OcGetMemoryMap (
|
||||
// Reserve larger area for the memory map when we need to split it.
|
||||
//
|
||||
if (BootCompat->ServiceState.AppleBootNestedCount > 0 && Status == EFI_BUFFER_TOO_SMALL) {
|
||||
*MemoryMapSize += OcCountSplitDescritptors () * *DescriptorSize;
|
||||
*MemoryMapSize += OcCountSplitDescriptors () * *DescriptorSize;
|
||||
return EFI_BUFFER_TOO_SMALL;
|
||||
}
|
||||
|
||||
|
@ -462,7 +462,7 @@ OcRebuildAttributes (
|
||||
}
|
||||
|
||||
UINTN
|
||||
OcCountSplitDescritptors (
|
||||
OcCountSplitDescriptors (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
|
@ -26,19 +26,19 @@
|
||||
EFI_MEMORY_DESCRIPTOR *
|
||||
OcGetCurrentMemoryMap (
|
||||
OUT UINTN *MemoryMapSize,
|
||||
OUT UINTN *DescriptorSize,
|
||||
IN UINTN *DescriptorSize,
|
||||
OUT UINTN *MapKey OPTIONAL,
|
||||
OUT UINT32 *DescriptorVersion OPTIONAL,
|
||||
OUT UINTN *OriginalMemoryMapSize OPTIONAL,
|
||||
IN BOOLEAN IncludeSplitSpace
|
||||
)
|
||||
{
|
||||
EFI_MEMORY_DESCRIPTOR *MemoryMap;
|
||||
EFI_MEMORY_DESCRIPTOR *MemoryMap = NULL;
|
||||
EFI_STATUS Status;
|
||||
UINTN MapKeyValue;
|
||||
UINTN MapKeyValue = 0;
|
||||
UINTN OriginalSize;
|
||||
UINTN ExtraSize;
|
||||
UINT32 DescriptorVersionValue;
|
||||
UINT32 DescriptorVersionValue = 0;
|
||||
BOOLEAN Result;
|
||||
|
||||
*MemoryMapSize = 0;
|
||||
@ -55,7 +55,7 @@ OcGetCurrentMemoryMap (
|
||||
}
|
||||
|
||||
if (IncludeSplitSpace) {
|
||||
ExtraSize = OcCountSplitDescritptors () * *DescriptorSize;
|
||||
ExtraSize = OcCountSplitDescriptors() * *DescriptorSize;
|
||||
} else {
|
||||
ExtraSize = 0;
|
||||
}
|
||||
@ -66,7 +66,7 @@ OcGetCurrentMemoryMap (
|
||||
//
|
||||
Result = OcOverflowAddUN (
|
||||
*MemoryMapSize,
|
||||
MAX (*DescriptorSize + ExtraSize, 1024 + ExtraSize),
|
||||
MAX(*DescriptorSize + ExtraSize, 1024 + ExtraSize),
|
||||
MemoryMapSize
|
||||
);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user