exclude double settings

implement Skip for OC compatibility

Signed-off-by: SergeySlice <sergey.slice@gmail.com>
This commit is contained in:
SergeySlice 2020-10-08 23:03:41 +03:00
parent 881796039f
commit 641b75e9eb
5 changed files with 53 additions and 46 deletions

View File

@ -1146,16 +1146,10 @@
<true/> <true/>
<key>KernelCache</key> <key>KernelCache</key>
<string>Auto</string> <string>Auto</string>
<key>AppleCpuPmCfgLock</key>
<false/>
<key>AppleXcpmCfgLock</key>
<true/>
<key>AppleXcpmExtraMsrs</key> <key>AppleXcpmExtraMsrs</key>
<false/> <false/>
<key>AppleXcpmForceBoost</key> <key>AppleXcpmForceBoost</key>
<false/> <false/>
<key>CustomSMBIOSGuid</key>
<false/>
<key>DisableIoMapper</key> <key>DisableIoMapper</key>
<true/> <true/>
<key>DisableLinkeditJettison</key> <key>DisableLinkeditJettison</key>
@ -1168,10 +1162,6 @@
<false/> <false/>
<key>IncreasePciBarSize</key> <key>IncreasePciBarSize</key>
<false/> <false/>
<key>LapicKernelPanic</key>
<false/>
<key>PanicNoKextDump</key>
<true/>
<key>PowerTimeoutKernelPanic</key> <key>PowerTimeoutKernelPanic</key>
<true/> <true/>
<key>ThirdPartyDrives</key> <key>ThirdPartyDrives</key>

View File

@ -8,7 +8,7 @@
# Nasm source version # Nasm source version
# here we can change source versions of tools # here we can change source versions of tools
# #
export NASM_VERSION=${NASM_VERSION:-2.14.02} export NASM_VERSION=${NASM_VERSION:-2.15.05}
# Change PREFIX if you want nasm installed on different place # Change PREFIX if you want nasm installed on different place
# #

View File

@ -837,14 +837,14 @@ FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches,
return FALSE; return FALSE;
} }
Prop = DictPointer->propertyForKey("OcFuzzyMatch"); // Prop = DictPointer->propertyForKey("OcFuzzyMatch");
if ( Prop ) panic("config.plist/KernelAndKextPatches/OcFuzzyMatch has been moved in section config.plist/Quirks. Update your config.plist"); //if ( Prop ) panic("config.plist/KernelAndKextPatches/OcFuzzyMatch has been moved in section config.plist/Quirks. Update your config.plist");
// if (Prop != NULL || gBootChanged) { // if (Prop != NULL || gBootChanged) {
// Patches->FuzzyMatch = IsPropertyNotNullAndTrue(Prop); // Patches->FuzzyMatch = IsPropertyNotNullAndTrue(Prop);
// } // }
// //
Prop = DictPointer->propertyForKey("OcKernelCache"); // Prop = DictPointer->propertyForKey("OcKernelCache");
if ( Prop ) panic("config.plist/KernelAndKextPatches/OcKernelCache has been moved in section config.plist/Quirks. Update your config.plist"); //if ( Prop ) panic("config.plist/KernelAndKextPatches/OcKernelCache has been moved in section config.plist/Quirks. Update your config.plist");
// if (Prop != NULL || gBootChanged) { // if (Prop != NULL || gBootChanged) {
// if ( Prop->isString() ) { // if ( Prop->isString() ) {
// if ( Prop->getString()->stringValue().notEmpty() ) { // if ( Prop->getString()->stringValue().notEmpty() ) {
@ -1124,15 +1124,21 @@ if ( Prop ) panic("config.plist/KernelAndKextPatches/OcKernelCache has been move
} }
DBG(" %s", newPatch.Label.c_str()); DBG(" %s", newPatch.Label.c_str());
newPatch.MenuItem.BValue = TRUE; // newPatch.MenuItem.BValue = TRUE;
Dict = Prop2->propertyForKey("Disabled"); Dict = Prop2->propertyForKey("Disabled");
if ((Dict != NULL) && IsPropertyNotNullAndTrue(Dict)) { newPatch.MenuItem.BValue = !IsPropertyNotNullAndTrue(Dict); //if absent then false, BValue = !Disabled
newPatch.MenuItem.BValue = FALSE;
} // if ((Dict != NULL) && IsPropertyNotNullAndTrue(Dict)) {
// newPatch.MenuItem.BValue = FALSE;
// }
Dict = Prop2->propertyForKey("RangeFind"); Dict = Prop2->propertyForKey("RangeFind");
newPatch.SearchLen = GetPropertyAsInteger(Dict, 0); //default 0 will be calculated later newPatch.SearchLen = GetPropertyAsInteger(Dict, 0); //default 0 will be calculated later
Dict = Prop2->propertyForKey("Skip");
newPatch.Skip = GetPropertyAsInteger(Dict, 0); //default 0 will be calculated later
UINT8* TmpData = GetDataSetting(Prop2, "StartPattern", &FindLen); UINT8* TmpData = GetDataSetting(Prop2, "StartPattern", &FindLen);
if (TmpData != NULL) { if (TmpData != NULL) {
newPatch.StartPattern.stealValueFrom(TmpData, FindLen); newPatch.StartPattern.stealValueFrom(TmpData, FindLen);
@ -1281,6 +1287,9 @@ if ( Prop ) panic("config.plist/KernelAndKextPatches/OcKernelCache has been move
prop3 = Prop2->propertyForKey("RangeFind"); prop3 = Prop2->propertyForKey("RangeFind");
newKernelPatch.SearchLen = GetPropertyAsInteger(prop3, 0); //default 0 will be calculated later newKernelPatch.SearchLen = GetPropertyAsInteger(prop3, 0); //default 0 will be calculated later
prop3 = Prop2->propertyForKey("Skip");
newKernelPatch.Skip = GetPropertyAsInteger(prop3, 0); //default 0 will be calculated later
TmpData = GetDataSetting (Prop2, "StartPattern", &FindLen); TmpData = GetDataSetting (Prop2, "StartPattern", &FindLen);
if (TmpData != NULL) { if (TmpData != NULL) {
newKernelPatch.StartPattern.stealValueFrom(TmpData, FindLen); newKernelPatch.StartPattern.stealValueFrom(TmpData, FindLen);
@ -1411,6 +1420,9 @@ if ( Prop ) panic("config.plist/KernelAndKextPatches/OcKernelCache has been move
prop3 = Prop2->propertyForKey("RangeFind"); prop3 = Prop2->propertyForKey("RangeFind");
newBootPatch.SearchLen = GetPropertyAsInteger(prop3, 0); //default 0 will be calculated later newBootPatch.SearchLen = GetPropertyAsInteger(prop3, 0); //default 0 will be calculated later
prop3 = Prop2->propertyForKey("Skip");
newBootPatch.Skip = GetPropertyAsInteger(prop3, 0); //default 0 will be calculated later
TmpData = GetDataSetting (Prop2, "StartPattern", &FindLen); TmpData = GetDataSetting (Prop2, "StartPattern", &FindLen);
if (TmpData != NULL) { if (TmpData != NULL) {
newBootPatch.StartPattern.stealValueFrom(TmpData, FindLen); newBootPatch.StartPattern.stealValueFrom(TmpData, FindLen);
@ -2927,16 +2939,16 @@ GetEarlyUserSettings (
} }
gSettings.mmioWhiteListArray.setEmpty(); gSettings.mmioWhiteListArray.setEmpty();
const TagDict* OcQuirksDict = CfgDict->dictPropertyForKey("OcQuirks"); // const TagDict* OcQuirksDict = CfgDict->dictPropertyForKey("OcQuirks");
if ( OcQuirksDict ) panic("config.plist/OcQuirks has been renamed Quirks. Update your config.plist"); //if ( OcQuirksDict ) panic("config.plist/OcQuirks has been renamed Quirks. Update your config.plist");
OcQuirksDict = CfgDict->dictPropertyForKey("Quirks"); const TagDict* OcQuirksDict = CfgDict->dictPropertyForKey("Quirks");
if ( !OcQuirksDict ) panic("Cannot find config.plist/Quirks"); //if ( !OcQuirksDict ) panic("Cannot find config.plist/Quirks");
if (OcQuirksDict != NULL) { if (OcQuirksDict != NULL) {
const TagStruct* Prop; const TagStruct* Prop;
Prop = OcQuirksDict->propertyForKey("AvoidRuntimeDefrag"); Prop = OcQuirksDict->propertyForKey("AvoidRuntimeDefrag");
if ( !Prop ) panic("Cannot find AvoidRuntimeDefrag in OcQuirks under root (OC booter quirks)"); //if ( !Prop ) panic("Cannot find AvoidRuntimeDefrag in OcQuirks under root (OC booter quirks)");
gSettings.ocBooterQuirks.AvoidRuntimeDefrag = !IsPropertyNotNullAndFalse(Prop); gSettings.ocBooterQuirks.AvoidRuntimeDefrag = !IsPropertyNotNullAndFalse(Prop); //true if absent so no panic
gSettings.QuirksMask |= gSettings.ocBooterQuirks.AvoidRuntimeDefrag? QUIRK_DEFRAG:0; gSettings.QuirksMask |= gSettings.ocBooterQuirks.AvoidRuntimeDefrag? QUIRK_DEFRAG:0;
Prop = OcQuirksDict->propertyForKey( "DevirtualiseMmio"); Prop = OcQuirksDict->propertyForKey( "DevirtualiseMmio");
gSettings.ocBooterQuirks.DevirtualiseMmio = IsPropertyNotNullAndTrue(Prop); gSettings.ocBooterQuirks.DevirtualiseMmio = IsPropertyNotNullAndTrue(Prop);
@ -3041,11 +3053,13 @@ if ( !Prop ) panic("Cannot find AvoidRuntimeDefrag in OcQuirks under root (OC bo
// Booter Quirks // Booter Quirks
Prop = OcQuirksDict->propertyForKey("AppleCpuPmCfgLock"); // Prop = OcQuirksDict->propertyForKey("AppleCpuPmCfgLock");
gSettings.KernelAndKextPatches.OcKernelQuirks.AppleCpuPmCfgLock = IsPropertyNotNullAndTrue(Prop); // gSettings.KernelAndKextPatches.OcKernelQuirks.AppleCpuPmCfgLock = IsPropertyNotNullAndTrue(Prop);
gSettings.KernelAndKextPatches.OcKernelQuirks.AppleCpuPmCfgLock = gSettings.KernelAndKextPatches.KPKernelPm;
Prop = OcQuirksDict->propertyForKey("AppleXcpmCfgLock"); // Prop = OcQuirksDict->propertyForKey("AppleXcpmCfgLock"); //
gSettings.KernelAndKextPatches.OcKernelQuirks.AppleXcpmCfgLock = IsPropertyNotNullAndTrue(Prop); // gSettings.KernelAndKextPatches.OcKernelQuirks.AppleXcpmCfgLock = IsPropertyNotNullAndTrue(Prop);
gSettings.KernelAndKextPatches.OcKernelQuirks.AppleXcpmCfgLock = gSettings.KernelAndKextPatches.KPKernelXCPM;
Prop = OcQuirksDict->propertyForKey("AppleXcpmExtraMsrs"); Prop = OcQuirksDict->propertyForKey("AppleXcpmExtraMsrs");
gSettings.KernelAndKextPatches.OcKernelQuirks.AppleXcpmExtraMsrs = IsPropertyNotNullAndTrue(Prop); gSettings.KernelAndKextPatches.OcKernelQuirks.AppleXcpmExtraMsrs = IsPropertyNotNullAndTrue(Prop);
@ -3058,7 +3072,7 @@ if ( !Prop ) panic("Cannot find AvoidRuntimeDefrag in OcQuirks under root (OC bo
// gSettings.KernelAndKextPatches.OcKernelQuirks.CustomSmbiosGuid = IsPropertyNotNullAndTrue(Prop); // gSettings.KernelAndKextPatches.OcKernelQuirks.CustomSmbiosGuid = IsPropertyNotNullAndTrue(Prop);
Prop = OcQuirksDict->propertyForKey("DisableIoMapper"); Prop = OcQuirksDict->propertyForKey("DisableIoMapper");
if ( !Prop ) panic("Cannot find DisableIoMapper in config.plist/Quirks. You forgot to merge your quirks into one section. Update your config.plist"); //if ( !Prop ) panic("Cannot find DisableIoMapper in config.plist/Quirks. You forgot to merge your quirks into one section. Update your config.plist");
gSettings.KernelAndKextPatches.OcKernelQuirks.DisableIoMapper = IsPropertyNotNullAndTrue(Prop); gSettings.KernelAndKextPatches.OcKernelQuirks.DisableIoMapper = IsPropertyNotNullAndTrue(Prop);
Prop = OcQuirksDict->propertyForKey("DisableLinkeditJettison"); Prop = OcQuirksDict->propertyForKey("DisableLinkeditJettison");
@ -3076,11 +3090,13 @@ if ( !Prop ) panic("Cannot find DisableIoMapper in config.plist/Quirks. You forg
Prop = OcQuirksDict->propertyForKey("IncreasePciBarSize"); Prop = OcQuirksDict->propertyForKey("IncreasePciBarSize");
gSettings.KernelAndKextPatches.OcKernelQuirks.IncreasePciBarSize = IsPropertyNotNullAndTrue(Prop); gSettings.KernelAndKextPatches.OcKernelQuirks.IncreasePciBarSize = IsPropertyNotNullAndTrue(Prop);
Prop = OcQuirksDict->propertyForKey("LapicKernelPanic"); // Prop = OcQuirksDict->propertyForKey("LapicKernelPanic");
gSettings.KernelAndKextPatches.OcKernelQuirks.LapicKernelPanic = IsPropertyNotNullAndTrue(Prop); // gSettings.KernelAndKextPatches.OcKernelQuirks.LapicKernelPanic = IsPropertyNotNullAndTrue(Prop);
gSettings.KernelAndKextPatches.OcKernelQuirks.LapicKernelPanic = gSettings.KernelAndKextPatches.KPKernelLapic;
Prop = OcQuirksDict->propertyForKey("PanicNoKextDump"); // Prop = OcQuirksDict->propertyForKey("PanicNoKextDump");
gSettings.KernelAndKextPatches.OcKernelQuirks.PanicNoKextDump = IsPropertyNotNullAndTrue(Prop); // gSettings.KernelAndKextPatches.OcKernelQuirks.PanicNoKextDump = IsPropertyNotNullAndTrue(Prop); //KPPanicNoKextDump
gSettings.KernelAndKextPatches.OcKernelQuirks.PanicNoKextDump = gSettings.KernelAndKextPatches.KPPanicNoKextDump;
Prop = OcQuirksDict->propertyForKey("PowerTimeoutKernelPanic"); Prop = OcQuirksDict->propertyForKey("PowerTimeoutKernelPanic");
gSettings.KernelAndKextPatches.OcKernelQuirks.PowerTimeoutKernelPanic = IsPropertyNotNullAndTrue(Prop); gSettings.KernelAndKextPatches.OcKernelQuirks.PowerTimeoutKernelPanic = IsPropertyNotNullAndTrue(Prop);

View File

@ -211,6 +211,7 @@ public:
INTN SearchLen; INTN SearchLen;
XString8 ProcedureName; //procedure len will be StartPatternLen XString8 ProcedureName; //procedure len will be StartPatternLen
INTN Count; INTN Count;
INTN Skip;
XString8 MatchOS; XString8 MatchOS;
XString8 MatchBuild; XString8 MatchBuild;
// CHAR8 *Name; // CHAR8 *Name;
@ -236,7 +237,7 @@ public:
// StartPattern(0), StartMask(0), StartPatternLen(0), SearchLen(0), ProcedureName(0), Count(-1), MatchOS(0), MatchBuild(0), MenuItem() // StartPattern(0), StartMask(0), StartPatternLen(0), SearchLen(0), ProcedureName(0), Count(-1), MatchOS(0), MatchBuild(0), MenuItem()
// { } // { }
KEXT_PATCH() : Name(), Label(), IsPlistPatch(0), Data(), Patch(), MaskFind(), MaskReplace(), KEXT_PATCH() : Name(), Label(), IsPlistPatch(0), Data(), Patch(), MaskFind(), MaskReplace(),
StartPattern(), StartMask(), SearchLen(0), ProcedureName(), Count(-1), MatchOS(), MatchBuild(), MenuItem() StartPattern(), StartMask(), SearchLen(0), ProcedureName(), Count(-1), Skip(0), MatchOS(), MatchBuild(), MenuItem()
{ } { }
KEXT_PATCH(const KEXT_PATCH& other) = default; // default is fine if there is only native type and objects that have copy ctor KEXT_PATCH(const KEXT_PATCH& other) = default; // default is fine if there is only native type and objects that have copy ctor
KEXT_PATCH& operator = ( const KEXT_PATCH & ) = default; // default is fine if there is only native type and objects that have copy ctor KEXT_PATCH& operator = ( const KEXT_PATCH & ) = default; // default is fine if there is only native type and objects that have copy ctor

View File

@ -1095,7 +1095,7 @@ DBG("Beginning OC\n");
OC_STRING_ASSIGN(mOpenCoreConfiguration.Kernel.Patch.Values[kextPatchIdx]->MinKernel, ""); OC_STRING_ASSIGN(mOpenCoreConfiguration.Kernel.Patch.Values[kextPatchIdx]->MinKernel, "");
OC_STRING_ASSIGN_N(mOpenCoreConfiguration.Kernel.Patch.Values[kextPatchIdx]->Replace, kextPatch.Patch.vdata(), kextPatch.Patch.size()); OC_STRING_ASSIGN_N(mOpenCoreConfiguration.Kernel.Patch.Values[kextPatchIdx]->Replace, kextPatch.Patch.vdata(), kextPatch.Patch.size());
OC_STRING_ASSIGN_N(mOpenCoreConfiguration.Kernel.Patch.Values[kextPatchIdx]->ReplaceMask, kextPatch.MaskReplace.vdata(), kextPatch.MaskReplace.size()); OC_STRING_ASSIGN_N(mOpenCoreConfiguration.Kernel.Patch.Values[kextPatchIdx]->ReplaceMask, kextPatch.MaskReplace.vdata(), kextPatch.MaskReplace.size());
mOpenCoreConfiguration.Kernel.Patch.Values[kextPatchIdx]->Skip = 0; mOpenCoreConfiguration.Kernel.Patch.Values[kextPatchIdx]->Skip = (UINT32)kextPatch.Skip;
} }
for (size_t forceKextIdx = 0 ; forceKextIdx < KernelAndKextPatches.ForceKexts.size() ; forceKextIdx++ ) for (size_t forceKextIdx = 0 ; forceKextIdx < KernelAndKextPatches.ForceKexts.size() ; forceKextIdx++ )
{ {