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

View File

@ -8,7 +8,7 @@
# Nasm source version
# 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
#

View File

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

View File

@ -211,6 +211,7 @@ public:
INTN SearchLen;
XString8 ProcedureName; //procedure len will be StartPatternLen
INTN Count;
INTN Skip;
XString8 MatchOS;
XString8 MatchBuild;
// CHAR8 *Name;
@ -236,7 +237,7 @@ public:
// 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(),
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& 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_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());
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++ )
{