From 6a56c2951b4e1c73b5d8f41e8d3e3ead30821fc0 Mon Sep 17 00:00:00 2001 From: Sergey Isakov Date: Fri, 4 Oct 2019 23:32:02 +0300 Subject: [PATCH] refactoring, renaming, cleanup --- Clover.dsc | 12 +- .../UefiCpuPkg/Include/Register/Microcode.h | 200 +++++ CloverPkg.dec | 36 +- Include/Guid/OcVariables.h | 85 +++ Include/IndustryStandard/AppleBootArgs.h | 173 +++++ Include/IndustryStandard/AppleCsrConfig.h | 62 ++ Include/IndustryStandard/AppleFeatures.h | 10 +- Include/IndustryStandard/AppleHibernate.h | 137 ++++ Include/IndustryStandard/UsbHid.h | 17 +- Include/Library/DeviceTreeLib.h | 282 +++++++ Include/Library/OcGuardLib.h | 705 +++++++++++++++++ Include/Library/OcMiscLib.h | 237 ++++++ Include/Library/OcStringLib.h | 197 +++++ Library/DeviceTreeLib/DeviceTreeLib.c | 715 ++++++++++++++++++ Library/DeviceTreeLib/DeviceTreeLib.inf | 44 ++ Library/MachoLib/CxxSymbols.c | 2 +- Library/MachoLib/MachoLib.inf | 9 +- Library/MachoLib/MachoLibInternal.h | 2 +- Library/MachoLib/Relocations.c | 4 +- Library/MachoLib/Symbols.c | 4 +- Library/OcGuardLib/OcGuardLib.inf | 3 +- MemoryFix/AptioMemoryFix/AptioMemoryFix.c | 4 +- MemoryFix/AptioMemoryFix/AptioMemoryFix.inf | 15 +- MemoryFix/AptioMemoryFix/BootFixes.c | 65 +- MemoryFix/AptioMemoryFix/CustomSlide.c | 22 +- MemoryFix/AptioMemoryFix/MemoryMap.c | 12 +- MemoryFix/AptioMemoryFix/ServiceOverrides.c | 22 +- MemoryFix/AptioMemoryFix/VMem.c | 4 +- MemoryFix/OsxAptioFixDrv/Lib.c | 20 +- MemoryFix/OsxLowMemFixDrv/Lib.c | 22 +- Protocols/AptioInputFix/Keycode/AIKTarget.c | 2 +- Protocols/AptioInputFix/Keycode/AIKTarget.h | 2 +- .../AptioInputFix/Keycode/AIKTranslate.c | 2 +- .../AptioInputFix/Keycode/AIKTranslate.h | 2 +- Protocols/DumpUefiCalls/Lib.c | 8 +- Xcode/Clover/Clover.xcodeproj/project.pbxproj | 543 +++++++++---- rEFIt_UEFI/Platform/Injectors.c | 6 +- rEFIt_UEFI/Platform/Platform.h | 4 +- rEFIt_UEFI/Platform/guid.c | 12 +- rEFIt_UEFI/refit.inf | 4 +- rEFIt_UEFI/refit/lib.h | 6 +- 41 files changed, 3414 insertions(+), 299 deletions(-) create mode 100644 CloverEFI/UefiCpuPkg/Include/Register/Microcode.h create mode 100644 Include/Guid/OcVariables.h create mode 100644 Include/IndustryStandard/AppleBootArgs.h create mode 100644 Include/IndustryStandard/AppleCsrConfig.h create mode 100755 Include/IndustryStandard/AppleHibernate.h create mode 100644 Include/Library/DeviceTreeLib.h create mode 100644 Include/Library/OcGuardLib.h create mode 100755 Include/Library/OcMiscLib.h create mode 100755 Include/Library/OcStringLib.h create mode 100755 Library/DeviceTreeLib/DeviceTreeLib.c create mode 100755 Library/DeviceTreeLib/DeviceTreeLib.inf diff --git a/Clover.dsc b/Clover.dsc index 428d28ddc..9a9e16bf5 100644 --- a/Clover.dsc +++ b/Clover.dsc @@ -151,15 +151,17 @@ AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLibNull.inf VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf - OcGuardLib|Library/OcGuardLib/OcGuardLib.inf - MachoLib|Library/MachoLib/MachoLib.inf - # # Our libs # MemLogLib|Library/MemLogLibDefault/MemLogLibDefault.inf VideoBiosPatchLib|Library/VideoBiosPatchLib/VideoBiosPatchLib.inf WaveLib|Library/WaveLib/WaveLib.inf + + OcGuardLib|Library/OcGuardLib/OcGuardLib.inf + MachoLib|Library/MachoLib/MachoLib.inf + DeviceTreeLib|Library/DeviceTreeLib/DeviceTreeLib.inf + ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf !ifndef NO_CLOVER_SHELL @@ -471,7 +473,7 @@ Protocols/HashServiceFix/HashServiceFix.inf Protocols/AppleKeyAggregator/AppleKeyAggregator.inf Protocols/AppleKeyFeeder/AppleKeyFeeder.inf -# Protocols/AptioInputFix/AptioInputFix.inf + Protocols/AptioInputFix/AptioInputFix.inf !ifdef DEBUG_ON_SERIAL_PORT @@ -585,7 +587,7 @@ # MemoryFix/OsxAptioFixDrv/OsxAptioFix2Drv.inf MemoryFix/OsxAptioFixDrv/OsxAptioFix3Drv.inf MemoryFix/OsxLowMemFixDrv/OsxLowMemFixDrv.inf -# MemoryFix/AptioMemoryFix/AptioMemoryFix.inf + MemoryFix/AptioMemoryFix/AptioMemoryFix.inf !ifdef DEBUG_ON_SERIAL_PORT MemoryFix/OsxAptioFixDrv/OsxAptioFixDrv.inf { # diff --git a/CloverEFI/UefiCpuPkg/Include/Register/Microcode.h b/CloverEFI/UefiCpuPkg/Include/Register/Microcode.h new file mode 100644 index 000000000..94529a1ca --- /dev/null +++ b/CloverEFI/UefiCpuPkg/Include/Register/Microcode.h @@ -0,0 +1,200 @@ +/** @file + Microcode Definitions. + + Microcode Definitions based on contents of the + Intel(R) 64 and IA-32 Architectures Software Developer's Manual + Volume 3A, Section 9.11 Microcode Definitions + + Copyright (c) 2016, Intel Corporation. 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. + + @par Specification Reference: + Intel(R) 64 and IA-32 Architectures Software Developer's Manual, Volume 3A, + June 2016, Chapter 9 Processor Management and Initialization, Section 9-11. + +**/ + +#ifndef __MICROCODE_H__ +#define __MICROCODE_H__ + +/// +/// CPU Microcode Date in BCD format +/// +typedef union { + struct { + UINT32 Year:16; + UINT32 Day:8; + UINT32 Month:8; + } Bits; + UINT32 Uint32; +} CPU_MICROCODE_DATE; + +/// +/// CPU Microcode Processor Signature format +/// +typedef union { + struct { + UINT32 Stepping:4; + UINT32 Model:4; + UINT32 Family:4; + UINT32 Type:2; + UINT32 Reserved1:2; + UINT32 ExtendedModel:4; + UINT32 ExtendedFamily:8; + UINT32 Reserved2:4; + } Bits; + UINT32 Uint32; +} CPU_MICROCODE_PROCESSOR_SIGNATURE; + +#pragma pack (1) + +/// +/// Microcode Update Format definition +/// +typedef struct { + /// + /// Version number of the update header + /// + UINT32 HeaderVersion; + /// + /// Unique version number for the update, the basis for the update + /// signature provided by the processor to indicate the current update + /// functioning within the processor. Used by the BIOS to authenticate + /// the update and verify that the processor loads successfully. The + /// value in this field cannot be used for processor stepping identification + /// alone. This is a signed 32-bit number. + /// + UINT32 UpdateRevision; + /// + /// Date of the update creation in binary format: mmddyyyy (e.g. + /// 07/18/98 is 07181998H). + /// + CPU_MICROCODE_DATE Date; + /// + /// Extended family, extended model, type, family, model, and stepping + /// of processor that requires this particular update revision (e.g., + /// 00000650H). Each microcode update is designed specifically for a + /// given extended family, extended model, type, family, model, and + /// stepping of the processor. + /// The BIOS uses the processor signature field in conjunction with the + /// CPUID instruction to determine whether or not an update is + /// appropriate to load on a processor. The information encoded within + /// this field exactly corresponds to the bit representations returned by + /// the CPUID instruction. + /// + CPU_MICROCODE_PROCESSOR_SIGNATURE ProcessorSignature; + /// + /// Checksum of Update Data and Header. Used to verify the integrity of + /// the update header and data. Checksum is correct when the + /// summation of all the DWORDs (including the extended Processor + /// Signature Table) that comprise the microcode update result in + /// 00000000H. + /// + UINT32 Checksum; + /// + /// Version number of the loader program needed to correctly load this + /// update. The initial version is 00000001H + /// + UINT32 LoaderRevision; + /// + /// Platform type information is encoded in the lower 8 bits of this 4- + /// byte field. Each bit represents a particular platform type for a given + /// CPUID. The BIOS uses the processor flags field in conjunction with + /// the platform Id bits in MSR (17H) to determine whether or not an + /// update is appropriate to load on a processor. Multiple bits may be set + /// representing support for multiple platform IDs. + /// + UINT32 ProcessorFlags; + /// + /// Specifies the size of the encrypted data in bytes, and must be a + /// multiple of DWORDs. If this value is 00000000H, then the microcode + /// update encrypted data is 2000 bytes (or 500 DWORDs). + /// + UINT32 DataSize; + /// + /// Specifies the total size of the microcode update in bytes. It is the + /// summation of the header size, the encrypted data size and the size of + /// the optional extended signature table. This value is always a multiple + /// of 1024. + /// + UINT32 TotalSize; + /// + /// Reserved fields for future expansion. + /// + UINT8 Reserved[12]; +} CPU_MICROCODE_HEADER; + +/// +/// Extended Signature Table Header Field Definitions +/// +typedef struct { + /// + /// Specifies the number of extended signature structures (Processor + /// Signature[n], processor flags[n] and checksum[n]) that exist in this + /// microcode update + /// + UINT32 ExtendedSignatureCount; + /// + /// Checksum of update extended processor signature table. Used to + /// verify the integrity of the extended processor signature table. + /// Checksum is correct when the summation of the DWORDs that + /// comprise the extended processor signature table results in + /// 00000000H. + /// + UINT32 ExtendedChecksum; + /// + /// Reserved fields. + /// + UINT8 Reserved[12]; +} CPU_MICROCODE_EXTENDED_TABLE_HEADER; + +/// +/// Extended Signature Table Field Definitions +/// +typedef struct { + /// + /// Extended family, extended model, type, family, model, and stepping + /// of processor that requires this particular update revision (e.g., + /// 00000650H). Each microcode update is designed specifically for a + /// given extended family, extended model, type, family, model, and + /// stepping of the processor. + /// The BIOS uses the processor signature field in conjunction with the + /// CPUID instruction to determine whether or not an update is + /// appropriate to load on a processor. The information encoded within + /// this field exactly corresponds to the bit representations returned by + /// the CPUID instruction. + /// + CPU_MICROCODE_PROCESSOR_SIGNATURE ProcessorSignature; + /// + /// Platform type information is encoded in the lower 8 bits of this 4- + /// byte field. Each bit represents a particular platform type for a given + /// CPUID. The BIOS uses the processor flags field in conjunction with + /// the platform Id bits in MSR (17H) to determine whether or not an + /// update is appropriate to load on a processor. Multiple bits may be set + /// representing support for multiple platform IDs. + /// + UINT32 ProcessorFlag; + /// + /// Used by utility software to decompose a microcode update into + /// multiple microcode updates where each of the new updates is + /// constructed without the optional Extended Processor Signature + /// Table. + /// To calculate the Checksum, substitute the Primary Processor + /// Signature entry and the Processor Flags entry with the + /// corresponding Extended Patch entry. Delete the Extended Processor + /// Signature Table entries. The Checksum is correct when the + /// summation of all DWORDs that comprise the created Extended + /// Processor Patch results in 00000000H. + /// + UINT32 Checksum; +} CPU_MICROCODE_EXTENDED_TABLE; + +#pragma pack () + +#endif diff --git a/CloverPkg.dec b/CloverPkg.dec index ccabf4a94..0e6d34e2f 100644 --- a/CloverPkg.dec +++ b/CloverPkg.dec @@ -35,6 +35,16 @@ ## @libraryclass WaveLib|Include/Library/WaveLib.h + ## @libraryclass + DeviceTreeLib|Include/Library/DeviceTreeLib.h + + ## @libraryclass + OcGuardLib|Include/Library/OcGuardLib.h + + ## @libraryclass + MachoLib|Include/Library/MachoLib.h + + [Guids] gEfiPciExpressBaseAddressGuid = {0x3677d529, 0x326f, 0x4603, {0xa9, 0x26, 0xea, 0xac, 0xe0, 0x1d, 0xcb, 0xb0 }} @@ -68,8 +78,14 @@ gAppleApfsPartitionTypeGuid = {0x7C3457EF, 0x0000, 0x11AA, {0xAA, 0x11, 0x00, 0x30, 0x65, 0x43, 0xEC, 0xAC}} gAppleApfsContainerInfoGuid = {0x3533CF0D, 0x685F, 0x5EBF, {0x8D, 0xC6, 0x73, 0x93, 0x48, 0x5B, 0xAF, 0xA2}} gAppleApfsVolumeInfoGuid = {0x900C7693, 0x8C14, 0x58BA, {0xB4, 0x4E, 0x97, 0x45, 0x15, 0xD2, 0x7C, 0x78}} - # Include/Guid/ApplePlatformInfo.h - gAppleKeyboardPlatformInfoGuid = { 0x51871CB9, 0xE25D, 0x44B4, { 0x96, 0x99, 0x0E, 0xE8, 0x64, 0x4C, 0xED, 0x69 }} + # Include/Guid/ApplePlatformInfo.h + gAppleKeyboardPlatformInfoGuid = {0x51871CB9, 0xE25D, 0x44B4, { 0x96, 0x99, 0x0E, 0xE8, 0x64, 0x4C, 0xED, 0x69 }} + + ## OC guids + gOcVendorVariableGuid = {0x4D1FDA02, 0x38C7, 0x4A6A, { 0x9C, 0xC6, 0x4B, 0xCC, 0xA8, 0xB3, 0x01, 0x02 }} + gOcReadOnlyVariableGuid = {0xE09B9297, 0x7928, 0x4440, { 0x9A, 0xAB, 0xD1, 0xF8, 0x53, 0x6F, 0xBF, 0x0A }} + gOcWriteOnlyVariableGuid = {0xF0B9AF8F, 0x2222, 0x4840, { 0x8A, 0x37, 0xEC, 0xF7, 0xCC, 0x8C, 0x12, 0xE1 }} + @@ -85,14 +101,14 @@ #Apple's protocols gEfiConsoleControlProtocolGuid = {0xF42F7782, 0x012E, 0x4C12, {0x99, 0x56, 0x49, 0xF9, 0x43, 0x04, 0xF7, 0x21}} - gAppleScreenInfoProtocolGuid = {0xE316E100, 0x0751, 0x4C49, {0x90, 0x56, 0x48, 0x6C, 0x7E, 0x47, 0x29, 0x03}} + gAppleFramebufferInfoProtocolGuid = {0xE316E100, 0x0751, 0x4C49, {0x90, 0x56, 0x48, 0x6C, 0x7E, 0x47, 0x29, 0x03}} gAppleGraphConfigProtocolGuid = {0x03622D6D, 0x362A, 0x4E47, {0x97, 0x10, 0xC2, 0x38, 0xB2, 0x37, 0x55, 0xC1}} gAppleImageCodecProtocolGuid = {0x0DFCE9F6, 0xC4E3, 0x45EE, {0xA0, 0x6A, 0xA8, 0x61, 0x3B, 0x98, 0xA5, 0x07}} - AppleDevicePropertyProtocolGuid = {0x91BD12FE, 0xF6C3, 0x44FB, {0xA5, 0xB7, 0x51, 0x22, 0xAB, 0x30, 0x3A, 0xE0}} - gEfiAppleFirmwarePasswordProtocolGuid = {0x8FFEEB3A, 0x4C98, 0x4630, {0x80, 0x3F, 0x74, 0x0F, 0x95, 0x67, 0x09, 0x1D}} - AppleBootKeyPressProtocolGuid = {0x5B213447, 0x6E73, 0x4901, {0xA4, 0xF1, 0xB8, 0x64, 0xF3, 0xB7, 0xA1, 0x72}} + gAppleDevicePropertyProtocolGuid = {0x91BD12FE, 0xF6C3, 0x44FB, {0xA5, 0xB7, 0x51, 0x22, 0xAB, 0x30, 0x3A, 0xE0}} + gAppleFirmwarePasswordProtocolGuid = {0x8FFEEB3A, 0x4C98, 0x4630, {0x80, 0x3F, 0x74, 0x0F, 0x95, 0x67, 0x09, 0x1D}} gAppleKeyStateProtocolGuid = {0x5B213447, 0x6E73, 0x4901, {0xA4, 0xF1, 0xB8, 0x64, 0xF3, 0xB7, 0xA1, 0x72}} - AppleNetBootProtocolGuid = {0x78EE99FB, 0x6A5E, 0x4186, {0x97, 0xDE, 0xCD, 0x0A, 0xBA, 0x34, 0x5A, 0x74}} + gAppleKeyStateProtocolGuid = {0x5B213447, 0x6E73, 0x4901, {0xA4, 0xF1, 0xB8, 0x64, 0xF3, 0xB7, 0xA1, 0x72}} + gAppleNetBootProtocolGuid = {0x78EE99FB, 0x6A5E, 0x4186, {0x97, 0xDE, 0xCD, 0x0A, 0xBA, 0x34, 0x5A, 0x74}} gAppleSMCProtocolGuid = {0x17407e5a, 0xaf6c, 0x4ee8, {0x98, 0xa8, 0x00, 0x21, 0x04, 0x53, 0xcd, 0xd9}} gAppleSMCStateProtocolGuid = {0x5301FE59, 0x1770, 0x4166, {0xA1, 0x69, 0x00, 0xC4, 0xBD, 0xE4, 0xA1, 0x62}} gEfiOSInfoProtocolGuid = {0xC5C5DA95, 0x7D5C, 0x45E6, {0xB2, 0xF1, 0x3F, 0xD5, 0x2B, 0xB1, 0x00, 0x77}} @@ -112,9 +128,9 @@ gEfiAudioIoProtocolGuid = { 0xF05B559C, 0x1971, 0x4AF5, { 0xB2, 0xAE, 0xD6, 0x08, 0x08, 0xF7, 0x4F, 0x70 }} ## Aptio Fix - gAptioMemoryFixProtocolGuid = { 0xC7CBA84E, 0xCC77, 0x461D, { 0x9E, 0x3C, 0x6B, 0xE0, 0xCB, 0x79, 0xA7, 0xC1 } } - gAmiEfiPointerProtocolGuid = { 0x15A10CE7, 0xEAB5, 0x43BF, { 0x90, 0x42, 0x74, 0x43, 0x2E, 0x69, 0x63, 0x77 } } - gAmiEfiKeycodeProtocolGuid = { 0x0ADFB62D, 0xFF74, 0x484C, { 0x89, 0x44, 0xF8, 0x5C, 0x4B, 0xEA, 0x87, 0xA8 } } + gAptioMemoryFixProtocolGuid = { 0xC7CBA84E, 0xCC77, 0x461D, { 0x9E, 0x3C, 0x6B, 0xE0, 0xCB, 0x79, 0xA7, 0xC1 } } + gAmiEfiPointerProtocolGuid = { 0x15A10CE7, 0xEAB5, 0x43BF, { 0x90, 0x42, 0x74, 0x43, 0x2E, 0x69, 0x63, 0x77 } } + gAmiEfiKeycodeProtocolGuid = { 0x0ADFB62D, 0xFF74, 0x484C, { 0x89, 0x44, 0xF8, 0x5C, 0x4B, 0xEA, 0x87, 0xA8 } } diff --git a/Include/Guid/OcVariables.h b/Include/Guid/OcVariables.h new file mode 100644 index 000000000..43944fc87 --- /dev/null +++ b/Include/Guid/OcVariables.h @@ -0,0 +1,85 @@ +/** @file + Lilu & OpenCore specific GUIDs for UEFI Variable Storage, version 1.0. + +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. + +**/ + +#ifndef OC_VARIABLES_H +#define OC_VARIABLES_H + +// +// Variable used for OpenCore log storage (if enabled). +// +#define OC_LOG_VARIABLE_NAME L"boot-log" + +// +// Variable used for OpenCore boot path (if enabled). +// +#define OC_LOG_VARIABLE_PATH L"boot-path" + +// +// Variable used for OpenCore request to redirect NVRAM Boot variable write. +// Boot Services only. +// See: https://github.com/acidanthera/bugtracker/issues/308. +// +#define OC_BOOT_REDIRECT_VARIABLE_NAME L"boot-redirect" + +// +// Variable used for exposing OpenCore Security -> LoadPolicy. +// Boot Services only. +// +#define OC_LOAD_POLICY_VARIABLE_NAME L"load-policy" + +// +// Variable used for exposing OpenCore Security -> ScanPolicy. +// Boot Services only. +// +#define OC_SCAN_POLICY_VARIABLE_NAME L"scan-policy" + +// +// Variable used to report OpenCore version in the following format: +// REL-001-2019-01-01. This follows versioning style of Lilu and plugins. +// +#define OC_VERSION_VARIABLE_NAME L"opencore-version" + +// +// 4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102 +// This GUID is specifically used for normal variable access by Lilu kernel extension and its plugins. +// +#define OC_VENDOR_VARIABLE_GUID \ + { 0x4D1FDA02, 0x38C7, 0x4A6A, { 0x9C, 0xC6, 0x4B, 0xCC, 0xA8, 0xB3, 0x01, 0x02 } } + +// +// E09B9297-7928-4440-9AAB-D1F8536FBF0A +// This GUID is specifically used for reading variables by Lilu kernel extension and its plugins. +// Any writes to this GUID should be prohibited via EFI_RUNTIME_SERVICES after EXIT_BOOT_SERVICES. +// The expected return code on variable write is EFI_SECURITY_VIOLATION. +// +#define OC_READ_ONLY_VARIABLE_GUID \ + { 0xE09B9297, 0x7928, 0x4440, { 0x9A, 0xAB, 0xD1, 0xF8, 0x53, 0x6F, 0xBF, 0x0A } } + +// +// F0B9AF8F-2222-4840-8A37-ECF7CC8C12E1 +// This GUID is specifically used for reading variables by Lilu and plugins. +// Any reads from this GUID should be prohibited via EFI_RUNTIME_SERVICES after EXIT_BOOT_SERVICES. +// The expected return code on variable read is EFI_SECURITY_VIOLATION. +// +#define OC_WRITE_ONLY_VARIABLE_GUID \ + { 0xF0B9AF8F, 0x2222, 0x4840, { 0x8A, 0x37, 0xEC, 0xF7, 0xCC, 0x8C, 0x12, 0xE1 } } + +// +// External global variables with GUID values. +// +extern EFI_GUID gOcVendorVariableGuid; +extern EFI_GUID gOcReadOnlyVariableGuid; +extern EFI_GUID gOcWriteOnlyVariableGuid; + +#endif // OC_VARIABLES_H diff --git a/Include/IndustryStandard/AppleBootArgs.h b/Include/IndustryStandard/AppleBootArgs.h new file mode 100644 index 000000000..60a5880c4 --- /dev/null +++ b/Include/IndustryStandard/AppleBootArgs.h @@ -0,0 +1,173 @@ +/** @file + Copyright (C) 2017, 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. +**/ + +#ifndef APPLE_BOOT_ARGS_H +#define APPLE_BOOT_ARGS_H + +/// +/// Keep in sync with XNU pexpert/pexpert/i386/boot.h. +/// Last sync time: 4903.221.2. +/// + +/* + * Video information... + */ + +struct Boot_VideoV1 { + UINT32 v_baseAddr; /* Base address of video memory */ + UINT32 v_display; /* Display Code (if Applicable */ + UINT32 v_rowBytes; /* Number of bytes per pixel row */ + UINT32 v_width; /* Width */ + UINT32 v_height; /* Height */ + UINT32 v_depth; /* Pixel Depth */ +}; +typedef struct Boot_VideoV1 Boot_VideoV1; + +struct Boot_Video { + UINT32 v_display; /* Display Code (if Applicable */ + UINT32 v_rowBytes; /* Number of bytes per pixel row */ + UINT32 v_width; /* Width */ + UINT32 v_height; /* Height */ + UINT32 v_depth; /* Pixel Depth */ + UINT32 v_resv[7]; /* Reserved */ + UINT64 v_baseAddr; /* Base address of video memory */ +}; +typedef struct Boot_Video Boot_Video; + +/* Values for v_display */ + +#define GRAPHICS_MODE 1 +#define FB_TEXT_MODE 2 + +/* Boot argument structure - passed into Mach kernel at boot time. + * "Revision" can be incremented for compatible changes + */ +#define kBootArgsRevision 0 +#define kBootArgsVersion 2 + +/* Snapshot constants of previous revisions that are supported */ +#define kBootArgsVersion1 1 +#define kBootArgsRevision1_4 4 +#define kBootArgsRevision1_5 5 +#define kBootArgsRevision1_6 6 + +#define kBootArgsVersion2 2 +#define kBootArgsRevision2_0 0 + +#define kBootArgsEfiMode32 32 +#define kBootArgsEfiMode64 64 + +/* Bitfields for boot_args->flags */ +#define kBootArgsFlagRebootOnPanic (1U << 0U) +#define kBootArgsFlagHiDPI (1U << 1U) +#define kBootArgsFlagBlack (1U << 2U) +#define kBootArgsFlagCSRActiveConfig (1U << 3U) +#define kBootArgsFlagCSRConfigMode (1U << 4U) +#define kBootArgsFlagCSRBoot (1U << 5U) +#define kBootArgsFlagBlackBg (1U << 6U) +#define kBootArgsFlagLoginUI (1U << 7U) +#define kBootArgsFlagInstallUI (1U << 8U) + +#define BOOT_LINE_LENGTH 1024 + +/* version 1 before Lion */ +typedef struct { + UINT16 Revision; /* Revision of boot_args structure */ + UINT16 Version; /* Version of boot_args structure */ + + CHAR8 CommandLine[BOOT_LINE_LENGTH]; /* Passed in command line */ + + UINT32 MemoryMap; /* Physical address of memory map */ + UINT32 MemoryMapSize; + UINT32 MemoryMapDescriptorSize; + UINT32 MemoryMapDescriptorVersion; + + Boot_VideoV1 Video; /* Video Information */ + + UINT32 deviceTreeP; /* Physical address of flattened device tree */ + UINT32 deviceTreeLength; /* Length of flattened tree */ + + UINT32 kaddr; /* Physical address of beginning of kernel text */ + UINT32 ksize; /* Size of combined kernel text+data+efi */ + + UINT32 efiRuntimeServicesPageStart; /* physical address of defragmented runtime pages */ + UINT32 efiRuntimeServicesPageCount; + UINT32 efiSystemTable; /* physical address of system table in runtime area */ + + UINT8 efiMode; /* 32 = 32-bit, 64 = 64-bit */ + UINT8 __reserved1[3]; + UINT32 __reserved2[1]; + UINT32 performanceDataStart; /* physical address of log */ + UINT32 performanceDataSize; + UINT64 efiRuntimeServicesVirtualPageStart; /* virtual address of defragmented runtime pages */ + UINT32 __reserved3[2]; + +} BootArgs1; + +/* version2 as used in Lion, updated with High Sierra fields */ +typedef struct { + + UINT16 Revision; /* Revision of boot_args structure */ + UINT16 Version; /* Version of boot_args structure */ + + UINT8 efiMode; /* 32 = 32-bit, 64 = 64-bit */ + UINT8 debugMode; /* Bit field with behavior changes */ + UINT16 flags; + + CHAR8 CommandLine[BOOT_LINE_LENGTH]; /* Passed in command line */ + + UINT32 MemoryMap; /* Physical address of memory map */ + UINT32 MemoryMapSize; + UINT32 MemoryMapDescriptorSize; + UINT32 MemoryMapDescriptorVersion; + + Boot_VideoV1 VideoV1; /* Video Information */ + + UINT32 deviceTreeP; /* Physical address of flattened device tree */ + UINT32 deviceTreeLength; /* Length of flattened tree */ + + UINT32 kaddr; /* Physical address of beginning of kernel text */ + UINT32 ksize; /* Size of combined kernel text+data+efi */ + + UINT32 efiRuntimeServicesPageStart; /* physical address of defragmented runtime pages */ + UINT32 efiRuntimeServicesPageCount; + UINT64 efiRuntimeServicesVirtualPageStart; /* virtual address of defragmented runtime pages */ + + UINT32 efiSystemTable; /* physical address of system table in runtime area */ + UINT32 kslide; + + UINT32 performanceDataStart; /* physical address of log */ + UINT32 performanceDataSize; + + UINT32 keyStoreDataStart; /* physical address of key store data */ + UINT32 keyStoreDataSize; + UINT64 bootMemStart; /* physical address of interpreter boot memory */ + UINT64 bootMemSize; + UINT64 PhysicalMemorySize; + UINT64 FSBFrequency; + UINT64 pciConfigSpaceBaseAddress; + UINT32 pciConfigSpaceStartBusNumber; + UINT32 pciConfigSpaceEndBusNumber; + UINT32 csrActiveConfig; + UINT32 csrCapabilities; + UINT32 boot_SMC_plimit; + UINT16 bootProgressMeterStart; + UINT16 bootProgressMeterEnd; + Boot_Video Video; /* Video Information */ + + UINT32 apfsDataStart; /* Physical address of apfs volume key structure */ + UINT32 apfsDataSize; + + UINT32 __reserved4[710]; +} BootArgs2; + +#endif // APPLE_BOOT_ARGS_H diff --git a/Include/IndustryStandard/AppleCsrConfig.h b/Include/IndustryStandard/AppleCsrConfig.h new file mode 100644 index 000000000..8dabc1684 --- /dev/null +++ b/Include/IndustryStandard/AppleCsrConfig.h @@ -0,0 +1,62 @@ +/** @file + Copyright (C) 2017, 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. +**/ + +#ifndef APPLE_CSR_CONFIG_H +#define APPLE_CSR_CONFIG_H + +/// +/// System Integrity Proteciton codes. +/// Keep in sync with XNU bsd/sys/csr.h. +/// Last sync time: 4903.221.2. +/// + +/// +/// Rootless configuration flags. +/// + +#define CSR_ALLOW_UNTRUSTED_KEXTS (1U << 0U) +#define CSR_ALLOW_UNRESTRICTED_FS (1U << 1U) +#define CSR_ALLOW_TASK_FOR_PID (1U << 2U) +#define CSR_ALLOW_KERNEL_DEBUGGER (1U << 3U) +#define CSR_ALLOW_APPLE_INTERNAL (1U << 4U) +#define CSR_ALLOW_DESTRUCTIVE_DTRACE (1U << 5U) /// < Name deprecated +#define CSR_ALLOW_UNRESTRICTED_DTRACE (1U << 5U) +#define CSR_ALLOW_UNRESTRICTED_NVRAM (1U << 6U) +#define CSR_ALLOW_DEVICE_CONFIGURATIO (1U << 7U) +#define CSR_ALLOW_ANY_RECOVERY_OS (1U << 8U) +#define CSR_ALLOW_UNAPPROVED_KEXTS (1U << 9U) +#define CSR_ALLOW_EXECUTABLE_POLICY_OVERRIDE (1U << 10U) + +#define CSR_VALID_FLAGS (CSR_ALLOW_UNTRUSTED_KEXTS | \ + CSR_ALLOW_UNRESTRICTED_FS | \ + CSR_ALLOW_TASK_FOR_PID | \ + CSR_ALLOW_KERNEL_DEBUGGER | \ + CSR_ALLOW_APPLE_INTERNAL | \ + CSR_ALLOW_UNRESTRICTED_DTRACE | \ + CSR_ALLOW_UNRESTRICTED_NVRAM | \ + CSR_ALLOW_DEVICE_CONFIGURATION | \ + CSR_ALLOW_ANY_RECOVERY_OS | \ + CSR_ALLOW_UNAPPROVED_KEXTS | \ + CSR_ALLOW_EXECUTABLE_POLICY_OVERRIDE) + +#define CSR_ALWAYS_ENFORCED_FLAGS (CSR_ALLOW_DEVICE_CONFIGURATION | CSR_ALLOW_ANY_RECOVERY_OS) + +/// +/// CSR capabilities that a booter can give to the system. +/// +#define CSR_CAPABILITY_UNLIMITED (1U << 0U) +#define CSR_CAPABILITY_CONFIG (1U << 1U) +#define CSR_CAPABILITY_APPLE_INTERNAL (1U << 2U) + +#define CSR_VALID_CAPABILITIES (CSR_CAPABILITY_UNLIMITED | CSR_CAPABILITY_CONFIG | CSR_CAPABILITY_APPLE_INTERNAL) + +#endif // APPLE_CSR_CONFIG_H diff --git a/Include/IndustryStandard/AppleFeatures.h b/Include/IndustryStandard/AppleFeatures.h index 681a64c11..21b936eb8 100644 --- a/Include/IndustryStandard/AppleFeatures.h +++ b/Include/IndustryStandard/AppleFeatures.h @@ -16,7 +16,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. // // OEM Firmware Volume Information - Firmware Feature Bits. // These bits are exposed via APPLE_SMBIOS_TABLE_TYPE128 FirmwareFeatures, -// and UEFI variables under gAppleVendorVariableGuid (4D1EDE05-38C7-4A6A-9CC6-4BCCA8B38C14): +// and UEFI variables under gEfiAppleNvramGuid (4D1EDE05-38C7-4A6A-9CC6-4BCCA8B38C14): // UINT32 FirmwareFeatures / FirmwareFeaturesMask. // UINT64 ExtendedFirmwareFeatures / ExtendedFirmwareFeaturesMask. // @@ -57,11 +57,11 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. // Features |= 0x1000000U; // } // Features = ((*(UINT64 *)(0xFFFFFF80) != 0x4E15E2F599858AC6ULL) << 12U) | Features & 0xFFFFFFFFFFFFEFFFULL; -// if (!EFI_ERROR (gRT->SetVariable(L"FirmwareFeaturesMask", &gAppleVendorVariableGuid, 6, sizeof (UINT32), &Mask))) -// gRT->SetVariable(L"FirmwareFeatures", &gAppleVendorVariableGuid, 6, sizeof (UINT32), &Features); +// if (!EFI_ERROR (gRT->SetVariable(L"FirmwareFeaturesMask", &gEfiAppleNvramGuid, 6, sizeof (UINT32), &Mask))) +// gRT->SetVariable(L"FirmwareFeatures", &gEfiAppleNvramGuid, 6, sizeof (UINT32), &Features); // if ((Features & 0x2000000U) -// && !EFI_ERROR (gRT->SetVariable(L"ExtendedFirmwareFeaturesMask", &gAppleVendorVariableGuid, 6, sizeof (UINT64), &Mask))) -// gRT->SetVariable(L"ExtendedFirmwareFeatures", &gAppleVendorVariableGuid, 6, sizeof (UINT64), &Features); +// && !EFI_ERROR (gRT->SetVariable(L"ExtendedFirmwareFeaturesMask", &gEfiAppleNvramGuid, 6, sizeof (UINT64), &Mask))) +// gRT->SetVariable(L"ExtendedFirmwareFeatures", &gEfiAppleNvramGuid, 6, sizeof (UINT64), &Features); // } // diff --git a/Include/IndustryStandard/AppleHibernate.h b/Include/IndustryStandard/AppleHibernate.h new file mode 100755 index 000000000..69a001f98 --- /dev/null +++ b/Include/IndustryStandard/AppleHibernate.h @@ -0,0 +1,137 @@ +/** @file + Copyright (C) 2017, 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. +**/ + +#ifndef APPLE_HIBERNATE_H +#define APPLE_HIBERNATE_H + +/// +/// Hibernate related definitions. +/// Keep in sync with XNU iokit/IOKit/IOHibernatePrivate.h. +/// Last sync time: 4903.221.2. +/// + +#pragma pack(push, 1) + +typedef struct +{ + UINT64 start; + UINT64 length; +} IOPolledFileExtent; + +typedef struct +{ + UINT64 imageSize; + UINT64 image1Size; + + UINT32 restore1CodePhysPage; + UINT32 reserved1; + UINT64 restore1CodeVirt; + UINT32 restore1PageCount; + UINT32 restore1CodeOffset; + UINT32 restore1StackOffset; + + UINT32 pageCount; + UINT32 bitmapSize; + + UINT32 restore1Sum; + UINT32 image1Sum; + UINT32 image2Sum; + + UINT32 actualRestore1Sum; + UINT32 actualImage1Sum; + UINT32 actualImage2Sum; + + UINT32 actualUncompressedPages; + UINT32 conflictCount; + UINT32 nextFree; + + UINT32 signature; + UINT32 processorFlags; + + UINT32 runtimePages; + UINT32 runtimePageCount; + UINT64 runtimeVirtualPages; + + UINT32 performanceDataStart; + UINT32 performanceDataSize; + + UINT64 encryptStart; + UINT64 machineSignature; + + UINT32 previewSize; + UINT32 previewPageListSize; + + UINT32 diag[4]; + + UINT32 handoffPages; + UINT32 handoffPageCount; + + UINT32 systemTableOffset; + + UINT32 debugFlags; + UINT32 options; + UINT32 sleepTime; + UINT32 compression; + + UINT8 bridgeBootSessionUUID[16]; + + UINT32 reserved[54]; // make sizeof == 512 + UINT32 booterTime0; + UINT32 booterTime1; + UINT32 booterTime2; + + UINT32 booterStart; + UINT32 smcStart; + UINT32 connectDisplayTime; + UINT32 splashTime; + UINT32 booterTime; + UINT32 trampolineTime; + + UINT64 encryptEnd; + UINT64 deviceBase; + UINT32 deviceBlockSize; + + UINT32 fileExtentMapSize; + IOPolledFileExtent fileExtentMap[2]; +} IOHibernateImageHeader; + +enum +{ + kIOHibernateHandoffType = 0x686f0000, + kIOHibernateHandoffTypeEnd = kIOHibernateHandoffType + 0, + kIOHibernateHandoffTypeGraphicsInfo = kIOHibernateHandoffType + 1, + kIOHibernateHandoffTypeCryptVars = kIOHibernateHandoffType + 2, + kIOHibernateHandoffTypeMemoryMap = kIOHibernateHandoffType + 3, + kIOHibernateHandoffTypeDeviceTree = kIOHibernateHandoffType + 4, + kIOHibernateHandoffTypeDeviceProperties = kIOHibernateHandoffType + 5, + kIOHibernateHandoffTypeKeyStore = kIOHibernateHandoffType + 6, + kIOHibernateHandoffTypeVolumeCryptKey = kIOHibernateHandoffType + 7, +}; + +typedef struct +{ + UINT32 type; + UINT32 bytecount; + UINT8 data[]; +} IOHibernateHandoff; + +typedef struct +{ + UINT8 signature[4]; + UINT32 revision; + UINT8 booterSignature[20]; + UINT8 wiredCryptKey[16]; +} AppleRTCHibernateVars; + +#pragma pack(pop) + +#endif // APPLE_HIBERNATE_H diff --git a/Include/IndustryStandard/UsbHid.h b/Include/IndustryStandard/UsbHid.h index 7a12b35a5..b8f3bb94f 100644 --- a/Include/IndustryStandard/UsbHid.h +++ b/Include/IndustryStandard/UsbHid.h @@ -24,6 +24,7 @@ // USB_HID_PAGE_USAGE #define USB_HID_USAGE(UsageId, PageId) (((PageId) << 16) | (UsageId)) +#define BIT(n) (1u << (n)) // USB_HID_PAGES enum { @@ -90,14 +91,14 @@ typedef UINT32 USB_HID_USAGE; // USB HID Modifier Map -#define USB_HID_KB_KP_MODIFIER_LEFT_CONTROL BIT (0) -#define USB_HID_KB_KP_MODIFIER_LEFT_SHIFT BIT (1) -#define USB_HID_KB_KP_MODIFIER_LEFT_ALT BIT (2) -#define USB_HID_KB_KP_MODIFIER_LEFT_GUI BIT (3) -#define USB_HID_KB_KP_MODIFIER_RIGHT_CONTROL BIT (4) -#define USB_HID_KB_KP_MODIFIER_RIGHT_SHIFT BIT (5) -#define USB_HID_KB_KP_MODIFIER_RIGHT_ALT BIT (6) -#define USB_HID_KB_KP_MODIFIER_RIGHT_GUI BIT (7) +#define USB_HID_KB_KP_MODIFIER_LEFT_CONTROL BIT(0) +#define USB_HID_KB_KP_MODIFIER_LEFT_SHIFT BIT(1) +#define USB_HID_KB_KP_MODIFIER_LEFT_ALT BIT(2) +#define USB_HID_KB_KP_MODIFIER_LEFT_GUI BIT(3) +#define USB_HID_KB_KP_MODIFIER_RIGHT_CONTROL BIT(4) +#define USB_HID_KB_KP_MODIFIER_RIGHT_SHIFT BIT(5) +#define USB_HID_KB_KP_MODIFIER_RIGHT_ALT BIT(6) +#define USB_HID_KB_KP_MODIFIER_RIGHT_GUI BIT(7) // Shortcuts for multiple modifers diff --git a/Include/Library/DeviceTreeLib.h b/Include/Library/DeviceTreeLib.h new file mode 100644 index 000000000..b09aec62e --- /dev/null +++ b/Include/Library/DeviceTreeLib.h @@ -0,0 +1,282 @@ +/** @file + Copyright (C) 2016, The HermitCrabs Lab. 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. +**/ + +#ifndef OC_DEVICE_TREE_LIB_H +#define OC_DEVICE_TREE_LIB_H + +// +// Struct at the beginning of every loaded kext. +// Pointers to every loaded kext (to this struct) are +// properties Driver- in DevTree /chosen/memory-map. +// +typedef struct DTBooterKextFileInfo_ { + UINT32 InfoDictPhysAddr; + UINT32 InfoDictLength; + UINT32 ExecutablePhysAddr; + UINT32 ExecutableLength; + UINT32 BundlePathPhysAddr; + UINT32 BundlePathLength; +} DTBooterKextFileInfo; + +// +// DeviceTree MemoryMap entry structure. +// +typedef struct DTMemMapEntry_ { + UINT32 Address; + UINT32 Length; +} DTMemMapEntry; + +// +// Foundation Types. +// + +#define DT_PATH_NAME_SEPERATOR '/' //< 0x2F + +#define DT_MAX_PROPERTY_NAME_LENGTH 31 //< Max length of Property Name (terminator not included) +#define DT_MAX_ENTRY_NAME_LENGTH 31 //< Max length of a C-String Entry Name (terminator not included) +#define DT_PROPERTY_NAME_LENGTH 32 + +typedef CHAR8 DTEntryNameBuf[DT_PROPERTY_NAME_LENGTH]; //< Length of DTEntryNameBuf = DT_MAX_ENTRY_NAME_LENGTH + 1 + +typedef struct OpaqueDTEntry_ DeviceTreeNode; +typedef DeviceTreeNode *DTEntry; //< Entry + +typedef struct OpaqueDTProperty_ DTProperty; + +typedef struct DTSavedScope_ DTSavedScope; +typedef DTSavedScope *DTSavedScopePtr; + +typedef struct OpaqueDTEntryIterator_ OpaqueDTEntryIterator; +typedef OpaqueDTEntryIterator *DTEntryIterator; + +typedef struct OpaqueDTPropertyIterator_ OpaqueDTPropertyIterator; +typedef OpaqueDTPropertyIterator *DTPropertyIterator; + +// +// Structures for a Flattened Device Tree. +// + +struct OpaqueDTProperty_ { + CHAR8 Name[DT_PROPERTY_NAME_LENGTH]; //< NUL terminated property name + UINT32 Length; //< Length (bytes) of folloing prop value +}; + +struct OpaqueDTEntry_ { + UINT32 NumProperties; // Number of props[] elements (0 => end) + UINT32 NumChildren; // Number of children[] elements +}; + +// +// Entry. +// + +struct DTSavedScope_ { + DTSavedScopePtr NextScope; + DTEntry Scope; + DTEntry Entry; + UINT32 Index; +}; + +// +// Entry Iterator. +// +struct OpaqueDTEntryIterator_ { + DTEntry OuterScope; + DTEntry CurrentScope; + DTEntry CurrentEntry; + DTSavedScopePtr SavedScope; + UINT32 CurrentIndex; +}; + +// +// Property Iterator. +// +struct OpaqueDTPropertyIterator_ { + DTEntry Entry; + DTProperty *CurrentProperty; + UINT32 CurrentIndex; +}; + + +/** + Lookup Entry + Locates an entry given a specified subroot (searchPoint) and path name. If the + searchPoint pointer is NULL, the path name is assumed to be an absolute path + name rooted to the root of the device tree. +**/ +EFI_STATUS +DTLookupEntry ( + IN CONST DTEntry SearchPoint, + IN CONST CHAR8 *PathName, + IN DTEntry *FoundEntry + ); + +/** + An Entry Iterator maintains three variables that are of interest to clients. + First is an "OutermostScope" which defines the outer boundry of the iteration. + This is defined by the starting entry and includes that entry plus all of it's + embedded entries. Second is a "currentScope" which is the entry the iterator is + currently in. And third is a "currentPosition" which is the last entry returned + during an iteration. + + Create Entry Iterator + Create the iterator structure. The outermostScope and currentScope of the iterator + are set to "startEntry". If "startEntry" = NULL, the outermostScope and + currentScope are set to the root entry. The currentPosition for the iterator is + set to "nil". +**/ +EFI_STATUS +DTCreateEntryIterator ( + IN CONST DTEntry StartEntry, + IN DTEntryIterator *Iterator + ); + +/** + Dispose Entry Iterator +**/ +EFI_STATUS +DTDisposeEntryIterator ( + IN DTEntryIterator Iterator + ); + +/** + Enter Child Entry + Move an Entry Iterator into the scope of a specified child entry. The + currentScope of the iterator is set to the entry specified in "childEntry". If + "childEntry" is nil, the currentScope is set to the entry specified by the + currentPosition of the iterator. +**/ +EFI_STATUS +DTEnterEntry ( + IN DTEntryIterator Iterator, + IN DTEntry ChildEntry + ); + +/** + Exit to Parent Entry + Move an Entry Iterator out of the current entry back into the scope of it's parent + entry. The currentPosition of the iterator is reset to the current entry (the + previous currentScope), so the next iteration call will continue where it left off. + This position is returned in parameter "currentPosition". +**/ +EFI_STATUS +DTExitEntry ( + IN DTEntryIterator Iterator, + IN DTEntry *CurrentPosition + ); + +/** + Iterate Entries + Iterate and return entries contained within the entry defined by the current + scope of the iterator. Entries are returned one at a time. When + int == kIterationDone, all entries have been exhausted, and the + value of nextEntry will be Nil. +**/ +EFI_STATUS +DTIterateEntries ( + IN DTEntryIterator Iterator, + IN DTEntry *NextEntry + ); + +/** + Restart Entry Iteration + Restart an iteration within the current scope. The iterator is reset such that + iteration of the contents of the currentScope entry can be restarted. The + outermostScope and currentScope of the iterator are unchanged. The currentPosition + for the iterator is set to "nil". +**/ +EFI_STATUS +DTRestartEntryIteration ( + IN DTEntryIterator Iterator + ); + +/** + Get the value of the specified property for the specified entry. +**/ +EFI_STATUS +DTGetProperty ( + IN CONST DTEntry Entry, + IN CHAR8 *PropertyName, + IN VOID **PropertyValue, + IN UINT32 *PropertySize + ); + +/** + Create Property Iterator + Create the property iterator structure. The target entry is defined by entry. +**/ +EFI_STATUS +DTCreatePropertyIterator ( + IN CONST DTEntry Entry, + IN DTPropertyIterator Iterator + ); + +/** + Iterate Properites + Iterate and return properties for given entry. + EFI_END_OF_MEDIA, all properties have been exhausted. +**/ + +EFI_STATUS +DTIterateProperties ( + IN DTPropertyIterator Iterator, + IN CHAR8 **FoundProperty + ); + +/** + Restart Property Iteration + Used to re-iterate over a list of properties. The Property Iterator is + reset to the beginning of the list of properties for an entry. +**/ +EFI_STATUS +DTRestartPropertyIteration ( + IN DTPropertyIterator Iterator + ); + +// +// Exported Functions +// + +/** + Used to initalize the device tree functions. + Base is the base address of the flatened device tree. +**/ +VOID +DTInit ( + IN VOID *Base, + IN UINT32 *Length + ); + +VOID +DumpDeviceTree ( + VOID + ); + +UINT32 +DTDeleteProperty ( + IN CHAR8 *NodeName, + IN CHAR8 *DeletePropertyName + ); + +VOID +DTInsertProperty ( + IN CHAR8 *NodeName, + IN CHAR8 *InsertPropertyName, + IN CHAR8 *AddPropertyName, + IN VOID *AddPropertyValue, + IN UINT32 ValueLength, + IN BOOLEAN InsertAfter OPTIONAL + ); + +#endif // OC_DEVICE_TREE_LIB_H diff --git a/Include/Library/OcGuardLib.h b/Include/Library/OcGuardLib.h new file mode 100644 index 000000000..31acbc212 --- /dev/null +++ b/Include/Library/OcGuardLib.h @@ -0,0 +1,705 @@ +/** @file + +OcGuardLib + +Copyright (c) 2018, 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. + +**/ + +#ifndef OC_GUARD_LIB_H +#define OC_GUARD_LIB_H + +/// +/// Maximum values for common UEFI Data Types +/// +#define MAX_INT8 ((INT8)0x7F) +#define MAX_UINT8 ((UINT8)0xFF) +#define MAX_INT16 ((INT16)0x7FFF) +#define MAX_UINT16 ((UINT16)0xFFFF) +#define MAX_INT32 ((INT32)0x7FFFFFFF) +#define MAX_UINT32 ((UINT32)0xFFFFFFFF) +#define MAX_INT64 ((INT64)0x7FFFFFFFFFFFFFFFULL) +#define MAX_UINT64 ((UINT64)0xFFFFFFFFFFFFFFFFULL) + +/// +/// Minimum values for the signed UEFI Data Types +/// +#define MIN_INT8 (((INT8) -127) - 1) +#define MIN_INT16 (((INT16) -32767) - 1) +#define MIN_INT32 (((INT32) -2147483647) - 1) +#define MIN_INT64 (((INT64) -9223372036854775807LL) - 1) + + +// +// The macros below provide compile-time assertions. +// This is important, as UDK only has VERIFY_SIZE_OF, which is limited and broken. +// Since it is implemented as an extern, it neither lets one to verify array size and array +// element size (due to variable redeclaration) at the same time, nor allows macro use +// within a .c file (due to unused variable warnings). +// The reason for split declarations exists due to MSVC legacy. +// +#if defined(__GUNC__) || (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201100L) +// +// Any supported GCC-compatible implements _Static_assert. +// So do any C11-compliant compilers. +// +#define OC_GLOBAL_STATIC_ASSERT(Expr, Message) _Static_assert (Expr, Message) +#define OC_INLINE_STATIC_ASSERT(Expr, Message) _Static_assert (Expr, Message) +#elif defined(_MSC_VER) && _MSC_VER >= 1600 +// +// Starting from VS 2010 MSVC supports static_assert in both C and C++ modes. +// +#define OC_GLOBAL_STATIC_ASSERT(Expr, Message) static_assert (Expr, Message) +#define OC_INLINE_STATIC_ASSERT(Expr, Message) static_assert (Expr, Message) +#else +// +// For MSVC we implement static assertions via switch, as they do not have compile-time +// offsetof implementation, yet it pointer arithmetics works fine for them in switch. +// The struct declaration is here to avoid a warning for extra ;. +// The concatenation indirection does not permit for multiple assertions on one line +// or within a macro. +// +#define OC_STATIC_ASSERT_CONCAT2(Left, Right) Left ## Right +#define OC_STATIC_ASSERT_CONCAT(Left, Right) OC_STATIC_ASSERT_CONCAT2 (Left, Right) +#define OC_GLOBAL_STATIC_ASSERT(Expr, Message) \ + VOID OC_STATIC_ASSERT_CONCAT(OC_STATIC_ASSERT__, __LINE__) (VOID) { \ + switch (0) { case 0: case (Expr):; } } \ + struct OC_STATIC_ASSERT_CONCAT(OC_STATIC_ASSERT_T__, __LINE__) { UINT32 Dummy; } +#define OC_INLINE_STATIC_ASSERT(Expr, Message) \ + do { switch (0) { case 0: case (Expr):; } } while(0) +#endif + +// +// The macros below provide pointer alignment checking interfaces. +// TypedPtr - pointer of a dedicated type, which alignment is to be checked. +// Align - valid alignment for the target platform (power of two so far). +// Type - valid complete typename. +// Ptr - raw pointer value, must fit into UINTN, meant to be uintptr_t equivalent. +// + +#if defined(OC_FORCE_ALIGN_SUPPORT) || defined(MDE_CPU_AARCH64) || defined(MDE_CPU_X64) || defined(MDE_CPU_ARM) || defined(MDE_CPU_IA32) + +#define OC_ALIGNED(TypedPtr) (0ULL == (((UINTN) (TypedPtr)) & \ + (sizeof (*(TypedPtr)) > sizeof (UINTN) ? (sizeof (UINTN) - 1U) : (sizeof (*(TypedPtr)) - 1U)))) + +#define OC_POT_ALIGNED(Align, Ptr) (0ULL == (((UINTN) (Ptr)) & (Align-1))) + +#define OC_TYPE_ALIGNED(Type, Ptr) (0ULL == (((UINTN) (Ptr)) & \ + (sizeof (Type) > sizeof(UINTN) ? (sizeof (UINTN) - 1U) : (sizeof (Type) - 1U)))) + +#else + +#error "Unknown target platform. Alignment macros are not applicable." + +#endif + +// +// The interfaces below provide base safe arithmetics, reporting +// signed integer overflow and unsigned integer wraparound similarly to +// os/overflow.h in macOS SDK. +// +// Each interface may be implemented not only as an actual function, but +// a macro as well. Macro implementations are allowed to evaluate the +// expressions no more than once, and are supposed to provide faster +// compiler builtins if available. +// +// Each interface returns FALSE when the the stored result is equal to +// the infinite precision result, otherwise TRUE. The operands should +// be read left to right with the last argument representing a non-NULL +// pointer to the resulting value of the same type. +// +// More information could be found in Clang Extensions documentation: +// http://releases.llvm.org/7.0.0/tools/clang/docs/LanguageExtensions.html#checked-arithmetic-builtins +// + +// +// 32-bit integer addition, subtraction, multiplication, triple addition (A+B+C), +// triple multiplication (A*B*C), addition with multiplication ((A+B)*C), +// and multiplication with addition (A*B+C) support. +// + +BOOLEAN +OcOverflowAddU32 ( + UINT32 A, + UINT32 B, + UINT32 *Result + ); + +BOOLEAN +OcOverflowSubU32 ( + UINT32 A, + UINT32 B, + UINT32 *Result + ); + +BOOLEAN +OcOverflowMulU32 ( + UINT32 A, + UINT32 B, + UINT32 *Result + ); + +BOOLEAN +OcOverflowTriAddU32 ( + UINT32 A, + UINT32 B, + UINT32 C, + UINT32 *Result + ); + +BOOLEAN +OcOverflowTriMulU32 ( + UINT32 A, + UINT32 B, + UINT32 C, + UINT32 *Result + ); + +BOOLEAN +OcOverflowAddMulU32 ( + UINT32 A, + UINT32 B, + UINT32 C, + UINT32 *Result + ); + +BOOLEAN +OcOverflowMulAddU32 ( + UINT32 A, + UINT32 B, + UINT32 C, + UINT32 *Result + ); + +BOOLEAN +OcOverflowAddS32 ( + INT32 A, + INT32 B, + INT32 *Result + ); + +BOOLEAN +OcOverflowSubS32 ( + INT32 A, + INT32 B, + INT32 *Result + ); + +BOOLEAN +OcOverflowMulS32 ( + INT32 A, + INT32 B, + INT32 *Result + ); + +BOOLEAN +OcOverflowTriAddS32 ( + INT32 A, + INT32 B, + INT32 C, + INT32 *Result + ); + +BOOLEAN +OcOverflowTriMulS32 ( + INT32 A, + INT32 B, + INT32 C, + INT32 *Result + ); + +BOOLEAN +OcOverflowAddMulS32 ( + INT32 A, + INT32 B, + INT32 C, + INT32 *Result + ); + +BOOLEAN +OcOverflowMulAddS32 ( + INT32 A, + INT32 B, + INT32 C, + INT32 *Result + ); + +// +// 64-bit integer addition, subtraction, multiplication, triple addition (A+B+C), +// triple multiplication (A*B*C), addition with multiplication ((A+B)*C), +// and multiplication with addition (A*B+C) support. +// + +BOOLEAN +OcOverflowAddU64 ( + UINT64 A, + UINT64 B, + UINT64 *Result + ); + +BOOLEAN +OcOverflowSubU64 ( + UINT64 A, + UINT64 B, + UINT64 *Result + ); + +BOOLEAN +OcOverflowMulU64 ( + UINT64 A, + UINT64 B, + UINT64 *Result + ); + +BOOLEAN +OcOverflowTriAddU64 ( + UINT64 A, + UINT64 B, + UINT64 C, + UINT64 *Result + ); + +BOOLEAN +OcOverflowTriMulU64 ( + UINT64 A, + UINT64 B, + UINT64 C, + UINT64 *Result + ); + +BOOLEAN +OcOverflowAddMulU64 ( + UINT64 A, + UINT64 B, + UINT64 C, + UINT64 *Result + ); + +BOOLEAN +OcOverflowMulAddU64 ( + UINT64 A, + UINT64 B, + UINT64 C, + UINT64 *Result + ); + + +BOOLEAN +OcOverflowAddS64 ( + INT64 A, + INT64 B, + INT64 *Result + ); + +BOOLEAN +OcOverflowSubS64 ( + INT64 A, + INT64 B, + INT64 *Result + ); + +BOOLEAN +OcOverflowMulS64 ( + INT64 A, + INT64 B, + INT64 *Result + ); + +BOOLEAN +OcOverflowTriAddS64 ( + INT64 A, + INT64 B, + INT64 C, + INT64 *Result + ); + +BOOLEAN +OcOverflowTriMulS64 ( + INT64 A, + INT64 B, + INT64 C, + INT64 *Result + ); + +BOOLEAN +OcOverflowAddMulS64 ( + INT64 A, + INT64 B, + INT64 C, + INT64 *Result + ); + +BOOLEAN +OcOverflowMulAddS64 ( + INT64 A, + INT64 B, + INT64 C, + INT64 *Result + ); + +// +// Native integer addition, subtraction, multiplication, triple addition (A+B+C), +// triple multiplication (A*B*C), addition with multiplication ((A+B)*C), +// and multiplication with addition (A*B+C) support. +// + +BOOLEAN +OcOverflowAddUN ( + UINTN A, + UINTN B, + UINTN *Result + ); + +BOOLEAN +OcOverflowSubUN ( + UINTN A, + UINTN B, + UINTN *Result + ); + +BOOLEAN +OcOverflowMulUN ( + UINTN A, + UINTN B, + UINTN *Result + ); + +BOOLEAN +OcOverflowTriAddUN ( + UINTN A, + UINTN B, + UINTN C, + UINTN *Result + ); + +BOOLEAN +OcOverflowTriMulUN ( + UINTN A, + UINTN B, + UINTN C, + UINTN *Result + ); + +BOOLEAN +OcOverflowAddMulUN ( + UINTN A, + UINTN B, + UINTN C, + UINTN *Result + ); + +BOOLEAN +OcOverflowMulAddUN ( + UINTN A, + UINTN B, + UINTN C, + UINTN *Result + ); + +BOOLEAN +OcOverflowAddSN ( + INTN A, + INTN B, + INTN *Result + ); + +BOOLEAN +OcOverflowSubSN ( + INTN A, + INTN B, + INTN *Result + ); + +BOOLEAN +OcOverflowMulSN ( + INTN A, + INTN B, + INTN *Result + ); + +BOOLEAN +OcOverflowTriAddSN ( + INTN A, + INTN B, + INTN C, + INTN *Result + ); + +BOOLEAN +OcOverflowTriMulSN ( + INTN A, + INTN B, + INTN C, + INTN *Result + ); + +BOOLEAN +OcOverflowAddMulSN ( + INTN A, + INTN B, + INTN C, + INTN *Result + ); + +BOOLEAN +OcOverflowMulAddSN ( + INTN A, + INTN B, + INTN C, + INTN *Result + ); + +// +// Macro implemenations of the above declarations +// + +#ifdef __has_builtin + +// +// Type-generic checkers are available +// +#if __has_builtin(__builtin_add_overflow) && __has_builtin(__builtin_sub_overflow) && __has_builtin(__builtin_mul_overflow) + +#define OcOverflowAddU32(A, B, Res) __builtin_add_overflow((UINT32)(A), (UINT32)(B), (UINT32 *)(Res)) +#define OcOverflowSubU32(A, B, Res) __builtin_sub_overflow((UINT32)(A), (UINT32)(B), (UINT32 *)(Res)) +#define OcOverflowMulU32(A, B, Res) __builtin_mul_overflow((UINT32)(A), (UINT32)(B), (UINT32 *)(Res)) +#define OcOverflowAddS32(A, B, Res) __builtin_add_overflow((INT32)(A), (INT32)(B), (INT32 *)(Res)) +#define OcOverflowSubS32(A, B, Res) __builtin_sub_overflow((INT32)(A), (INT32)(B), (INT32 *)(Res)) +#define OcOverflowMulS32(A, B, Res) __builtin_mul_overflow((INT32)(A), (INT32)(B), (INT32 *)(Res)) + +#define OcOverflowAddU64(A, B, Res) __builtin_add_overflow((UINT64)(A), (UINT64)(B), (UINT64 *)(Res)) +#define OcOverflowSubU64(A, B, Res) __builtin_sub_overflow((UINT64)(A), (UINT64)(B), (UINT64 *)(Res)) +#define OcOverflowMulU64(A, B, Res) __builtin_mul_overflow((UINT64)(A), (UINT64)(B), (UINT64 *)(Res)) +#define OcOverflowAddS64(A, B, Res) __builtin_add_overflow((INT64)(A), (INT64)(B), (INT64 *)(Res)) +#define OcOverflowSubS64(A, B, Res) __builtin_sub_overflow((INT64)(A), (INT64)(B), (INT64 *)(Res)) +#define OcOverflowMulS64(A, B, Res) __builtin_mul_overflow((INT64)(A), (INT64)(B), (INT64 *)(Res)) + +#define OcOverflowAddUN(A, B, Res) __builtin_add_overflow((UINTN)(A), (UINTN)(B), (UINTN *)(Res)) +#define OcOverflowSubUN(A, B, Res) __builtin_sub_overflow((UINTN)(A), (UINTN)(B), (UINTN *)(Res)) +#define OcOverflowMulUN(A, B, Res) __builtin_mul_overflow((UINTN)(A), (UINTN)(B), (UINTN *)(Res)) +#define OcOverflowAddSN(A, B, Res) __builtin_add_overflow((INTN)(A), (INTN)(B), (INTN *)(Res)) +#define OcOverflowSubSN(A, B, Res) __builtin_sub_overflow((INTN)(A), (INTN)(B), (INTN *)(Res)) +#define OcOverflowMulSN(A, B, Res) __builtin_mul_overflow((INTN)(A), (INTN)(B), (INTN *)(Res)) + +#elif defined(__GNUC__) || defined(__clang__) + +// +// Builtin type checkers are available, but we have to match their sizes. +// For this reason we force the list of supported architectures here based on ProcessorBind.h, +// and with the assumption that CHAR_BIT is 8. +// + +// +// Implement 32-bit intrinsics with int and unsigned int on architectures that support it. +// +#if defined(MDE_CPU_AARCH64) || defined(MDE_CPU_ARM) || defined(MDE_CPU_X64) || defined(MDE_CPU_IA32) + +VERIFY_SIZE_OF (int, 4); +VERIFY_SIZE_OF (unsigned, 4); + +#define OcOverflowAddU32(A, B, Res) __builtin_uadd_overflow((UINT32)(A), (UINT32)(B), (UINT32 *)(Res)) +#define OcOverflowSubU32(A, B, Res) __builtin_usub_overflow((UINT32)(A), (UINT32)(B), (UINT32 *)(Res)) +#define OcOverflowMulU32(A, B, Res) __builtin_umul_overflow((UINT32)(A), (UINT32)(B), (UINT32 *)(Res)) +#define OcOverflowAddS32(A, B, Res) __builtin_sadd_overflow((INT32)(A), (INT32)(B), (INT32 *)(Res)) +#define OcOverflowSubS32(A, B, Res) __builtin_ssub_overflow((INT32)(A), (INT32)(B), (INT32 *)(Res)) +#define OcOverflowMulS32(A, B, Res) __builtin_smul_overflow((INT32)(A), (INT32)(B), (INT32 *)(Res)) + +#endif // 32-bit integer support + +// +// Implement 64-bit intrinsics with long long and unsigned long long on architectures that support it. +// Note: ProcessorBind.h may use long on X64, but it is as large as long long. +// +#if defined(MDE_CPU_AARCH64) || defined(MDE_CPU_ARM) || defined(MDE_CPU_X64) || defined(MDE_CPU_IA32) + +typedef long long oc_guard_long_long; +typedef unsigned long long oc_guard_unsigned_long_long; + +VERIFY_SIZE_OF (oc_guard_long_long, 8); +VERIFY_SIZE_OF (oc_guard_unsigned_long_long, 8); + +#define OcOverflowAddU64(A, B, Res) __builtin_uaddll_overflow((UINT64)(A), (UINT64)(B), (UINT64 *)(Res)) +#define OcOverflowSubU64(A, B, Res) __builtin_usubll_overflow((UINT64)(A), (UINT64)(B), (UINT64 *)(Res)) +#define OcOverflowMulU64(A, B, Res) __builtin_umulll_overflow((UINT64)(A), (UINT64)(B), (UINT64 *)(Res)) +#define OcOverflowAddS64(A, B, Res) __builtin_saddll_overflow((INT64)(A), (INT64)(B), (INT64 *)(Res)) +#define OcOverflowSubS64(A, B, Res) __builtin_ssubll_overflow((INT64)(A), (INT64)(B), (INT64 *)(Res)) +#define OcOverflowMulS64(A, B, Res) __builtin_smulll_overflow((INT64)(A), (INT64)(B), (INT64 *)(Res)) + +#endif // 64-bit integer support + +// +// Implement native intrinsics with 32-bit or 64-bit intrinsics depending on the support. +// +#if defined(MDE_CPU_AARCH64) || defined(MDE_CPU_X64) + +VERIFY_SIZE_OF (INTN, 8); +VERIFY_SIZE_OF (UINTN, 8); + +#define OcOverflowAddUN(A, B, Res) OcOverflowAddU64((A), (B), (Res)) +#define OcOverflowSubUN(A, B, Res) OcOverflowSubU64((A), (B), (Res)) +#define OcOverflowMulUN(A, B, Res) OcOverflowMulU64((A), (B), (Res)) +#define OcOverflowAddSN(A, B, Res) OcOverflowAddS64((A), (B), (Res)) +#define OcOverflowSubSN(A, B, Res) OcOverflowSubS64((A), (B), (Res)) +#define OcOverflowMulSN(A, B, Res) OcOverflowMulS64((A), (B), (Res)) + +#elif defined(MDE_CPU_ARM) || defined(MDE_CPU_IA32) + +VERIFY_SIZE_OF (INTN, 4); +VERIFY_SIZE_OF (UINTN, 4); + +#define OcOverflowAddUN(A, B, Res) OcOverflowAddU32((A), (B), (Res)) +#define OcOverflowSubUN(A, B, Res) OcOverflowSubU32((A), (B), (Res)) +#define OcOverflowMulUN(A, B, Res) OcOverflowMulU32((A), (B), (Res)) +#define OcOverflowAddSN(A, B, Res) OcOverflowAddS32((A), (B), (Res)) +#define OcOverflowSubSN(A, B, Res) OcOverflowSubS32((A), (B), (Res)) +#define OcOverflowMulSN(A, B, Res) OcOverflowMulS32((A), (B), (Res)) + +#endif // native integer support + +#endif // type integer support + +#endif // __has_builtin + +#if defined(__GNUC__) || defined(__clang__) + +// +// Macro implementations for compilers supporting Statement Expressions: +// https://gcc.gnu.org/onlinedocs/gcc/Statement-Exprs.html +// + +#define OcOverflowTriAddU32(A, B, C, Res) ({ \ + UINT32 OcTmp__; BOOLEAN OcFirst__, OcSecond__; \ + OcFirst__ = OcOverflowAddU32((A), (B), &OcTmp__); \ + OcSecond__ = OcOverflowAddU32(OcTmp__, (C), (Res)); \ + OcFirst__ | OcSecond__; }) +#define OcOverflowTriMulU32(A, B, C, Res) ({ \ + UINT32 OcTmp__; BOOLEAN OcFirst__, OcSecond__; \ + OcFirst__ = OcOverflowMulU32((A), (B), &OcTmp__); \ + OcSecond__ = OcOverflowMulU32(OcTmp__, (C), (Res)); \ + OcFirst__ | OcSecond__; }) +#define OcOverflowAddMulU32(A, B, C, Res) ({ \ + UINT32 OcTmp__; BOOLEAN OcFirst__, OcSecond__; \ + OcFirst__ = OcOverflowAddU32((A), (B), &OcTmp__); \ + OcSecond__ = OcOverflowMulU32(OcTmp__, (C), (Res)); \ + OcFirst__ | OcSecond__; }) +#define OcOverflowMulAddU32(A, B, C, Res) ({ \ + UINT32 OcTmp__; BOOLEAN OcFirst__, OcSecond__; \ + OcFirst__ = OcOverflowMulU32((A), (B), &OcTmp__); \ + OcSecond__ = OcOverflowAddU32(OcTmp__, (C), (Res)); \ + OcFirst__ | OcSecond__; }) +#define OcOverflowTriAddS32(A, B, C, Res) ({ \ + INT32 OcTmp__; BOOLEAN OcFirst__, OcSecond__; \ + OcFirst__ = OcOverflowAddS32((A), (B), &OcTmp__); \ + OcSecond__ = OcOverflowAddS32(OcTmp__, (C), (Res)); \ + OcFirst__ | OcSecond__; }) +#define OcOverflowTriMulS32(A, B, C, Res) ({ \ + INT32 OcTmp__; BOOLEAN OcFirst__, OcSecond__; \ + OcFirst__ = OcOverflowMulS32((A), (B), &OcTmp__); \ + OcSecond__ = OcOverflowMulS32(OcTmp__, (C), (Res)); \ + OcFirst__ | OcSecond__; }) +#define OcOverflowAddMulS32(A, B, C, Res) ({ \ + INT32 OcTmp__; BOOLEAN OcFirst__, OcSecond__; \ + OcFirst__ = OcOverflowAddS32((A), (B), &OcTmp__); \ + OcSecond__ = OcOverflowMulS32(OcTmp__, (C), (Res)); \ + OcFirst__ | OcSecond__; }) +#define OcOverflowMulAddS32(A, B, C, Res) ({ \ + INT32 OcTmp__; BOOLEAN OcFirst__, OcSecond__; \ + OcFirst__ = OcOverflowMulS32((A), (B), &OcTmp__); \ + OcSecond__ = OcOverflowAddS32(OcTmp__, (C), (Res)); \ + OcFirst__ | OcSecond__; }) + +#define OcOverflowTriAddU64(A, B, C, Res) ({ \ + UINT64 OcTmp__; BOOLEAN OcFirst__, OcSecond__; \ + OcFirst__ = OcOverflowAddU64((A), (B), &OcTmp__); \ + OcSecond__ = OcOverflowAddU64(OcTmp__, (C), (Res)); \ + OcFirst__ | OcSecond__; }) +#define OcOverflowTriMulU64(A, B, C, Res) ({ \ + UINT64 OcTmp__; BOOLEAN OcFirst__, OcSecond__; \ + OcFirst__ = OcOverflowMulU64((A), (B), &OcTmp__); \ + OcSecond__ = OcOverflowMulU64(OcTmp__, (C), (Res)); \ + OcFirst__ | OcSecond__; }) +#define OcOverflowAddMulU64(A, B, C, Res) ({ \ + UINT64 OcTmp__; BOOLEAN OcFirst__, OcSecond__; \ + OcFirst__ = OcOverflowAddU64((A), (B), &OcTmp__); \ + OcSecond__ = OcOverflowMulU64(OcTmp__, (C), (Res)); \ + OcFirst__ | OcSecond__; }) +#define OcOverflowMulAddU64(A, B, C, Res) ({ \ + UINT64 OcTmp__; BOOLEAN OcFirst__, OcSecond__; \ + OcFirst__ = OcOverflowMulU64((A), (B), &OcTmp__); \ + OcSecond__ = OcOverflowAddU64(OcTmp__, (C), (Res)); \ + OcFirst__ | OcSecond__; }) +#define OcOverflowTriAddS64(A, B, C, Res) ({ \ + INT64 OcTmp__; BOOLEAN OcFirst__, OcSecond__; \ + OcFirst__ = OcOverflowAddS64((A), (B), &OcTmp__); \ + OcSecond__ = OcOverflowAddS64(OcTmp__, (C), (Res)); \ + OcFirst__ | OcSecond__; }) +#define OcOverflowTriMulS64(A, B, C, Res) ({ \ + INT64 OcTmp__; BOOLEAN OcFirst__, OcSecond__; \ + OcFirst__ = OcOverflowMulS64((A), (B), &OcTmp__); \ + OcSecond__ = OcOverflowMulS64(OcTmp__, (C), (Res)); \ + OcFirst__ | OcSecond__; }) +#define OcOverflowAddMulS64(A, B, C, Res) ({ \ + INT64 OcTmp__; BOOLEAN OcFirst__, OcSecond__; \ + OcFirst__ = OcOverflowAddS64((A), (B), &OcTmp__); \ + OcSecond__ = OcOverflowMulS64(OcTmp__, (C), (Res)); \ + OcFirst__ | OcSecond__; }) +#define OcOverflowMulAddS64(A, B, C, Res) ({ \ + INT64 OcTmp__; BOOLEAN OcFirst__, OcSecond__; \ + OcFirst__ = OcOverflowMulS64((A), (B), &OcTmp__); \ + OcSecond__ = OcOverflowAddS64(OcTmp__, (C), (Res)); \ + OcFirst__ | OcSecond__; }) + +#define OcOverflowTriAddUN(A, B, C, Res) ({ \ + UINTN OcTmp__; BOOLEAN OcFirst__, OcSecond__; \ + OcFirst__ = OcOverflowAddUN((A), (B), &OcTmp__); \ + OcSecond__ = OcOverflowAddUN(OcTmp__, (C), (Res)); \ + OcFirst__ | OcSecond__; }) +#define OcOverflowTriMulUN(A, B, C, Res) ({ \ + UINTN OcTmp__; BOOLEAN OcFirst__, OcSecond__; \ + OcFirst__ = OcOverflowMulUN((A), (B), &OcTmp__); \ + OcSecond__ = OcOverflowMulUN(OcTmp__, (C), (Res)); \ + OcFirst__ | OcSecond__; }) +#define OcOverflowAddMulUN(A, B, C, Res) ({ \ + UINTN OcTmp__; BOOLEAN OcFirst__, OcSecond__; \ + OcFirst__ = OcOverflowAddUN((A), (B), &OcTmp__); \ + OcSecond__ = OcOverflowMulUN(OcTmp__, (C), (Res)); \ + OcFirst__ | OcSecond__; }) +#define OcOverflowMulAddUN(A, B, C, Res) ({ \ + UINTN OcTmp__; BOOLEAN OcFirst__, OcSecond__; \ + OcFirst__ = OcOverflowMulUN((A), (B), &OcTmp__); \ + OcSecond__ = OcOverflowAddUN(OcTmp__, (C), (Res)); \ + OcFirst__ | OcSecond__; }) +#define OcOverflowTriAddSN(A, B, C, Res) ({ \ + INTN OcTmp__; BOOLEAN OcFirst__, OcSecond__; \ + OcFirst__ = OcOverflowAddSN((A), (B), &OcTmp__); \ + OcSecond__ = OcOverflowAddSN(OcTmp__, (C), (Res)); \ + OcFirst__ | OcSecond__; }) +#define OcOverflowTriMulSN(A, B, C, Res) ({ \ + INTN OcTmp__; BOOLEAN OcFirst__, OcSecond__; \ + OcFirst__ = OcOverflowMulSN((A), (B), &OcTmp__); \ + OcSecond__ = OcOverflowMulSN(OcTmp__, (C), (Res)); \ + OcFirst__ | OcSecond__; }) +#define OcOverflowAddMulSN(A, B, C, Res) ({ \ + INTN OcTmp__; BOOLEAN OcFirst__, OcSecond__; \ + OcFirst__ = OcOverflowAddSN((A), (B), &OcTmp__); \ + OcSecond__ = OcOverflowMulSN(OcTmp__, (C), (Res)); \ + OcFirst__ | OcSecond__; }) +#define OcOverflowMulAddSN(A, B, C, Res) ({ \ + INTN OcTmp__; BOOLEAN OcFirst__, OcSecond__; \ + OcFirst__ = OcOverflowMulSN((A), (B), &OcTmp__); \ + OcSecond__ = OcOverflowAddSN(OcTmp__, (C), (Res)); \ + OcFirst__ | OcSecond__; }) + +#endif // __GNUC__ + +#endif // OC_GUARD_LIB_H diff --git a/Include/Library/OcMiscLib.h b/Include/Library/OcMiscLib.h new file mode 100755 index 000000000..618e297b4 --- /dev/null +++ b/Include/Library/OcMiscLib.h @@ -0,0 +1,237 @@ +/** @file + Copyright (C) 2016 - 2018, The HermitCrabs Lab. 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. +**/ + +#ifndef OC_MISC_LIB_H +#define OC_MISC_LIB_H + +#include +#include + +/** + Convert seconds to microseconds for use in e.g. gBS->Stall. +**/ +#define SECONDS_TO_MICROSECONDS(x) ((x)*1000000) + +/** + TODO: EDK II has its implementation in BaseLib, but it is broken, + as it fails to update DecodedLength: + https://github.com/acidanthera/bugtracker/issues/372 + + @param[in] EncodedData A pointer to the data to convert. + @param[in] EncodedLength The length of data to convert. + @param[in] DecodedData A pointer to location to store the decoded data. + @param[in] DecodedSize A pointer to location to store the decoded size. + + @retval TRUE on success. +**/ +RETURN_STATUS +EFIAPI +OcBase64Decode ( + IN CONST CHAR8 *EncodedData, + IN UINTN EncodedLength, + OUT UINT8 *DecodedData, + IN OUT UINTN *DecodedLength + ); + +// LegacyRegionlock +/** Lock the legacy region specified to enable modification. + + @param[in] LegacyAddress The address of the region to lock. + @param[in] LegacyLength The size of the region to lock. + + @retval EFI_SUCCESS The region was locked successfully. +**/ +EFI_STATUS +LegacyRegionLock ( + IN UINT32 LegacyAddress, + IN UINT32 LegacyLength + ); + +// LegacyRegionUnlock +/** Unlock the legacy region specified to enable modification. + + @param[in] LegacyAddress The address of the region to unlock. + @param[in] LegacyLength The size of the region to unlock. + + @retval EFI_SUCCESS The region was unlocked successfully. +**/ +EFI_STATUS +LegacyRegionUnlock ( + IN UINT32 LegacyAddress, + IN UINT32 LegacyLength + ); + +/** Log the boot options passed + + @param[in] BootOrder A pointer to the boot order list. + @param[in] BootOrderLength Size of the boot order list. + + @retval EFI_SUCCESS The entry point is executed successfully. +**/ +EFI_STATUS +LogBootOrder ( + IN INT16 *BootOrder, + IN UINTN BootOrderSize + ); + +// LogHexDump +/** Convert memory locations into hex strings and output to the boot log + + @param[in] Address The address of the region to dump hex from. + @param[in] Address2 The address to show when dumping hex. + @param[in] Length The length of the string to show. + @param[in] LineSize How many bytes to show per line. + @param[in] DisplayAscii Flag to show ascii charater also. + + @retval EFI_SUCCESS The region was unlocked successfully. +**/ +EFI_STATUS +LogHexDump ( + IN VOID *Address, + IN VOID *Address2, + IN UINTN Length, + IN UINTN LineSize, + IN BOOLEAN DisplayAscii + ); + +// SetPlatformData +/** + + @param[in] DataRecordGuid The guid of the record to use. + @param[in] Key A pointer to the ascii key string. + @param[in] Data A pointer to the data to store. + @param[in] DataSize The length of the data to store. + + @retval EFI_SUCCESS The datahub was updated successfully. +**/ +EFI_STATUS +SetPlatformData ( + IN EFI_GUID *DataRecordGuid, + IN CHAR8 *Key, + IN VOID *Data, + IN UINT32 DataSize + ); + +/** + Allocate new System Table with disabled text output. + + @param[in] SystemTable Base System Table. + + @retval non NULL The System Table table was allocated successfully. +**/ +EFI_SYSTEM_TABLE * +AllocateNullTextOutSystemTable ( + EFI_SYSTEM_TABLE *SystemTable + ); + +/** + Dummy function that debuggers may break on. +**/ +VOID +DebugBreak ( + VOID + ); + +/** + Wait for user input after printing message. + + @param[in] Message Message to print. +**/ +VOID +WaitForKeyPress ( + CONST CHAR16 *Message + ); + +/** + Default index mapping macros. +**/ +#define OC_INPUT_STR "123456789ABCDEFGHIJKLMNOPQRSTUVXWZ" +#define OC_INPUT_MAX L_STR_LEN (OC_INPUT_STR) +#define OC_INPUT_ABORTED -1 ///< Esc or 0 +#define OC_INPUT_INVALID -2 ///< Some other key +#define OC_INPUT_TIMEOUT -3 ///< Timeout + +/** + Obtains key index from user input. + + @param TimeOutSeconds Timeout to wait for. + + @returns key index [0, OC_INPUT_MAX), OC_INPUT_ABORTED, or OC_INPUT_INVALID. +**/ +INTN +WaitForKeyIndex ( + UINTN TimeOutSeconds + ); + +INT32 +FindPattern ( + IN CONST UINT8 *Pattern, + IN CONST UINT8 *PatternMask OPTIONAL, + IN CONST UINT32 PatternSize, + IN CONST UINT8 *Data, + IN UINT32 DataSize, + IN INT32 DataOff + ); + +UINT32 +ApplyPatch ( + IN CONST UINT8 *Pattern, + IN CONST UINT8 *PatternMask OPTIONAL, + IN CONST UINT32 PatternSize, + IN CONST UINT8 *Replace, + IN CONST UINT8 *ReplaceMask OPTIONAL, + IN UINT8 *Data, + IN UINT32 DataSize, + IN UINT32 Count, + IN UINT32 Skip + ); + +/** + @param[in] Protocol The published unique identifier of the protocol. It is the caller’s responsibility to pass in + a valid GUID. + + @retval EFI_SUCCESS on success. +**/ +EFI_STATUS +UninstallAllProtocolInstances ( + EFI_GUID *Protocol + ); + +/** + Release UEFI ownership from USB controllers at booting. +**/ +EFI_STATUS +ReleaseUsbOwnership ( + VOID + ); + +/** + Get current memory map allocated on pool. + + @param[out] MemoryMapSize Resulting memory map size in bytes. + @param[out] DescriptorSize Resulting memory map descriptor size in bytes. + @param[out] MapKey Memory map key, optional. + @param[out] DescriptorVersion Memory map version, optional. + + @retval current memory map or NULL. +**/ +EFI_MEMORY_DESCRIPTOR * +GetCurrentMemoryMap ( + OUT UINTN *MemoryMapSize, + OUT UINTN *DescriptorSize, + OUT UINTN *MapKey OPTIONAL, + OUT UINT32 *DescriptorVersion OPTIONAL + ); + +#endif // OC_MISC_LIB_H diff --git a/Include/Library/OcStringLib.h b/Include/Library/OcStringLib.h new file mode 100755 index 000000000..4279b24a2 --- /dev/null +++ b/Include/Library/OcStringLib.h @@ -0,0 +1,197 @@ +/** @file + Copyright (C) 2016 - 2018, The HermitCrabs Lab. 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. +**/ + +#ifndef OC_STRING_LIB_H_ +#define OC_STRING_LIB_H_ + +/** + Returns the length of a Null-terminated string literal. + + @param[in] String The Null-terminated string literal. + +**/ +#define L_STR_LEN(String) (ARRAY_SIZE (String) - 1) + +/** + Returns the size of a Null-terminated string literal in bytes, including the + Null terminator. + + @param[in] String The Null-terminated string literal. + +**/ +#define L_STR_SIZE(String) (sizeof (String)) + +/** + Returns the size of a Null-terminated string literal in bytes, excluding the + Null terminator. + + @param[in] String The Null-terminated string literal. + +**/ +#define L_STR_SIZE_NT(String) (sizeof (String) - sizeof (*(String))) + +/** Check if character is printable + + @param[in] Char The ascii character to check if is printable. + + @retval TRUE, if character is printable. +**/ +BOOLEAN +IsAsciiPrint ( + IN CHAR8 Char + ); + +/** Check if character is a white space character + + @param[in] Char The ascii character to check if is white space. + + @retval TRUE, if character is a white space character +**/ +INTN +IsAsciiSpace ( + IN CHAR8 Char + ); + +/** Convert null terminated ascii string to unicode. + + @param[in] String1 A pointer to the ascii string to convert to unicode. + @param[in] Length Length or 0 to calculate the length of the ascii string to convert. + + @retval A pointer to the converted unicode string allocated from pool. +**/ +CHAR16 * +AsciiStrCopyToUnicode ( + IN CONST CHAR8 *String, + IN UINTN Length + ); + +/** + Convert 64-bit unsigned integer to a nul-termianted hex string. + + @param[out] Buffer Destination buffer. + @param[in] BufferSize Destination buffer size in bytes. + @param[in] Value Value to convert. +**/ +BOOLEAN +AsciiUint64ToLowerHex ( + OUT CHAR8 *Buffer, + IN UINT32 BufferSize, + IN UINT64 Value + ); + +/** + Performs a case insensitive comparison of two Null-terminated Unicode strings, + and returns the difference between the first mismatched Unicode characters. + + This function performs a case insensitive comparison of the Null-terminated + Unicode string FirstString to the Null-terminated Unicode string + SecondString. If FirstString is identical to SecondString, then 0 is + returned. Otherwise, the value returned is the first mismatched upper case + Unicode character in SecondString subtracted from the first mismatched upper + case Unicode character in FirstString. + + If FirstString is NULL, then ASSERT(). + If SecondString is NULL, then ASSERT(). + If PcdMaximumUnicodeStringLength is not zero and FirstString contains more + than PcdMaximumUnicodeStringLength Unicode characters, not including the + Null-terminator, then ASSERT(). + If PcdMaximumUnicodeStringLength is not zero and SecondString contains more + than PcdMaximumUnicodeStringLength Unicode characters, not including the + Null-terminator, then ASSERT(). + + @param FirstString A pointer to a Null-terminated Unicode string. + @param SecondString A pointer to a Null-terminated Unicode string. + + @retval ==0 FirstString is identical to SecondString using case + insensitiv comparisons. + @retval !=0 FirstString is not identical to SecondString using case + insensitive comparisons. + +**/ +INTN +EFIAPI +StriCmp ( + IN CHAR16 *FirstString, + IN CHAR16 *SecondString + ); + +/** + Compares up to a specified length the contents of two Null-terminated Unicode + strings using case insensitive comparisons, and returns the difference + between the first mismatched Unicode characters. + + This function compares the Null-terminated Unicode string FirstString to the + Null-terminated Unicode string SecondString using case insensitive + comparisons. At most, Length Unicode characters will be compared. If Length + is 0, then 0 is returned. If FirstString is identical to SecondString, then 0 + is returned. Otherwise, the value returned is the first mismatched upper case + Unicode character in SecondString subtracted from the first mismatched upper + case Unicode character in FirstString. + + If Length > 0 and FirstString is NULL, then ASSERT(). + If Length > 0 and FirstString is not aligned on a 16-bit boundary, then + ASSERT(). + If Length > 0 and SecondString is NULL, then ASSERT(). + If Length > 0 and SecondString is not aligned on a 16-bit boundary, then + ASSERT(). + If PcdMaximumUnicodeStringLength is not zero, and Length is greater than + PcdMaximumUnicodeStringLength, then ASSERT(). + If PcdMaximumUnicodeStringLength is not zero, and FirstString contains more + than PcdMaximumUnicodeStringLength Unicode characters, not including the + Null-terminator, then ASSERT(). + If PcdMaximumUnicodeStringLength is not zero, and SecondString contains more + than PcdMaximumUnicodeStringLength Unicode characters, not including the + Null-terminator, then ASSERT(). + + @param FirstString A pointer to a Null-terminated Unicode string. + @param SecondString A pointer to a Null-terminated Unicode string. + @param Length The maximum number of Unicode characters to compare. + + @retval ==0 FirstString is identical to SecondString using case + insensitive comparisons. + @retval others FirstString is not identical to SecondString using case + insensitive comparisons. + +**/ +INTN +EFIAPI +StrniCmp ( + IN CONST CHAR16 *FirstString, + IN CONST CHAR16 *SecondString, + IN UINTN Length + ); + +/** + Convert path with mixed slashes to UEFI slashes (\\). + + @param[in,out] String Path. +**/ +VOID +UnicodeUefiSlashes ( + IN OUT CHAR16 *String + ); + +/** + Filter string from unprintable characters. + + @param[in,out] String String to filter. + @param[in] SingleLine Enforce only one line. +**/ +VOID +UnicodeFilterString ( + IN OUT CHAR16 *String, + IN BOOLEAN SingleLine + ); + +#endif // OC_STRING_LIB_H_ diff --git a/Library/DeviceTreeLib/DeviceTreeLib.c b/Library/DeviceTreeLib/DeviceTreeLib.c new file mode 100755 index 000000000..ee756b47c --- /dev/null +++ b/Library/DeviceTreeLib/DeviceTreeLib.c @@ -0,0 +1,715 @@ +/** @file + Copyright (C) 2016 - 2017, The HermitCrabs Lab. 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. +**/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// +// Obtain next property by address. +// +#define DEVICE_TREE_GET_NEXT_PROPERTY(Prop) \ + (DTProperty *)(((UINT8 *)(UINTN)(Prop)) \ + + sizeof (*Prop) + ALIGN_VALUE (Prop->Length, sizeof (UINT32))) + +// +// Location of the Device Tree. +// +STATIC DTEntry mDTRootNode; + +// +// Pointer to location that contains the length of the Device Tree. +// +STATIC UINT32 *mDTLength; + +STATIC UINT32 mDTNodeDepth; + +STATIC OpaqueDTPropertyIterator mOpaquePropIter; + +// +// Support Routines. +// + +STATIC +DTEntry +DTSkipProperties ( + IN DTEntry Entry + ) +{ + DTProperty *Prop; + UINT32 Count; + + if (Entry == NULL || Entry->NumProperties == 0) { + return NULL; + } else { + Prop = (DTProperty *) (Entry + 1); + for (Count = 0; Count < Entry->NumProperties; ++Count) { + Prop = DEVICE_TREE_GET_NEXT_PROPERTY (Prop); + } + } + + return (DTEntry) Prop; +} + +STATIC +DTEntry +DTSkipTree ( + IN DTEntry Root + ) +{ + DTEntry Entry; + UINT32 Count; + + Entry = DTSkipProperties (Root); + + if (Entry == NULL) { + return NULL; + } + + for (Count = 0; Count < Root->NumChildren; ++Count) { + Entry = DTSkipTree (Entry); + } + return Entry; +} + +STATIC +DTEntry +GetFirstChild ( + IN DTEntry Parent + ) +{ + return DTSkipProperties (Parent); +} + +STATIC +DTEntry +GetNextChild ( + IN DTEntry Sibling + ) +{ + return DTSkipTree (Sibling); +} + +STATIC +CONST CHAR8 * +GetNextComponent ( + IN CONST CHAR8 *Cp, + IN CHAR8 *Bp + ) +{ + while (*Cp != 0) { + if (*Cp == DT_PATH_NAME_SEPERATOR) { + Cp++; + break; + } + *Bp++ = *Cp++; + } + + *Bp = 0; + return Cp; +} + +STATIC +DTEntry +FindChild ( + IN DTEntry Cur, + IN CHAR8 *Buf + ) +{ + DTEntry Child; + UINTN Index; + CHAR8 *Str; + UINT32 Dummy; + + if (Cur->NumChildren == 0) { + return NULL; + } + + Index = 1; + Child = GetFirstChild (Cur); + while (1) { + if (EFI_ERROR (DTGetProperty (Child, "name", (VOID **)&Str, &Dummy))) { + break; + } + + if (AsciiStrCmp (Str, Buf) == 0) { + return Child; + } + + if (Index >= Cur->NumChildren) { + break; + } + + Child = GetNextChild (Child); + ++Index; + } + + return NULL; +} + +// +// External Routines. +// + +EFI_STATUS +DTLookupEntry ( + IN CONST DTEntry SearchPoint, + IN CONST CHAR8 *PathName, + IN DTEntry *FoundEntry + ) +{ + DTEntryNameBuf Buf; + DTEntry Cur; + CONST CHAR8 *Cp; + + if (mDTRootNode == NULL) { + return EFI_INVALID_PARAMETER; + } + + if (SearchPoint == NULL) { + Cur = mDTRootNode; + } else { + Cur = SearchPoint; + } + + Cp = PathName; + if (*Cp == DT_PATH_NAME_SEPERATOR) { + Cp++; + if (*Cp == '\0') { + *FoundEntry = Cur; + return EFI_SUCCESS; + } + } + + do { + Cp = GetNextComponent (Cp, Buf); + + // + // Check for done. + // + if (*Buf == '\0') { + if (*Cp == '\0') { + *FoundEntry = Cur; + return EFI_SUCCESS; + } + break; + } + + Cur = FindChild (Cur, Buf); + } while (Cur != NULL); + + return EFI_INVALID_PARAMETER; +} + +EFI_STATUS +DTCreateEntryIterator ( + IN CONST DTEntry StartEntry, + IN DTEntryIterator *Iterator + ) +{ + DTEntryIterator Iter; + + if (mDTRootNode == NULL) { + return EFI_INVALID_PARAMETER; + } + + Iter = AllocatePool (sizeof (OpaqueDTEntryIterator)); + + if (Iter == NULL) { + return EFI_OUT_OF_RESOURCES; + } + + if (StartEntry != NULL) { + Iter->OuterScope = (DTEntry) StartEntry; + Iter->CurrentScope = (DTEntry) StartEntry; + } else { + Iter->OuterScope = mDTRootNode; + Iter->CurrentScope = mDTRootNode; + } + + Iter->CurrentEntry = NULL; + Iter->SavedScope = NULL; + Iter->CurrentIndex = 0; + + *Iterator = Iter; + return EFI_SUCCESS; +} + +EFI_STATUS +DTDisposeEntryIterator ( + IN DTEntryIterator Iterator + ) +{ + DTSavedScopePtr Scope; + + while ((Scope = Iterator->SavedScope) != NULL) { + Iterator->SavedScope = Scope->NextScope; + FreePool (Scope); + } + + FreePool (Iterator); + return EFI_SUCCESS; +} + +EFI_STATUS +DTEnterEntry ( + IN DTEntryIterator Iterator, + IN DTEntry ChildEntry + ) +{ + DTSavedScopePtr NewScope; + + if (ChildEntry == NULL) { + return EFI_INVALID_PARAMETER; + } + + NewScope = AllocatePool (sizeof (DTSavedScope)); + + if (NewScope == NULL) { + return EFI_OUT_OF_RESOURCES; + } + + NewScope->NextScope = Iterator->SavedScope; + NewScope->Scope = Iterator->CurrentScope; + NewScope->Entry = Iterator->CurrentEntry; + NewScope->Index = Iterator->CurrentIndex; + + Iterator->CurrentScope = ChildEntry; + Iterator->CurrentEntry = NULL; + Iterator->SavedScope = NewScope; + Iterator->CurrentIndex = 0; + + return EFI_SUCCESS; +} + +EFI_STATUS +DTExitEntry ( + IN DTEntryIterator Iterator, + IN DTEntry *CurrentPosition + ) +{ + DTSavedScopePtr NewScope; + + NewScope = Iterator->SavedScope; + + if (NewScope == NULL) { + return EFI_INVALID_PARAMETER; + } + + Iterator->SavedScope = NewScope->NextScope; + Iterator->CurrentScope = NewScope->Scope; + Iterator->CurrentEntry = NewScope->Entry; + Iterator->CurrentIndex = NewScope->Index; + + *CurrentPosition = Iterator->CurrentEntry; + + FreePool (NewScope); + + return EFI_SUCCESS; +} + +EFI_STATUS +DTIterateEntries ( + IN DTEntryIterator Iterator, + IN DTEntry *NextEntry + ) +{ + if (Iterator->CurrentIndex >= Iterator->CurrentScope->NumChildren) { + *NextEntry = NULL; + return EFI_END_OF_MEDIA; + } + + ++Iterator->CurrentIndex; + if (Iterator->CurrentIndex == 1) { + Iterator->CurrentEntry = GetFirstChild (Iterator->CurrentScope); + } else { + Iterator->CurrentEntry = GetNextChild (Iterator->CurrentEntry); + } + *NextEntry = Iterator->CurrentEntry; + return EFI_SUCCESS; +} + +EFI_STATUS +DTRestartEntryIteration ( + IN DTEntryIterator Iterator + ) +{ + Iterator->CurrentEntry = NULL; + Iterator->CurrentIndex = 0; + return EFI_SUCCESS; +} + +EFI_STATUS +DTGetProperty ( + IN CONST DTEntry Entry, + IN CHAR8 *PropertyName, + IN VOID **PropertyValue, + IN UINT32 *PropertySize + ) +{ + DTProperty *Prop; + UINT32 Count; + + if (Entry == NULL || Entry->NumProperties == 0) { + return EFI_INVALID_PARAMETER; + } + + Prop = (DTProperty *) (Entry + 1); + for (Count = 0; Count < Entry->NumProperties; Count++) { + if (AsciiStrCmp (Prop->Name, PropertyName) == 0) { + *PropertyValue = (VOID *) (((UINT8 *)Prop) + sizeof (DTProperty)); + *PropertySize = Prop->Length; + return EFI_SUCCESS; + } + Prop = DEVICE_TREE_GET_NEXT_PROPERTY (Prop); + } + + return EFI_INVALID_PARAMETER; +} + +EFI_STATUS +DTCreatePropertyIterator ( + IN CONST DTEntry Entry, + IN DTPropertyIterator Iterator + ) +{ + Iterator->Entry = Entry; + Iterator->CurrentProperty = NULL; + Iterator->CurrentIndex = 0; + + return EFI_SUCCESS; +} + +EFI_STATUS +DTIterateProperties ( + IN DTPropertyIterator Iterator, + IN CHAR8 **FoundProperty + ) +{ + if (Iterator->CurrentIndex >= Iterator->Entry->NumProperties) { + *FoundProperty = NULL; + return EFI_END_OF_MEDIA; + } + + Iterator->CurrentIndex++; + if (Iterator->CurrentIndex == 1) { + Iterator->CurrentProperty = (DTProperty *) (Iterator->Entry + 1); + } else { + Iterator->CurrentProperty = DEVICE_TREE_GET_NEXT_PROPERTY (Iterator->CurrentProperty); + } + *FoundProperty = Iterator->CurrentProperty->Name; + + return EFI_SUCCESS; +} + +EFI_STATUS +DTRestartPropertyIteration ( + IN DTPropertyIterator Iterator + ) +{ + Iterator->CurrentProperty = NULL; + Iterator->CurrentIndex = 0; + + return EFI_SUCCESS; +} + +EFI_STATUS +DumpDeviceTreeNodeRecusively ( + IN DTEntry Entry + ) +{ + EFI_STATUS Status; + DTEntry Root; + UINTN Spacer; + + DTEntryIterator EntryIterator; + DTPropertyIterator PropIter; + DTMemMapEntry *MemMap; + DTBooterKextFileInfo *Kext; + UINT8 *Address; + + CHAR8 *PropertyParent = NULL; + CHAR8 *PropertyName = NULL; + CHAR8 *PropertyValue = NULL; + + UINT32 PropertySize = 0; + + PropIter = &mOpaquePropIter; + + if (Entry == NULL) { + return EFI_INVALID_PARAMETER; + } + + Root = Entry; + Spacer = 1; + + Status = DTCreatePropertyIterator (Entry, PropIter); + + if (!EFI_ERROR (Status)) { + PropertyParent = "/"; + + while ((Status = DTIterateProperties (PropIter, &PropertyName)) == EFI_SUCCESS) { + if ((Status = DTGetProperty (Entry, (CHAR8 *)PropertyName, (void *)&PropertyValue, &PropertySize)) != EFI_SUCCESS) { + DEBUG ((DEBUG_WARN, "DeviceTree is probably invalid - %r\n", Status)); + break; + } + + if (AsciiStrnCmp (PropertyName, "name", 4) == 0) { + DEBUG ((DEBUG_INFO, "+%*ao %a\n", mDTNodeDepth * Spacer, "-", PropertyValue, mDTNodeDepth)); + DEBUG ((DEBUG_INFO, "|%*a\n", mDTNodeDepth * Spacer, " {" , mDTNodeDepth)); + PropertyParent = PropertyValue; + mDTNodeDepth++; + } else if (AsciiStrnCmp (PropertyName, "guid", 4) == 0) { + // + // Show Guid. + // + DEBUG ((DEBUG_INFO, "|%*a \"%a\" = < %g >\n", mDTNodeDepth * Spacer, " ", PropertyName, PropertyValue, PropertySize)); + } else if (AsciiStrnCmp (PropertyParent, "memory-map", 10) == 0) { + MemMap = (DTMemMapEntry *)PropertyValue; + + if (AsciiStrnCmp (PropertyName, "Driver-", 7) == 0) { + Kext = (DTBooterKextFileInfo *)(UINTN)MemMap->Address; + + if (Kext != NULL && Kext->ExecutablePhysAddr != 0) { + DEBUG (( + DEBUG_INFO, + "|%*a \"%a\" = < Dict 0x%0X Binary 0x%0X \"%a\" >\n", mDTNodeDepth * Spacer, " ", + PropertyName, + Kext->InfoDictPhysAddr, + Kext->ExecutablePhysAddr, + Kext->BundlePathPhysAddr + )); + } + } else { + Address = (UINT8 *)(UINTN)MemMap->Address; + if (Address != NULL) { + DEBUG ((DEBUG_INFO, "|%*a \"%a\" = < 0x%0X %02X %02X %02X %02X Length %X >\n", mDTNodeDepth * Spacer, " ", + PropertyName, + MemMap->Address, + Address[0], Address[1], Address[2], Address[3], + MemMap->Length + )); + } + } + + } else { + // + // TODO: Print data here. + // + DEBUG ((DEBUG_INFO, "|%*a \"%a\" = < ... > (%d)\n", mDTNodeDepth * Spacer, " ", + PropertyName, + PropertySize)); + } + } + + DEBUG ((DEBUG_INFO, "|%*a\n", (mDTNodeDepth - 1 ) * Spacer, " }" , mDTNodeDepth)); + } + + Status = DTCreateEntryIterator (Root, &EntryIterator); + + if (!EFI_ERROR (Status)) { + while (!EFI_ERROR(DTIterateEntries (EntryIterator, &Root))) { + DumpDeviceTreeNodeRecusively (Root); + mDTNodeDepth--; + } + } + + return !EFI_ERROR (Status) ? EFI_SUCCESS : EFI_NOT_FOUND; +} + +VOID +DumpDeviceTree ( + VOID + ) +{ + DTEntry DTRoot = NULL; + + if (!EFI_ERROR (DTLookupEntry (NULL, "/", &DTRoot))) { + DumpDeviceTreeNodeRecusively (DTRoot); + } +} + +// DTInit +/// +/// +/// @param[in] Base Pointer to the Device Tree +/// @param[in] Length Pointer to location containg the Device Tree length +/// + +VOID +DTInit ( + IN VOID *Base, + IN UINT32 *Length + ) +{ + if (Base != NULL && Length != NULL) { + mDTRootNode = (DTEntry) Base; + mDTLength = Length; + } +} + +// DTDeleteProperty +/// +/// +/// @param[in] NodeName +/// @param[in] DeletePropertyName +/// + +UINT32 +DTDeleteProperty ( + IN CHAR8 *NodeName, + IN CHAR8 *DeletePropertyName + ) +{ + DTEntry Node; + DTPropertyIterator PropIter; + DTProperty *Property; + CHAR8 *DeletePosition; + CHAR8 *DeviceTreeEnd; + UINT32 DeleteLength; + + PropIter = &mOpaquePropIter; + DeletePosition = NULL; + DeviceTreeEnd = (CHAR8 *) mDTRootNode + *mDTLength; + DeleteLength = 0; + + if (!EFI_ERROR (DTLookupEntry (NULL, NodeName, &Node))) { + if (!EFI_ERROR (DTCreatePropertyIterator (Node, PropIter))) { + while (!EFI_ERROR (DTIterateProperties (PropIter, &DeletePosition))) { + if (AsciiStrStr (DeletePosition, DeletePropertyName) != NULL) { + Property = (DTProperty *)DeletePosition; + DeleteLength = sizeof (DTProperty) + ALIGN_VALUE (Property->Length, sizeof (UINT32)); + + // + // Adjust Device Tree Length. + // + if (mDTLength != NULL) { + *mDTLength -= DeleteLength; + } + + // + // Delete Property. + // + CopyMem (DeletePosition, DeletePosition + DeleteLength, DeviceTreeEnd - DeletePosition); + ZeroMem (DeviceTreeEnd - DeleteLength, DeleteLength); + + // + // Decrement Nodes Properties Count. + // + Node->NumProperties--; + + break; + } + } + } + } + + return DeleteLength; +} + +// DTInsertProperty +/// +/// +/// @param[in] NodeName +/// @param[in] InsertPropertyName +/// @param[in] AddPropertyName +/// @param[in] AddPropertyValue +/// @param[in] ValueLength +/// @param[in] InsertAfter +/// + +VOID +DTInsertProperty ( + IN CHAR8 *NodeName, + IN CHAR8 *InsertPropertyName, + IN CHAR8 *AddPropertyName, + IN VOID *AddPropertyValue, + IN UINT32 ValueLength, + IN BOOLEAN InsertAfter + ) +{ + DTEntry Node; + DTPropertyIterator PropIter; + DTProperty *Property; + UINT32 EntryLength; + CHAR8 *DeviceTree; + CHAR8 *DeviceTreeEnd; + CHAR8 *InsertPosition; + + PropIter = &mOpaquePropIter; + EntryLength = ALIGN_VALUE (ValueLength, sizeof (UINT32)); + DeviceTree = NULL; + DeviceTreeEnd = (CHAR8 *)mDTRootNode + *mDTLength; + InsertPosition = NULL; + + if (!EFI_ERROR (DTLookupEntry (NULL, NodeName, &Node))) { + if (!EFI_ERROR (DTCreatePropertyIterator (Node, PropIter))) { + while (!EFI_ERROR (DTIterateProperties (PropIter, &DeviceTree))) { + InsertPosition = DeviceTree; + if (AsciiStrStr (InsertPosition, InsertPropertyName) != NULL) { + break; + } + } + + if (InsertAfter) { + Property = (DTProperty *) InsertPosition; + InsertPosition += sizeof (DTProperty) + ALIGN_VALUE (Property->Length, sizeof (UINT32)); + } + + Property = (DTProperty *)InsertPosition; + + // + // Make space. + // + CopyMem (InsertPosition + sizeof (DTProperty) + EntryLength, InsertPosition, DeviceTreeEnd - InsertPosition); + ZeroMem (InsertPosition, sizeof (DTProperty) + EntryLength); + + // + // Insert Property Name. + // + CopyMem (Property->Name, AddPropertyName, AsciiStrLen (AddPropertyName)); + + // + // Insert Property Value Length. + // + Property->Length = ValueLength; + + // + // Insert Property Value. + // + CopyMem (InsertPosition + sizeof (DTProperty), AddPropertyValue, ValueLength); + + // + // Increment Nodes Properties Count. + // + Node->NumProperties++; + + // + // Adjust Length. + // + if (mDTLength != NULL) { + *mDTLength += sizeof (DTProperty) + EntryLength; + } + } + } +} diff --git a/Library/DeviceTreeLib/DeviceTreeLib.inf b/Library/DeviceTreeLib/DeviceTreeLib.inf new file mode 100755 index 000000000..85914473e --- /dev/null +++ b/Library/DeviceTreeLib/DeviceTreeLib.inf @@ -0,0 +1,44 @@ +## @file +# +# Component description file for OcDeviceTreeLib. +# +# Copyright (C) 2016, The HermitCrabs Lab. 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. +# +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = DeviceTreeLib + FILE_GUID = 1B5DD808-FBE6-4792-B285-7520A27AD8AB + MODULE_TYPE = BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = DeviceTreeLib|PEIM DXE_DRIVER DXE_RUNTIME_DRIVER UEFI_DRIVER UEFI_APPLICATION DXE_SMM_DRIVER + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 +# + +[Sources] + DeviceTreeLib.c + +[Packages] + CloverPkg.dec + MdePkg/MdePkg.dec + +[LibraryClasses] + BaseLib + BaseMemoryLib + DebugLib + MemoryAllocationLib diff --git a/Library/MachoLib/CxxSymbols.c b/Library/MachoLib/CxxSymbols.c index f929fd45a..78fb393fc 100644 --- a/Library/MachoLib/CxxSymbols.c +++ b/Library/MachoLib/CxxSymbols.c @@ -20,7 +20,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include #include #include -#include +#include #include #define CXX_PREFIX "__Z" diff --git a/Library/MachoLib/MachoLib.inf b/Library/MachoLib/MachoLib.inf index 049242caa..cb4f7f25e 100644 --- a/Library/MachoLib/MachoLib.inf +++ b/Library/MachoLib/MachoLib.inf @@ -12,16 +12,15 @@ ## [Defines] - BASE_NAME = OcMachoLib - LIBRARY_CLASS = OcMachoLib + BASE_NAME = MachoLib + LIBRARY_CLASS = MachoLib MODULE_TYPE = BASE VERSION_STRING = 1.0 INF_VERSION = 0x00010005 [Packages] + CloverPkg.dec MdePkg/MdePkg.dec - EfiPkg/EfiPkg.dec - OcSupportPkg/OcSupportPkg.dec [LibraryClasses] BaseLib @@ -32,6 +31,6 @@ [Sources] CxxSymbols.c Header.c - OcMachoLibInternal.h + MachoLibInternal.h Relocations.c Symbols.c diff --git a/Library/MachoLib/MachoLibInternal.h b/Library/MachoLib/MachoLibInternal.h index 2f11ac7c5..82b5c2db3 100644 --- a/Library/MachoLib/MachoLibInternal.h +++ b/Library/MachoLib/MachoLibInternal.h @@ -17,7 +17,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include -#include +#include /** Retrieves the SYMTAB command. diff --git a/Library/MachoLib/Relocations.c b/Library/MachoLib/Relocations.c index 1b71f3a82..6a17db494 100644 --- a/Library/MachoLib/Relocations.c +++ b/Library/MachoLib/Relocations.c @@ -17,9 +17,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include #include -#include +#include -#include "OcMachoLibInternal.h" +#include "MachoLibInternal.h" /** Returns whether the Relocation's type indicates a Pair for the Intel 64 diff --git a/Library/MachoLib/Symbols.c b/Library/MachoLib/Symbols.c index c3aa4c28a..fa098145e 100644 --- a/Library/MachoLib/Symbols.c +++ b/Library/MachoLib/Symbols.c @@ -19,9 +19,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include #include #include -#include +#include -#include "OcMachoLibInternal.h" +#include "MachoLibInternal.h" BOOLEAN InternalSymbolIsSane ( diff --git a/Library/OcGuardLib/OcGuardLib.inf b/Library/OcGuardLib/OcGuardLib.inf index d2bbc321e..10b44bf9c 100644 --- a/Library/OcGuardLib/OcGuardLib.inf +++ b/Library/OcGuardLib/OcGuardLib.inf @@ -38,8 +38,9 @@ Ubsan.h [Packages] + CloverPkg.dec MdePkg/MdePkg.dec - OcSupportPkg/OcSupportPkg.dec +# OcSupportPkg/OcSupportPkg.dec [LibraryClasses] BaseLib diff --git a/MemoryFix/AptioMemoryFix/AptioMemoryFix.c b/MemoryFix/AptioMemoryFix/AptioMemoryFix.c index 0f258b6cc..c45db3b53 100644 --- a/MemoryFix/AptioMemoryFix/AptioMemoryFix.c +++ b/MemoryFix/AptioMemoryFix/AptioMemoryFix.c @@ -8,7 +8,7 @@ #include #include -#include +#include #include #include #include @@ -69,7 +69,7 @@ AptioMemoryFixEntrypoint ( ); if (EFI_ERROR (Status)) { - OcPrintScreen (L"AMF: protocol install failure - %r\n", Status); + Print(L"AMF: protocol install failure - %r\n", Status); return Status; } diff --git a/MemoryFix/AptioMemoryFix/AptioMemoryFix.inf b/MemoryFix/AptioMemoryFix/AptioMemoryFix.inf index ee1c0ac25..662463172 100644 --- a/MemoryFix/AptioMemoryFix/AptioMemoryFix.inf +++ b/MemoryFix/AptioMemoryFix/AptioMemoryFix.inf @@ -21,6 +21,7 @@ CloverPkg.dec MdeModulePkg/MdeModulePkg.dec MdePkg/MdePkg.dec + IntelFrameworkPkg/IntelFrameworkPkg.dec # OcSupportPkg/OcSupportPkg.dec CloverEFI/UefiCpuPkg/UefiCpuPkg.dec @@ -31,8 +32,8 @@ CpuLib DevicePathLib MemoryAllocationLib -# OcDeviceTreeLib -# OcDevicePathLib + DeviceTreeLib +# DevicePathLib MachoLib # OcStringLib UefiBootServicesTableLib @@ -73,8 +74,8 @@ gOcReadOnlyVariableGuid ## CONSUMES gOcWriteOnlyVariableGuid ## CONSUMES gOcVendorVariableGuid ## CONSUMES - gAppleBootVariableGuid ## SOMETIMES_CONSUMES - gAppleVendorVariableGuid ## SOMETIMES_CONSUMES + gEfiAppleBootGuid ## SOMETIMES_CONSUMES + gEfiAppleNvramGuid ## SOMETIMES_CONSUMES gEfiMiscSubClassGuid ## SOMETIMES_CONSUMES gEfiProcessorSubClassGuid ## SOMETIMES_CONSUMES gEfiMemorySubClassGuid ## SOMETIMES_CONSUMES @@ -91,11 +92,11 @@ gEfiDiskIo2ProtocolGuid ## CONSUMES gEfiConsoleControlProtocolGuid ## SOMETIMES_CONSUMES gAppleFirmwarePasswordProtocolGuid ## SOMETIMES_CONSUMES - gEfiDevicePathPropertyDatabaseProtocolGuid ## SOMETIMES_CONSUMES + gAppleDevicePropertyProtocolGuid ## SOMETIMES_CONSUMES gAppleFramebufferInfoProtocolGuid ## SOMETIMES_CONSUMES - gAppleKeyMapAggregatorProtocolGuid ## SOMETIMES_CONSUMES + gAppleKeyStateProtocolGuid ## SOMETIMES_CONSUMES gAppleNetBootProtocolGuid ## SOMETIMES_CONSUMES - gAppleImageConversionProtocolGuid ## SOMETIMES_CONSUMES + gAppleImageCodecProtocolGuid ## SOMETIMES_CONSUMES gEfiDataHubProtocolGuid ## SOMETIMES_CONSUMES [BuildOptions] diff --git a/MemoryFix/AptioMemoryFix/BootFixes.c b/MemoryFix/AptioMemoryFix/BootFixes.c index 2ce0b8e17..f4004edc0 100644 --- a/MemoryFix/AptioMemoryFix/BootFixes.c +++ b/MemoryFix/AptioMemoryFix/BootFixes.c @@ -10,9 +10,8 @@ #include #include -#include -#include -#include +#include +#include #include #include #include @@ -28,6 +27,23 @@ #include "RtShims.h" #include "VMem.h" +// DBG_TO: 0=no debug, 1=serial, 2=console +// serial requires +// [PcdsFixedAtBuild] +// gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x07 +// gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0xFFFFFFFF +// in package DSC file +#define DBG_TO 0 + +#if DBG_TO == 2 +#define DBG(...) AsciiPrint(__VA_ARGS__); +#elif DBG_TO == 1 +#define DBG(...) DebugPrint(1, __VA_ARGS__); +#else +#define DBG(...) +#endif + + EFI_PHYSICAL_ADDRESS gSysTableRtArea; EFI_PHYSICAL_ADDRESS gRelocatedSysTableRtArea; @@ -207,7 +223,7 @@ ReadBooterArguments ( // Status = OrgGetVariable ( L"boot-args", - &gAppleBootVariableGuid, + &gEfiAppleBootGuid, NULL, &BootArgsVarLen, &BootArgsVar[0] ); @@ -262,7 +278,7 @@ PrepareJumpFromKernel ( HigherMem = BASE_4GB; Status = AllocatePagesFromTop (EfiBootServicesCode, 1, &HigherMem, FALSE); if (Status != EFI_SUCCESS) { - OcPrintScreen (L"AMF: Failed to allocate JumpToKernel memory - %r\n", Status); + Print (L"AMF: Failed to allocate JumpToKernel memory - %r\n", Status); return Status; } @@ -274,7 +290,7 @@ PrepareJumpFromKernel ( Size = (UINT8 *)&JumpToKernelEnd - (UINT8 *)&JumpToKernel; if (Size > EFI_PAGES_TO_SIZE (1)) { - OcPrintScreen (L"AMF: JumpToKernel32 size is too big - %ld\n", Size); + Print (L"AMF: JumpToKernel32 size is too big - %ld\n", Size); return EFI_BUFFER_TOO_SMALL; } @@ -295,7 +311,7 @@ PrepareJumpFromKernel ( gSysTableRtArea = BASE_4GB; Status = AllocatePagesFromTop (EfiRuntimeServicesData, 1, &gSysTableRtArea, FALSE); if (Status != EFI_SUCCESS) { - OcPrintScreen (L"AMF: Failed to allocate system table memory - %r\n", Status); + Print (L"AMF: Failed to allocate system table memory - %r\n", Status); return Status; } @@ -519,6 +535,39 @@ CopyEfiSysTableToRtArea ( *EfiSystemTable = (UINT32)(UINTN)Dest; } +/** + Returns the length of PathName. + + @param[in] FilePath The file Device Path node to inspect. + + **/ +UINTN +FileDevicePathNameLen (IN CONST FILEPATH_DEVICE_PATH *FilePath) +{ + UINTN Size; + UINTN Len; + + if (!FilePath) { + return 0; + } + + if (!IsDevicePathValid (&FilePath->Header, 0)) { + return 0; + } + + Size = DevicePathNodeLength (FilePath) - SIZE_OF_FILEPATH_DEVICE_PATH; + // + // Account for more than one termination character. + // + Len = (Size / sizeof (*FilePath->PathName)) - 1; + while (Len > 0 && FilePath->PathName[Len - 1] == L'\0') { + --Len; + } + + return Len; +} + + EFI_LOADED_IMAGE_PROTOCOL * GetAppleBootLoadedImage ( EFI_HANDLE ImageHandle @@ -546,7 +595,7 @@ GetAppleBootLoadedImage ( // // Detect macOS by boot.efi in the bootloader name. // - PathLen = OcFileDevicePathNameLen (LastNode); + PathLen = FileDevicePathNameLen (LastNode); if (PathLen >= BootPathLen) { Index = PathLen - BootPathLen; IsMacOS = (Index == 0 || LastNode->PathName[Index - 1] == L'\\') diff --git a/MemoryFix/AptioMemoryFix/CustomSlide.c b/MemoryFix/AptioMemoryFix/CustomSlide.c index 3b3758076..24e564149 100644 --- a/MemoryFix/AptioMemoryFix/CustomSlide.c +++ b/MemoryFix/AptioMemoryFix/CustomSlide.c @@ -9,8 +9,8 @@ #include #include -#include -#include +#include +#include #include #include #include @@ -212,7 +212,7 @@ DecideOnCustomSlideImplementation ( ); if (Status != EFI_SUCCESS) { - OcPrintScreen (L"AMF: Failed to obtain memory map for KASLR - %r\n", Status); + Print (L"AMF: Failed to obtain memory map for KASLR - %r\n", Status); return; } @@ -302,28 +302,28 @@ DecideOnCustomSlideImplementation ( if (mValidSlidesNum != TOTAL_SLIDE_NUM) { if (mValidSlidesNum == 0) { - OcPrintScreen (L"AMF: No slide values are usable! Falling back to %d with 0x%08X bytes!\n", FallbackSlide, MaxAvailableSize); + Print (L"AMF: No slide values are usable! Falling back to %d with 0x%08X bytes!\n", FallbackSlide, MaxAvailableSize); mValidSlides[mValidSlidesNum++] = (UINT8)FallbackSlide; } else { // // Pretty-print valid slides as ranges. // For example, 1, 2, 3, 4, 5 will become 1-5. // - OcPrintScreen (L"AMF: Only %d/%d slide values are usable!\n", mValidSlidesNum, TOTAL_SLIDE_NUM); + Print (L"AMF: Only %d/%d slide values are usable!\n", mValidSlidesNum, TOTAL_SLIDE_NUM); NumEntries = 0; for (Index = 0; Index <= mValidSlidesNum; Index++) { if (Index == 0) { - OcPrintScreen (L"Valid slides: %d", mValidSlides[Index]); + Print (L"Valid slides: %d", mValidSlides[Index]); } else if (Index == mValidSlidesNum || mValidSlides[Index - 1] + 1 != mValidSlides[Index]) { if (NumEntries == 1) { - OcPrintScreen (L", %d", mValidSlides[Index - 1]); + Print (L", %d", mValidSlides[Index - 1]); } else if (NumEntries > 1) { - OcPrintScreen (L"-%d", mValidSlides[Index - 1]); + Print (L"-%d", mValidSlides[Index - 1]); } if (Index == mValidSlidesNum) { - OcPrintScreen (L"\n"); + Print (L"\n"); } else { - OcPrintScreen (L", %d", mValidSlides[Index]); + Print (L", %d", mValidSlides[Index]); } NumEntries = 0; } else { @@ -586,7 +586,7 @@ GetVariableCustomSlide ( ) { if (gMacOSBootNestedCount > 0 && VariableName && VendorGuid && DataSize && - CompareGuid (VendorGuid, &gAppleBootVariableGuid)) { + CompareGuid (VendorGuid, &gEfiAppleBootGuid)) { // // We override csr-active-config with CSR_ALLOW_UNRESTRICTED_NVRAM bit set // to allow one to pass a custom slide value even when SIP is on. diff --git a/MemoryFix/AptioMemoryFix/MemoryMap.c b/MemoryFix/AptioMemoryFix/MemoryMap.c index 204562f1a..ef0fdbad6 100644 --- a/MemoryFix/AptioMemoryFix/MemoryMap.c +++ b/MemoryFix/AptioMemoryFix/MemoryMap.c @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include #include #include @@ -180,15 +180,15 @@ PrintMemMap ( Desc = MemoryMap; NumEntries = MemoryMapSize / DescriptorSize; - OcPrintScreen (L"--- Dump Memory Map (%s) start ---\n", Name); - OcPrintScreen (L"MEMMAP: Size=%d, Addr=%p, DescSize=%d, Shims=%08lX, ST=%08lX\n", + Print (L"--- Dump Memory Map (%s) start ---\n", Name); + Print (L"MEMMAP: Size=%d, Addr=%p, DescSize=%d, Shims=%08lX, ST=%08lX\n", MemoryMapSize, MemoryMap, DescriptorSize, (UINTN)Shims, (UINTN)SysTable); - OcPrintScreen (L"Type Start End Virtual # Pages Attributes\n"); + Print (L"Type Start End Virtual # Pages Attributes\n"); for (Index = 0; Index < NumEntries; Index++) { Bytes = EFI_PAGES_TO_SIZE (Desc->NumberOfPages); - OcPrintScreen (L"%-9s %010lX %010lX %016lX %010lX %016lX\n", + Print (L"%-9s %010lX %010lX %016lX %010lX %016lX\n", mEfiMemoryTypeDesc[Desc->Type], Desc->PhysicalStart, Desc->PhysicalStart + Bytes - 1, @@ -206,7 +206,7 @@ PrintMemMap ( gBS->Stall (SECONDS_TO_MICROSECONDS (5)); } - OcPrintScreen (L"--- Dump Memory Map (%s) end ---\n", Name); + Print (L"--- Dump Memory Map (%s) end ---\n", Name); gBS->Stall (SECONDS_TO_MICROSECONDS (5)); EnableDynamicPoolAllocations (); diff --git a/MemoryFix/AptioMemoryFix/ServiceOverrides.c b/MemoryFix/AptioMemoryFix/ServiceOverrides.c index 33e2615d8..f937e53f0 100644 --- a/MemoryFix/AptioMemoryFix/ServiceOverrides.c +++ b/MemoryFix/AptioMemoryFix/ServiceOverrides.c @@ -11,7 +11,7 @@ #include #include -#include +#include #include #include #include @@ -110,7 +110,7 @@ InstallBsOverrides ( // This is undesired, but technically less fatal than attempting to reduce the number // of slides available when no memory map dumping is necessary, for example. // - OcPrintScreen (L"AMF: Not using custom memory pool - %r\n", Status); + Print (L"AMF: Not using custom memory pool - %r\n", Status); } } #endif @@ -243,14 +243,14 @@ MOStartImage ( // Starting with 10.13.6 boot-switch-vars is no longer supported. // ValueSize = 0; - if (gRT->GetVariable (L"boot-signature", &gAppleBootVariableGuid, NULL, &ValueSize, NULL) == EFI_BUFFER_TOO_SMALL) { + if (gRT->GetVariable (L"boot-signature", &gEfiAppleBootGuid, NULL, &ValueSize, NULL) == EFI_BUFFER_TOO_SMALL) { ValueSize = 0; - if (gRT->GetVariable (L"boot-image-key", &gAppleBootVariableGuid, NULL, &ValueSize, NULL) == EFI_BUFFER_TOO_SMALL) { + if (gRT->GetVariable (L"boot-image-key", &gEfiAppleBootGuid, NULL, &ValueSize, NULL) == EFI_BUFFER_TOO_SMALL) { gHibernateWake = TRUE; } } else { ValueSize = 0; - if (gRT->GetVariable (L"boot-switch-vars", &gAppleBootVariableGuid, NULL, &ValueSize, NULL) == EFI_BUFFER_TOO_SMALL) { + if (gRT->GetVariable (L"boot-switch-vars", &gEfiAppleBootGuid, NULL, &ValueSize, NULL) == EFI_BUFFER_TOO_SMALL) { gHibernateWake = TRUE; } } @@ -348,7 +348,7 @@ MOAllocatePages ( /** gBS->AllocatePool override: * Allows us to use a custom allocator that uses a preallocated memory pool - * for certain types of memory. See details in OcPrintScreen function. + * for certain types of memory. See details in Print function. */ EFI_STATUS EFIAPI @@ -481,7 +481,7 @@ MOExitBootServices ( // We need hibernate image address for wake // if (gHibernateWake && mHibernateImageAddress == 0) { - OcPrintScreen (L"AMF: Failed to find hibernate image address\n"); + Print (L"AMF: Failed to find hibernate image address\n"); gBS->Stall (SECONDS_TO_MICROSECONDS (5)); return EFI_INVALID_PARAMETER; } @@ -542,7 +542,7 @@ ForceExitBootServices ( // Just report error as var in nvram to be visible from macOS with "nvram -p" // gRT->SetVariable (L"aptiomemfix-exitbs", - &gAppleBootVariableGuid, + &gEfiAppleBootGuid, EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, 4, "fail" @@ -561,14 +561,14 @@ ForceExitBootServices ( // Status = ExitBs (ImageHandle, MapKey); if (EFI_ERROR (Status)) - OcPrintScreen (L"AMF: ExitBootServices failed twice - %r\n", Status); + Print (L"AMF: ExitBootServices failed twice - %r\n", Status); } else { - OcPrintScreen (L"AMF: Failed to get MapKey for ExitBootServices - %r\n", Status); + Print (L"AMF: Failed to get MapKey for ExitBootServices - %r\n", Status); Status = EFI_INVALID_PARAMETER; } if (EFI_ERROR (Status)) { - OcPrintScreen (L"Waiting 10 secs...\n"); + Print (L"Waiting 10 secs...\n"); gBS->Stall (SECONDS_TO_MICROSECONDS (10)); } } diff --git a/MemoryFix/AptioMemoryFix/VMem.c b/MemoryFix/AptioMemoryFix/VMem.c index 289d41429..c67bb8ed7 100644 --- a/MemoryFix/AptioMemoryFix/VMem.c +++ b/MemoryFix/AptioMemoryFix/VMem.c @@ -8,7 +8,7 @@ #include #include -#include +#include #include "Config.h" #include "VMem.h" @@ -293,7 +293,7 @@ VmAllocateMemoryPool ( Status = AllocatePagesFromTop (EfiBootServicesData, VmMemoryPoolFreePages, &Addr, FALSE); if (EFI_ERROR (Status)) { - OcPrintScreen (L"AMF: vm memory pool allocation failure - %r\n", Status); + Print (L"AMF: vm memory pool allocation failure - %r\n", Status); } else { VmMemoryPool = (UINT8*)Addr; DEBUG ((DEBUG_VERBOSE, "VmMemoryPool = %lx - %lx\n", VmMemoryPool, VmMemoryPool + EFI_PAGES_TO_SIZE(VmMemoryPoolFreePages) - 1)); diff --git a/MemoryFix/OsxAptioFixDrv/Lib.c b/MemoryFix/OsxAptioFixDrv/Lib.c index f52c80160..8faf829e2 100644 --- a/MemoryFix/OsxAptioFixDrv/Lib.c +++ b/MemoryFix/OsxAptioFixDrv/Lib.c @@ -80,15 +80,15 @@ EFI_GUID gVendorGuid = {0xe62111ab, 0xcf4d, 0x4137, {0x87, 0x5c, 0x88, 0xde, 0xe EFI_GUID gEfiConsoleControlProtocolGuid = {0xF42F7782, 0x012E, 0x4C12, {0x99, 0x56, 0x49, 0xF9, 0x43, 0x04, 0xF7, 0x21}}; -EFI_GUID gEfiAppleFirmwarePasswordProtocolGuid = {0x8FFEEB3A, 0x4C98, 0x4630, {0x80, 0x3F, 0x74, 0x0F, 0x95, 0x67, 0x09, 0x1D}}; +EFI_GUID gAppleFirmwarePasswordProtocolGuid = {0x8FFEEB3A, 0x4C98, 0x4630, {0x80, 0x3F, 0x74, 0x0F, 0x95, 0x67, 0x09, 0x1D}}; EFI_GUID gEfiGlobalVarGuid = {0x8BE4DF61, 0x93CA, 0x11D2, {0xAA, 0x0D, 0x00, 0xE0, 0x98, 0x03, 0x2B, 0x8C}}; EFI_GUID gDevicePropertiesGuid = {0x91BD12FE, 0xF6C3, 0x44FB, {0xA5, 0xB7, 0x51, 0x22, 0xAB, 0x30, 0x3A, 0xE0}}; EFI_GUID gEfiAppleBootGuid = {0x7C436110, 0xAB2A, 0x4BBB, {0xA8, 0x80, 0xFE, 0x41, 0x99, 0x5C, 0x9F, 0x82}}; EFI_GUID gEfiAppleNvramGuid = {0x4D1EDE05, 0x38C7, 0x4A6A, {0x9C, 0xC6, 0x4B, 0xCC, 0xA8, 0xB3, 0x8C, 0x14}}; -EFI_GUID gAppleScreenInfoProtocolGuid = {0xE316E100, 0x0751, 0x4C49, {0x90, 0x56, 0x48, 0x6C, 0x7E, 0x47, 0x29, 0x03}}; -EFI_GUID AppleBootKeyPressProtocolGuid = {0x5B213447, 0x6E73, 0x4901, {0xA4, 0xF1, 0xB8, 0x64, 0xF3, 0xB7, 0xA1, 0x72}}; -EFI_GUID AppleNetBootProtocolGuid = {0x78EE99FB, 0x6A5E, 0x4186, {0x97, 0xDE, 0xCD, 0x0A, 0xBA, 0x34, 0x5A, 0x74}}; -EFI_GUID AppleImageCodecProtocolGuid = {0x0DFCE9F6, 0xC4E3, 0x45EE, {0xA0, 0x6A, 0xA8, 0x61, 0x3B, 0x98, 0xA5, 0x07}}; +EFI_GUID gAppleFramebufferInfoProtocolGuid = {0xE316E100, 0x0751, 0x4C49, {0x90, 0x56, 0x48, 0x6C, 0x7E, 0x47, 0x29, 0x03}}; +EFI_GUID gAppleKeyStateProtocolGuid = {0x5B213447, 0x6E73, 0x4901, {0xA4, 0xF1, 0xB8, 0x64, 0xF3, 0xB7, 0xA1, 0x72}}; +EFI_GUID gAppleNetBootProtocolGuid = {0x78EE99FB, 0x6A5E, 0x4186, {0x97, 0xDE, 0xCD, 0x0A, 0xBA, 0x34, 0x5A, 0x74}}; +EFI_GUID gAppleImageCodecProtocolGuid = {0x0DFCE9F6, 0xC4E3, 0x45EE, {0xA0, 0x6A, 0xA8, 0x61, 0x3B, 0x98, 0xA5, 0x07}}; EFI_GUID gEfiAppleVendorGuid = {0xAC39C713, 0x7E50, 0x423D, {0x88, 0x9D, 0x27, 0x8F, 0xCC, 0x34, 0x22, 0xB6}}; EFI_GUID gAppleEFINVRAMTRBSecureGuid = {0xF68DA75E, 0x1B55, 0x4E70, {0xB4, 0x1B, 0xA7, 0xB7, 0xA5, 0xB7, 0x58, 0xEA}}; EFI_GUID gDataHubOptionsGuid = {0x0021001C, 0x3CE3, 0x41F8, {0x99, 0xC6, 0xEC, 0xF5, 0xDA, 0x75, 0x47, 0x31}}; @@ -116,15 +116,15 @@ MAP_EFI_GUID_STR EfiGuidStrMap[] = { {&gEfiGraphicsOutputProtocolGuid, L"gEfiGraphicsOutputProtocolGuid"}, {&gEfiConsoleControlProtocolGuid, L"gEfiConsoleControlProtocolGuid"}, - {&gEfiAppleFirmwarePasswordProtocolGuid, L"gEfiAppleFirmwarePasswordProtocolGuid"}, + {&gAppleFirmwarePasswordProtocolGuid, L"gAppleFirmwarePasswordProtocolGuid"}, {&gEfiGlobalVarGuid, L"gEfiGlobalVarGuid"}, {&gDevicePropertiesGuid, L"gDevicePropertiesGuid"}, {&gEfiAppleBootGuid, L"gEfiAppleBootGuid"}, {&gEfiAppleNvramGuid, L"gEfiAppleNvramGuid"}, - {&gAppleScreenInfoProtocolGuid, L"gAppleScreenInfoProtocolGuid"}, - {&AppleBootKeyPressProtocolGuid, L"AppleBootKeyPressProtocolGuid"}, - {&AppleNetBootProtocolGuid, L"AppleNetBootProtocolGuid"}, - {&AppleImageCodecProtocolGuid, L"AppleImageCodecProtocolGuid"}, + {&gAppleFramebufferInfoProtocolGuid, L"gAppleFramebufferInfoProtocolGuid"}, + {&gAppleKeyStateProtocolGuid, L"gAppleKeyStateProtocolGuid"}, + {&gAppleNetBootProtocolGuid, L"gAppleNetBootProtocolGuid"}, + {&gAppleImageCodecProtocolGuid, L"gAppleImageCodecProtocolGuid"}, {&gEfiAppleVendorGuid, L"gEfiAppleVendorGuid"}, {&gAppleEFINVRAMTRBSecureGuid, L"gAppleEFINVRAMTRBSecureGuid"}, {&gDataHubOptionsGuid, L"gDataHubOptionsGuid"}, diff --git a/MemoryFix/OsxLowMemFixDrv/Lib.c b/MemoryFix/OsxLowMemFixDrv/Lib.c index 40181620d..4e869cba0 100644 --- a/MemoryFix/OsxLowMemFixDrv/Lib.c +++ b/MemoryFix/OsxLowMemFixDrv/Lib.c @@ -80,15 +80,15 @@ EFI_GUID gVendorGuid = {0xe62111ab, 0xcf4d, 0x4137, {0x87, 0x5c, 0x88, 0xde, 0xe EFI_GUID gEfiConsoleControlProtocolGuid = {0xF42F7782, 0x012E, 0x4C12, {0x99, 0x56, 0x49, 0xF9, 0x43, 0x04, 0xF7, 0x21}}; -EFI_GUID gEfiAppleFirmwarePasswordProtocolGuid = {0x8FFEEB3A, 0x4C98, 0x4630, {0x80, 0x3F, 0x74, 0x0F, 0x95, 0x67, 0x09, 0x1D}}; +EFI_GUID gAppleFirmwarePasswordProtocolGuid = {0x8FFEEB3A, 0x4C98, 0x4630, {0x80, 0x3F, 0x74, 0x0F, 0x95, 0x67, 0x09, 0x1D}}; EFI_GUID gEfiGlobalVarGuid = {0x8BE4DF61, 0x93CA, 0x11D2, {0xAA, 0x0D, 0x00, 0xE0, 0x98, 0x03, 0x2B, 0x8C}}; EFI_GUID gDevicePropertiesGuid = {0x91BD12FE, 0xF6C3, 0x44FB, {0xA5, 0xB7, 0x51, 0x22, 0xAB, 0x30, 0x3A, 0xE0}}; EFI_GUID gEfiAppleBootGuid = {0x7C436110, 0xAB2A, 0x4BBB, {0xA8, 0x80, 0xFE, 0x41, 0x99, 0x5C, 0x9F, 0x82}}; EFI_GUID gEfiAppleNvramGuid = {0x4D1EDE05, 0x38C7, 0x4A6A, {0x9C, 0xC6, 0x4B, 0xCC, 0xA8, 0xB3, 0x8C, 0x14}}; -EFI_GUID gAppleScreenInfoProtocolGuid = {0xE316E100, 0x0751, 0x4C49, {0x90, 0x56, 0x48, 0x6C, 0x7E, 0x47, 0x29, 0x03}}; -EFI_GUID AppleBootKeyPressProtocolGuid = {0x5B213447, 0x6E73, 0x4901, {0xA4, 0xF1, 0xB8, 0x64, 0xF3, 0xB7, 0xA1, 0x72}}; -EFI_GUID AppleNetBootProtocolGuid = {0x78EE99FB, 0x6A5E, 0x4186, {0x97, 0xDE, 0xCD, 0x0A, 0xBA, 0x34, 0x5A, 0x74}}; -EFI_GUID AppleImageCodecProtocolGuid = {0x0DFCE9F6, 0xC4E3, 0x45EE, {0xA0, 0x6A, 0xA8, 0x61, 0x3B, 0x98, 0xA5, 0x07}}; +EFI_GUID gAppleFramebufferInfoProtocolGuid = {0xE316E100, 0x0751, 0x4C49, {0x90, 0x56, 0x48, 0x6C, 0x7E, 0x47, 0x29, 0x03}}; +EFI_GUID gAppleKeyStateProtocolGuid = {0x5B213447, 0x6E73, 0x4901, {0xA4, 0xF1, 0xB8, 0x64, 0xF3, 0xB7, 0xA1, 0x72}}; +EFI_GUID gAppleNetBootProtocolGuid = {0x78EE99FB, 0x6A5E, 0x4186, {0x97, 0xDE, 0xCD, 0x0A, 0xBA, 0x34, 0x5A, 0x74}}; +EFI_GUID gAppleImageCodecProtocolGuid = {0x0DFCE9F6, 0xC4E3, 0x45EE, {0xA0, 0x6A, 0xA8, 0x61, 0x3B, 0x98, 0xA5, 0x07}}; EFI_GUID gEfiAppleVendorGuid = {0xAC39C713, 0x7E50, 0x423D, {0x88, 0x9D, 0x27, 0x8F, 0xCC, 0x34, 0x22, 0xB6}}; EFI_GUID gAppleEFINVRAMTRBSecureGuid = {0xF68DA75E, 0x1B55, 0x4E70, {0xB4, 0x1B, 0xA7, 0xB7, 0xA5, 0xB7, 0x58, 0xEA}}; EFI_GUID gDataHubOptionsGuid = {0x0021001C, 0x3CE3, 0x41F8, {0x99, 0xC6, 0xEC, 0xF5, 0xDA, 0x75, 0x47, 0x31}}; @@ -116,15 +116,15 @@ MAP_EFI_GUID_STR EfiGuidStrMap[] = { {&gEfiGraphicsOutputProtocolGuid, L"gEfiGraphicsOutputProtocolGuid"}, {&gEfiConsoleControlProtocolGuid, L"gEfiConsoleControlProtocolGuid"}, - {&gEfiAppleFirmwarePasswordProtocolGuid, L"gEfiAppleFirmwarePasswordProtocolGuid"}, + {&gAppleFirmwarePasswordProtocolGuid, L"gAppleFirmwarePasswordProtocolGuid"}, {&gEfiGlobalVarGuid, L"gEfiGlobalVarGuid"}, {&gDevicePropertiesGuid, L"gDevicePropertiesGuid"}, {&gEfiAppleBootGuid, L"gEfiAppleBootGuid"}, {&gEfiAppleNvramGuid, L"gEfiAppleNvramGuid"}, - {&gAppleScreenInfoProtocolGuid, L"gAppleScreenInfoProtocolGuid"}, - {&AppleBootKeyPressProtocolGuid, L"AppleBootKeyPressProtocolGuid"}, - {&AppleNetBootProtocolGuid, L"AppleNetBootProtocolGuid"}, - {&AppleImageCodecProtocolGuid, L"AppleImageCodecProtocolGuid"}, + {&gAppleFramebufferInfoProtocolGuid, L"gAppleFramebufferInfoProtocolGuid"}, + {&gAppleKeyStateProtocolGuid, L"gAppleKeyStateProtocolGuid"}, + {&gAppleNetBootProtocolGuid, L"gAppleNetBootProtocolGuid"}, + {&gAppleImageCodecProtocolGuid, L"gAppleImageCodecProtocolGuid"}, {&gEfiAppleVendorGuid, L"gEfiAppleVendorGuid"}, {&gAppleEFINVRAMTRBSecureGuid, L"gAppleEFINVRAMTRBSecureGuid"}, {&gDataHubOptionsGuid, L"gDataHubOptionsGuid"}, @@ -697,4 +697,4 @@ AllocatePagesFromTop( FreePool(MemoryMap); return Status; -} \ No newline at end of file +} diff --git a/Protocols/AptioInputFix/Keycode/AIKTarget.c b/Protocols/AptioInputFix/Keycode/AIKTarget.c index fc55473d8..c4989f2bc 100644 --- a/Protocols/AptioInputFix/Keycode/AIKTarget.c +++ b/Protocols/AptioInputFix/Keycode/AIKTarget.c @@ -114,7 +114,7 @@ AIKTargetWriteEntry ( ) { APPLE_MODIFIER_MAP Modifiers; - APPLE_KEY_CODE Key; + APPLE_KEY Key; UINTN Index; UINTN InsertIndex; UINT64 OldestCounter; diff --git a/Protocols/AptioInputFix/Keycode/AIKTarget.h b/Protocols/AptioInputFix/Keycode/AIKTarget.h index 07b42775f..0f8572c25 100644 --- a/Protocols/AptioInputFix/Keycode/AIKTarget.h +++ b/Protocols/AptioInputFix/Keycode/AIKTarget.h @@ -68,7 +68,7 @@ typedef struct { // // Previously reported Apple active keys // - APPLE_KEY_CODE Keys[AIK_TARGET_BUFFER_SIZE]; + APPLE_KEY Keys[AIK_TARGET_BUFFER_SIZE]; // // Previously reported Apple key timestamps diff --git a/Protocols/AptioInputFix/Keycode/AIKTranslate.c b/Protocols/AptioInputFix/Keycode/AIKTranslate.c index c282c701d..735892b5a 100644 --- a/Protocols/AptioInputFix/Keycode/AIKTranslate.c +++ b/Protocols/AptioInputFix/Keycode/AIKTranslate.c @@ -157,7 +157,7 @@ VOID AIKTranslate ( IN AMI_EFI_KEY_DATA *KeyData, OUT APPLE_MODIFIER_MAP *Modifiers, - OUT APPLE_KEY_CODE *Key + OUT APPLE_KEY *Key ) { AIK_PS2KEY_TO_USB Ps2Key; diff --git a/Protocols/AptioInputFix/Keycode/AIKTranslate.h b/Protocols/AptioInputFix/Keycode/AIKTranslate.h index 7e0cae885..b75aa5ca7 100644 --- a/Protocols/AptioInputFix/Keycode/AIKTranslate.h +++ b/Protocols/AptioInputFix/Keycode/AIKTranslate.h @@ -127,7 +127,7 @@ VOID AIKTranslate ( IN AMI_EFI_KEY_DATA *KeyData, OUT APPLE_MODIFIER_MAP *Modifiers, - OUT APPLE_KEY_CODE *Key + OUT APPLE_KEY *Key ); #endif diff --git a/Protocols/DumpUefiCalls/Lib.c b/Protocols/DumpUefiCalls/Lib.c index a532865bb..161376ca9 100644 --- a/Protocols/DumpUefiCalls/Lib.c +++ b/Protocols/DumpUefiCalls/Lib.c @@ -84,8 +84,8 @@ EFI_GUID mEfiGlobalVariableGuid = {0x8BE4DF61, 0x93CA, 0x11D2, EFI_GUID mAppleDevicePropertyProtocolGuid = {0x91BD12FE, 0xF6C3, 0x44FB, {0xA5, 0xB7, 0x51, 0x22, 0xAB, 0x30, 0x3A, 0xE0}}; EFI_GUID mEfiAppleBootGuid = {0x7C436110, 0xAB2A, 0x4BBB, {0xA8, 0x80, 0xFE, 0x41, 0x99, 0x5C, 0x9F, 0x82}}; EFI_GUID mEfiAppleNvramGuid = {0x4D1EDE05, 0x38C7, 0x4A6A, {0x9C, 0xC6, 0x4B, 0xCC, 0xA8, 0xB3, 0x8C, 0x14}}; -EFI_GUID mAppleScreenInfoProtocolGuid = {0xE316E100, 0x0751, 0x4C49, {0x90, 0x56, 0x48, 0x6C, 0x7E, 0x47, 0x29, 0x03}}; -EFI_GUID mAppleBootKeyPressProtocolGuid = {0x5B213447, 0x6E73, 0x4901, {0xA4, 0xF1, 0xB8, 0x64, 0xF3, 0xB7, 0xA1, 0x72}}; +EFI_GUID mAppleFramebufferInfoProtocolGuid = {0xE316E100, 0x0751, 0x4C49, {0x90, 0x56, 0x48, 0x6C, 0x7E, 0x47, 0x29, 0x03}}; +EFI_GUID mAppleKeyStateProtocolGuid = {0x5B213447, 0x6E73, 0x4901, {0xA4, 0xF1, 0xB8, 0x64, 0xF3, 0xB7, 0xA1, 0x72}}; EFI_GUID mAppleNetBootProtocolGuid = {0x78EE99FB, 0x6A5E, 0x4186, {0x97, 0xDE, 0xCD, 0x0A, 0xBA, 0x34, 0x5A, 0x74}}; EFI_GUID mAppleImageCodecProtocolGuid = {0x0DFCE9F6, 0xC4E3, 0x45EE, {0xA0, 0x6A, 0xA8, 0x61, 0x3B, 0x98, 0xA5, 0x07}}; EFI_GUID mAppleEfiVendorGuid = {0xAC39C713, 0x7E50, 0x423D, {0x88, 0x9D, 0x27, 0x8F, 0xCC, 0x34, 0x22, 0xB6}}; @@ -251,8 +251,8 @@ MAP_EFI_GUID_STR EfiGuidStrMap[] = { {&mAppleDevicePropertyProtocolGuid, L"gAppleDevicePropertyProtocolGuid"}, {&mEfiAppleBootGuid, L"gEfiAppleBootGuid"}, {&mEfiAppleNvramGuid, L"gEfiAppleNvramGuid"}, - {&mAppleScreenInfoProtocolGuid, L"gAppleScreenInfoProtocolGuid"}, - {&mAppleBootKeyPressProtocolGuid, L"gAppleBootKeyPressProtocolGuid"}, + {&mAppleFramebufferInfoProtocolGuid, L"gAppleFramebufferInfoProtocolGuid"}, + {&mAppleKeyStateProtocolGuid, L"gAppleKeyStateProtocolGuid"}, {&mAppleNetBootProtocolGuid, L"gAppleNetBootProtocolGuid"}, {&mAppleImageCodecProtocolGuid, L"gAppleImageCodecProtocolGuid"}, {&mAppleEfiVendorGuid, L"gAppleEfiVendorGuid"}, diff --git a/Xcode/Clover/Clover.xcodeproj/project.pbxproj b/Xcode/Clover/Clover.xcodeproj/project.pbxproj index 1df71e073..8e6f2352c 100644 --- a/Xcode/Clover/Clover.xcodeproj/project.pbxproj +++ b/Xcode/Clover/Clover.xcodeproj/project.pbxproj @@ -7,9 +7,6 @@ objects = { /* Begin PBXBuildFile section */ - 123B399B200E76DD00DC2ED9 /* BootFixes3.c in Sources */ = {isa = PBXBuildFile; fileRef = 123B3999200E76DD00DC2ED9 /* BootFixes3.c */; }; - 123B399E200E76EA00DC2ED9 /* OsxAptioFix3Drv.c in Sources */ = {isa = PBXBuildFile; fileRef = 123B399C200E76EA00DC2ED9 /* OsxAptioFix3Drv.c */; }; - 123B39A1200E770100DC2ED9 /* RTShims.nasm in Sources */ = {isa = PBXBuildFile; fileRef = 123B39A0200E770100DC2ED9 /* RTShims.nasm */; }; 1288B5211A30CEFB007CBCEF /* Net.c in Sources */ = {isa = PBXBuildFile; fileRef = 1288B5201A30CEFB007CBCEF /* Net.c */; }; 12A60F5A1DB610500068BF8B /* AppleImageCodec.c in Sources */ = {isa = PBXBuildFile; fileRef = 12A60F4E1DB610500068BF8B /* AppleImageCodec.c */; }; 12A60F5B1DB610500068BF8B /* load_bmp.c in Sources */ = {isa = PBXBuildFile; fileRef = 12A60F501DB610500068BF8B /* load_bmp.c */; }; @@ -24,23 +21,6 @@ 12E3015A1D5A413A00EED426 /* lodepng.c in Sources */ = {isa = PBXBuildFile; fileRef = 12E301581D5A413A00EED426 /* lodepng.c */; }; 2C794E3F1A0AA85900D845B0 /* FSInject.c in Sources */ = {isa = PBXBuildFile; fileRef = 2C794CEA1A0AA85900D845B0 /* FSInject.c */; }; 2C794E401A0AA85900D845B0 /* Test.c in Sources */ = {isa = PBXBuildFile; fileRef = 2C794CF11A0AA85900D845B0 /* Test.c */; }; - 2C794E411A0AA85900D845B0 /* BootArgs.c in Sources */ = {isa = PBXBuildFile; fileRef = 2C794CF51A0AA85900D845B0 /* BootArgs.c */; }; - 2C794E421A0AA85900D845B0 /* BootFixes.c in Sources */ = {isa = PBXBuildFile; fileRef = 2C794CF71A0AA85900D845B0 /* BootFixes.c */; }; - 2C794E431A0AA85900D845B0 /* DecodedKernelCheck.c in Sources */ = {isa = PBXBuildFile; fileRef = 2C794CF91A0AA85900D845B0 /* DecodedKernelCheck.c */; }; - 2C794E441A0AA85900D845B0 /* device_tree.c in Sources */ = {isa = PBXBuildFile; fileRef = 2C794CFB1A0AA85900D845B0 /* device_tree.c */; }; - 2C794E451A0AA85900D845B0 /* Lib.c in Sources */ = {isa = PBXBuildFile; fileRef = 2C794CFF1A0AA85900D845B0 /* Lib.c */; }; - 2C794E461A0AA85900D845B0 /* Mach-O.c in Sources */ = {isa = PBXBuildFile; fileRef = 2C794D021A0AA85900D845B0 /* Mach-O.c */; }; - 2C794E471A0AA85900D845B0 /* NVRAMDebug.c in Sources */ = {isa = PBXBuildFile; fileRef = 2C794D061A0AA85900D845B0 /* NVRAMDebug.c */; }; - 2C794E481A0AA85900D845B0 /* OsxAptioFix2Drv.c in Sources */ = {isa = PBXBuildFile; fileRef = 2C794D081A0AA85900D845B0 /* OsxAptioFix2Drv.c */; }; - 2C794E491A0AA85900D845B0 /* OsxAptioFixDrv.c in Sources */ = {isa = PBXBuildFile; fileRef = 2C794D0A1A0AA85900D845B0 /* OsxAptioFixDrv.c */; }; - 2C794E4A1A0AA85900D845B0 /* VMem.c in Sources */ = {isa = PBXBuildFile; fileRef = 2C794D0C1A0AA85900D845B0 /* VMem.c */; }; - 2C794E4B1A0AA85900D845B0 /* AsmFuncsX64.asm in Sources */ = {isa = PBXBuildFile; fileRef = 2C794D0E1A0AA85900D845B0 /* AsmFuncsX64.asm */; }; - 2C794E4C1A0AA85900D845B0 /* AsmFuncsX64.nasm in Sources */ = {isa = PBXBuildFile; fileRef = 2C794D0F1A0AA85900D845B0 /* AsmFuncsX64.nasm */; }; - 2C794E4D1A0AA85900D845B0 /* AsmFuncsX64.S in Sources */ = {isa = PBXBuildFile; fileRef = 2C794D101A0AA85900D845B0 /* AsmFuncsX64.S */; }; - 2C794E4E1A0AA85900D845B0 /* TestAsm32.asm in Sources */ = {isa = PBXBuildFile; fileRef = 2C794D111A0AA85900D845B0 /* TestAsm32.asm */; }; - 2C794E501A0AA85900D845B0 /* Lib.c in Sources */ = {isa = PBXBuildFile; fileRef = 2C794D181A0AA85900D845B0 /* Lib.c */; }; - 2C794E511A0AA85900D845B0 /* NVRAMDebug.c in Sources */ = {isa = PBXBuildFile; fileRef = 2C794D1A1A0AA85900D845B0 /* NVRAMDebug.c */; }; - 2C794E521A0AA85900D845B0 /* OsxLowMemFixDrv.c in Sources */ = {isa = PBXBuildFile; fileRef = 2C794D1C1A0AA85900D845B0 /* OsxLowMemFixDrv.c */; }; A5582AFD21019EA6002CFB6E /* VectorGraphics.c in Sources */ = {isa = PBXBuildFile; fileRef = A5582AFC21019EA6002CFB6E /* VectorGraphics.c */; }; A5603D0421F04ECE005F400E /* sound.c in Sources */ = {isa = PBXBuildFile; fileRef = A5603D0321F04ECE005F400E /* sound.c */; }; A5611B3421DCBA53008FDB96 /* StartupSound.c in Sources */ = {isa = PBXBuildFile; fileRef = A5611B3321DCBA53008FDB96 /* StartupSound.c */; }; @@ -66,12 +46,6 @@ 12098EC21DC76858008B4AC3 /* hda.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = hda.c; sourceTree = ""; }; 12098EC31DC76858008B4AC3 /* hda.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = hda.h; sourceTree = ""; }; 12344F581CAB9A5700318A6E /* AppleSmBios.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppleSmBios.h; sourceTree = ""; }; - 123B3999200E76DD00DC2ED9 /* BootFixes3.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = BootFixes3.c; sourceTree = ""; }; - 123B399A200E76DD00DC2ED9 /* BootFixes3.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BootFixes3.h; sourceTree = ""; }; - 123B399C200E76EA00DC2ED9 /* OsxAptioFix3Drv.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = OsxAptioFix3Drv.c; sourceTree = ""; }; - 123B399D200E76EA00DC2ED9 /* OsxAptioFix3Drv.inf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = OsxAptioFix3Drv.inf; sourceTree = ""; }; - 123B399F200E76F600DC2ED9 /* RTShims.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RTShims.h; sourceTree = ""; }; - 123B39A0200E770100DC2ED9 /* RTShims.nasm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.nasm; path = RTShims.nasm; sourceTree = ""; }; 1261513A1A15BBB000903E7B /* bootscreen.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = bootscreen.c; sourceTree = ""; }; 1261513B1A15BBB000903E7B /* common.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = common.c; sourceTree = ""; }; 1261513C1A15BBB000903E7B /* entry_scan.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = entry_scan.h; sourceTree = ""; }; @@ -829,7 +803,6 @@ 12C874D01DE42A4900BF4974 /* ebuild.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; name = ebuild.sh; path = ../../ebuild.sh; sourceTree = ""; }; 12E301581D5A413A00EED426 /* lodepng.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = lodepng.c; sourceTree = ""; }; 12E301591D5A413A00EED426 /* lodepng.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lodepng.h; sourceTree = ""; }; - 12E94D32213EF04A00D1F644 /* AppleKeyFeeder */ = {isa = PBXFileReference; lastKnownFileType = folder; path = AppleKeyFeeder; sourceTree = ""; }; 12EA7C221E65FC3D00085A48 /* HashServiceFix.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = HashServiceFix.c; sourceTree = ""; }; 12EA7C231E65FC3D00085A48 /* HashServiceFix.inf */ = {isa = PBXFileReference; lastKnownFileType = text; path = HashServiceFix.inf; sourceTree = ""; }; 12EA7C241E65FC3D00085A48 /* sha1.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = sha1.c; sourceTree = ""; }; @@ -874,40 +847,6 @@ 2C794CEE1A0AA85900D845B0 /* FSInjectProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FSInjectProtocol.h; sourceTree = ""; }; 2C794CF11A0AA85900D845B0 /* Test.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = Test.c; sourceTree = ""; }; 2C794CF21A0AA85900D845B0 /* Test.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Test.h; sourceTree = ""; }; - 2C794CF41A0AA85900D845B0 /* AsmFuncs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AsmFuncs.h; sourceTree = ""; }; - 2C794CF51A0AA85900D845B0 /* BootArgs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = BootArgs.c; sourceTree = ""; }; - 2C794CF61A0AA85900D845B0 /* BootArgs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BootArgs.h; sourceTree = ""; }; - 2C794CF71A0AA85900D845B0 /* BootFixes.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = BootFixes.c; sourceTree = ""; }; - 2C794CF81A0AA85900D845B0 /* BootFixes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BootFixes.h; sourceTree = ""; }; - 2C794CF91A0AA85900D845B0 /* DecodedKernelCheck.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = DecodedKernelCheck.c; sourceTree = ""; }; - 2C794CFA1A0AA85900D845B0 /* DecodedKernelCheck.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DecodedKernelCheck.h; sourceTree = ""; }; - 2C794CFB1A0AA85900D845B0 /* device_tree.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = device_tree.c; sourceTree = ""; }; - 2C794CFC1A0AA85900D845B0 /* device_tree.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = device_tree.h; sourceTree = ""; }; - 2C794CFE1A0AA85900D845B0 /* Hibernate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Hibernate.h; sourceTree = ""; }; - 2C794CFF1A0AA85900D845B0 /* Lib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = Lib.c; sourceTree = ""; }; - 2C794D001A0AA85900D845B0 /* Lib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Lib.h; sourceTree = ""; }; - 2C794D011A0AA85900D845B0 /* loader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = loader.h; sourceTree = ""; }; - 2C794D021A0AA85900D845B0 /* Mach-O.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "Mach-O.c"; sourceTree = ""; }; - 2C794D031A0AA85900D845B0 /* Mach-O.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Mach-O.h"; sourceTree = ""; }; - 2C794D041A0AA85900D845B0 /* UefiLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UefiLoader.h; sourceTree = ""; }; - 2C794D061A0AA85900D845B0 /* NVRAMDebug.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = NVRAMDebug.c; sourceTree = ""; }; - 2C794D071A0AA85900D845B0 /* NVRAMDebug.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NVRAMDebug.h; sourceTree = ""; }; - 2C794D081A0AA85900D845B0 /* OsxAptioFix2Drv.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = OsxAptioFix2Drv.c; sourceTree = ""; }; - 2C794D091A0AA85900D845B0 /* OsxAptioFix2Drv.inf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = OsxAptioFix2Drv.inf; sourceTree = ""; }; - 2C794D0A1A0AA85900D845B0 /* OsxAptioFixDrv.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = OsxAptioFixDrv.c; sourceTree = ""; }; - 2C794D0B1A0AA85900D845B0 /* OsxAptioFixDrv.inf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = OsxAptioFixDrv.inf; sourceTree = ""; }; - 2C794D0C1A0AA85900D845B0 /* VMem.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = VMem.c; sourceTree = ""; }; - 2C794D0D1A0AA85900D845B0 /* VMem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VMem.h; sourceTree = ""; }; - 2C794D0E1A0AA85900D845B0 /* AsmFuncsX64.asm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm.asm; path = AsmFuncsX64.asm; sourceTree = ""; }; - 2C794D0F1A0AA85900D845B0 /* AsmFuncsX64.nasm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.nasm; path = AsmFuncsX64.nasm; sourceTree = ""; }; - 2C794D101A0AA85900D845B0 /* AsmFuncsX64.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = AsmFuncsX64.S; sourceTree = ""; }; - 2C794D111A0AA85900D845B0 /* TestAsm32.asm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm.asm; path = TestAsm32.asm; sourceTree = ""; }; - 2C794D181A0AA85900D845B0 /* Lib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = Lib.c; sourceTree = ""; }; - 2C794D191A0AA85900D845B0 /* Lib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Lib.h; sourceTree = ""; }; - 2C794D1A1A0AA85900D845B0 /* NVRAMDebug.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = NVRAMDebug.c; sourceTree = ""; }; - 2C794D1B1A0AA85900D845B0 /* NVRAMDebug.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NVRAMDebug.h; sourceTree = ""; }; - 2C794D1C1A0AA85900D845B0 /* OsxLowMemFixDrv.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = OsxLowMemFixDrv.c; sourceTree = ""; }; - 2C794D1D1A0AA85900D845B0 /* OsxLowMemFixDrv.inf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = OsxLowMemFixDrv.inf; sourceTree = ""; }; A51C783321E00504001385A7 /* WaveLib.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = WaveLib.c; sourceTree = ""; }; A51C783421E00504001385A7 /* WaveLib.inf */ = {isa = PBXFileReference; lastKnownFileType = text; path = WaveLib.inf; sourceTree = ""; }; A51C783621E0981C001385A7 /* AudioDxe.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = AudioDxe.c; sourceTree = ""; }; @@ -6103,6 +6042,125 @@ A5BF392820D9F18C004340E1 /* nanosvg.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = nanosvg.h; sourceTree = ""; }; A5BF392920D9F18C004340E1 /* nanosvgrast.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = nanosvgrast.c; sourceTree = ""; }; A5BF392A20D9F18C004340E1 /* nanosvg.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = nanosvg.c; sourceTree = ""; }; + A5E283D12347AE550068ED34 /* MemoryMap.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = MemoryMap.c; sourceTree = ""; }; + A5E283D22347AE550068ED34 /* ServiceOverrides.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ServiceOverrides.h; sourceTree = ""; }; + A5E283D32347AE550068ED34 /* BootFixes.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = BootFixes.c; sourceTree = ""; }; + A5E283D42347AE550068ED34 /* CustomSlide.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = CustomSlide.c; sourceTree = ""; }; + A5E283D52347AE550068ED34 /* RtShims.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = RtShims.c; sourceTree = ""; }; + A5E283D62347AE550068ED34 /* AptioMemoryFix.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = AptioMemoryFix.c; sourceTree = ""; }; + A5E283D72347AE550068ED34 /* Config.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Config.h; sourceTree = ""; }; + A5E283D92347AE550068ED34 /* AsmRtShims.nasm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.nasm; path = AsmRtShims.nasm; sourceTree = ""; }; + A5E283DA2347AE550068ED34 /* AsmFuncs.nasm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.nasm; path = AsmFuncs.nasm; sourceTree = ""; }; + A5E283DB2347AE550068ED34 /* VMem.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = VMem.c; sourceTree = ""; }; + A5E283DC2347AE550068ED34 /* BootArgs.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BootArgs.h; sourceTree = ""; }; + A5E283DD2347AE550068ED34 /* AsmFuncs.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AsmFuncs.h; sourceTree = ""; }; + A5E283DE2347AE550068ED34 /* BootFixes.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BootFixes.h; sourceTree = ""; }; + A5E283DF2347AE550068ED34 /* ServiceOverrides.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = ServiceOverrides.c; sourceTree = ""; }; + A5E283E02347AE550068ED34 /* AptioMemoryFix.inf */ = {isa = PBXFileReference; lastKnownFileType = text; path = AptioMemoryFix.inf; sourceTree = ""; }; + A5E283E12347AE550068ED34 /* MemoryMap.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MemoryMap.h; sourceTree = ""; }; + A5E283E32347AE550068ED34 /* UmmMalloc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = UmmMalloc.h; sourceTree = ""; }; + A5E283E42347AE550068ED34 /* UmmMalloc.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = UmmMalloc.c; sourceTree = ""; }; + A5E283E52347AE550068ED34 /* RtShims.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RtShims.h; sourceTree = ""; }; + A5E283E62347AE550068ED34 /* CustomSlide.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CustomSlide.h; sourceTree = ""; }; + A5E283E72347AE550068ED34 /* AptioFixPkg.dec */ = {isa = PBXFileReference; lastKnownFileType = text; path = AptioFixPkg.dec; sourceTree = ""; }; + A5E283E82347AE550068ED34 /* BootArgs.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = BootArgs.c; sourceTree = ""; }; + A5E283E92347AE550068ED34 /* VMem.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VMem.h; sourceTree = ""; }; + A5E283EB2347AE550068ED34 /* Hibernate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Hibernate.h; sourceTree = ""; }; + A5E283EC2347AE550068ED34 /* OsxAptioFix3Drv.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = OsxAptioFix3Drv.c; sourceTree = ""; }; + A5E283ED2347AE550068ED34 /* BootFixes.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = BootFixes.c; sourceTree = ""; }; + A5E283EE2347AE550068ED34 /* OsxAptioFixDrv.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = OsxAptioFixDrv.c; sourceTree = ""; }; + A5E283EF2347AE550068ED34 /* Lib.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = Lib.c; sourceTree = ""; }; + A5E283F02347AE550068ED34 /* OsxAptioFix2Drv.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = OsxAptioFix2Drv.c; sourceTree = ""; }; + A5E283F12347AE550068ED34 /* NVRAMDebug.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = NVRAMDebug.c; sourceTree = ""; }; + A5E283F22347AE550068ED34 /* OsxAptioFix3Drv.inf */ = {isa = PBXFileReference; lastKnownFileType = text; path = OsxAptioFix3Drv.inf; sourceTree = ""; }; + A5E283F42347AE550068ED34 /* AsmFuncsX64.nasm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.nasm; path = AsmFuncsX64.nasm; sourceTree = ""; }; + A5E283F52347AE550068ED34 /* TestAsm32.asm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm.asm; path = TestAsm32.asm; sourceTree = ""; }; + A5E283F62347AE550068ED34 /* AsmFuncsX64.asm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm.asm; path = AsmFuncsX64.asm; sourceTree = ""; }; + A5E283F72347AE550068ED34 /* RTShims.nasm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.nasm; path = RTShims.nasm; sourceTree = ""; }; + A5E283F82347AE550068ED34 /* AsmFuncsX64.S */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = AsmFuncsX64.S; sourceTree = ""; }; + A5E283F92347AE550068ED34 /* DecodedKernelCheck.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DecodedKernelCheck.h; sourceTree = ""; }; + A5E283FA2347AE550068ED34 /* OsxAptioFixDrv.inf */ = {isa = PBXFileReference; lastKnownFileType = text; path = OsxAptioFixDrv.inf; sourceTree = ""; }; + A5E283FB2347AE550068ED34 /* BootFixes3.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = BootFixes3.c; sourceTree = ""; }; + A5E283FC2347AE550068ED34 /* VMem.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = VMem.c; sourceTree = ""; }; + A5E283FD2347AE550068ED34 /* BootArgs.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BootArgs.h; sourceTree = ""; }; + A5E283FE2347AE550068ED34 /* AsmFuncs.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AsmFuncs.h; sourceTree = ""; }; + A5E283FF2347AE550068ED34 /* Lib.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Lib.h; sourceTree = ""; }; + A5E284002347AE550068ED34 /* BootFixes.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BootFixes.h; sourceTree = ""; }; + A5E284012347AE550068ED34 /* OsxAptioFix2Drv.inf */ = {isa = PBXFileReference; lastKnownFileType = text; path = OsxAptioFix2Drv.inf; sourceTree = ""; }; + A5E284022347AE550068ED34 /* RTShims.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RTShims.h; sourceTree = ""; }; + A5E284032347AE550068ED34 /* NVRAMDebug.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NVRAMDebug.h; sourceTree = ""; }; + A5E284052347AE550068ED34 /* Mach-O.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "Mach-O.c"; sourceTree = ""; }; + A5E284062347AE550068ED34 /* loader.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = loader.h; sourceTree = ""; }; + A5E284072347AE550068ED34 /* Mach-O.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Mach-O.h"; sourceTree = ""; }; + A5E284082347AE550068ED34 /* UefiLoader.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = UefiLoader.h; sourceTree = ""; }; + A5E284092347AE550068ED34 /* DecodedKernelCheck.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = DecodedKernelCheck.c; sourceTree = ""; }; + A5E2840B2347AE550068ED34 /* device_tree.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = device_tree.h; sourceTree = ""; }; + A5E2840C2347AE550068ED34 /* device_tree.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = device_tree.c; sourceTree = ""; }; + A5E2840D2347AE550068ED34 /* BootArgs.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = BootArgs.c; sourceTree = ""; }; + A5E2840E2347AE550068ED34 /* VMem.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VMem.h; sourceTree = ""; }; + A5E2840F2347AE550068ED34 /* BootFixes3.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BootFixes3.h; sourceTree = ""; }; + A5E284112347AE550068ED34 /* Lib.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = Lib.c; sourceTree = ""; }; + A5E284122347AE550068ED34 /* NVRAMDebug.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = NVRAMDebug.c; sourceTree = ""; }; + A5E284132347AE550068ED34 /* Lib.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Lib.h; sourceTree = ""; }; + A5E284142347AE550068ED34 /* OsxLowMemFixDrv.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = OsxLowMemFixDrv.c; sourceTree = ""; }; + A5E284152347AE550068ED34 /* OsxLowMemFixDrv.inf */ = {isa = PBXFileReference; lastKnownFileType = text; path = OsxLowMemFixDrv.inf; sourceTree = ""; }; + A5E284162347AE550068ED34 /* NVRAMDebug.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NVRAMDebug.h; sourceTree = ""; }; + A5E284182347AE760068ED34 /* SimpleTextExProxy.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SimpleTextExProxy.h; sourceTree = ""; }; + A5E284192347AE760068ED34 /* SimpleTextProxy.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SimpleTextProxy.c; sourceTree = ""; }; + A5E2841A2347AE760068ED34 /* AppleKeyFeeder.inf */ = {isa = PBXFileReference; lastKnownFileType = text; path = AppleKeyFeeder.inf; sourceTree = ""; }; + A5E2841B2347AE760068ED34 /* AppleKeyMapUtils.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = AppleKeyMapUtils.c; sourceTree = ""; }; + A5E2841C2347AE760068ED34 /* SimpleTextProxy.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SimpleTextProxy.h; sourceTree = ""; }; + A5E2841D2347AE760068ED34 /* AppleKeyFeeder.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = AppleKeyFeeder.c; sourceTree = ""; }; + A5E2841E2347AE760068ED34 /* SimpleTextExProxy.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SimpleTextExProxy.c; sourceTree = ""; }; + A5E2841F2347AE760068ED34 /* AppleKeyMapUtils.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppleKeyMapUtils.h; sourceTree = ""; }; + A5E284222347AE900068ED34 /* AppleHid.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = AppleHid.txt; sourceTree = ""; }; + A5E284232347AE900068ED34 /* AIKSource.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AIKSource.h; sourceTree = ""; }; + A5E284242347AE900068ED34 /* AIK.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AIK.h; sourceTree = ""; }; + A5E284252347AE900068ED34 /* AIKTarget.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = AIKTarget.c; sourceTree = ""; }; + A5E284262347AE900068ED34 /* AIKShim.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = AIKShim.c; sourceTree = ""; }; + A5E284272347AE900068ED34 /* AIKTranslate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AIKTranslate.h; sourceTree = ""; }; + A5E284282347AE900068ED34 /* AIKData.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AIKData.h; sourceTree = ""; }; + A5E284292347AE900068ED34 /* AIKMap.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = AIKMap.c; sourceTree = ""; }; + A5E2842A2347AE900068ED34 /* AIK.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = AIK.c; sourceTree = ""; }; + A5E2842B2347AE900068ED34 /* AIKSource.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = AIKSource.c; sourceTree = ""; }; + A5E2842C2347AE900068ED34 /* AIKTranslate.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = AIKTranslate.c; sourceTree = ""; }; + A5E2842D2347AE900068ED34 /* AIKTarget.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AIKTarget.h; sourceTree = ""; }; + A5E2842E2347AE900068ED34 /* AIKShim.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AIKShim.h; sourceTree = ""; }; + A5E2842F2347AE900068ED34 /* AIKData.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = AIKData.c; sourceTree = ""; }; + A5E284302347AE900068ED34 /* AptioInput.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = AptioInput.c; sourceTree = ""; }; + A5E284322347AE900068ED34 /* AIT.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AIT.h; sourceTree = ""; }; + A5E284332347AE900068ED34 /* AIT.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = AIT.c; sourceTree = ""; }; + A5E284352347AE900068ED34 /* AIM.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = AIM.c; sourceTree = ""; }; + A5E284362347AE900068ED34 /* AIM.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AIM.h; sourceTree = ""; }; + A5E284372347AE900068ED34 /* AptioInputFix.inf */ = {isa = PBXFileReference; lastKnownFileType = text; path = AptioInputFix.inf; sourceTree = ""; }; + A5E284392347AEDF0068ED34 /* MachoLib.inf */ = {isa = PBXFileReference; lastKnownFileType = text; path = MachoLib.inf; sourceTree = ""; }; + A5E2843A2347AEDF0068ED34 /* MachoLibInternal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MachoLibInternal.h; sourceTree = ""; }; + A5E2843B2347AEDF0068ED34 /* Header.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = Header.c; sourceTree = ""; }; + A5E2843C2347AEDF0068ED34 /* Symbols.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = Symbols.c; sourceTree = ""; }; + A5E2843D2347AEDF0068ED34 /* Relocations.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = Relocations.c; sourceTree = ""; }; + A5E2843E2347AEDF0068ED34 /* CxxSymbols.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = CxxSymbols.c; sourceTree = ""; }; + A5E284402347AEE80068ED34 /* Canary.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = Canary.c; sourceTree = ""; }; + A5E284412347AEE80068ED34 /* Ubsan.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Ubsan.h; sourceTree = ""; }; + A5E284422347AEE80068ED34 /* UbsanPrintf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = UbsanPrintf.c; sourceTree = ""; }; + A5E284432347AEE80068ED34 /* OcGuardLib.inf */ = {isa = PBXFileReference; lastKnownFileType = text; path = OcGuardLib.inf; sourceTree = ""; }; + A5E284442347AEE80068ED34 /* BitOverflow.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = BitOverflow.c; sourceTree = ""; }; + A5E284452347AEE80068ED34 /* TripleOverflow.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = TripleOverflow.c; sourceTree = ""; }; + A5E284462347AEE80068ED34 /* Ubsan.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = Ubsan.c; sourceTree = ""; }; + A5E284472347AEE80068ED34 /* NativeOverflow.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = NativeOverflow.c; sourceTree = ""; }; + A5E284482347AF2E0068ED34 /* AppleFatBinaryImage.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppleFatBinaryImage.h; sourceTree = ""; }; + A5E284492347AF380068ED34 /* AppleMachoImage.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppleMachoImage.h; sourceTree = ""; }; + A5E2844A2347AF590068ED34 /* MachoLib.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MachoLib.h; sourceTree = ""; }; + A5E2844B2347AF870068ED34 /* AmiPointer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AmiPointer.h; sourceTree = ""; }; + A5E2844C2347AF880068ED34 /* AmiKeycode.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AmiKeycode.h; sourceTree = ""; }; + A5E2844D2347AF9F0068ED34 /* AptioMemoryFix.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AptioMemoryFix.h; sourceTree = ""; }; + A5E2844E2347AFC70068ED34 /* NullTextOutput.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NullTextOutput.h; sourceTree = ""; }; + A5E284522347DB780068ED34 /* DeviceTreeLib.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = DeviceTreeLib.c; sourceTree = ""; }; + A5E284532347DB780068ED34 /* DeviceTreeLib.inf */ = {isa = PBXFileReference; lastKnownFileType = text; path = DeviceTreeLib.inf; sourceTree = ""; }; + A5E284542347DC020068ED34 /* DeviceTreeLib.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DeviceTreeLib.h; sourceTree = ""; }; + A5E284552347DC1C0068ED34 /* OcGuardLib.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OcGuardLib.h; sourceTree = ""; }; + A5E284562347DC1C0068ED34 /* OcStringLib.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OcStringLib.h; sourceTree = ""; }; + A5E284572347DC1D0068ED34 /* OcMiscLib.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OcMiscLib.h; sourceTree = ""; }; + A5E284582347E1FE0068ED34 /* OcVariables.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OcVariables.h; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -6290,8 +6348,9 @@ children = ( 12A60F4D1DB610500068BF8B /* AppleImageCodec */, 12AAF5F11DC0F03B00A52B12 /* AppleKeyAggregator */, - 12E94D32213EF04A00D1F644 /* AppleKeyFeeder */, + A5E284172347AE760068ED34 /* AppleKeyFeeder */, 12AAF5051DBE167600A52B12 /* AppleUITheme */, + A5E284202347AE900068ED34 /* AptioInputFix */, 12AAF3C41DB7743E00A52B12 /* DriverOverride */, 12AAF3C71DB7744B00A52B12 /* DumpUefiCalls */, 12AAF3E01DB7745A00A52B12 /* EmuVariableUefi */, @@ -6428,11 +6487,14 @@ 12C865541DE426F600BF4974 /* Library */ = { isa = PBXGroup; children = ( + A5E284512347DB780068ED34 /* DeviceTreeLib */, 12C865551DE426F600BF4974 /* DuetTimerLib */, 12C865581DE426F600BF4974 /* GenericBdsLib */, 12C865641DE426F600BF4974 /* IntrinsicLib */, 12C865681DE426F600BF4974 /* LzmaCustomDecompressLib */, + A5E284382347AEDF0068ED34 /* MachoLib */, 12C8657C1DE426F700BF4974 /* MemLogLibDefault */, + A5E2843F2347AEE80068ED34 /* OcGuardLib */, 12C86AB61DE426F800BF4974 /* OsxBdsPlatformLib */, 12C86ABC1DE426F800BF4974 /* UefiHiiServicesLib */, 12C86ABF1DE426F800BF4974 /* VBoxPeCoffLib */, @@ -7913,6 +7975,7 @@ 2C794ABC1A0AA85900D845B0 /* DxeCoreFileName.h */, 2C794ABD1A0AA85900D845B0 /* FlashMapHob.h */, 2C794ABE1A0AA85900D845B0 /* LdrMemoryDescriptor.h */, + A5E284582347E1FE0068ED34 /* OcVariables.h */, 2C794ABF1A0AA85900D845B0 /* PciExpressBaseAddress.h */, 2C794AC01A0AA85900D845B0 /* PciOptionRomTable.h */, ); @@ -7922,8 +7985,10 @@ 2C794AC91A0AA85900D845B0 /* IndustryStandard */ = { isa = PBXGroup; children = ( + A5E284482347AF2E0068ED34 /* AppleFatBinaryImage.h */, A51F63C822DFB7E300086DB7 /* AppleFeatures.h */, 12AAF55C1DBE447200A52B12 /* AppleHid.h */, + A5E284492347AF380068ED34 /* AppleMachoImage.h */, 12344F581CAB9A5700318A6E /* AppleSmBios.h */, 2C794AC21A0AA85900D845B0 /* AtomBios.h */, A51C784921E0C280001385A7 /* HdaCodec.h */, @@ -7941,17 +8006,22 @@ 2C794AD11A0AA85900D845B0 /* Library */ = { isa = PBXGroup; children = ( + A5E284542347DC020068ED34 /* DeviceTreeLib.h */, 2C794ACA1A0AA85900D845B0 /* GenericBdsLib.h */, A5611B2B21DCB9A0008FDB96 /* HdaModels.h */, A5611B2D21DCB9A0008FDB96 /* HdaRegisters.h */, A5611B2E21DCB9A0008FDB96 /* HdaVerbs.h */, - A5611B2C21DCB9A0008FDB96 /* WaveLib.h */, + A5E2844A2347AF590068ED34 /* MachoLib.h */, 2C794ACB1A0AA85900D845B0 /* MemLogLib.h */, + A5E284552347DC1C0068ED34 /* OcGuardLib.h */, + A5E284572347DC1D0068ED34 /* OcMiscLib.h */, + A5E284562347DC1C0068ED34 /* OcStringLib.h */, 2C794ACC1A0AA85900D845B0 /* PeCoffLib.h */, 2C794ACD1A0AA85900D845B0 /* UefiHiiServicesLib.h */, 2C794ACE1A0AA85900D845B0 /* UsbMass.h */, 2C794ACF1A0AA85900D845B0 /* UsbMassBoot.h */, 2C794AD01A0AA85900D845B0 /* VideoBiosPatchLib.h */, + A5611B2C21DCB9A0008FDB96 /* WaveLib.h */, ); path = Library; sourceTree = ""; @@ -7959,6 +8029,8 @@ 2C794ADC1A0AA85900D845B0 /* Protocol */ = { isa = PBXGroup; children = ( + A5E2844C2347AF880068ED34 /* AmiKeycode.h */, + A5E2844B2347AF870068ED34 /* AmiPointer.h */, A51F63CA22DFB84500086DB7 /* ApfsEfiBootRecordInfo.h */, 2C794AD21A0AA85900D845B0 /* AppleDeviceControl.h */, 2C794AD31A0AA85900D845B0 /* AppleDiskIo.h */, @@ -7970,16 +8042,18 @@ A51F63CB22DFB86F00086DB7 /* ApplePartitionInfo.h */, 12AAF5601DBE44AD00A52B12 /* ApplePlatformInfoDatabase.h */, 2C794AD51A0AA85900D845B0 /* AppleSMC.h */, + A5E2844D2347AF9F0068ED34 /* AptioMemoryFix.h */, A5611B2F21DCB9BA008FDB96 /* AudioIo.h */, 2C794AD61A0AA85900D845B0 /* efiConsoleControl.h */, 2C794AD71A0AA85900D845B0 /* EmuVariableControl.h */, + 2C794AD81A0AA85900D845B0 /* FSInjectProtocol.h */, 12AAF5611DBE44BC00A52B12 /* Hash.h */, A5611B3021DCB9CD008FDB96 /* HdaCodecInfo.h */, A5611B3121DCB9CD008FDB96 /* HdaControllerInfo.h */, A5611B3221DCB9CE008FDB96 /* HdaIo.h */, - 2C794AD81A0AA85900D845B0 /* FSInjectProtocol.h */, 12AAF5621DBE44C500A52B12 /* KeyboardInfo.h */, 2C794AD91A0AA85900D845B0 /* MsgLog.h */, + A5E2844E2347AFC70068ED34 /* NullTextOutput.h */, 12676CCE1DB5624B00CFC57E /* OSInfo.h */, 2C794ADA1A0AA85900D845B0 /* PciIoImp.h */, 12B804401DD3295400F955DF /* SimpleAudioOut.h */, @@ -8035,92 +8109,11 @@ path = ../../FSInject; sourceTree = ""; }; - 2C794CFD1A0AA85900D845B0 /* FlatDevTree */ = { - isa = PBXGroup; - children = ( - 2C794CFB1A0AA85900D845B0 /* device_tree.c */, - 2C794CFC1A0AA85900D845B0 /* device_tree.h */, - ); - path = FlatDevTree; - sourceTree = ""; - }; - 2C794D051A0AA85900D845B0 /* Mach-O */ = { - isa = PBXGroup; - children = ( - 2C794D011A0AA85900D845B0 /* loader.h */, - 2C794D021A0AA85900D845B0 /* Mach-O.c */, - 2C794D031A0AA85900D845B0 /* Mach-O.h */, - 2C794D041A0AA85900D845B0 /* UefiLoader.h */, - ); - path = "Mach-O"; - sourceTree = ""; - }; - 2C794D121A0AA85900D845B0 /* X64 */ = { - isa = PBXGroup; - children = ( - 2C794D0E1A0AA85900D845B0 /* AsmFuncsX64.asm */, - 2C794D0F1A0AA85900D845B0 /* AsmFuncsX64.nasm */, - 2C794D101A0AA85900D845B0 /* AsmFuncsX64.S */, - 123B39A0200E770100DC2ED9 /* RTShims.nasm */, - 2C794D111A0AA85900D845B0 /* TestAsm32.asm */, - ); - path = X64; - sourceTree = ""; - }; - 2C794D131A0AA85900D845B0 /* OsxAptioFixDrv */ = { - isa = PBXGroup; - children = ( - 2C794CF41A0AA85900D845B0 /* AsmFuncs.h */, - 2C794CF51A0AA85900D845B0 /* BootArgs.c */, - 2C794CF61A0AA85900D845B0 /* BootArgs.h */, - 2C794CF71A0AA85900D845B0 /* BootFixes.c */, - 2C794CF81A0AA85900D845B0 /* BootFixes.h */, - 123B3999200E76DD00DC2ED9 /* BootFixes3.c */, - 123B399A200E76DD00DC2ED9 /* BootFixes3.h */, - 2C794CF91A0AA85900D845B0 /* DecodedKernelCheck.c */, - 2C794CFA1A0AA85900D845B0 /* DecodedKernelCheck.h */, - 2C794CFD1A0AA85900D845B0 /* FlatDevTree */, - 2C794CFE1A0AA85900D845B0 /* Hibernate.h */, - 2C794CFF1A0AA85900D845B0 /* Lib.c */, - 2C794D001A0AA85900D845B0 /* Lib.h */, - 2C794D051A0AA85900D845B0 /* Mach-O */, - 2C794D061A0AA85900D845B0 /* NVRAMDebug.c */, - 2C794D071A0AA85900D845B0 /* NVRAMDebug.h */, - 2C794D081A0AA85900D845B0 /* OsxAptioFix2Drv.c */, - 2C794D091A0AA85900D845B0 /* OsxAptioFix2Drv.inf */, - 123B399C200E76EA00DC2ED9 /* OsxAptioFix3Drv.c */, - 123B399D200E76EA00DC2ED9 /* OsxAptioFix3Drv.inf */, - 2C794D0A1A0AA85900D845B0 /* OsxAptioFixDrv.c */, - 2C794D0B1A0AA85900D845B0 /* OsxAptioFixDrv.inf */, - 123B399F200E76F600DC2ED9 /* RTShims.h */, - 2C794D0C1A0AA85900D845B0 /* VMem.c */, - 2C794D0D1A0AA85900D845B0 /* VMem.h */, - 2C794D121A0AA85900D845B0 /* X64 */, - ); - name = OsxAptioFixDrv; - path = ../../OsxAptioFixDrv; - sourceTree = ""; - }; - 2C794D1E1A0AA85900D845B0 /* OsxLowMemFixDrv */ = { - isa = PBXGroup; - children = ( - 2C794D181A0AA85900D845B0 /* Lib.c */, - 2C794D191A0AA85900D845B0 /* Lib.h */, - 2C794D1A1A0AA85900D845B0 /* NVRAMDebug.c */, - 2C794D1B1A0AA85900D845B0 /* NVRAMDebug.h */, - 2C794D1C1A0AA85900D845B0 /* OsxLowMemFixDrv.c */, - 2C794D1D1A0AA85900D845B0 /* OsxLowMemFixDrv.inf */, - ); - name = OsxLowMemFixDrv; - path = ../../OsxLowMemFixDrv; - sourceTree = ""; - }; 2C794D1F1A0AA85900D845B0 /* CloverUEFI */ = { isa = PBXGroup; children = ( + A5E283CF2347AE550068ED34 /* MemoryFix */, 2C794CF31A0AA85900D845B0 /* FSInject */, - 2C794D131A0AA85900D845B0 /* OsxAptioFixDrv */, - 2C794D1E1A0AA85900D845B0 /* OsxLowMemFixDrv */, 12A60F4B1DB610500068BF8B /* Protocols */, ); name = CloverUEFI; @@ -18669,6 +18662,244 @@ path = ApfsDriverLoader; sourceTree = ""; }; + A5E283CF2347AE550068ED34 /* MemoryFix */ = { + isa = PBXGroup; + children = ( + A5E283D02347AE550068ED34 /* AptioMemoryFix */, + A5E283EA2347AE550068ED34 /* OsxAptioFixDrv */, + A5E284102347AE550068ED34 /* OsxLowMemFixDrv */, + ); + name = MemoryFix; + path = ../../MemoryFix; + sourceTree = ""; + }; + A5E283D02347AE550068ED34 /* AptioMemoryFix */ = { + isa = PBXGroup; + children = ( + A5E283D62347AE550068ED34 /* AptioMemoryFix.c */, + A5E283D72347AE550068ED34 /* Config.h */, + A5E283D82347AE550068ED34 /* X64 */, + A5E283E92347AE550068ED34 /* VMem.h */, + A5E283DB2347AE550068ED34 /* VMem.c */, + A5E283DC2347AE550068ED34 /* BootArgs.h */, + A5E283DD2347AE550068ED34 /* AsmFuncs.h */, + A5E283DE2347AE550068ED34 /* BootFixes.h */, + A5E283D32347AE550068ED34 /* BootFixes.c */, + A5E283D22347AE550068ED34 /* ServiceOverrides.h */, + A5E283DF2347AE550068ED34 /* ServiceOverrides.c */, + A5E283E02347AE550068ED34 /* AptioMemoryFix.inf */, + A5E283E12347AE550068ED34 /* MemoryMap.h */, + A5E283D12347AE550068ED34 /* MemoryMap.c */, + A5E283E22347AE550068ED34 /* UmmMalloc */, + A5E283E52347AE550068ED34 /* RtShims.h */, + A5E283D52347AE550068ED34 /* RtShims.c */, + A5E283E62347AE550068ED34 /* CustomSlide.h */, + A5E283D42347AE550068ED34 /* CustomSlide.c */, + A5E283E72347AE550068ED34 /* AptioFixPkg.dec */, + A5E283E82347AE550068ED34 /* BootArgs.c */, + ); + path = AptioMemoryFix; + sourceTree = ""; + }; + A5E283D82347AE550068ED34 /* X64 */ = { + isa = PBXGroup; + children = ( + A5E283D92347AE550068ED34 /* AsmRtShims.nasm */, + A5E283DA2347AE550068ED34 /* AsmFuncs.nasm */, + ); + path = X64; + sourceTree = ""; + }; + A5E283E22347AE550068ED34 /* UmmMalloc */ = { + isa = PBXGroup; + children = ( + A5E283E32347AE550068ED34 /* UmmMalloc.h */, + A5E283E42347AE550068ED34 /* UmmMalloc.c */, + ); + path = UmmMalloc; + sourceTree = ""; + }; + A5E283EA2347AE550068ED34 /* OsxAptioFixDrv */ = { + isa = PBXGroup; + children = ( + A5E283EB2347AE550068ED34 /* Hibernate.h */, + A5E283EC2347AE550068ED34 /* OsxAptioFix3Drv.c */, + A5E283ED2347AE550068ED34 /* BootFixes.c */, + A5E283EE2347AE550068ED34 /* OsxAptioFixDrv.c */, + A5E283EF2347AE550068ED34 /* Lib.c */, + A5E283F02347AE550068ED34 /* OsxAptioFix2Drv.c */, + A5E283F12347AE550068ED34 /* NVRAMDebug.c */, + A5E283F22347AE550068ED34 /* OsxAptioFix3Drv.inf */, + A5E283F32347AE550068ED34 /* X64 */, + A5E283F92347AE550068ED34 /* DecodedKernelCheck.h */, + A5E283FA2347AE550068ED34 /* OsxAptioFixDrv.inf */, + A5E283FB2347AE550068ED34 /* BootFixes3.c */, + A5E283FC2347AE550068ED34 /* VMem.c */, + A5E283FD2347AE550068ED34 /* BootArgs.h */, + A5E283FE2347AE550068ED34 /* AsmFuncs.h */, + A5E283FF2347AE550068ED34 /* Lib.h */, + A5E284002347AE550068ED34 /* BootFixes.h */, + A5E284012347AE550068ED34 /* OsxAptioFix2Drv.inf */, + A5E284022347AE550068ED34 /* RTShims.h */, + A5E284032347AE550068ED34 /* NVRAMDebug.h */, + A5E284042347AE550068ED34 /* Mach-O */, + A5E284092347AE550068ED34 /* DecodedKernelCheck.c */, + A5E2840A2347AE550068ED34 /* FlatDevTree */, + A5E2840D2347AE550068ED34 /* BootArgs.c */, + A5E2840E2347AE550068ED34 /* VMem.h */, + A5E2840F2347AE550068ED34 /* BootFixes3.h */, + ); + path = OsxAptioFixDrv; + sourceTree = ""; + }; + A5E283F32347AE550068ED34 /* X64 */ = { + isa = PBXGroup; + children = ( + A5E283F42347AE550068ED34 /* AsmFuncsX64.nasm */, + A5E283F52347AE550068ED34 /* TestAsm32.asm */, + A5E283F62347AE550068ED34 /* AsmFuncsX64.asm */, + A5E283F72347AE550068ED34 /* RTShims.nasm */, + A5E283F82347AE550068ED34 /* AsmFuncsX64.S */, + ); + path = X64; + sourceTree = ""; + }; + A5E284042347AE550068ED34 /* Mach-O */ = { + isa = PBXGroup; + children = ( + A5E284052347AE550068ED34 /* Mach-O.c */, + A5E284062347AE550068ED34 /* loader.h */, + A5E284072347AE550068ED34 /* Mach-O.h */, + A5E284082347AE550068ED34 /* UefiLoader.h */, + ); + path = "Mach-O"; + sourceTree = ""; + }; + A5E2840A2347AE550068ED34 /* FlatDevTree */ = { + isa = PBXGroup; + children = ( + A5E2840B2347AE550068ED34 /* device_tree.h */, + A5E2840C2347AE550068ED34 /* device_tree.c */, + ); + path = FlatDevTree; + sourceTree = ""; + }; + A5E284102347AE550068ED34 /* OsxLowMemFixDrv */ = { + isa = PBXGroup; + children = ( + A5E284112347AE550068ED34 /* Lib.c */, + A5E284122347AE550068ED34 /* NVRAMDebug.c */, + A5E284132347AE550068ED34 /* Lib.h */, + A5E284142347AE550068ED34 /* OsxLowMemFixDrv.c */, + A5E284152347AE550068ED34 /* OsxLowMemFixDrv.inf */, + A5E284162347AE550068ED34 /* NVRAMDebug.h */, + ); + path = OsxLowMemFixDrv; + sourceTree = ""; + }; + A5E284172347AE760068ED34 /* AppleKeyFeeder */ = { + isa = PBXGroup; + children = ( + A5E284182347AE760068ED34 /* SimpleTextExProxy.h */, + A5E284192347AE760068ED34 /* SimpleTextProxy.c */, + A5E2841A2347AE760068ED34 /* AppleKeyFeeder.inf */, + A5E2841B2347AE760068ED34 /* AppleKeyMapUtils.c */, + A5E2841C2347AE760068ED34 /* SimpleTextProxy.h */, + A5E2841D2347AE760068ED34 /* AppleKeyFeeder.c */, + A5E2841E2347AE760068ED34 /* SimpleTextExProxy.c */, + A5E2841F2347AE760068ED34 /* AppleKeyMapUtils.h */, + ); + path = AppleKeyFeeder; + sourceTree = ""; + }; + A5E284202347AE900068ED34 /* AptioInputFix */ = { + isa = PBXGroup; + children = ( + A5E284212347AE900068ED34 /* Keycode */, + A5E284302347AE900068ED34 /* AptioInput.c */, + A5E284312347AE900068ED34 /* Timer */, + A5E284342347AE900068ED34 /* Pointer */, + A5E284372347AE900068ED34 /* AptioInputFix.inf */, + ); + path = AptioInputFix; + sourceTree = ""; + }; + A5E284212347AE900068ED34 /* Keycode */ = { + isa = PBXGroup; + children = ( + A5E284222347AE900068ED34 /* AppleHid.txt */, + A5E284232347AE900068ED34 /* AIKSource.h */, + A5E284242347AE900068ED34 /* AIK.h */, + A5E284252347AE900068ED34 /* AIKTarget.c */, + A5E284262347AE900068ED34 /* AIKShim.c */, + A5E284272347AE900068ED34 /* AIKTranslate.h */, + A5E284282347AE900068ED34 /* AIKData.h */, + A5E284292347AE900068ED34 /* AIKMap.c */, + A5E2842A2347AE900068ED34 /* AIK.c */, + A5E2842B2347AE900068ED34 /* AIKSource.c */, + A5E2842C2347AE900068ED34 /* AIKTranslate.c */, + A5E2842D2347AE900068ED34 /* AIKTarget.h */, + A5E2842E2347AE900068ED34 /* AIKShim.h */, + A5E2842F2347AE900068ED34 /* AIKData.c */, + ); + path = Keycode; + sourceTree = ""; + }; + A5E284312347AE900068ED34 /* Timer */ = { + isa = PBXGroup; + children = ( + A5E284322347AE900068ED34 /* AIT.h */, + A5E284332347AE900068ED34 /* AIT.c */, + ); + path = Timer; + sourceTree = ""; + }; + A5E284342347AE900068ED34 /* Pointer */ = { + isa = PBXGroup; + children = ( + A5E284352347AE900068ED34 /* AIM.c */, + A5E284362347AE900068ED34 /* AIM.h */, + ); + path = Pointer; + sourceTree = ""; + }; + A5E284382347AEDF0068ED34 /* MachoLib */ = { + isa = PBXGroup; + children = ( + A5E284392347AEDF0068ED34 /* MachoLib.inf */, + A5E2843A2347AEDF0068ED34 /* MachoLibInternal.h */, + A5E2843B2347AEDF0068ED34 /* Header.c */, + A5E2843C2347AEDF0068ED34 /* Symbols.c */, + A5E2843D2347AEDF0068ED34 /* Relocations.c */, + A5E2843E2347AEDF0068ED34 /* CxxSymbols.c */, + ); + path = MachoLib; + sourceTree = ""; + }; + A5E2843F2347AEE80068ED34 /* OcGuardLib */ = { + isa = PBXGroup; + children = ( + A5E284402347AEE80068ED34 /* Canary.c */, + A5E284412347AEE80068ED34 /* Ubsan.h */, + A5E284422347AEE80068ED34 /* UbsanPrintf.c */, + A5E284432347AEE80068ED34 /* OcGuardLib.inf */, + A5E284442347AEE80068ED34 /* BitOverflow.c */, + A5E284452347AEE80068ED34 /* TripleOverflow.c */, + A5E284462347AEE80068ED34 /* Ubsan.c */, + A5E284472347AEE80068ED34 /* NativeOverflow.c */, + ); + path = OcGuardLib; + sourceTree = ""; + }; + A5E284512347DB780068ED34 /* DeviceTreeLib */ = { + isa = PBXGroup; + children = ( + A5E284522347DB780068ED34 /* DeviceTreeLib.c */, + A5E284532347DB780068ED34 /* DeviceTreeLib.inf */, + ); + path = DeviceTreeLib; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXLegacyTarget section */ @@ -18749,35 +18980,17 @@ files = ( A5BF392720D9F17B004340E1 /* FloatLib.c in Sources */, 2C794E401A0AA85900D845B0 /* Test.c in Sources */, - 2C794E411A0AA85900D845B0 /* BootArgs.c in Sources */, - 123B399B200E76DD00DC2ED9 /* BootFixes3.c in Sources */, 12B8EBBE1DDCE91200AC0A2C /* egemb_font.c in Sources */, 12B8EBC21DDCEA2A00AC0A2C /* scroll_images.c in Sources */, - 2C794E431A0AA85900D845B0 /* DecodedKernelCheck.c in Sources */, - 2C794E461A0AA85900D845B0 /* Mach-O.c in Sources */, - 2C794E4D1A0AA85900D845B0 /* AsmFuncsX64.S in Sources */, - 2C794E511A0AA85900D845B0 /* NVRAMDebug.c in Sources */, - 2C794E421A0AA85900D845B0 /* BootFixes.c in Sources */, A5611B3421DCBA53008FDB96 /* StartupSound.c in Sources */, - 2C794E481A0AA85900D845B0 /* OsxAptioFix2Drv.c in Sources */, - 2C794E501A0AA85900D845B0 /* Lib.c in Sources */, 12E3015A1D5A413A00EED426 /* lodepng.c in Sources */, - 2C794E451A0AA85900D845B0 /* Lib.c in Sources */, - 2C794E4C1A0AA85900D845B0 /* AsmFuncsX64.nasm in Sources */, A5603D0421F04ECE005F400E /* sound.c in Sources */, - 2C794E521A0AA85900D845B0 /* OsxLowMemFixDrv.c in Sources */, - 2C794E4E1A0AA85900D845B0 /* TestAsm32.asm in Sources */, A5BF392C20D9F18C004340E1 /* nanosvg.c in Sources */, - 2C794E471A0AA85900D845B0 /* NVRAMDebug.c in Sources */, - 2C794E4A1A0AA85900D845B0 /* VMem.c in Sources */, 12B2F75C211E169E009BF236 /* egemb_icons_dark.c in Sources */, 2C794E3F1A0AA85900D845B0 /* FSInject.c in Sources */, 12B8EBBF1DDCE91200AC0A2C /* egemb_icons.c in Sources */, A5BF392B20D9F18C004340E1 /* nanosvgrast.c in Sources */, - 2C794E491A0AA85900D845B0 /* OsxAptioFixDrv.c in Sources */, - 2C794E4B1A0AA85900D845B0 /* AsmFuncsX64.asm in Sources */, A59CB66921BC14AB0054A7CF /* SmbiosGen.c in Sources */, - 2C794E441A0AA85900D845B0 /* device_tree.c in Sources */, 1288B5211A30CEFB007CBCEF /* Net.c in Sources */, 12A60F5A1DB610500068BF8B /* AppleImageCodec.c in Sources */, 12A60F5B1DB610500068BF8B /* load_bmp.c in Sources */, @@ -18786,8 +18999,6 @@ 12A60F5D1DB610500068BF8B /* picopng.c in Sources */, 12A60F5F1DB610500068BF8B /* SMCHelper.c in Sources */, 12AAF3A51DB75DC800A52B12 /* FirmwareVolume.c in Sources */, - 123B399E200E76EA00DC2ED9 /* OsxAptioFix3Drv.c in Sources */, - 123B39A1200E770100DC2ED9 /* RTShims.nasm in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/rEFIt_UEFI/Platform/Injectors.c b/rEFIt_UEFI/Platform/Injectors.c index faa5fbfa0..0fb2d0633 100644 --- a/rEFIt_UEFI/Platform/Injectors.c +++ b/rEFIt_UEFI/Platform/Injectors.c @@ -26,7 +26,7 @@ EFI_GUID gDevicePropertiesGuid = { 0x91BD12FE, 0xF6C3, 0x44FB, {0xA5, 0xB7, 0x51, 0x22, 0xAB, 0x30, 0x3A, 0xE0} }; /* -EFI_GUID gAppleScreenInfoProtocolGuid = { +EFI_GUID gAppleFramebufferInfoProtocolGuid = { 0xe316e100, 0x0751, 0x4c49, {0x90, 0x56, 0x48, 0x6c, 0x7e, 0x47, 0x29, 0x03} }; */ // gEfiKeyboardInfoProtocolGuid @@ -35,7 +35,7 @@ EFI_GUID gAppleScreenInfoProtocolGuid = { // C5C5DA95-7D5C-45E6-B2F1-3FD52BB10077 - EfiOSInfo // 03622D6D-362A-4E47-9710-C238B23755C1 - GraphConfig -extern EFI_GUID gAppleScreenInfoProtocolGuid; +extern EFI_GUID gAppleFramebufferInfoProtocolGuid; UINT32 mPropSize = 0; UINT8* mProperties = NULL; @@ -337,7 +337,7 @@ SetPrivateVarProto(VOID) //This must be independent install // optional protocols /*Status = */gBS->InstallMultipleProtocolInterfaces (&gImageHandle, - &gAppleScreenInfoProtocolGuid, + &gAppleFramebufferInfoProtocolGuid, &mScreenInfo, &gEfiOSInfoProtocolGuid, &mEfiOSInfo, diff --git a/rEFIt_UEFI/Platform/Platform.h b/rEFIt_UEFI/Platform/Platform.h index 6ae1a92cf..f0c2d9629 100644 --- a/rEFIt_UEFI/Platform/Platform.h +++ b/rEFIt_UEFI/Platform/Platform.h @@ -1653,8 +1653,8 @@ extern UINT64 machineSignature; extern EFI_GUID gEfiAppleBootGuid; extern EFI_GUID gEfiAppleNvramGuid; extern EFI_GUID AppleSystemInfoProducerName; -extern EFI_GUID AppleDevicePropertyProtocolGuid; -extern EFI_GUID gAppleScreenInfoProtocolGuid; +extern EFI_GUID gAppleDevicePropertyProtocolGuid; +extern EFI_GUID gAppleFramebufferInfoProtocolGuid; extern EFI_GUID gEfiAppleVendorGuid; extern EFI_GUID gEfiPartTypeSystemPartGuid; extern EFI_GUID gMsgLogProtocolGuid; diff --git a/rEFIt_UEFI/Platform/guid.c b/rEFIt_UEFI/Platform/guid.c index f1d385040..44a2fd8c7 100644 --- a/rEFIt_UEFI/Platform/guid.c +++ b/rEFIt_UEFI/Platform/guid.c @@ -5,16 +5,16 @@ #include "Platform.h" //EFI_GUID gEfiConsoleControlProtocolGuid = {0xF42F7782, 0x012E, 0x4C12, {0x99, 0x56, 0x49, 0xF9, 0x43, 0x04, 0xF7, 0x21}}; -//EFI_GUID gEfiAppleFirmwarePasswordProtocolGuid = {0x8FFEEB3A, 0x4C98, 0x4630, {0x80, 0x3F, 0x74, 0x0F, 0x95, 0x67, 0x09, 0x1D}}; +//EFI_GUID gAppleFirmwarePasswordProtocolGuid = {0x8FFEEB3A, 0x4C98, 0x4630, {0x80, 0x3F, 0x74, 0x0F, 0x95, 0x67, 0x09, 0x1D}}; //gEfiGlobalVariableGuid //EFI_GUID gEfiGlobalVarGuid = {0x8BE4DF61, 0x93CA, 0x11D2, {0xAA, 0x0D, 0x00, 0xE0, 0x98, 0x03, 0x2B, 0x8C}}; -//EFI_GUID AppleDevicePropertyProtocolGuid = {0x91BD12FE, 0xF6C3, 0x44FB, {0xA5, 0xB7, 0x51, 0x22, 0xAB, 0x30, 0x3A, 0xE0}}; +//EFI_GUID gAppleDevicePropertyProtocolGuid = {0x91BD12FE, 0xF6C3, 0x44FB, {0xA5, 0xB7, 0x51, 0x22, 0xAB, 0x30, 0x3A, 0xE0}}; //EFI_GUID gEfiAppleBootGuid = {0x7C436110, 0xAB2A, 0x4BBB, {0xA8, 0x80, 0xFE, 0x41, 0x99, 0x5C, 0x9F, 0x82}}; //EFI_GUID gEfiAppleNvramGuid = {0x4D1EDE05, 0x38C7, 0x4A6A, {0x9C, 0xC6, 0x4B, 0xCC, 0xA8, 0xB3, 0x8C, 0x14}}; -//EFI_GUID gAppleScreenInfoProtocolGuid = {0xE316E100, 0x0751, 0x4C49, {0x90, 0x56, 0x48, 0x6C, 0x7E, 0x47, 0x29, 0x03}}; -//EFI_GUID AppleBootKeyPressProtocolGuid = {0x5B213447, 0x6E73, 0x4901, {0xA4, 0xF1, 0xB8, 0x64, 0xF3, 0xB7, 0xA1, 0x72}}; -//EFI_GUID AppleNetBootProtocolGuid = {0x78EE99FB, 0x6A5E, 0x4186, {0x97, 0xDE, 0xCD, 0x0A, 0xBA, 0x34, 0x5A, 0x74}}; -//EFI_GUID AppleImageCodecProtocolGuid = {0x0DFCE9F6, 0xC4E3, 0x45EE, {0xA0, 0x6A, 0xA8, 0x61, 0x3B, 0x98, 0xA5, 0x07}}; +//EFI_GUID gAppleFramebufferInfoProtocolGuid = {0xE316E100, 0x0751, 0x4C49, {0x90, 0x56, 0x48, 0x6C, 0x7E, 0x47, 0x29, 0x03}}; +//EFI_GUID gAppleKeyStateProtocolGuid = {0x5B213447, 0x6E73, 0x4901, {0xA4, 0xF1, 0xB8, 0x64, 0xF3, 0xB7, 0xA1, 0x72}}; +//EFI_GUID gAppleNetBootProtocolGuid = {0x78EE99FB, 0x6A5E, 0x4186, {0x97, 0xDE, 0xCD, 0x0A, 0xBA, 0x34, 0x5A, 0x74}}; +//EFI_GUID gAppleImageCodecProtocolGuid = {0x0DFCE9F6, 0xC4E3, 0x45EE, {0xA0, 0x6A, 0xA8, 0x61, 0x3B, 0x98, 0xA5, 0x07}}; //EFI_GUID gEfiAppleVendorGuid = {0xAC39C713, 0x7E50, 0x423D, {0x88, 0x9D, 0x27, 0x8F, 0xCC, 0x34, 0x22, 0xB6}}; //EFI_GUID gAppleEFINVRAMTRBSecureGuid = {0xF68DA75E, 0x1B55, 0x4E70, {0xB4, 0x1B, 0xA7, 0xB7, 0xA5, 0xB7, 0x58, 0xEA}}; //EFI_GUID gDataHubOptionsGuid = {0x0021001C, 0x3CE3, 0x41F8, {0x99, 0xC6, 0xEC, 0xF5, 0xDA, 0x75, 0x47, 0x31}}; diff --git a/rEFIt_UEFI/refit.inf b/rEFIt_UEFI/refit.inf index 50baa8863..3ffd12448 100644 --- a/rEFIt_UEFI/refit.inf +++ b/rEFIt_UEFI/refit.inf @@ -272,8 +272,8 @@ gEfiSecurityArchProtocolGuid gEfiSecurity2ArchProtocolGuid - AppleDevicePropertyProtocolGuid - gAppleScreenInfoProtocolGuid + gAppleDevicePropertyProtocolGuid + gAppleFramebufferInfoProtocolGuid gEfiConsoleControlProtocolGuid gAppleGraphConfigProtocolGuid gEfiLegacyBiosProtocolGuid diff --git a/rEFIt_UEFI/refit/lib.h b/rEFIt_UEFI/refit/lib.h index 8af2fc3bf..bf090c125 100644 --- a/rEFIt_UEFI/refit/lib.h +++ b/rEFIt_UEFI/refit/lib.h @@ -745,6 +745,7 @@ INTN FindMem(IN VOID *Buffer, IN UINTN BufferLength, IN VOID *SearchString, IN U CHAR16 *FileDevicePathToStr(IN EFI_DEVICE_PATH_PROTOCOL *DevPath); CHAR16 *FileDevicePathFileToStr(IN EFI_DEVICE_PATH_PROTOCOL *DevPath); +//UINTN FileDevicePathNameLen(IN CONST FILEPATH_DEVICE_PATH *FilePath); EFI_STATUS InitializeUnicodeCollationProtocol (VOID); @@ -760,16 +761,13 @@ EFI_STATUS InitializeUnicodeCollationProtocol (VOID); #define ATTR_SCROLLARROW (EFI_LIGHTGREEN | EFI_BACKGROUND_BLACK) #define LAYOUT_TEXT_WIDTH (500) -#define LAYOUT_TOTAL_HEIGHT (376) //376 +#define LAYOUT_TOTAL_HEIGHT (376) #define LAYOUT_BANNER_HEIGHT (32) #define LAYOUT_BANNER_YOFFSET (LAYOUT_BANNER_HEIGHT + 32) #define LAYOUT_Y_EDGE (20) #define LAYOUT_X_EDGE (20) #define BAR_WIDTH (16) -//#define FONT_CELL_WIDTH (7) -//#define FONT_CELL_HEIGHT (12) - extern INTN FontWidth; extern INTN FontHeight; extern INTN TextHeight;