mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2024-11-10 09:40:53 +01:00
Make OC compile as a library for Clover. It compiles, doesn't mean it's
working !
This commit is contained in:
parent
381bc886e5
commit
04a8211cbe
50
Clover.dsc
50
Clover.dsc
@ -203,6 +203,7 @@
|
||||
# OcMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
|
||||
OcMiscLib|OpenCorePkg/Library/OcMiscLib/OcMiscLib.inf
|
||||
OcOSInfoLib|OpenCorePkg/Library/OcOSInfoLib/OcOSInfoLib.inf
|
||||
OcPciIoLib|OpenCorePkg/Library/OcPciIoLib/OcPciIoLib.inf
|
||||
# OcPngLib|OpenCorePkg/Library/OcPngLib/OcPngLib.inf
|
||||
OcRngLib|OpenCorePkg/Library/OcRngLib/OcRngLib.inf
|
||||
OcRtcLib|OpenCorePkg/Library/OcRtcLib/OcRtcLib.inf
|
||||
@ -219,6 +220,7 @@
|
||||
OcAppleKernelLib|OpenCorePkg/Library/OcAppleKernelLib/OcAppleKernelLib.inf
|
||||
OcMachoLib|OpenCorePkg/Library/OcMachoLib/OcMachoLib.inf
|
||||
OcVirtualFsLib|OpenCorePkg/Library/OcVirtualFsLib/OcVirtualFsLib.inf
|
||||
OcPeCoffExtLib|OpenCorePkg/Library/OcPeCoffExtLib/OcPeCoffExtLib.inf
|
||||
OcMacInfoLib|OpenCorePkg/Library/OcMacInfoLib/OcMacInfoLib.inf
|
||||
OcApfsLib|OpenCorePkg/Library/OcApfsLib/OcApfsLib.inf
|
||||
OcAppleSecureBootLib|OpenCorePkg/Library/OcAppleSecureBootLib/OcAppleSecureBootLib.inf
|
||||
@ -233,18 +235,22 @@
|
||||
OcAppleUserInterfaceThemeLib|OpenCorePkg/Library/OcAppleUserInterfaceThemeLib/OcAppleUserInterfaceThemeLib.inf
|
||||
OcConfigurationLib|OpenCorePkg/Library/OcConfigurationLib/OcConfigurationLib.inf
|
||||
OcDevicePropertyLib|OpenCorePkg/Library/OcDevicePropertyLib/OcDevicePropertyLib.inf
|
||||
OcDirectResetLib|OpenCorePkg/Library/OcDirectResetLib/OcDirectResetLib.inf
|
||||
# OcFirmwareVolumeLib|OpenCorePkg/Library/OcFirmwareVolumeLib/OcFirmwareVolumeLib.inf
|
||||
OcHashServicesLib|OpenCorePkg/Library/OcHashServicesLib/OcHashServicesLib.inf
|
||||
OcSmbiosLib|OpenCorePkg/Library/OcSmbiosLib/OcSmbiosLib.inf
|
||||
# OcSmcLib|OpenCorePkg/Library/OcSmcLib/OcSmcLib.inf
|
||||
OcUnicodeCollationEngGenericLib|OpenCorePkg/Library/OcUnicodeCollationEngLib/OcUnicodeCollationEngGenericLib.inf
|
||||
OcPeCoffExtLib|OpenCorePkg/Library/OcPeCoffExtLib/OcPeCoffExtLib.inf
|
||||
OcPeCoffLib|OpenCorePkg/Library/OcPeCoffLib/OcPeCoffLib.inf
|
||||
OcVariableLib|OpenCorePkg/Library/OcVariableLib/OcVariableLib.inf
|
||||
# OcPeCoffExtLib|OpenCorePkg/Library/OcPeCoffExtLib/OcPeCoffExtLib.inf
|
||||
# OcPeCoffLib|OpenCorePkg/Library/OcPeCoffLib/OcPeCoffLib.inf
|
||||
PeCoffLib2|MdePkg/Library/BasePeCoffLib2/BasePeCoffLib2.inf
|
||||
UefiImageExtraActionLib|MdePkg/Library/BaseUefiImageExtraActionLibNull/BaseUefiImageExtraActionLibNull.inf
|
||||
ResetSystemLib|OpenCorePkg/Library/OcResetSystemLib/OcResetSystemLib.inf
|
||||
|
||||
OcVariableLib|OpenCorePkg/Library/OcVariableLib/OcVariableLib.inf
|
||||
|
||||
OpenCoreLib|OpenCorePkg/Application/OpenCore/OpenCoreLib.inf
|
||||
|
||||
# OpenCoreLib|OpenCorePkg/Application/OpenCore/OpenCoreLib.inf
|
||||
OcDebugLogLibOc2Clover|OpenCorePkg/Library/OcDebugLogLibOc2Clover/OcDebugLogLibOc2Clover.inf
|
||||
|
||||
#MachoLib|Library/MachoLib/MachoLib.inf
|
||||
@ -307,10 +313,10 @@
|
||||
DEFINE OC_INCLUDE_FLAG = -include OpenCoreFromClover.h
|
||||
!endif
|
||||
|
||||
OpenCorePkg/Application/OpenCore/OpenCoreLib.inf {
|
||||
<BuildOptions>
|
||||
*_*_*_CC_FLAGS = $(OC_INCLUDE_FLAG)
|
||||
}
|
||||
# OpenCorePkg/Application/OpenCore/OpenCoreLib.inf {
|
||||
# <BuildOptions>
|
||||
# *_*_*_CC_FLAGS = $(OC_INCLUDE_FLAG)
|
||||
# }
|
||||
OpenCorePkg/Library/OcGuardLib/OcGuardLib.inf {
|
||||
<BuildOptions>
|
||||
*_*_*_CC_FLAGS = $(OC_INCLUDE_FLAG)
|
||||
@ -489,6 +495,10 @@
|
||||
<BuildOptions>
|
||||
*_*_*_CC_FLAGS = $(OC_INCLUDE_FLAG)
|
||||
}
|
||||
OpenCorePkg/Library/OcDirectResetLib/OcDirectResetLib.inf {
|
||||
<BuildOptions>
|
||||
*_*_*_CC_FLAGS = $(OC_INCLUDE_FLAG)
|
||||
}
|
||||
# OpenCorePkg/Library/OcFirmwareVolumeLib/OcFirmwareVolumeLib.inf {
|
||||
# <BuildOptions>
|
||||
# *_*_*_CC_FLAGS = $(OC_INCLUDE_FLAG)
|
||||
@ -509,10 +519,10 @@
|
||||
<BuildOptions>
|
||||
*_*_*_CC_FLAGS = $(OC_INCLUDE_FLAG)
|
||||
}
|
||||
OpenCorePkg/Library/OcPeCoffLib/OcPeCoffLib.inf {
|
||||
<BuildOptions>
|
||||
*_*_*_CC_FLAGS = $(OC_INCLUDE_FLAG)
|
||||
}
|
||||
# OpenCorePkg/Library/OcPeCoffLib/OcPeCoffLib.inf {
|
||||
# <BuildOptions>
|
||||
# *_*_*_CC_FLAGS = $(OC_INCLUDE_FLAG)
|
||||
# }
|
||||
OpenCorePkg/Library/OcVariableLib/OcVariableLib.inf {
|
||||
<BuildOptions>
|
||||
*_*_*_CC_FLAGS = $(OC_INCLUDE_FLAG)
|
||||
@ -821,7 +831,7 @@
|
||||
#Sample/Application/Sample.inf
|
||||
#gptsync/gptsync.inf
|
||||
bdmesg_efi/bdmesg.inf
|
||||
OpenCorePkg/Application/ControlMsrE2/ControlMsrE2Clover.inf
|
||||
#OpenCorePkg/Application/ControlMsrE2/ControlMsrE2Clover.inf
|
||||
|
||||
!ifndef NO_CLOVER_SHELL
|
||||
ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.inf
|
||||
@ -869,6 +879,20 @@ rEFIt_UEFI/refit.inf {
|
||||
gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x80000042
|
||||
}
|
||||
|
||||
#from OpenCore
|
||||
[PcdsPatchableInModule]
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterAccessWidth|8
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialUseMmio|FALSE
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialUseHardwareFlowControl|FALSE
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialDetectCable|FALSE
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase|0x03F8
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialBaudRate|115200
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialLineControl|0x03
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialFifoControl|0x07
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialClockRate|1843200
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialPciDeviceInfo|{0xFF,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialExtendedTxFifoSize|64
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterStride|1
|
||||
|
||||
[Components.X64]
|
||||
|
||||
|
21
Include/IndustryStandard/VirtualMemory.h
Executable file → Normal file
21
Include/IndustryStandard/VirtualMemory.h
Executable file → Normal file
@ -55,7 +55,7 @@ typedef union {
|
||||
UINT64 CacheDisabled : 1; // 0 = Cached, 1=Non-Cached
|
||||
UINT64 Accessed : 1; // 0 = Not accessed, 1 = Accessed (set by CPU)
|
||||
UINT64 Dirty : 1; // 0 = Not Dirty, 1 = written by processor on access to page
|
||||
UINT64 PAT:1; //
|
||||
UINT64 PAT : 1; // Combines with CD, WT and MTRR to define true caching type
|
||||
UINT64 Global : 1; // 0 = Not global page, 1 = global page TLB not cleared on CR3 write
|
||||
UINT64 Available : 3; // Available for use by system software
|
||||
UINT64 PageTableBaseAddress : 40; // Page Table Base Address
|
||||
@ -80,7 +80,7 @@ typedef union {
|
||||
UINT64 MustBe1 : 1; // Must be 1
|
||||
UINT64 Global : 1; // 0 = Not global page, 1 = global page TLB not cleared on CR3 write
|
||||
UINT64 Available : 3; // Available for use by system software
|
||||
UINT64 PAT:1; //
|
||||
UINT64 PAT : 1; // Combines with CD, WT and MTRR to define true caching type
|
||||
UINT64 MustBeZero : 8; // Must be zero;
|
||||
UINT64 PageTableBaseAddress : 31; // Page Table Base Address
|
||||
UINT64 AvabilableHigh : 11; // Available for use by system software
|
||||
@ -104,7 +104,7 @@ typedef union {
|
||||
UINT64 MustBe1 : 1; // Must be 1
|
||||
UINT64 Global : 1; // 0 = Not global page, 1 = global page TLB not cleared on CR3 write
|
||||
UINT64 Available : 3; // Available for use by system software
|
||||
UINT64 PAT:1; //
|
||||
UINT64 PAT : 1; // Combines with CD, WT and MTRR to define true caching type
|
||||
UINT64 MustBeZero : 17; // Must be zero;
|
||||
UINT64 PageTableBaseAddress : 22; // Page Table Base Address
|
||||
UINT64 AvabilableHigh : 11; // Available for use by system software
|
||||
@ -113,6 +113,19 @@ typedef union {
|
||||
UINT64 Uint64;
|
||||
} PAGE_TABLE_1G_ENTRY;
|
||||
|
||||
//
|
||||
// PAT index bits.
|
||||
//
|
||||
typedef union {
|
||||
struct {
|
||||
UINT8 WriteThrough : 1; // 0 = Write-Back caching, 1=Write-Through caching
|
||||
UINT8 CacheDisabled : 1; // 0 = Cached, 1=Non-Cached
|
||||
UINT8 PAT : 1; // Combines with CD, WT and MTRR to define true caching type
|
||||
UINT8 Reserved : 5; // Reserved
|
||||
} Bits;
|
||||
UINT8 Index;
|
||||
} PAT_INDEX;
|
||||
|
||||
typedef union {
|
||||
struct {
|
||||
UINT64 PhysPgOffset : 12; // 0 = Physical Page Offset
|
||||
@ -142,6 +155,8 @@ typedef union {
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
#define CR0_WP BIT16
|
||||
|
||||
#define CR3_ADDR_MASK 0x000FFFFFFFFFF000ull
|
||||
#define CR3_FLAG_PWT 0x0000000000000008ull
|
||||
#define CR3_FLAG_PCD 0x0000000000000010ull
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit f184c6d350c3ad000deff5d3f949d8fd7d3ec183
|
||||
Subproject commit a82ac0b0ec755ddc8094d4dd3f5c645ca1320090
|
@ -37,15 +37,15 @@ extern OC_CPU_INFO mOpenCoreCpuInfo;
|
||||
//extern EFI_HANDLE mLoadHandle;
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
OcKernelFileOpen (
|
||||
IN EFI_FILE_PROTOCOL *This,
|
||||
OUT EFI_FILE_PROTOCOL **NewHandle,
|
||||
IN CHAR16 *FileName,
|
||||
IN UINT64 OpenMode,
|
||||
IN UINT64 Attributes
|
||||
);
|
||||
//EFI_STATUS
|
||||
//EFIAPI
|
||||
//OcKernelFileOpen (
|
||||
// IN EFI_FILE_PROTOCOL *This,
|
||||
// OUT EFI_FILE_PROTOCOL **NewHandle,
|
||||
// IN CHAR16 *FileName,
|
||||
// IN UINT64 OpenMode,
|
||||
// IN UINT64 Attributes
|
||||
// );
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
|
@ -436,7 +436,7 @@
|
||||
VideoBiosPatchLib
|
||||
# OpensslLib # for secureboot, I think
|
||||
WaveLib
|
||||
OpenCoreLib
|
||||
OcMainLib
|
||||
DebugLib
|
||||
OcDebugLogLibOc2Clover
|
||||
CppMemLib
|
||||
|
@ -255,6 +255,106 @@ void AllocSmallBlocks()
|
||||
}
|
||||
}
|
||||
|
||||
OC_GLOBAL_CONFIG
|
||||
mOpenCoreConfiguration;
|
||||
|
||||
OC_STORAGE_CONTEXT
|
||||
mOpenCoreStorage;
|
||||
|
||||
OC_CPU_INFO
|
||||
mOpenCoreCpuInfo;
|
||||
|
||||
UINT8
|
||||
mOpenCoreBooterHash[SHA1_DIGEST_SIZE];
|
||||
|
||||
OC_RSA_PUBLIC_KEY *
|
||||
mOpenCoreVaultKey;
|
||||
|
||||
OC_PRIVILEGE_CONTEXT
|
||||
mOpenCorePrivilege;
|
||||
|
||||
EFI_HANDLE
|
||||
mStorageHandle;
|
||||
|
||||
EFI_DEVICE_PATH_PROTOCOL *
|
||||
mStoragePath;
|
||||
|
||||
CHAR16 *
|
||||
mStorageRoot;
|
||||
|
||||
VOID
|
||||
OcMain (
|
||||
IN OC_STORAGE_CONTEXT *Storage,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *LoadPath
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
// OC_PRIVILEGE_CONTEXT *Privilege;
|
||||
|
||||
DEBUG ((DEBUG_INFO, "OC: OcMiscEarlyInit...\n"));
|
||||
Status = OcMiscEarlyInit (
|
||||
Storage,
|
||||
&mOpenCoreConfiguration,
|
||||
mOpenCoreVaultKey
|
||||
);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
return;
|
||||
}
|
||||
|
||||
OcCpuScanProcessor (&mOpenCoreCpuInfo);
|
||||
|
||||
DEBUG ((DEBUG_INFO, "OC: OcLoadNvramSupport...\n"));
|
||||
OcLoadNvramSupport (Storage, &mOpenCoreConfiguration);
|
||||
DEBUG ((DEBUG_INFO, "OC: OcMiscMiddleInit...\n"));
|
||||
OcMiscMiddleInit (
|
||||
Storage,
|
||||
&mOpenCoreConfiguration,
|
||||
mStorageRoot,
|
||||
LoadPath,
|
||||
mStorageHandle,
|
||||
mOpenCoreConfiguration.Booter.Quirks.ForceBooterSignature ? mOpenCoreBooterHash : NULL
|
||||
);
|
||||
DEBUG ((DEBUG_INFO, "OC: OcLoadUefiSupport...\n"));
|
||||
OcLoadUefiSupport (Storage, &mOpenCoreConfiguration, &mOpenCoreCpuInfo, mOpenCoreBooterHash);
|
||||
DEBUG_CODE_BEGIN ();
|
||||
DEBUG ((DEBUG_INFO, "OC: OcMiscLoadSystemReport...\n"));
|
||||
OcMiscLoadSystemReport (&mOpenCoreConfiguration, mStorageHandle);
|
||||
DEBUG_CODE_END ();
|
||||
DEBUG ((DEBUG_INFO, "OC: OcLoadAcpiSupport...\n"));
|
||||
OcLoadAcpiSupport (&mOpenCoreStorage, &mOpenCoreConfiguration);
|
||||
DEBUG ((DEBUG_INFO, "OC: OcLoadPlatformSupport...\n"));
|
||||
OcLoadPlatformSupport (&mOpenCoreConfiguration, &mOpenCoreCpuInfo);
|
||||
DEBUG ((DEBUG_INFO, "OC: OcLoadDevPropsSupport...\n"));
|
||||
OcLoadDevPropsSupport (&mOpenCoreConfiguration);
|
||||
DEBUG ((DEBUG_INFO, "OC: OcMiscLateInit...\n"));
|
||||
OcMiscLateInit (Storage, &mOpenCoreConfiguration);
|
||||
DEBUG ((DEBUG_INFO, "OC: OcLoadKernelSupport...\n"));
|
||||
OcLoadKernelSupport (&mOpenCoreStorage, &mOpenCoreConfiguration, &mOpenCoreCpuInfo);
|
||||
|
||||
if (mOpenCoreConfiguration.Misc.Security.EnablePassword) {
|
||||
mOpenCorePrivilege.CurrentLevel = OcPrivilegeUnauthorized;
|
||||
mOpenCorePrivilege.Hash = mOpenCoreConfiguration.Misc.Security.PasswordHash;
|
||||
mOpenCorePrivilege.Salt = OC_BLOB_GET (&mOpenCoreConfiguration.Misc.Security.PasswordSalt);
|
||||
mOpenCorePrivilege.SaltSize = mOpenCoreConfiguration.Misc.Security.PasswordSalt.Size;
|
||||
|
||||
// Privilege = &mOpenCorePrivilege;
|
||||
} else {
|
||||
// Privilege = NULL;
|
||||
}
|
||||
|
||||
DEBUG ((DEBUG_INFO, "OC: All green, starting boot management...\n"));
|
||||
|
||||
// OcMiscBoot (
|
||||
// &mOpenCoreStorage,
|
||||
// &mOpenCoreConfiguration,
|
||||
// Privilege,
|
||||
// OcStartImage,
|
||||
// mOpenCoreConfiguration.Uefi.Quirks.RequestBootVarRouting,
|
||||
// mStorageHandle
|
||||
// );
|
||||
}
|
||||
|
||||
|
||||
static EFI_STATUS LoadEFIImageList(IN EFI_DEVICE_PATH **DevicePaths,
|
||||
IN CONST XStringW& ImageTitle,
|
||||
@ -3593,7 +3693,7 @@ RefitMain (IN EFI_HANDLE ImageHandle,
|
||||
MemoryTrackerInit();
|
||||
|
||||
EFI_STATUS Status = RefitMainMain(ImageHandle, SystemTable);
|
||||
|
||||
debugStartImageWithOC();
|
||||
|
||||
DBG("MT_alloc_count=%lld\n", MT_getAllocCount());
|
||||
MT_outputDanglingPtr();
|
||||
|
Loading…
Reference in New Issue
Block a user