Handle booter quircks.

This commit is contained in:
jief666 2020-09-09 20:06:34 +03:00
parent 389ec9d17c
commit 232f94f00c
5 changed files with 134 additions and 96 deletions

View File

@ -349,26 +349,26 @@ EFI_KEYBOARD_INFO_PROTOCOL mKeyboardInfo = {
UsbKbGetKeyboardDeviceInfo UsbKbGetKeyboardDeviceInfo
}; };
#define OCQUIRKS_PROTOCOL_REVISION 23 //#define OCQUIRKS_PROTOCOL_REVISION 23
//
EFI_STATUS //EFI_STATUS
EFIAPI //EFIAPI
GetQuirksConfig (IN OCQUIRKS_PROTOCOL *This, //GetQuirksConfig (IN OCQUIRKS_PROTOCOL *This,
OUT OC_ABC_SETTINGS_4CLOVER *Buffer, // OUT OC_ABC_SETTINGS_4CLOVER *Buffer,
OUT BOOLEAN *GopEnable // OUT BOOLEAN *GopEnable
) // )
{ //{
DBG("GetQuirksConfig called\n"); // DBG("GetQuirksConfig called\n");
CopyMem(Buffer, &gQuirks, sizeof(OC_ABC_SETTINGS_4CLOVER)); // CopyMem(Buffer, &gQuirks, sizeof(OC_ABC_SETTINGS_4CLOVER));
*GopEnable = gProvideConsoleGopEnable; // *GopEnable = gProvideConsoleGopEnable;
return EFI_SUCCESS; // return EFI_SUCCESS;
} //}
//
OCQUIRKS_PROTOCOL mQuirksConfig = { //OCQUIRKS_PROTOCOL mQuirksConfig = {
OCQUIRKS_PROTOCOL_REVISION, // OCQUIRKS_PROTOCOL_REVISION,
0, //reserved // 0, //reserved
GetQuirksConfig // GetQuirksConfig
}; //};
EFI_STATUS EFI_STATUS
SetPrivateVarProto(VOID) SetPrivateVarProto(VOID)
@ -385,8 +385,8 @@ SetPrivateVarProto(VOID)
&mGraphConfig, &mGraphConfig,
&gEfiKeyboardInfoProtocolGuid, &gEfiKeyboardInfoProtocolGuid,
&mKeyboardInfo, &mKeyboardInfo,
&gOcQuirksProtocolGuid, // &gOcQuirksProtocolGuid,
&mQuirksConfig, // &mQuirksConfig,
NULL NULL
); );
//obligatory protocol //obligatory protocol

View File

@ -17,7 +17,7 @@ extern UINT32 cPropSize;
extern UINT8 *cProperties; extern UINT8 *cProperties;
extern XString8 cDeviceProperties; extern XString8 cDeviceProperties;
extern CHAR8 *BootOSName; extern CHAR8 *BootOSName;
extern OC_ABC_SETTINGS_4CLOVER gQuirks; //extern OC_ABC_SETTINGS_4CLOVER gQuirks;
EFI_STATUS EFI_STATUS
SetPrivateVarProto (VOID); SetPrivateVarProto (VOID);

View File

@ -140,7 +140,7 @@ EFI_GUID gUuid;
EMU_VARIABLE_CONTROL_PROTOCOL *gEmuVariableControl = NULL; EMU_VARIABLE_CONTROL_PROTOCOL *gEmuVariableControl = NULL;
extern BOOLEAN NeedPMfix; extern BOOLEAN NeedPMfix;
OC_ABC_SETTINGS_4CLOVER gQuirks; //OC_ABC_SETTINGS_4CLOVER gQuirks;
BOOLEAN gProvideConsoleGopEnable; BOOLEAN gProvideConsoleGopEnable;
//extern INTN OldChosenAudio; //extern INTN OldChosenAudio;
@ -2900,61 +2900,65 @@ GetEarlyUserSettings (
} }
} }
const TagDict* DictPointer = CfgDict->dictPropertyForKey("Quirks"); const TagDict* DictPointer = CfgDict->dictPropertyForKey("OcBooter");
if (DictPointer != NULL) { if (DictPointer != NULL) {
const TagStruct* Prop; const TagDict* OcQuirksDict = DictPointer->dictPropertyForKey("Quirks");
Prop = DictPointer->propertyForKey( "AvoidRuntimeDefrag"); if (OcQuirksDict != NULL) {
gQuirks.OcAbcSettings.AvoidRuntimeDefrag = IsPropertyNotNullAndTrue(Prop); const TagStruct* Prop;
gSettings.QuirksMask |= gQuirks.OcAbcSettings.AvoidRuntimeDefrag? QUIRK_DEFRAG:0; Prop = OcQuirksDict->propertyForKey( "AvoidRuntimeDefrag");
Prop = DictPointer->propertyForKey( "DevirtualiseMmio"); gSettings.ocBooterQuirks.AvoidRuntimeDefrag = IsPropertyNotNullAndTrue(Prop);
gQuirks.OcAbcSettings.DevirtualiseMmio = IsPropertyNotNullAndTrue(Prop); gSettings.QuirksMask |= gSettings.ocBooterQuirks.AvoidRuntimeDefrag? QUIRK_DEFRAG:0;
gSettings.QuirksMask |= gQuirks.OcAbcSettings.DevirtualiseMmio? QUIRK_MMIO:0; Prop = OcQuirksDict->propertyForKey( "DevirtualiseMmio");
Prop = DictPointer->propertyForKey( "DisableSingleUser"); gSettings.ocBooterQuirks.DevirtualiseMmio = IsPropertyNotNullAndTrue(Prop);
gQuirks.OcAbcSettings.DisableSingleUser = IsPropertyNotNullAndTrue(Prop); gSettings.QuirksMask |= gSettings.ocBooterQuirks.DevirtualiseMmio? QUIRK_MMIO:0;
gSettings.QuirksMask |= gQuirks.OcAbcSettings.DisableSingleUser? QUIRK_SU:0; Prop = OcQuirksDict->propertyForKey( "DisableSingleUser");
Prop = DictPointer->propertyForKey( "DisableVariableWrite"); gSettings.ocBooterQuirks.DisableSingleUser = IsPropertyNotNullAndTrue(Prop);
gQuirks.OcAbcSettings.DisableVariableWrite = IsPropertyNotNullAndTrue(Prop); gSettings.QuirksMask |= gSettings.ocBooterQuirks.DisableSingleUser? QUIRK_SU:0;
gSettings.QuirksMask |= gQuirks.OcAbcSettings.DisableVariableWrite? QUIRK_VAR:0; Prop = OcQuirksDict->propertyForKey( "DisableVariableWrite");
Prop = DictPointer->propertyForKey( "DiscardHibernateMap"); gSettings.ocBooterQuirks.DisableVariableWrite = IsPropertyNotNullAndTrue(Prop);
gQuirks.OcAbcSettings.DiscardHibernateMap = IsPropertyNotNullAndTrue(Prop); gSettings.QuirksMask |= gSettings.ocBooterQuirks.DisableVariableWrite? QUIRK_VAR:0;
gSettings.QuirksMask |= gQuirks.OcAbcSettings.DiscardHibernateMap? QUIRK_HIBER:0; Prop = OcQuirksDict->propertyForKey( "DiscardHibernateMap");
Prop = DictPointer->propertyForKey( "EnableSafeModeSlide"); gSettings.ocBooterQuirks.DiscardHibernateMap = IsPropertyNotNullAndTrue(Prop);
gQuirks.OcAbcSettings.EnableSafeModeSlide = IsPropertyNotNullAndTrue(Prop); gSettings.QuirksMask |= gSettings.ocBooterQuirks.DiscardHibernateMap? QUIRK_HIBER:0;
gSettings.QuirksMask |= gQuirks.OcAbcSettings.EnableSafeModeSlide? QUIRK_SAFE:0; Prop = OcQuirksDict->propertyForKey( "EnableSafeModeSlide");
Prop = DictPointer->propertyForKey( "EnableWriteUnprotector"); gSettings.ocBooterQuirks.EnableSafeModeSlide = IsPropertyNotNullAndTrue(Prop);
gQuirks.OcAbcSettings.EnableWriteUnprotector = IsPropertyNotNullAndTrue(Prop); gSettings.QuirksMask |= gSettings.ocBooterQuirks.EnableSafeModeSlide? QUIRK_SAFE:0;
gSettings.QuirksMask |= gQuirks.OcAbcSettings.EnableWriteUnprotector? QUIRK_UNPROT:0; Prop = OcQuirksDict->propertyForKey( "EnableWriteUnprotector");
Prop = DictPointer->propertyForKey( "ForceExitBootServices"); gSettings.ocBooterQuirks.EnableWriteUnprotector = IsPropertyNotNullAndTrue(Prop);
gQuirks.OcAbcSettings.ForceExitBootServices = IsPropertyNotNullAndTrue(Prop); gSettings.QuirksMask |= gSettings.ocBooterQuirks.EnableWriteUnprotector? QUIRK_UNPROT:0;
gSettings.QuirksMask |= gQuirks.OcAbcSettings.ForceExitBootServices? QUIRK_EXIT:0; Prop = OcQuirksDict->propertyForKey( "ForceExitBootServices");
Prop = DictPointer->propertyForKey( "ProtectMemoryRegions"); gSettings.ocBooterQuirks.ForceExitBootServices = IsPropertyNotNullAndTrue(Prop);
gQuirks.OcAbcSettings.ProtectMemoryRegions = IsPropertyNotNullAndTrue(Prop); gSettings.QuirksMask |= gSettings.ocBooterQuirks.ForceExitBootServices? QUIRK_EXIT:0;
gSettings.QuirksMask |= gQuirks.OcAbcSettings.ProtectMemoryRegions? QUIRK_REGION:0; Prop = OcQuirksDict->propertyForKey( "ProtectMemoryRegions");
Prop = DictPointer->propertyForKey( "ProtectSecureBoot"); gSettings.ocBooterQuirks.ProtectMemoryRegions = IsPropertyNotNullAndTrue(Prop);
gQuirks.OcAbcSettings.ProtectSecureBoot = IsPropertyNotNullAndTrue(Prop); gSettings.QuirksMask |= gSettings.ocBooterQuirks.ProtectMemoryRegions? QUIRK_REGION:0;
gSettings.QuirksMask |= gQuirks.OcAbcSettings.ProtectMemoryRegions? QUIRK_SECURE:0; Prop = OcQuirksDict->propertyForKey( "ProtectSecureBoot");
Prop = DictPointer->propertyForKey( "ProtectUefiServices"); gSettings.ocBooterQuirks.ProtectSecureBoot = IsPropertyNotNullAndTrue(Prop);
gQuirks.OcAbcSettings.ProtectUefiServices = IsPropertyNotNullAndTrue(Prop); gSettings.QuirksMask |= gSettings.ocBooterQuirks.ProtectMemoryRegions? QUIRK_SECURE:0;
gSettings.QuirksMask |= gQuirks.OcAbcSettings.ProtectUefiServices? QUIRK_UEFI:0; Prop = OcQuirksDict->propertyForKey( "ProtectUefiServices");
Prop = DictPointer->propertyForKey( "ProvideConsoleGopEnable"); gSettings.ocBooterQuirks.ProtectUefiServices = IsPropertyNotNullAndTrue(Prop);
gProvideConsoleGopEnable = IsPropertyNotNullAndTrue(Prop); gSettings.QuirksMask |= gSettings.ocBooterQuirks.ProtectUefiServices? QUIRK_UEFI:0;
Prop = DictPointer->propertyForKey( "ProvideCustomSlide"); Prop = OcQuirksDict->propertyForKey( "ProvideConsoleGopEnable");
gQuirks.OcAbcSettings.ProvideCustomSlide = IsPropertyNotNullAndTrue(Prop); gProvideConsoleGopEnable = IsPropertyNotNullAndTrue(Prop);
gSettings.QuirksMask |= gQuirks.OcAbcSettings.ProvideCustomSlide? QUIRK_CUSTOM:0; Prop = OcQuirksDict->propertyForKey( "ProvideCustomSlide");
Prop = DictPointer->propertyForKey( "ProvideMaxSlide"); gSettings.ocBooterQuirks.ProvideCustomSlide = IsPropertyNotNullAndTrue(Prop);
gQuirks.OcAbcSettings.ProvideMaxSlide = GetPropertyAsInteger(Prop, 0); gSettings.QuirksMask |= gSettings.ocBooterQuirks.ProvideCustomSlide? QUIRK_CUSTOM:0;
Prop = DictPointer->propertyForKey( "RebuildAppleMemoryMap"); Prop = OcQuirksDict->propertyForKey( "ProvideMaxSlide");
gQuirks.OcAbcSettings.RebuildAppleMemoryMap = IsPropertyNotNullAndTrue(Prop); gSettings.ocBooterQuirks.ProvideMaxSlide = GetPropertyAsInteger(Prop, 0);
gSettings.QuirksMask |= gQuirks.OcAbcSettings.RebuildAppleMemoryMap? QUIRK_MAP:0; Prop = OcQuirksDict->propertyForKey( "RebuildAppleMemoryMap");
Prop = DictPointer->propertyForKey( "SetupVirtualMap"); gSettings.ocBooterQuirks.RebuildAppleMemoryMap = IsPropertyNotNullAndTrue(Prop);
gQuirks.OcAbcSettings.SetupVirtualMap = IsPropertyNotNullAndTrue(Prop); gSettings.QuirksMask |= gSettings.ocBooterQuirks.RebuildAppleMemoryMap? QUIRK_MAP:0;
gSettings.QuirksMask |= gQuirks.OcAbcSettings.SetupVirtualMap? QUIRK_VIRT:0; Prop = OcQuirksDict->propertyForKey( "SetupVirtualMap");
Prop = DictPointer->propertyForKey( "SignalAppleOS"); gSettings.ocBooterQuirks.SetupVirtualMap = IsPropertyNotNullAndTrue(Prop);
gQuirks.OcAbcSettings.SignalAppleOS = IsPropertyNotNullAndTrue(Prop); gSettings.QuirksMask |= gSettings.ocBooterQuirks.SetupVirtualMap? QUIRK_VIRT:0;
gSettings.QuirksMask |= gQuirks.OcAbcSettings.SignalAppleOS? QUIRK_OS:0; Prop = OcQuirksDict->propertyForKey( "SignalAppleOS");
Prop = DictPointer->propertyForKey( "SyncRuntimePermissions"); gSettings.ocBooterQuirks.SignalAppleOS = IsPropertyNotNullAndTrue(Prop);
gQuirks.OcAbcSettings.SyncRuntimePermissions = IsPropertyNotNullAndTrue(Prop); gSettings.QuirksMask |= gSettings.ocBooterQuirks.SignalAppleOS? QUIRK_OS:0;
gSettings.QuirksMask |= gQuirks.OcAbcSettings.SyncRuntimePermissions? QUIRK_PERM:0; Prop = OcQuirksDict->propertyForKey( "SyncRuntimePermissions");
gSettings.ocBooterQuirks.SyncRuntimePermissions = IsPropertyNotNullAndTrue(Prop);
gSettings.QuirksMask |= gSettings.ocBooterQuirks.SyncRuntimePermissions? QUIRK_PERM:0;
}
gSettings.mmioWhiteListArray.setEmpty();
const TagArray* Dict2 = DictPointer->arrayPropertyForKey("MmioWhitelist"); // array of dict const TagArray* Dict2 = DictPointer->arrayPropertyForKey("MmioWhitelist"); // array of dict
if (Dict2 != NULL) { if (Dict2 != NULL) {
INTN Count = Dict2->arrayContent().size(); INTN Count = Dict2->arrayContent().size();
@ -2962,29 +2966,26 @@ GetEarlyUserSettings (
//OC_SCHEMA_STRING_IN ("Comment", OC_MMIO_WL_STRUCT, Comment), //OC_SCHEMA_STRING_IN ("Comment", OC_MMIO_WL_STRUCT, Comment),
//OC_SCHEMA_BOOLEAN_IN ("Enabled", OC_MMIO_WL_STRUCT, Enabled), //OC_SCHEMA_BOOLEAN_IN ("Enabled", OC_MMIO_WL_STRUCT, Enabled),
if (Count > 0) { if (Count > 0) {
gQuirks.MmioWhitelistLabels = (__typeof__(gQuirks.MmioWhitelistLabels))AllocatePool(sizeof(char*) * Count); for (INTN i = 0; i < Count; i++)
gQuirks.OcAbcSettings.MmioWhitelist = (__typeof__(gQuirks.OcAbcSettings.MmioWhitelist))AllocatePool(sizeof(*gQuirks.OcAbcSettings.MmioWhitelist) * Count); {
gQuirks.MmioWhitelistEnabled = (__typeof__(gQuirks.MmioWhitelistEnabled))AllocatePool(sizeof(BOOLEAN) * Count);
gQuirks.OcAbcSettings.MmioWhitelistSize = 0;
for (INTN i = 0; i < Count; i++) {
const TagDict* Dict3 = Dict2->dictElementAt(i, "MmioWhitelist"_XS8); const TagDict* Dict3 = Dict2->dictElementAt(i, "MmioWhitelist"_XS8);
MMIOWhiteList* mmioWhiteListPtr = new MMIOWhiteList();
MMIOWhiteList& mmioWhiteList = *mmioWhiteListPtr;
gQuirks.MmioWhitelistLabels[gQuirks.OcAbcSettings.MmioWhitelistSize] = (__typeof__(char *))AllocateZeroPool(256);
const TagStruct* Prop2 = Dict3->propertyForKey("Comment"); const TagStruct* Prop2 = Dict3->propertyForKey("Comment");
if (Prop2 != NULL && (Prop2->isString()) && Prop2->getString()->stringValue().notEmpty()) { if (Prop2 != NULL && Prop2->isString() && Prop2->getString()->stringValue().notEmpty()) {
snprintf(gQuirks.MmioWhitelistLabels[gQuirks.OcAbcSettings.MmioWhitelistSize], 255, "%s", Prop2->getString()->stringValue().c_str()); mmioWhiteList.comment = Prop2->getString()->stringValue();
} else { } else {
snprintf(gQuirks.MmioWhitelistLabels[gQuirks.OcAbcSettings.MmioWhitelistSize], 255, " (NoLabel)"); mmioWhiteList.comment = " (NoLabel)"_XS8;
} }
Prop2 = Dict3->propertyForKey("Address"); Prop2 = Dict3->propertyForKey("Address");
if (Prop2 != 0) { if (Prop2 != 0) {
gQuirks.OcAbcSettings.MmioWhitelist[gQuirks.OcAbcSettings.MmioWhitelistSize] = GetPropertyAsInteger(Prop2, 0); mmioWhiteList.address = GetPropertyAsInteger(Prop2, 0);
Prop2 = Dict3->propertyForKey("Enabled"); Prop2 = Dict3->propertyForKey("Enabled");
gQuirks.MmioWhitelistEnabled[gQuirks.OcAbcSettings.MmioWhitelistSize] = IsPropertyNotNullAndTrue(Prop2); mmioWhiteList.enabled = IsPropertyNotNullAndTrue(Prop2);
} }
gQuirks.OcAbcSettings.MmioWhitelistSize++; gSettings.mmioWhiteListArray.AddReference(mmioWhiteListPtr, true);
} }
} }
} }

View File

@ -222,8 +222,22 @@ public :
DSDT_Patch() : PatchDsdtFind(), PatchDsdtReplace(), PatchDsdtLabel(), PatchDsdtTgt(), PatchDsdtMenuItem() { } DSDT_Patch() : PatchDsdtFind(), PatchDsdtReplace(), PatchDsdtLabel(), PatchDsdtTgt(), PatchDsdtMenuItem() { }
// Not sure if default are valid. Delete them. If needed, proper ones can be created // Not sure if default are valid. Delete them. If needed, proper ones can be created
DSDT_Patch(const DEV_PROPERTY&) = delete; DSDT_Patch(const DSDT_Patch&) = delete;
DSDT_Patch& operator=(const DEV_PROPERTY&) = delete; DSDT_Patch& operator=(const DSDT_Patch&) = delete;
};
class MMIOWhiteList
{
public :
UINTN address;
XString8 comment;
bool enabled;
MMIOWhiteList() : address(0), comment(), enabled(false) { }
// Not sure if default are valid. Delete them. If needed, proper ones can be created
MMIOWhiteList(const MMIOWhiteList&) = delete;
MMIOWhiteList& operator=(const MMIOWhiteList&) = delete;
}; };
class SETTINGS_DATA { class SETTINGS_DATA {
@ -591,6 +605,9 @@ public:
UINT8 pad38[4]; UINT8 pad38[4];
UINTN MaxSlide; UINTN MaxSlide;
OC_BOOTER_QUIRKS ocBooterQuirks;
XObjArray<MMIOWhiteList> mmioWhiteListArray;
SETTINGS_DATA() : VendorName(), RomVersion(), EfiVersion(), ReleaseDate(), ManufactureName(), ProductName(), VersionNr(), SerialNr(), SmUUID({0,0,0,{0}}), SETTINGS_DATA() : VendorName(), RomVersion(), EfiVersion(), ReleaseDate(), ManufactureName(), ProductName(), VersionNr(), SerialNr(), SmUUID({0,0,0,{0}}),
SmUUIDConfig(0), pad0{0}, FamilyName(), OEMProduct(), OEMVendor(), BoardManufactureName(), BoardSerialNumber(), BoardNumber(), LocationInChassis(), SmUUIDConfig(0), pad0{0}, FamilyName(), OEMProduct(), OEMVendor(), BoardManufactureName(), BoardSerialNumber(), BoardNumber(), LocationInChassis(),
@ -618,7 +635,7 @@ public:
AFGLowPowerState(0), PNLF_UID(0), ACPIDropTables(0), DisableEntryScan(0), DisableToolScan(0), KernelScan(0), LinuxScan(0), CustomEntries(0), AFGLowPowerState(0), PNLF_UID(0), ACPIDropTables(0), DisableEntryScan(0), DisableToolScan(0), KernelScan(0), LinuxScan(0), CustomEntries(0),
CustomLegacy(0), CustomTool(0), NrAddProperties(0), AddProperties(0), BlockKexts{0}, SortedACPICount(0), SortedACPI(0), DisabledAMLCount(0), DisabledAML(0), CustomLegacy(0), CustomTool(0), NrAddProperties(0), AddProperties(0), BlockKexts{0}, SortedACPICount(0), SortedACPI(0), DisabledAMLCount(0), DisabledAML(0),
IntelMaxValue(0), OptionsBits(0), FlagsBits(0), UIScale(0), EFILoginHiDPI(0), flagstate{0}, IntelMaxValue(0), OptionsBits(0), FlagsBits(0), UIScale(0), EFILoginHiDPI(0), flagstate{0},
ArbProperties(0), QuirksMask(0), MaxSlide(0) ArbProperties(0), QuirksMask(0), MaxSlide(0), ocBooterQuirks{0}, mmioWhiteListArray()
{}; {};
SETTINGS_DATA(const SETTINGS_DATA& other) = delete; // Can be defined if needed SETTINGS_DATA(const SETTINGS_DATA& other) = delete; // Can be defined if needed
const SETTINGS_DATA& operator = ( const SETTINGS_DATA & ) = delete; // Can be defined if needed const SETTINGS_DATA& operator = ( const SETTINGS_DATA & ) = delete; // Can be defined if needed

View File

@ -1184,7 +1184,7 @@ VOID LOADER_ENTRY::StartLoader11()
// DBG("SetDevices\n"); // DBG("SetDevices\n");
SetDevices(this); SetDevices(this);
// DBG("SetFSInjection\n"); // DBG("SetFSInjection\n");
SetFSInjection(); //SetFSInjection();
//PauseForKey(L"SetFSInjection"); //PauseForKey(L"SetFSInjection");
// DBG("SetVariablesForOSX\n"); // DBG("SetVariablesForOSX\n");
SetVariablesForOSX(this); SetVariablesForOSX(this);
@ -1255,6 +1255,8 @@ VOID LOADER_ENTRY::StartLoader11()
// } // }
// //
memset(&mOpenCoreConfiguration, 0, sizeof(mOpenCoreConfiguration));
UINT64 CPUFrequencyFromART; UINT64 CPUFrequencyFromART;
InternalCalculateARTFrequencyIntel(&CPUFrequencyFromART, NULL, 1); InternalCalculateARTFrequencyIntel(&CPUFrequencyFromART, NULL, 1);
@ -1273,6 +1275,23 @@ VOID LOADER_ENTRY::StartLoader11()
); );
DEBUG ((DEBUG_INFO, "OC: Log initialized...\n")); DEBUG ((DEBUG_INFO, "OC: Log initialized...\n"));
OcAppleDebugLogInstallProtocol(0); OcAppleDebugLogInstallProtocol(0);
mOpenCoreConfiguration.Booter.MmioWhitelist.Count = gSettings.mmioWhiteListArray.size();
mOpenCoreConfiguration.Booter.MmioWhitelist.AllocCount = mOpenCoreConfiguration.Booter.MmioWhitelist.Count;
mOpenCoreConfiguration.Booter.MmioWhitelist.ValueSize = sizeof(__typeof_am__(**mOpenCoreConfiguration.Booter.MmioWhitelist.Values)); // sizeof(OC_KERNEL_ADD_ENTRY) == 680
mOpenCoreConfiguration.Booter.MmioWhitelist.Values = (OC_BOOTER_WL_ENTRY**)AllocatePool(mOpenCoreConfiguration.Booter.MmioWhitelist.AllocCount*sizeof(*mOpenCoreConfiguration.Booter.MmioWhitelist.Values)); // sizeof(OC_KERNEL_ADD_ENTRY) == 680
for ( size_t idx = 0 ; idx < gSettings.mmioWhiteListArray.size() ; idx++ ) {
const MMIOWhiteList& entry = gSettings.mmioWhiteListArray[idx];
DBG("Bridge mmioWhiteList[%zu] to OC : comment=%s\n", idx, entry.comment.c_str());
mOpenCoreConfiguration.Booter.MmioWhitelist.Values[idx] = (__typeof_am__(*mOpenCoreConfiguration.Booter.MmioWhitelist.Values))AllocatePool(mOpenCoreConfiguration.Booter.MmioWhitelist.ValueSize);
mOpenCoreConfiguration.Booter.MmioWhitelist.Values[idx]->Address = entry.address;
OC_STRING_ASSIGN(mOpenCoreConfiguration.Booter.MmioWhitelist.Values[idx]->Comment, entry.comment.c_str());
mOpenCoreConfiguration.Booter.MmioWhitelist.Values[idx]->Enabled = entry.enabled;
}
memcpy(&mOpenCoreConfiguration.Booter.Quirks, &gSettings.ocBooterQuirks, sizeof(mOpenCoreConfiguration.Booter.Quirks));
OcLoadBooterUefiSupport(&mOpenCoreConfiguration); OcLoadBooterUefiSupport(&mOpenCoreConfiguration);
OcLoadKernelSupport(&mOpenCoreStorage, &mOpenCoreConfiguration, &mOpenCoreCpuInfo); OcLoadKernelSupport(&mOpenCoreStorage, &mOpenCoreConfiguration, &mOpenCoreCpuInfo);
OcImageLoaderInit (); OcImageLoaderInit ();
@ -1282,7 +1301,8 @@ VOID LOADER_ENTRY::StartLoader11()
AddKextsInArray(LStringW(L"Kexts\\11"), LStringW(L"11"), CPU_TYPE_X86_64, &kextArray); AddKextsInArray(LStringW(L"Kexts\\11"), LStringW(L"11"), CPU_TYPE_X86_64, &kextArray);
} }
memset(&mOpenCoreConfiguration, 0, sizeof(mOpenCoreConfiguration));
OC_STRING_ASSIGN(mOpenCoreConfiguration.Kernel.Scheme.KernelCache, "Auto"); OC_STRING_ASSIGN(mOpenCoreConfiguration.Kernel.Scheme.KernelCache, "Auto");
OC_STRING_ASSIGN(mOpenCoreConfiguration.Misc.Security.SecureBootModel, "Default"); OC_STRING_ASSIGN(mOpenCoreConfiguration.Misc.Security.SecureBootModel, "Default");
mOpenCoreConfiguration.Kernel.Scheme.FuzzyMatch = gSettings.KernelAndKextPatches.FuzzyMatch; mOpenCoreConfiguration.Kernel.Scheme.FuzzyMatch = gSettings.KernelAndKextPatches.FuzzyMatch;