未验证 提交 2f1043d9 编写于 作者: P PMheart 提交者: GitHub

User: Codestyle fix (#175)

上级 44ec646d
/** @file
Copyright (c) 2020, PMheart. All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
**/
#ifndef OC_USER_GLOBAL_VAR_H
#define OC_USER_GLOBAL_VAR_H
#include <Uefi.h>
#include <Library/UefiLib.h>
#include <Library/UefiApplicationEntryPoint.h>
extern EFI_GUID gAppleBootVariableGuid;
extern EFI_GUID gAppleEventProtocolGuid;
extern EFI_GUID gAppleKeyMapAggregatorProtocolGuid;
extern EFI_GUID gAppleKeyMapDatabaseProtocolGuid;
extern EFI_GUID gAppleApfsContainerInfoGuid;
extern EFI_GUID gAppleApfsVolumeInfoGuid;
extern EFI_GUID gAppleBlessedOsxFolderInfoGuid;
extern EFI_GUID gAppleBlessedSystemFileInfoGuid;
extern EFI_GUID gAppleBlessedSystemFolderInfoGuid;
extern EFI_GUID gAppleBootPolicyProtocolGuid;
extern EFI_GUID gAppleVendorVariableGuid;
extern EFI_GUID gAppleImg4VerificationProtocolGuid;
extern EFI_GUID gAppleBeepGenProtocolGuid;
extern const CHAR8 *gEfiCallerBaseName;
extern EFI_GUID gEfiGraphicsOutputProtocolGuid;
extern EFI_GUID gEfiHiiFontProtocolGuid;
extern EFI_GUID gEfiSimpleTextOutProtocolGuid;
extern EFI_GUID gEfiUgaDrawProtocolGuid;
extern EFI_GUID gEfiAbsolutePointerProtocolGuid;
extern EFI_GUID gEfiLoadedImageProtocolGuid;
extern EFI_GUID gEfiShellParametersProtocolGuid;
extern EFI_GUID gEfiSimplePointerProtocolGuid;
extern EFI_GUID gEfiDebugPortProtocolGuid;
extern EFI_GUID gEfiDevicePathProtocolGuid;
extern EFI_GUID gEfiPcAnsiGuid;
extern EFI_GUID gEfiPersistentVirtualCdGuid;
extern EFI_GUID gEfiPersistentVirtualDiskGuid;
extern EFI_GUID gEfiSasDevicePathGuid;
extern EFI_GUID gEfiUartDevicePathGuid;
extern EFI_GUID gEfiVT100Guid;
extern EFI_GUID gEfiVT100PlusGuid;
extern EFI_GUID gEfiVTUTF8Guid;
extern EFI_GUID gEfiVirtualCdGuid;
extern EFI_GUID gEfiVirtualDiskGuid;
extern EFI_GUID gEfiFileInfoGuid;
extern EFI_GUID gEfiFileSystemVolumeLabelInfoIdGuid;
extern EFI_GUID gEfiSimpleFileSystemProtocolGuid;
extern EFI_GUID gEfiUserInterfaceThemeProtocolGuid;
extern EFI_GUID gEfiMpServiceProtocolGuid;
extern EFI_GUID gFrameworkEfiMpServiceProtocolGuid;
extern EFI_GUID gEfiGlobalVariableGuid;
extern EFI_GUID gEfiSmbios3TableGuid;
extern EFI_GUID gEfiLegacyRegionProtocolGuid;
extern EFI_GUID gEfiLegacyRegion2ProtocolGuid;
extern EFI_GUID gEfiPciRootBridgeIoProtocolGuid;
extern EFI_GUID gEfiSmbiosTableGuid;
extern EFI_GUID gOcVendorVariableGuid;
extern EFI_GUID gOcCustomSmbios3TableGuid;
extern EFI_GUID gOcCustomSmbiosTableGuid;
extern EFI_GUID gOcAudioProtocolGuid;
#ifdef SANITIZE_TEST
#include <sanitizer/asan_interface.h>
#else
#define ASAN_POISON_MEMORY_REGION(addr, size) do { } while (0)
#define ASAN_UNPOISON_MEMORY_REGION(addr, size) do { } while (0)
#endif
#endif // OC_USER_GLOBAL_VAR_H
......@@ -14,11 +14,9 @@
#include <Library/UefiBootServicesTableLib.h>
#include <Library/DebugLib.h>
#include <stdio.h>
extern EFI_BOOT_SERVICES mBootServices;
extern EFI_SYSTEM_TABLE mSystemTable;
extern EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL mConOut;
extern EFI_BOOT_SERVICES mBootServices;
extern EFI_SYSTEM_TABLE mSystemTable;
extern EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL mConOut;
EFI_TPL
EFIAPI
......@@ -27,13 +25,15 @@ DummyRaiseTPL (
);
EFI_STATUS
EFIAPI
DummyLocateProtocol (
EFI_GUID *ProtocolGuid,
VOID *Registration,
VOID **Interface
IN EFI_GUID *Protocol,
IN VOID *Registration, OPTIONAL
OUT VOID **Interface
);
EFI_STATUS
EFIAPI
DummyAllocatePages (
IN EFI_ALLOCATE_TYPE Type,
IN EFI_MEMORY_TYPE MemoryType,
......@@ -44,15 +44,15 @@ DummyAllocatePages (
EFI_STATUS
EFIAPI
DummyInstallConfigurationTable (
IN EFI_GUID *Guid,
IN VOID *Table
IN EFI_GUID *Guid,
IN VOID *Table
);
EFI_STATUS
EFIAPI
NullTextOutputString (
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
IN CHAR16 *String
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
IN CHAR16 *String
);
#endif // OC_USER_BOOT_SERVICES_H
......@@ -10,8 +10,8 @@
#include <stdlib.h>
#include <stdint.h>
uint8_t *readFile(const char *str, uint32_t *size);
uint8_t *UserReadFile(const char *str, uint32_t *size);
void writeFile(const char *str, void *data, uint32_t size);
void UserWriteFile(const char *str, void *data, uint32_t size);
#endif // OC_USER_FILE_H
/** @file
Copyright (c) 2020, PMheart. All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
**/
#ifndef OC_USER_GLOBAL_VAR_H
#define OC_USER_GLOBAL_VAR_H
#include <Uefi.h>
#include <Library/UefiLib.h>
#include <Library/UefiApplicationEntryPoint.h>
#ifdef SANITIZE_TEST
#include <sanitizer/asan_interface.h>
#else
#define ASAN_POISON_MEMORY_REGION(addr, size) do { } while (0)
#define ASAN_UNPOISON_MEMORY_REGION(addr, size) do { } while (0)
#endif
extern EFI_GUID gAppleBootVariableGuid;
extern EFI_GUID gAppleEventProtocolGuid;
extern EFI_GUID gAppleKeyMapAggregatorProtocolGuid;
extern EFI_GUID gAppleKeyMapDatabaseProtocolGuid;
extern EFI_GUID gAppleApfsContainerInfoGuid;
extern EFI_GUID gAppleApfsVolumeInfoGuid;
extern EFI_GUID gAppleBlessedOsxFolderInfoGuid;
extern EFI_GUID gAppleBlessedSystemFileInfoGuid;
extern EFI_GUID gAppleBlessedSystemFolderInfoGuid;
extern EFI_GUID gAppleBootPolicyProtocolGuid;
extern EFI_GUID gAppleVendorVariableGuid;
extern EFI_GUID gAppleImg4VerificationProtocolGuid;
extern EFI_GUID gAppleBeepGenProtocolGuid;
extern CONST CHAR8 *gEfiCallerBaseName;
extern EFI_GUID gEfiGraphicsOutputProtocolGuid;
extern EFI_GUID gEfiHiiFontProtocolGuid;
extern EFI_GUID gEfiSimpleTextOutProtocolGuid;
extern EFI_GUID gEfiUgaDrawProtocolGuid;
extern EFI_GUID gEfiAbsolutePointerProtocolGuid;
extern EFI_GUID gEfiLoadedImageProtocolGuid;
extern EFI_GUID gEfiShellParametersProtocolGuid;
extern EFI_GUID gEfiSimplePointerProtocolGuid;
extern EFI_GUID gEfiDebugPortProtocolGuid;
extern EFI_GUID gEfiDevicePathProtocolGuid;
extern EFI_GUID gEfiPcAnsiGuid;
extern EFI_GUID gEfiPersistentVirtualCdGuid;
extern EFI_GUID gEfiPersistentVirtualDiskGuid;
extern EFI_GUID gEfiSasDevicePathGuid;
extern EFI_GUID gEfiUartDevicePathGuid;
extern EFI_GUID gEfiVT100Guid;
extern EFI_GUID gEfiVT100PlusGuid;
extern EFI_GUID gEfiVTUTF8Guid;
extern EFI_GUID gEfiVirtualCdGuid;
extern EFI_GUID gEfiVirtualDiskGuid;
extern EFI_GUID gEfiFileInfoGuid;
extern EFI_GUID gEfiFileSystemVolumeLabelInfoIdGuid;
extern EFI_GUID gEfiSimpleFileSystemProtocolGuid;
extern EFI_GUID gEfiUserInterfaceThemeProtocolGuid;
extern EFI_GUID gEfiMpServiceProtocolGuid;
extern EFI_GUID gFrameworkEfiMpServiceProtocolGuid;
extern EFI_GUID gEfiGlobalVariableGuid;
extern EFI_GUID gEfiSmbios3TableGuid;
extern EFI_GUID gEfiLegacyRegionProtocolGuid;
extern EFI_GUID gEfiLegacyRegion2ProtocolGuid;
extern EFI_GUID gEfiPciRootBridgeIoProtocolGuid;
extern EFI_GUID gEfiSmbiosTableGuid;
extern EFI_GUID gOcVendorVariableGuid;
extern EFI_GUID gOcCustomSmbios3TableGuid;
extern EFI_GUID gOcCustomSmbiosTableGuid;
extern EFI_GUID gOcAudioProtocolGuid;
#endif // OC_USER_GLOBAL_VAR_H
......@@ -39,40 +39,42 @@
#include <Library/UefiApplicationEntryPoint.h>
#include <Library/OcCryptoLib.h>
extern UINT32 _gPcd_FixedAtBuild_PcdUefiLibMaxPrintBufferSize;
extern UINT32 _gPcd_FixedAtBuild_PcdUefiLibMaxPrintBufferSize;
extern BOOLEAN _gPcd_FixedAtBuild_PcdUgaConsumeSupport;
extern UINT8 _gPcd_FixedAtBuild_PcdDebugPropertyMask;
extern UINT8 _gPcd_FixedAtBuild_PcdDebugClearMemoryValue;
extern UINT32 _gPcd_FixedAtBuild_PcdFixedDebugPrintErrorLevel;
extern UINT32 _gPcd_FixedAtBuild_PcdDebugPrintErrorLevel;
extern UINT32 _gPcd_FixedAtBuild_PcdMaximumAsciiStringLength;
extern UINT32 _gPcd_FixedAtBuild_PcdMaximumUnicodeStringLength;
extern UINT32 _gPcd_FixedAtBuild_PcdMaximumLinkedListLength;
extern BOOLEAN _gPcd_FixedAtBuild_PcdVerifyNodeInList;
extern UINT32 _gPcd_FixedAtBuild_PcdCpuNumberOfReservedVariableMtrrs;
extern UINT32 _gPcd_FixedAtBuild_PcdMaximumDevicePathNodeCount;
extern BOOLEAN _gPcd_FixedAtBuild_PcdImageLoaderHashProhibitOverlap;
extern BOOLEAN _gPcd_FixedAtBuild_PcdImageLoaderLoadHeader;
extern UINT8 _gPcd_FixedAtBuild_PcdDebugPropertyMask;
extern UINT8 _gPcd_FixedAtBuild_PcdDebugClearMemoryValue;
extern UINT32 _gPcd_FixedAtBuild_PcdFixedDebugPrintErrorLevel;
extern UINT32 _gPcd_FixedAtBuild_PcdDebugPrintErrorLevel;
extern UINT32 _gPcd_FixedAtBuild_PcdMaximumAsciiStringLength;
extern UINT32 _gPcd_FixedAtBuild_PcdMaximumUnicodeStringLength;
extern UINT32 _gPcd_FixedAtBuild_PcdMaximumLinkedListLength;
extern BOOLEAN _gPcd_FixedAtBuild_PcdVerifyNodeInList;
extern UINT32 _gPcd_FixedAtBuild_PcdCpuNumberOfReservedVariableMtrrs;
extern UINT32 _gPcd_FixedAtBuild_PcdMaximumDevicePathNodeCount;
extern BOOLEAN _gPcd_FixedAtBuild_PcdImageLoaderHashProhibitOverlap;
extern BOOLEAN _gPcd_FixedAtBuild_PcdImageLoaderLoadHeader;
#define _PCD_GET_MODE_32_PcdUefiLibMaxPrintBufferSize _gPcd_FixedAtBuild_PcdUefiLibMaxPrintBufferSize
#define _PCD_GET_MODE_BOOL_PcdUgaConsumeSupport _gPcd_FixedAtBuild_PcdUgaConsumeSupport
#define _PCD_GET_MODE_8_PcdDebugPropertyMask _gPcd_FixedAtBuild_PcdDebugPropertyMask
#define _PCD_GET_MODE_8_PcdDebugClearMemoryValue _gPcd_FixedAtBuild_PcdDebugClearMemoryValue
#define _PCD_GET_MODE_32_PcdFixedDebugPrintErrorLevel _gPcd_FixedAtBuild_PcdFixedDebugPrintErrorLevel
#define _PCD_GET_MODE_32_PcdDebugPrintErrorLevel _gPcd_FixedAtBuild_PcdDebugPrintErrorLevel
#define _PCD_GET_MODE_32_PcdMaximumAsciiStringLength _gPcd_FixedAtBuild_PcdMaximumAsciiStringLength
#define _PCD_GET_MODE_32_PcdMaximumUnicodeStringLength _gPcd_FixedAtBuild_PcdMaximumUnicodeStringLength
#define _PCD_GET_MODE_32_PcdMaximumLinkedListLength _gPcd_FixedAtBuild_PcdMaximumLinkedListLength
#define _PCD_GET_MODE_BOOL_PcdVerifyNodeInList _gPcd_FixedAtBuild_PcdVerifyNodeInList
#define _PCD_GET_MODE_16_PcdOcCryptoAllowedRsaModuli (512U | 256U)
#define _PCD_GET_MODE_32_PcdUefiLibMaxPrintBufferSize _gPcd_FixedAtBuild_PcdUefiLibMaxPrintBufferSize
#define _PCD_GET_MODE_BOOL_PcdUgaConsumeSupport _gPcd_FixedAtBuild_PcdUgaConsumeSupport
#define _PCD_GET_MODE_8_PcdDebugPropertyMask _gPcd_FixedAtBuild_PcdDebugPropertyMask
#define _PCD_GET_MODE_8_PcdDebugClearMemoryValue _gPcd_FixedAtBuild_PcdDebugClearMemoryValue
#define _PCD_GET_MODE_32_PcdFixedDebugPrintErrorLevel _gPcd_FixedAtBuild_PcdFixedDebugPrintErrorLevel
#define _PCD_GET_MODE_32_PcdDebugPrintErrorLevel _gPcd_FixedAtBuild_PcdDebugPrintErrorLevel
#define _PCD_GET_MODE_32_PcdMaximumAsciiStringLength _gPcd_FixedAtBuild_PcdMaximumAsciiStringLength
#define _PCD_GET_MODE_32_PcdMaximumUnicodeStringLength _gPcd_FixedAtBuild_PcdMaximumUnicodeStringLength
#define _PCD_GET_MODE_32_PcdMaximumLinkedListLength _gPcd_FixedAtBuild_PcdMaximumLinkedListLength
#define _PCD_GET_MODE_BOOL_PcdVerifyNodeInList _gPcd_FixedAtBuild_PcdVerifyNodeInList
#define _PCD_GET_MODE_16_PcdOcCryptoAllowedRsaModuli (512U | 256U)
#define _PCD_GET_MODE_16_PcdOcCryptoAllowedSigHashTypes \
((1U << OcSigHashTypeSha256) | (1U << OcSigHashTypeSha384) | (1U << OcSigHashTypeSha512))
#define _PCD_GET_MODE_32_PcdCpuNumberOfReservedVariableMtrrs _gPcd_FixedAtBuild_PcdCpuNumberOfReservedVariableMtrrs
// this will not be of any effect at userspace
#define _PCD_GET_MODE_64_PcdPciExpressBaseAddress 0
#define _PCD_GET_MODE_64_PcdPciExpressBaseSize 0
#define _PCD_GET_MODE_32_PcdMaximumDevicePathNodeCount _gPcd_FixedAtBuild_PcdMaximumDevicePathNodeCount
//
// This will not be of any effect at userspace.
//
#define _PCD_GET_MODE_64_PcdPciExpressBaseAddress 0
#define _PCD_GET_MODE_64_PcdPciExpressBaseSize 0
#define _PCD_GET_MODE_32_PcdMaximumDevicePathNodeCount _gPcd_FixedAtBuild_PcdMaximumDevicePathNodeCount
#define _PCD_GET_MODE_BOOL_PcdImageLoaderHashProhibitOverlap _gPcd_FixedAtBuild_PcdImageLoaderHashProhibitOverlap
#define _PCD_GET_MODE_BOOL_PcdImageLoaderLoadHeader _gPcd_FixedAtBuild_PcdImageLoaderLoadHeader
#define _PCD_GET_MODE_BOOL_PcdImageLoaderLoadHeader _gPcd_FixedAtBuild_PcdImageLoaderLoadHeader
#endif // OC_USER_PCD_H
/** @file
Copyright (c) 2020, PMheart. All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
**/
#include <GlobalVar.h>
EFI_GUID gAppleBootVariableGuid = { 0x7C436110, 0xAB2A, 0x4BBB, { 0xA8, 0x80, 0xFE, 0x41, 0x99, 0x5C, 0x9F, 0x82 }};
EFI_GUID gAppleEventProtocolGuid = { 0x33BE0EF1, 0x89C9, 0x4A6D, { 0xBB, 0x9F, 0x69, 0xDC, 0x8D, 0xD5, 0x16, 0xB9 }};
EFI_GUID gAppleKeyMapAggregatorProtocolGuid = { 0x5B213447, 0x6E73, 0x4901, { 0xA4, 0xF1, 0xB8, 0x64, 0xF3, 0xB7, 0xA1, 0x72 }};
EFI_GUID gAppleKeyMapDatabaseProtocolGuid = { 0x584B9EBE, 0x80C1, 0x4BD6, { 0x98, 0xB0, 0xA7, 0x78, 0x6E, 0xC2, 0xF2, 0xE2 }};
EFI_GUID gAppleApfsContainerInfoGuid = { 0x3533CF0D, 0x685F, 0x5EBF, { 0x8D, 0xC6, 0x73, 0x93, 0x48, 0x5B, 0xAF, 0xA2 }};
EFI_GUID gAppleApfsVolumeInfoGuid = { 0x900C7693, 0x8C14, 0x58BA, { 0xB4, 0x4E, 0x97, 0x45, 0x15, 0xD2, 0x7C, 0x78 }};
EFI_GUID gAppleBlessedOsxFolderInfoGuid = { 0x893CA450, 0x5F5E, 0x48BA, { 0x85, 0x8F, 0x08, 0xC4, 0x5D, 0x80, 0x23, 0x18 }};
EFI_GUID gAppleBlessedSystemFileInfoGuid = { 0xCA7E4814, 0x2ADC, 0x4ADD, { 0xAB, 0xFF, 0x73, 0x4E, 0x3C, 0xFE, 0x13, 0xF3 }};
EFI_GUID gAppleBlessedSystemFolderInfoGuid = { 0x7BD1F02D, 0x9C2F, 0x4581, { 0xBF, 0x12, 0xD5, 0x4a, 0xBA, 0x0D, 0x98, 0xD6 }};
EFI_GUID gAppleBootPolicyProtocolGuid = { 0x62257758, 0x350C, 0x4D0A, { 0xB0, 0xBD, 0xF6, 0xBE, 0x2E, 0x1E, 0x27, 0x2C }};
EFI_GUID gAppleVendorVariableGuid = { 0x4D1EDE05, 0x38C7, 0x4A6A, { 0x9C, 0xC6, 0x4B, 0xCC, 0xA8, 0xB3, 0x8C, 0x14 }};
EFI_GUID gAppleImg4VerificationProtocolGuid = { 0x314735F0, 0x26FE, 0x11E8, { 0xA4, 0x70, 0xB8, 0xE8, 0x56, 0x2C, 0xBA, 0xFA }};
EFI_GUID gAppleBeepGenProtocolGuid = { 0xC32332DF, 0xFC56, 0x4FE1, { 0x93, 0x58, 0xBA, 0x0D, 0x52, 0x9B, 0x24, 0xCD }};
const CHAR8 *gEfiCallerBaseName = "OpenCore";
EFI_GUID gEfiGraphicsOutputProtocolGuid = { 0x9042A9DE, 0x23DC, 0x4A38, { 0x96, 0xFB, 0x7A, 0xDE, 0xD0, 0x80, 0x51, 0x6A }};
EFI_GUID gEfiHiiFontProtocolGuid = {0xe9ca4775, 0x8657, 0x47fc, {0x97, 0xe7, 0x7e, 0xd6, 0x5a, 0x08, 0x43, 0x24}};
EFI_GUID gEfiSimpleTextOutProtocolGuid = { 0x387477C2, 0x69C7, 0x11D2, { 0x8E, 0x39, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B }};
EFI_GUID gEfiUgaDrawProtocolGuid = { 0x982C298B, 0xF4FA, 0x41CB, { 0xB8, 0x38, 0x77, 0xAA, 0x68, 0x8F, 0xB8, 0x39 }};
EFI_GUID gEfiAbsolutePointerProtocolGuid = { 0x8D59D32B, 0xC655, 0x4AE9, { 0x9B, 0x15, 0xF2, 0x59, 0x04, 0x99, 0x2A, 0x43 } };
EFI_GUID gEfiLoadedImageProtocolGuid = { 0x5B1B31A1, 0x9562, 0x11D2, { 0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B }};
EFI_GUID gEfiShellParametersProtocolGuid = { 0x752f3136, 0x4e16, 0x4fdc, {0xa2, 0x2a, 0xe5, 0xf4, 0x68, 0x12, 0xf4, 0xca }};
EFI_GUID gEfiSimplePointerProtocolGuid = { 0x31878C87, 0x0B75, 0x11D5, { 0x9A, 0x4F, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }};
EFI_GUID gEfiDebugPortProtocolGuid = { 0xEBA4E8D2, 0x3858, 0x41EC, { 0xA2, 0x81, 0x26, 0x47, 0xBA, 0x96, 0x60, 0xD0 }};
EFI_GUID gEfiDevicePathProtocolGuid = { 0x09576E91, 0x6D3F, 0x11D2, { 0x8E, 0x39, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B }};
EFI_GUID gEfiPcAnsiGuid = { 0xE0C14753, 0xF9BE, 0x11D2, { 0x9A, 0x0C, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }};
EFI_GUID gEfiPersistentVirtualCdGuid = { 0x08018188, 0x42CD, 0xBB48, {0x10, 0x0F, 0x53, 0x87, 0xD5, 0x3D, 0xED, 0x3D }};
EFI_GUID gEfiPersistentVirtualDiskGuid = { 0x5CEA02C9, 0x4D07, 0x69D3, {0x26, 0x9F ,0x44, 0x96, 0xFB, 0xE0, 0x96, 0xF9 }};
EFI_GUID gEfiSasDevicePathGuid = { 0xd487ddb4, 0x008b, 0x11d9, { 0xaf, 0xdc, 0x00, 0x10, 0x83, 0xff, 0xca, 0x4d }};
EFI_GUID gEfiUartDevicePathGuid = { 0x37499a9d, 0x542f, 0x4c89, { 0xa0, 0x26, 0x35, 0xda, 0x14, 0x20, 0x94, 0xe4 }};
EFI_GUID gEfiVT100Guid = { 0xDFA66065, 0xB419, 0x11D3, { 0x9A, 0x2D, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }};
EFI_GUID gEfiVT100PlusGuid = { 0x7BAEC70B, 0x57E0, 0x4C76, { 0x8E, 0x87, 0x2F, 0x9E, 0x28, 0x08, 0x83, 0x43 }};
EFI_GUID gEfiVTUTF8Guid = { 0xAD15A0D6, 0x8BEC, 0x4ACF, { 0xA0, 0x73, 0xD0, 0x1D, 0xE7, 0x7E, 0x2D, 0x88 }};
EFI_GUID gEfiVirtualCdGuid = { 0x3D5ABD30, 0x4175, 0x87CE, {0x6D, 0x64, 0xD2, 0xAD, 0xE5, 0x23, 0xC4, 0xBB }};
EFI_GUID gEfiVirtualDiskGuid = { 0x77AB535A, 0x45FC, 0x624B, {0x55, 0x60, 0xF7, 0xB2, 0x81, 0xD1, 0xF9, 0x6E }};
EFI_GUID gEfiFileInfoGuid = { 0x09576E92, 0x6D3F, 0x11D2, { 0x8E, 0x39, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B }};
EFI_GUID gEfiFileSystemVolumeLabelInfoIdGuid = { 0xDB47D7D3, 0xFE81, 0x11D3, { 0x9A, 0x35, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }};
EFI_GUID gEfiSimpleFileSystemProtocolGuid = { 0x964E5B22, 0x6459, 0x11D2, { 0x8E, 0x39, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B }};
EFI_GUID gEfiUserInterfaceThemeProtocolGuid = { 0xD5B0AC65, 0x9A2D, 0x4D2A, { 0xBB, 0xD6, 0xE8, 0x71, 0xA9, 0x5E, 0x04, 0x35 }};
EFI_GUID gEfiMpServiceProtocolGuid = { 0x3fdda605, 0xa76e, 0x4f46, { 0xad, 0x29, 0x12, 0xf4, 0x53, 0x1b, 0x3d, 0x08 }};
EFI_GUID gFrameworkEfiMpServiceProtocolGuid = { 0xF33261E7, 0x23CB, 0x11D5, { 0xBD, 0x5C, 0x00, 0x80, 0xC7, 0x3C, 0x88, 0x81 }};
EFI_GUID gEfiGlobalVariableGuid = { 0x8BE4DF61, 0x93CA, 0x11D2, { 0xAA, 0x0D, 0x00, 0xE0, 0x98, 0x03, 0x2B, 0x8C }};
EFI_GUID gEfiSmbios3TableGuid = { 0xF2FD1544, 0x9794, 0x4A2C, { 0x99, 0x2E, 0xE5, 0xBB, 0xCF, 0x20, 0xE3, 0x94 }};
EFI_GUID gEfiLegacyRegionProtocolGuid = { 0x0fc9013a, 0x0568, 0x4ba9, { 0x9b, 0x7e, 0xc9, 0xc3, 0x90, 0xa6, 0x60, 0x9b }};
EFI_GUID gEfiLegacyRegion2ProtocolGuid = { 0x70101eaf, 0x85, 0x440c, { 0xb3, 0x56, 0x8e, 0xe3, 0x6f, 0xef, 0x24, 0xf0 }};
EFI_GUID gEfiPciRootBridgeIoProtocolGuid = { 0x2F707EBB, 0x4A1A, 0x11D4, { 0x9A, 0x38, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }};
EFI_GUID gEfiSmbiosTableGuid = { 0xEB9D2D31, 0x2D88, 0x11D3, { 0x9A, 0x16, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }};
EFI_GUID gOcVendorVariableGuid = { 0x4D1FDA02, 0x38C7, 0x4A6A, { 0x9C, 0xC6, 0x4B, 0xCC, 0xA8, 0xB3, 0x01, 0x02 }};
EFI_GUID gOcCustomSmbios3TableGuid = { 0xF2FD1545, 0x9794, 0x4A2C, { 0x99, 0x2E, 0xE5, 0xBB, 0xCF, 0x20, 0xE3, 0x94 }};
EFI_GUID gOcCustomSmbiosTableGuid = { 0xEB9D2D35, 0x2D88, 0x11D3, { 0x9A, 0x16, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }};
EFI_GUID gOcAudioProtocolGuid = { 0x4B228577, 0x6274, 0x4A48, { 0x82, 0xAE, 0x07, 0x13, 0xA1, 0x17, 0x19, 0x87 }};
/** @file
Copyright (c) 2020, PMheart. All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
**/
#include <Pcd.h>
#define _PCD_VALUE_PcdUefiLibMaxPrintBufferSize 320U
#define _PCD_VALUE_PcdUgaConsumeSupport ((BOOLEAN)1U)
#define _PCD_VALUE_PcdDebugPropertyMask 0x23U
#define _PCD_VALUE_PcdDebugClearMemoryValue 0xAFU
#define _PCD_VALUE_PcdFixedDebugPrintErrorLevel 0x80000002U
#define _PCD_VALUE_PcdDebugPrintErrorLevel 0x80000002U
#define _PCD_VALUE_PcdMaximumAsciiStringLength 0U
#define _PCD_VALUE_PcdMaximumUnicodeStringLength 1000000U
#define _PCD_VALUE_PcdMaximumLinkedListLength 1000000U
#define _PCD_VALUE_PcdVerifyNodeInList ((BOOLEAN)0U)
#define _PCD_VALUE_PcdCpuNumberOfReservedVariableMtrrs 0x2U
#define _PCD_VALUE_PcdMaximumDevicePathNodeCount 0U
#define _PCD_VALUE_PcdImageLoaderHashProhibitOverlap 1U
#define _PCD_VALUE_PcdImageLoaderLoadHeader 0U
UINT32 _gPcd_FixedAtBuild_PcdUefiLibMaxPrintBufferSize = _PCD_VALUE_PcdUefiLibMaxPrintBufferSize;
BOOLEAN _gPcd_FixedAtBuild_PcdUgaConsumeSupport = _PCD_VALUE_PcdUgaConsumeSupport;
UINT8 _gPcd_FixedAtBuild_PcdDebugPropertyMask = _PCD_VALUE_PcdDebugPropertyMask;
UINT8 _gPcd_FixedAtBuild_PcdDebugClearMemoryValue = _PCD_VALUE_PcdDebugClearMemoryValue;
UINT32 _gPcd_FixedAtBuild_PcdFixedDebugPrintErrorLevel = _PCD_VALUE_PcdFixedDebugPrintErrorLevel;
UINT32 _gPcd_FixedAtBuild_PcdDebugPrintErrorLevel = _PCD_VALUE_PcdDebugPrintErrorLevel;
UINT32 _gPcd_FixedAtBuild_PcdMaximumAsciiStringLength = _PCD_VALUE_PcdMaximumAsciiStringLength;
UINT32 _gPcd_FixedAtBuild_PcdMaximumUnicodeStringLength = _PCD_VALUE_PcdMaximumUnicodeStringLength;
UINT32 _gPcd_FixedAtBuild_PcdMaximumLinkedListLength = _PCD_VALUE_PcdMaximumLinkedListLength;
BOOLEAN _gPcd_FixedAtBuild_PcdVerifyNodeInList = _PCD_VALUE_PcdVerifyNodeInList;
UINT32 _gPcd_FixedAtBuild_PcdCpuNumberOfReservedVariableMtrrs = _PCD_VALUE_PcdCpuNumberOfReservedVariableMtrrs;
UINT32 _gPcd_FixedAtBuild_PcdMaximumDevicePathNodeCount = _PCD_VALUE_PcdMaximumDevicePathNodeCount;
BOOLEAN _gPcd_FixedAtBuild_PcdImageLoaderHashProhibitOverlap = _PCD_VALUE_PcdImageLoaderHashProhibitOverlap;
BOOLEAN _gPcd_FixedAtBuild_PcdImageLoaderLoadHeader = _PCD_VALUE_PcdImageLoaderLoadHeader;
......@@ -19,9 +19,9 @@
VOID *
EFIAPI
CopyMem (
OUT VOID *DestinationBuffer,
IN CONST VOID *SourceBuffer,
IN UINTN Length
OUT VOID *DestinationBuffer,
IN CONST VOID *SourceBuffer,
IN UINTN Length
)
{
return memmove (DestinationBuffer, SourceBuffer, Length);
......@@ -30,9 +30,9 @@ CopyMem (
VOID *
EFIAPI
SetMem (
OUT VOID *Buffer,
IN UINTN Length,
IN UINT8 Value
OUT VOID *Buffer,
IN UINTN Length,
IN UINT8 Value
)
{
return memset (Buffer, Value, Length);
......@@ -41,8 +41,8 @@ SetMem (
VOID *
EFIAPI
ZeroMem (
OUT VOID *Buffer,
IN UINTN Length
OUT VOID *Buffer,
IN UINTN Length
)
{
return memset (Buffer, 0, Length);
......@@ -51,9 +51,9 @@ ZeroMem (
INTN
EFIAPI
CompareMem (
IN CONST VOID *DestinationBuffer,
IN CONST VOID *SourceBuffer,
IN UINTN Length
IN CONST VOID *DestinationBuffer,
IN CONST VOID *SourceBuffer,
IN UINTN Length
)
{
return memcmp (DestinationBuffer, SourceBuffer, Length);
......@@ -62,17 +62,18 @@ CompareMem (
VOID *
EFIAPI
ScanMem16 (
IN CONST VOID *Buffer,
IN UINTN Length,
IN UINT16 Value
IN CONST VOID *Buffer,
IN UINTN Length,
IN UINT16 Value
)
{
UINT16 *Pointer;
UINT16 *Pointer;
UINTN Index;
Pointer = (UINT16*)Buffer;
Pointer = (UINT16 *) Buffer;
for (UINTN i = 0; i < Length; ++i) {
if (Pointer[i] == Value) {
for (Index = 0; Index < Length; ++Index) {
if (Pointer[Index] == Value) {
return Pointer;
}
}
......@@ -83,7 +84,7 @@ ScanMem16 (
VOID *
EFIAPI
AllocatePool (
IN UINTN AllocationSize
IN UINTN AllocationSize
)
{
return malloc (AllocationSize);
......@@ -92,8 +93,8 @@ AllocatePool (
VOID *
EFIAPI
AllocateCopyPool (
IN UINTN AllocationSize,
IN CONST VOID *Buffer
IN UINTN AllocationSize,
IN CONST VOID *Buffer
)
{
VOID *Memory;
......@@ -101,16 +102,18 @@ AllocateCopyPool (
ASSERT (Buffer != NULL);
Memory = AllocatePool (AllocationSize);
if (Memory != NULL) {
Memory = CopyMem (Memory, Buffer, AllocationSize);
}
return Memory;
}
VOID *
EFIAPI
AllocateZeroPool (
IN UINTN AllocationSize
IN UINTN AllocationSize
)
{
VOID *Memory;
......@@ -120,23 +123,26 @@ AllocateZeroPool (
if (Memory != NULL) {
Memory = ZeroMem (Memory, AllocationSize);
}
return Memory;
}
VOID *
ReallocatePool (
UINTN OldSize,
UINTN NewSize,
VOID *OldBuffer OPTIONAL
IN UINTN OldSize,
IN UINTN NewSize,
IN VOID *OldBuffer OPTIONAL
)
{
VOID *NewBuffer;
NewBuffer = AllocateZeroPool (NewSize);
if (NewBuffer != NULL && OldBuffer != NULL) {
memcpy (NewBuffer, OldBuffer, MIN (OldSize, NewSize));
free (OldBuffer);
}
return NewBuffer;
}
......@@ -149,12 +155,15 @@ AllocatePages (
#ifdef WIN32
return _aligned_malloc (Pages * EFI_PAGE_SIZE, EFI_PAGE_SIZE);
#else // !WIN32
VOID *Memory;
int r;
VOID *Memory;
INTN RetVal;
Memory = NULL;
r = posix_memalign (&Memory, EFI_PAGE_SIZE, Pages * EFI_PAGE_SIZE);
if (r != 0) {
DEBUG ((DEBUG_ERROR, "posix_memalign returns error %d\n", r));
RetVal = posix_memalign (&Memory, EFI_PAGE_SIZE, Pages * EFI_PAGE_SIZE);
if (RetVal != 0) {
DEBUG ((DEBUG_ERROR, "posix_memalign returns error %d\n", RetVal));
return NULL;
}
......@@ -188,19 +197,20 @@ FreePages (
GUID *
EFIAPI
CopyGuid (
OUT GUID *DestinationGuid,
IN CONST GUID *SourceGuid
OUT GUID *DestinationGuid,
IN CONST GUID *SourceGuid
)
{
memmove (DestinationGuid, SourceGuid, sizeof (GUID));
return DestinationGuid;
}
BOOLEAN
EFIAPI
CompareGuid (
IN CONST GUID *Guid1,
IN CONST GUID *Guid2
IN CONST GUID *Guid1,
IN CONST GUID *Guid2
)
{
return memcmp (Guid1, Guid2, sizeof (GUID)) == 0;
......@@ -209,36 +219,39 @@ CompareGuid (
UINT16
EFIAPI
ReadUnaligned16 (
IN CONST UINT16 *Buffer
IN CONST UINT16 *Buffer
)
{
UINT16 Value;
memmove (&Value, Buffer, sizeof (UINT16));
return Value;
}
UINT16
EFIAPI
WriteUnaligned16 (
OUT UINT16 *Buffer,
IN UINT16 Value
OUT UINT16 *Buffer,
IN UINT16 Value
)
{
ASSERT (Buffer != NULL);
memmove (Buffer, &Value, sizeof (UINT16));
return Value;
}
UINT32
EFIAPI
ReadUnaligned24 (
IN CONST UINT32 *Buffer
IN CONST UINT32 *Buffer
)
{
UINT32 Value;
Value = ReadUnaligned32 (Buffer) & 0xffffff;
Value = ReadUnaligned32 (Buffer) & 0xFFFFFFU;
return Value;
}
......@@ -246,47 +259,53 @@ ReadUnaligned24 (
UINT32
EFIAPI
ReadUnaligned32 (
IN CONST UINT32 *Buffer
IN CONST UINT32 *Buffer
)
{
UINT32 Value;
memmove (&Value, Buffer, sizeof (UINT32));
return Value;
}
UINT64
EFIAPI
ReadUnaligned64 (
IN CONST UINT64 *Buffer
IN CONST UINT64 *Buffer
)
{
UINT64 Value;
memmove (&Value, Buffer, sizeof (UINT64));
return Value;
}
UINT32
EFIAPI
WriteUnaligned32 (
OUT UINT32 *Buffer,
IN UINT32 Value
OUT UINT32 *Buffer,
IN UINT32 Value
)
{
ASSERT (Buffer != NULL);
memmove (Buffer, &Value, sizeof (UINT32));
return Value;
}
UINT64
EFIAPI
WriteUnaligned64 (
OUT UINT64 *Buffer,
IN UINT64 Value
OUT UINT64 *Buffer,
IN UINT64 Value
)
{
ASSERT (Buffer != NULL);
memmove (Buffer, &Value, sizeof (UINT64));
return Value;
}
......@@ -3,43 +3,40 @@
SPDX-License-Identifier: BSD-3-Clause
**/
#include <BootServices.h>
#include <UserBootServices.h>
EFI_BOOT_SERVICES mBootServices =
{
.RaiseTPL = DummyRaiseTPL,
.LocateProtocol = DummyLocateProtocol,
.AllocatePages = DummyAllocatePages,
#include <stdio.h>
EFI_BOOT_SERVICES mBootServices = {
.RaiseTPL = DummyRaiseTPL,
.LocateProtocol = DummyLocateProtocol,
.AllocatePages = DummyAllocatePages,
.InstallConfigurationTable = DummyInstallConfigurationTable
};
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL mConOut =
{
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL mConOut = {
.OutputString = NullTextOutputString
};
EFI_SYSTEM_TABLE mSystemTable =
{
EFI_SYSTEM_TABLE mSystemTable = {
.BootServices = &mBootServices,
.ConOut = &mConOut
};
EFI_RUNTIME_SERVICES mRuntimeServices = {
};
EFI_RUNTIME_SERVICES mRuntimeServices = {};
EFI_SYSTEM_TABLE *gST = &mSystemTable;
EFI_BOOT_SERVICES *gBS = &mBootServices;
EFI_SYSTEM_TABLE *gST = &mSystemTable;
EFI_BOOT_SERVICES *gBS = &mBootServices;
EFI_HANDLE gImageHandle = (EFI_HANDLE)(UINTN) 0x12345;
EFI_HANDLE gImageHandle = (EFI_HANDLE) 0xDEADBABEULL;
BOOLEAN mPostEBS = FALSE;
EFI_SYSTEM_TABLE *mDebugST = &mSystemTable;
BOOLEAN mPostEBS = FALSE;
EFI_SYSTEM_TABLE *mDebugST = &mSystemTable;
EFI_RUNTIME_SERVICES *gRT = &mRuntimeServices;
EFI_RUNTIME_SERVICES *gRT = &mRuntimeServices;
#define CONFIG_TABLE_SIZE_INCREASED 0x10
UINTN mSystemTableAllocateSize = 0;
#define CONFIG_TABLE_SIZE_INCREASED 0x10
UINTN mSystemTableAllocateSize = 0ULL;
EFI_TPL
EFIAPI
......@@ -48,23 +45,23 @@ DummyRaiseTPL (
)
{
ASSERT (FALSE);
return 0;
}
EFI_STATUS
EFIAPI
DummyLocateProtocol (
EFI_GUID *ProtocolGuid,
VOID *Registration,
VOID **Interface
IN EFI_GUID *Protocol,
IN VOID *Registration, OPTIONAL
OUT VOID **Interface
)
{
(VOID) ProtocolGuid;
(VOID) Registration;
(VOID) Interface;
return EFI_NOT_FOUND;
}
EFI_STATUS
EFIAPI
DummyAllocatePages (
IN EFI_ALLOCATE_TYPE Type,
IN EFI_MEMORY_TYPE MemoryType,
......@@ -80,13 +77,17 @@ DummyAllocatePages (
EFI_STATUS
EFIAPI
DummyInstallConfigurationTable (
IN EFI_GUID *Guid,
IN VOID *Table
IN EFI_GUID *Guid,
IN VOID *Table
)
{
UINTN Index;
EFI_CONFIGURATION_TABLE *EfiConfigurationTable;
EFI_CONFIGURATION_TABLE *OldTable;
//
// NOTE: This code is adapted from original EDK II implementations.
//
UINTN Index;
EFI_CONFIGURATION_TABLE *EfiConfigurationTable;
EFI_CONFIGURATION_TABLE *OldTable;
//
// If Guid is NULL, then this operation cannot be performed
......@@ -133,13 +134,10 @@ DummyInstallConfigurationTable (
&(gST->ConfigurationTable[Index + 1]),
(gST->NumberOfTableEntries - Index) * sizeof (EFI_CONFIGURATION_TABLE)
);
} else {
//
// No matching GUIDs were found, so this is an add operation.
//
if (Table == NULL) {
//
// If Table is NULL on an add operation, then return an error.
......@@ -155,7 +153,7 @@ DummyInstallConfigurationTable (
// Allocate a table with one additional entry.
//
mSystemTableAllocateSize += (CONFIG_TABLE_SIZE_INCREASED * sizeof (EFI_CONFIGURATION_TABLE));
EfiConfigurationTable = AllocatePool (mSystemTableAllocateSize);
EfiConfigurationTable = AllocatePool (mSystemTableAllocateSize);
if (EfiConfigurationTable == NULL) {
//
// If a new table could not be allocated, then return an error.
......@@ -203,7 +201,7 @@ DummyInstallConfigurationTable (
//
// Fill in the new entry
//
CopyGuid ((VOID *)&EfiConfigurationTable[Index].VendorGuid, Guid);
CopyGuid ((VOID *) &EfiConfigurationTable[Index].VendorGuid, Guid);
EfiConfigurationTable[Index].VendorTable = Table;
//
......@@ -212,27 +210,26 @@ DummyInstallConfigurationTable (
gST->NumberOfTableEntries++;
}
//
// Fix up the CRC-32 in the EFI System Table
//
// CalculateEfiHdrCrc (&gST->Hdr);
return EFI_SUCCESS;
}
EFI_STATUS
EFIAPI
NullTextOutputString (
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
IN CHAR16 *String
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
IN CHAR16 *String
)
{
while (*String) {
while (*String != '\0') {
if (*String != '\r') {
printf("%c", (char) *String);
//
// Cast string to CHAR8 to truncate unicode symbols.
//
putchar ((CHAR8) *String);
}
++String;
}
return EFI_SUCCESS;
}
......@@ -3,9 +3,9 @@
SPDX-License-Identifier: BSD-3-Clause
**/
#include <File.h>
#include <UserFile.h>
uint8_t *readFile(const char *str, uint32_t *size) {
uint8_t *UserReadFile(const char *str, uint32_t *size) {
FILE *f = fopen(str, "rb");
if (!f) return NULL;
......@@ -25,14 +25,12 @@ uint8_t *readFile(const char *str, uint32_t *size) {
return string;
}
void writeFile(const char *str, void *data, uint32_t size) {
void UserWriteFile(const char *str, void *data, uint32_t size) {
FILE *Fh = fopen(str, "wb");
if (Fh != NULL) {
if (fwrite (data, size, 1, Fh) != 1)
abort();
fclose(Fh);
} else {
if (!Fh) abort();
if (fwrite (data, size, 1, Fh) != 1)
abort();
}
fclose(Fh);
}
/** @file
Copyright (c) 2020, PMheart. All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
**/
#include <UserGlobalVar.h>
EFI_GUID gAppleBootVariableGuid = { 0X7C436110, 0XAB2A, 0X4BBB, { 0XA8, 0X80, 0XFE, 0X41, 0X99, 0X5C, 0X9F, 0X82 }};
EFI_GUID gAppleEventProtocolGuid = { 0X33BE0EF1, 0X89C9, 0X4A6D, { 0XBB, 0X9F, 0X69, 0XDC, 0X8D, 0XD5, 0X16, 0XB9 }};
EFI_GUID gAppleKeyMapAggregatorProtocolGuid = { 0X5B213447, 0X6E73, 0X4901, { 0XA4, 0XF1, 0XB8, 0X64, 0XF3, 0XB7, 0XA1, 0X72 }};
EFI_GUID gAppleKeyMapDatabaseProtocolGuid = { 0X584B9EBE, 0X80C1, 0X4BD6, { 0X98, 0XB0, 0XA7, 0X78, 0X6E, 0XC2, 0XF2, 0XE2 }};
EFI_GUID gAppleApfsContainerInfoGuid = { 0x3533CF0D, 0x685F, 0x5EBF, { 0x8D, 0xC6, 0x73, 0x93, 0x48, 0x5B, 0xAF, 0xA2 }};
EFI_GUID gAppleApfsVolumeInfoGuid = { 0x900C7693, 0x8C14, 0x58BA, { 0xB4, 0x4E, 0x97, 0x45, 0x15, 0xD2, 0x7C, 0x78 }};
EFI_GUID gAppleBlessedOsxFolderInfoGuid = { 0x893CA450, 0x5F5E, 0x48BA, { 0x85, 0x8F, 0x08, 0xC4, 0x5D, 0x80, 0x23, 0x18 }};
EFI_GUID gAppleBlessedSystemFileInfoGuid = { 0xCA7E4814, 0x2ADC, 0x4ADD, { 0xAB, 0xFF, 0x73, 0x4E, 0x3C, 0xFE, 0x13, 0xF3 }};
EFI_GUID gAppleBlessedSystemFolderInfoGuid = { 0x7BD1F02D, 0x9C2F, 0x4581, { 0xBF, 0x12, 0xD5, 0x4a, 0xBA, 0x0D, 0x98, 0xD6 }};
EFI_GUID gAppleBootPolicyProtocolGuid = { 0x62257758, 0x350C, 0x4D0A, { 0xB0, 0xBD, 0xF6, 0xBE, 0x2E, 0x1E, 0x27, 0x2C }};
EFI_GUID gAppleVendorVariableGuid = { 0x4D1EDE05, 0x38C7, 0x4A6A, { 0x9C, 0xC6, 0x4B, 0xCC, 0xA8, 0xB3, 0x8C, 0x14 }};
EFI_GUID gAppleImg4VerificationProtocolGuid = { 0x314735F0, 0x26FE, 0x11E8, { 0xA4, 0x70, 0xB8, 0xE8, 0x56, 0x2C, 0xBA, 0xFA }};
EFI_GUID gAppleBeepGenProtocolGuid = { 0xC32332DF, 0xFC56, 0x4FE1, { 0x93, 0x58, 0xBA, 0x0D, 0x52, 0x9B, 0x24, 0xCD }};
CONST CHAR8 *gEfiCallerBaseName = "OpenCore";
EFI_GUID gEfiGraphicsOutputProtocolGuid = { 0x9042A9DE, 0x23DC, 0x4A38, { 0x96, 0xFB, 0x7A, 0xDE, 0xD0, 0x80, 0x51, 0x6A }};
EFI_GUID gEfiHiiFontProtocolGuid = { 0xe9ca4775, 0x8657, 0x47fc, { 0x97, 0xe7, 0x7e, 0xd6, 0x5a, 0x08, 0x43, 0x24 }};
EFI_GUID gEfiSimpleTextOutProtocolGuid = { 0x387477C2, 0x69C7, 0x11D2, { 0x8E, 0x39, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B }};
EFI_GUID gEfiUgaDrawProtocolGuid = { 0x982C298B, 0xF4FA, 0x41CB, { 0xB8, 0x38, 0x77, 0xAA, 0x68, 0x8F, 0xB8, 0x39 }};
EFI_GUID gEfiAbsolutePointerProtocolGuid = { 0x8D59D32B, 0xC655, 0x4AE9, { 0x9B, 0x15, 0xF2, 0x59, 0x04, 0x99, 0x2A, 0x43 }};
EFI_GUID gEfiLoadedImageProtocolGuid = { 0x5B1B31A1, 0x9562, 0x11D2, { 0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B }};
EFI_GUID gEfiShellParametersProtocolGuid = { 0x752f3136, 0x4e16, 0x4fdc, { 0xa2, 0x2a, 0xe5, 0xf4, 0x68, 0x12, 0xf4, 0xca }};
EFI_GUID gEfiSimplePointerProtocolGuid = { 0x31878C87, 0x0B75, 0x11D5, { 0x9A, 0x4F, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }};
EFI_GUID gEfiDebugPortProtocolGuid = { 0xEBA4E8D2, 0x3858, 0x41EC, { 0xA2, 0x81, 0x26, 0x47, 0xBA, 0x96, 0x60, 0xD0 }};
EFI_GUID gEfiDevicePathProtocolGuid = { 0x09576E91, 0x6D3F, 0x11D2, { 0x8E, 0x39, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B }};
EFI_GUID gEfiPcAnsiGuid = { 0xE0C14753, 0xF9BE, 0x11D2, { 0x9A, 0x0C, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }};
EFI_GUID gEfiPersistentVirtualCdGuid = { 0x08018188, 0x42CD, 0xBB48, { 0x10, 0x0F, 0x53, 0x87, 0xD5, 0x3D, 0xED, 0x3D }};
EFI_GUID gEfiPersistentVirtualDiskGuid = { 0x5CEA02C9, 0x4D07, 0x69D3, { 0x26, 0x9F ,0x44, 0x96, 0xFB, 0xE0, 0x96, 0xF9 }};
EFI_GUID gEfiSasDevicePathGuid = { 0xd487ddb4, 0x008b, 0x11d9, { 0xaf, 0xdc, 0x00, 0x10, 0x83, 0xff, 0xca, 0x4d }};
EFI_GUID gEfiUartDevicePathGuid = { 0x37499a9d, 0x542f, 0x4c89, { 0xa0, 0x26, 0x35, 0xda, 0x14, 0x20, 0x94, 0xe4 }};
EFI_GUID gEfiVT100Guid = { 0xDFA66065, 0xB419, 0x11D3, { 0x9A, 0x2D, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }};
EFI_GUID gEfiVT100PlusGuid = { 0x7BAEC70B, 0x57E0, 0x4C76, { 0x8E, 0x87, 0x2F, 0x9E, 0x28, 0x08, 0x83, 0x43 }};
EFI_GUID gEfiVTUTF8Guid = { 0xAD15A0D6, 0x8BEC, 0x4ACF, { 0xA0, 0x73, 0xD0, 0x1D, 0xE7, 0x7E, 0x2D, 0x88 }};
EFI_GUID gEfiVirtualCdGuid = { 0x3D5ABD30, 0x4175, 0x87CE, { 0x6D, 0x64, 0xD2, 0xAD, 0xE5, 0x23, 0xC4, 0xBB }};
EFI_GUID gEfiVirtualDiskGuid = { 0x77AB535A, 0x45FC, 0x624B, { 0x55, 0x60, 0xF7, 0xB2, 0x81, 0xD1, 0xF9, 0x6E }};
EFI_GUID gEfiFileInfoGuid = { 0x09576E92, 0x6D3F, 0x11D2, { 0x8E, 0x39, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B }};
EFI_GUID gEfiFileSystemVolumeLabelInfoIdGuid = { 0xDB47D7D3, 0xFE81, 0x11D3, { 0x9A, 0x35, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }};
EFI_GUID gEfiSimpleFileSystemProtocolGuid = { 0x964E5B22, 0x6459, 0x11D2, { 0x8E, 0x39, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B }};
EFI_GUID gEfiUserInterfaceThemeProtocolGuid = { 0xD5B0AC65, 0x9A2D, 0x4D2A, { 0xBB, 0xD6, 0xE8, 0x71, 0xA9, 0x5E, 0x04, 0x35 }};
EFI_GUID gEfiMpServiceProtocolGuid = { 0x3fdda605, 0xa76e, 0x4f46, { 0xad, 0x29, 0x12, 0xf4, 0x53, 0x1b, 0x3d, 0x08 }};
EFI_GUID gFrameworkEfiMpServiceProtocolGuid = { 0xF33261E7, 0x23CB, 0x11D5, { 0xBD, 0x5C, 0x00, 0x80, 0xC7, 0x3C, 0x88, 0x81 }};
EFI_GUID gEfiGlobalVariableGuid = { 0x8BE4DF61, 0x93CA, 0x11D2, { 0xAA, 0x0D, 0x00, 0xE0, 0x98, 0x03, 0x2B, 0x8C }};
EFI_GUID gEfiSmbios3TableGuid = { 0xF2FD1544, 0x9794, 0x4A2C, { 0x99, 0x2E, 0xE5, 0xBB, 0xCF, 0x20, 0xE3, 0x94 }};
EFI_GUID gEfiLegacyRegionProtocolGuid = { 0x0fc9013a, 0x0568, 0x4ba9, { 0x9b, 0x7e, 0xc9, 0xc3, 0x90, 0xa6, 0x60, 0x9b }};
EFI_GUID gEfiLegacyRegion2ProtocolGuid = { 0x70101eaf, 0x85, 0x440c, { 0xb3, 0x56, 0x8e, 0xe3, 0x6f, 0xef, 0x24, 0xf0 }};
EFI_GUID gEfiPciRootBridgeIoProtocolGuid = { 0x2F707EBB, 0x4A1A, 0x11D4, { 0x9A, 0x38, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }};
EFI_GUID gEfiSmbiosTableGuid = { 0xEB9D2D31, 0x2D88, 0x11D3, { 0x9A, 0x16, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }};
EFI_GUID gOcVendorVariableGuid = { 0x4D1FDA02, 0x38C7, 0x4A6A, { 0x9C, 0xC6, 0x4B, 0xCC, 0xA8, 0xB3, 0x01, 0x02 }};
EFI_GUID gOcCustomSmbios3TableGuid = { 0xF2FD1545, 0x9794, 0x4A2C, { 0x99, 0x2E, 0xE5, 0xBB, 0xCF, 0x20, 0xE3, 0x94 }};
EFI_GUID gOcCustomSmbiosTableGuid = { 0xEB9D2D35, 0x2D88, 0x11D3, { 0x9A, 0x16, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }};
EFI_GUID gOcAudioProtocolGuid = { 0x4B228577, 0x6274, 0x4A48, { 0x82, 0xAE, 0x07, 0x13, 0xA1, 0x17, 0x19, 0x87 }};
......@@ -33,6 +33,7 @@ DivU64x32Remainder (
if (Remainder != NULL) {
*Remainder = (UINT32)(Dividend % Divisor);
}
return Dividend / Divisor;
}
......@@ -49,6 +50,7 @@ DivS64x64Remainder (
if (Remainder != NULL) {
*Remainder = Dividend % Divisor;
}
return Dividend / Divisor;
}
......@@ -65,6 +67,7 @@ DivU64x64Remainder (
if (Remainder != NULL) {
*Remainder = Dividend % Divisor;
}
return Dividend / Divisor;
}
......@@ -124,4 +127,4 @@ SwapBytes64 (
)
{
return __builtin_bswap64 (Operand);
}
\ No newline at end of file
}
......@@ -15,6 +15,7 @@ CpuBreakpoint (
)
{
ASSERT (FALSE);
while (TRUE);
}
......@@ -53,14 +54,24 @@ AsmCpuid (
{
UINT32 eax = 0, ebx = 0, ecx = 0, edx = 0;
asm ("cpuid\n"
: "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx)
: "0" (Index));
if (Eax) *Eax = eax;
if (Ebx) *Ebx = ebx;
if (Ecx) *Ecx = ecx;
if (Edx) *Edx = edx;
asm (
"cpuid\n"
: "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx)
: "0" (Index)
);
if (Eax) {
*Eax = eax;
}
if (Ebx) {
*Ebx = ebx;
}
if (Ecx) {
*Ecx = ecx;
}
if (Edx) {
*Edx = edx;
}
return Index;
}
......@@ -77,14 +88,25 @@ AsmCpuidEx (
{
UINT32 eax = 0, ebx = 0, ecx = 0, edx = 0;
asm ("cpuid\n"
: "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx)
: "0" (Index), "2" (SubIndex));
if (Eax) *Eax = eax;
if (Ebx) *Ebx = ebx;
if (Ecx) *Ecx = ecx;
if (Edx) *Edx = edx;
asm (
"cpuid\n"
: "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx)
: "0" (Index),
"2" (SubIndex)
);
if (Eax) {
*Eax = eax;
}
if (Ebx) {
*Ebx = ebx;
}
if (Ecx) {
*Ecx = ecx;
}
if (Edx) {
*Edx = edx;
}
return Index;
}
......
/** @file
Copyright (c) 2020, PMheart. All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
**/
#include <UserPcd.h>
#define _PCD_VALUE_PcdUefiLibMaxPrintBufferSize 320U
#define _PCD_VALUE_PcdUgaConsumeSupport ((BOOLEAN)1U)
#define _PCD_VALUE_PcdDebugPropertyMask 0x23U
#define _PCD_VALUE_PcdDebugClearMemoryValue 0xAFU
#define _PCD_VALUE_PcdFixedDebugPrintErrorLevel 0x80000002U
#define _PCD_VALUE_PcdDebugPrintErrorLevel 0x80000002U
#define _PCD_VALUE_PcdMaximumAsciiStringLength 0U
#define _PCD_VALUE_PcdMaximumUnicodeStringLength 1000000U
#define _PCD_VALUE_PcdMaximumLinkedListLength 1000000U
#define _PCD_VALUE_PcdVerifyNodeInList ((BOOLEAN)0U)
#define _PCD_VALUE_PcdCpuNumberOfReservedVariableMtrrs 0x2U
#define _PCD_VALUE_PcdMaximumDevicePathNodeCount 0U
#define _PCD_VALUE_PcdImageLoaderHashProhibitOverlap 1U
#define _PCD_VALUE_PcdImageLoaderLoadHeader 0U
UINT32 _gPcd_FixedAtBuild_PcdUefiLibMaxPrintBufferSize = _PCD_VALUE_PcdUefiLibMaxPrintBufferSize;
BOOLEAN _gPcd_FixedAtBuild_PcdUgaConsumeSupport = _PCD_VALUE_PcdUgaConsumeSupport;
UINT8 _gPcd_FixedAtBuild_PcdDebugPropertyMask = _PCD_VALUE_PcdDebugPropertyMask;
UINT8 _gPcd_FixedAtBuild_PcdDebugClearMemoryValue = _PCD_VALUE_PcdDebugClearMemoryValue;
UINT32 _gPcd_FixedAtBuild_PcdFixedDebugPrintErrorLevel = _PCD_VALUE_PcdFixedDebugPrintErrorLevel;
UINT32 _gPcd_FixedAtBuild_PcdDebugPrintErrorLevel = _PCD_VALUE_PcdDebugPrintErrorLevel;
UINT32 _gPcd_FixedAtBuild_PcdMaximumAsciiStringLength = _PCD_VALUE_PcdMaximumAsciiStringLength;
UINT32 _gPcd_FixedAtBuild_PcdMaximumUnicodeStringLength = _PCD_VALUE_PcdMaximumUnicodeStringLength;
UINT32 _gPcd_FixedAtBuild_PcdMaximumLinkedListLength = _PCD_VALUE_PcdMaximumLinkedListLength;
BOOLEAN _gPcd_FixedAtBuild_PcdVerifyNodeInList = _PCD_VALUE_PcdVerifyNodeInList;
UINT32 _gPcd_FixedAtBuild_PcdCpuNumberOfReservedVariableMtrrs = _PCD_VALUE_PcdCpuNumberOfReservedVariableMtrrs;
UINT32 _gPcd_FixedAtBuild_PcdMaximumDevicePathNodeCount = _PCD_VALUE_PcdMaximumDevicePathNodeCount;
BOOLEAN _gPcd_FixedAtBuild_PcdImageLoaderHashProhibitOverlap = _PCD_VALUE_PcdImageLoaderHashProhibitOverlap;
BOOLEAN _gPcd_FixedAtBuild_PcdImageLoaderLoadHeader = _PCD_VALUE_PcdImageLoaderLoadHeader;
......@@ -124,7 +124,7 @@ ifneq ($(STANDALONE),1)
#
# Compatibility headers.
#
CFLAGS += -include ../../User/Include/Pcd.h -include ../../User/Include/GlobalVar.h
CFLAGS += -include ../../User/Include/UserPcd.h -include ../../User/Include/UserGlobalVar.h
#
# UDK implementations.
#
......@@ -132,7 +132,7 @@ ifneq ($(STANDALONE),1)
#
# Customised/Simplified implementations at userspace level.
#
OBJS += BaseMemoryLib.o BootServices.o GlobalVar.o UserMath.o UserMisc.o Pcd.o OcDummy.o
OBJS += UserBaseMemoryLib.o UserBootServices.o UserGlobalVar.o UserMath.o UserMisc.o UserPcd.o UserOcDummy.o
#
# OcGuardLib targets.
#
......@@ -212,7 +212,7 @@ endif
# Miscellaneous implementations that do not depend on UDK.
#
VPATH += ../../User/Library:$
OBJS += File.o
OBJS += UserFile.o
#
# Directory where objects will be produced.
......
......@@ -5,7 +5,7 @@
SPDX-License-Identifier: BSD-3-Clause
**/
#include <File.h>
#include <UserFile.h>
#include <Base.h>
#include <Library/MemoryAllocationLib.h>
......@@ -67,8 +67,8 @@ int main (int argc, char** argv)
UINT32 BmpImageSize;
FILE *write_ptr;
FontImage = readFile (argv[1], &FontImageSize);
FontMetrics = readFile (argv[2], &FontMetricsSize);
FontImage = UserReadFile (argv[1], &FontImageSize);
FontMetrics = UserReadFile (argv[2], &FontMetricsSize);
Result = GuiFontConstruct (&Context, FontImage, FontImageSize, FontMetrics, FontMetricsSize);
if (!Result) {
DEBUG ((DEBUG_WARN, "BMF: Helvetica failed\n"));
......
......@@ -15,7 +15,7 @@
#include <string.h>
#include <File.h>
#include <UserFile.h>
int ENTRY_POINT (int argc, char *argv[]) {
if (argc < 2) {
......@@ -38,7 +38,7 @@ int ENTRY_POINT (int argc, char *argv[]) {
uint8_t *UncompDmg = NULL;
uint32_t UncompSize;
if ((Dmg = readFile (argv[i], &DmgSize)) == NULL) {
if ((Dmg = UserReadFile (argv[i], &DmgSize)) == NULL) {
printf ("Read fail\n");
goto ContinueDmgLoop;
}
......@@ -75,7 +75,7 @@ int ENTRY_POINT (int argc, char *argv[]) {
DmgContextValid = 1;
if (strcmp (argv[i + 1], "n") != 0) {
if ((Chunklist = readFile (argv[i + 1], &ChunklistSize)) == NULL) {
if ((Chunklist = UserReadFile (argv[i + 1], &ChunklistSize)) == NULL) {
printf ("Read fail\n");
goto ContinueDmgLoop;
}
......
......@@ -19,7 +19,7 @@ UefiMain (
return EFI_SUCCESS;
}
int main(int argc, char **argv) {
int main(int argc, const char *argv[]) {
UefiMain (gImageHandle, gST);
return 0;
}
......@@ -4,7 +4,7 @@
#include <stdlib.h>
#include <string.h>
#include <File.h>
#include <UserFile.h>
#include <Base.h>
......@@ -53,7 +53,7 @@ int debugManifest (char *manifestName)
uint32_t ManSize;
DERImg4ManifestInfo ManInfo;
Manifest = readFile (manifestName, &ManSize);
Manifest = UserReadFile (manifestName, &ManSize);
if (Manifest == NULL) {
printf ("\n!!! read error !!!\n");
return -1;
......@@ -112,7 +112,7 @@ int verifyImg4 (char *imageName, char *manifestName, char *type)
uint32_t ManSize, ImgSize;
DERImg4ManifestInfo ManInfo;
Manifest = readFile (manifestName, &ManSize);
Manifest = UserReadFile (manifestName, &ManSize);
if (Manifest == NULL) {
printf ("\n!!! read error !!!\n");
return -1;
......@@ -132,7 +132,7 @@ int verifyImg4 (char *imageName, char *manifestName, char *type)
InternalDebugEnvInfo (&ManInfo.environment);
Image = readFile (imageName, &ImgSize);
Image = UserReadFile (imageName, &ImgSize);
if (Image == NULL) {
printf ("\n!!! read error !!!\n");
return -1;
......
......@@ -21,7 +21,7 @@
#include <string.h>
#include <sys/time.h>
#include <File.h>
#include <UserFile.h>
STATIC BOOLEAN FailedToProcess = FALSE;
STATIC UINT32 KernelVersion = 0;
......@@ -530,7 +530,7 @@ int wrap_main(int argc, char** argv) {
UINT32 AllocSize;
PRELINKED_CONTEXT Context;
const char *name = argc > 1 ? argv[1] : "/System/Library/PrelinkedKernels/prelinkedkernel";
if ((Prelinked = readFile(name, &PrelinkedSize)) == NULL) {
if ((Prelinked = UserReadFile(name, &PrelinkedSize)) == NULL) {
printf("Read fail %s\n", name);
return -1;
}
......@@ -549,7 +549,7 @@ int wrap_main(int argc, char** argv) {
TestData = NULL;
TestDataSize = 0;
} else {
TestData = readFile(argv[argi + 2], &TestDataSize);
TestData = UserReadFile(argv[argi + 2], &TestDataSize);
if (TestData == NULL) {
printf("Read data fail %s\n", argv[argi + 2]);
abort();
......@@ -559,7 +559,7 @@ int wrap_main(int argc, char** argv) {
}
if (argc - argi > 3) {
TestPlist = (CHAR8*) readFile(argv[argi + 3], &TestPlistSize);
TestPlist = (CHAR8*) UserReadFile(argv[argi + 3], &TestPlistSize);
if (TestPlist == NULL) {
printf("Read plist fail\n");
free(TestData);
......@@ -688,7 +688,7 @@ int wrap_main(int argc, char** argv) {
TestData = NULL;
TestDataSize = 0;
} else {
TestData = readFile(argv[2], &TestDataSize);
TestData = UserReadFile(argv[2], &TestDataSize);
if (TestData == NULL) {
printf("Read data fail %s\n", argv[2]);
abort();
......@@ -698,7 +698,7 @@ int wrap_main(int argc, char** argv) {
}
if (argc > 3) {
TestPlist = (CHAR8*) readFile(argv[3], &TestPlistSize);
TestPlist = (CHAR8*) UserReadFile(argv[3], &TestPlistSize);
if (TestPlist == NULL) {
printf("Read plist fail\n");
abort();
......@@ -741,7 +741,7 @@ int wrap_main(int argc, char** argv) {
ApplyKextPatches (&Context);
writeFile("out.bin", Prelinked, Context.PrelinkedSize);
UserWriteFile("out.bin", Prelinked, Context.PrelinkedSize);
if (!EFI_ERROR (Status)) {
DEBUG ((DEBUG_WARN, "[OK] Prelink inject complete success\n"));
......@@ -771,7 +771,7 @@ INT32 LLVMFuzzerTestOneInput(CONST UINT8 *Data, UINTN Size) {
return 0;
}
if ((Prelinked = readFile("prelinkedkernel.unpack", &PrelinkedSize)) == NULL) {
if ((Prelinked = UserReadFile("prelinkedkernel.unpack", &PrelinkedSize)) == NULL) {
printf("Read fail\n");
return 0;
}
......
......@@ -20,7 +20,7 @@
#include <string.h>
#include <sys/time.h>
#include <File.h>
#include <UserFile.h>
MACH_HEADER_64 Header;
MACH_SECTION_64 Sect;
......@@ -274,7 +274,7 @@ static int FeedMacho(void *file, uint32_t size) {
int ENTRY_POINT(int argc, char** argv) {
uint32_t f;
uint8_t *b;
if ((b = readFile(argc > 1 ? argv[1] : "kernel", &f)) == NULL) {
if ((b = UserReadFile(argc > 1 ? argv[1] : "kernel", &f)) == NULL) {
printf("Read fail\n");
return -1;
}
......
......@@ -13,7 +13,7 @@
#include <stdio.h>
#include <string.h>
#include <File.h>
#include <UserFile.h>
EFI_STATUS
TestImageLoad (
......@@ -113,7 +113,7 @@ int ENTRY_POINT (int argc, char *argv[]) {
uint8_t *Image;
uint32_t ImageSize;
if ((Image = readFile (argv[1], &ImageSize)) == NULL) {
if ((Image = UserReadFile (argv[1], &ImageSize)) == NULL) {
printf ("Read fail\n");
return 1;
}
......
......@@ -17,7 +17,7 @@
#include <stdlib.h>
#include <string.h>
#include <File.h>
#include <UserFile.h>
#include <Base.h>
......@@ -66,7 +66,7 @@ int main(int argc, char *argv[]) {
uint32_t PkSize;
for (Index = 1; (int) Index < argc; ++Index) {
PublicKey = (OC_RSA_PUBLIC_KEY *)readFile (argv[Index], &PkSize);
PublicKey = (OC_RSA_PUBLIC_KEY *)UserReadFile (argv[Index], &PkSize);
if (PublicKey == NULL) {
printf ("read error\n");
return -1;
......
......@@ -12,10 +12,10 @@
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include <File.h>
#include <GlobalVar.h>
#include <BootServices.h>
#include <Pcd.h>
#include <UserFile.h>
#include <UserGlobalVar.h>
#include <UserBootServices.h>
#include <UserPcd.h>
#include <Library/BaseMemoryLib.h>
#include <Library/MemoryAllocationLib.h>
......@@ -75,7 +75,7 @@ int ENTRY_POINT(int argc, char** argv) {
uint32_t f;
uint8_t *b;
if ((b = readFile(argc > 1 ? argv[1] : "Smbios.bin", &f)) == NULL) {
if ((b = UserReadFile(argc > 1 ? argv[1] : "Smbios.bin", &f)) == NULL) {
printf("Read fail\n");
return -1;
}
......
......@@ -18,7 +18,7 @@
#include <OpenCore.h>
#include <File.h>
#include <UserFile.h>
UINT32
CheckConfig (
......@@ -79,7 +79,7 @@ int ENTRY_POINT(int argc, const char *argv[]) {
// Read config file (Only one single config is supported).
//
ConfigFileName = argv[1];
ConfigFileBuffer = readFile (ConfigFileName, &ConfigFileSize);
ConfigFileBuffer = UserReadFile (ConfigFileName, &ConfigFileSize);
if (ConfigFileBuffer == NULL) {
DEBUG ((DEBUG_ERROR, "Failed to read %a\n", ConfigFileName));
return -1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册