implement ForceOcWriteFlash

Signed-off-by: SergeySlice <sergey.slice@gmail.com>
This commit is contained in:
SergeySlice 2021-11-11 21:58:28 +03:00
parent e66e32d81d
commit 1ba1ba6d6c
6 changed files with 73 additions and 117 deletions

View File

@ -1117,6 +1117,8 @@
<true/> <true/>
<key>ForceExitBootServices</key> <key>ForceExitBootServices</key>
<false/> <false/>
<key>ForceOcWriteFlash</key>
<false/>
<key>MmioWhitelist</key> <key>MmioWhitelist</key>
<array> <array>
<dict> <dict>

View File

@ -1,48 +1,25 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project> <project>
<configuration id="cdt.managedbuild.config.gnu.macosx.exe.debug.1043399644.573872575" name="Clang-Debug">
<configuration id="cdt.managedbuild.config.gnu.macosx.exe.debug.1043399644.573872575" name="Clang-Debug"> <extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider"> <provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/> <provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="26118944103653619" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/> <language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/> </extension>
</configuration>
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="1822183346599785303" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true"> <configuration id="cdt.managedbuild.config.gnu.macosx.exe.debug.1043399644.1294514338" name="Gcc92-Debug">
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
<language-scope id="org.eclipse.cdt.core.gcc"/> <provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<language-scope id="org.eclipse.cdt.core.g++"/> <provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="99479219182169715" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
</provider> <language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</extension> </provider>
</extension>
</configuration> </configuration>
</project>
<configuration id="cdt.managedbuild.config.gnu.macosx.exe.debug.1043399644.1294514338" name="Gcc92-Debug">
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="1868664118498733496" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
</extension>
</configuration>
</project>

View File

@ -1,70 +1,36 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project> <project>
<configuration id="cdt.managedbuild.config.gnu.macosx.exe.debug.1043399644.573872575" name="DEBUG_XCODE8_UTF32">
<configuration id="cdt.managedbuild.config.gnu.macosx.exe.debug.1043399644.573872575" name="DEBUG_XCODE8_UTF32"> <extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider"> <provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/> <provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="62282808119614425" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/> <language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/> </extension>
</configuration>
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="-1803094147850445849" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true"> <configuration id="cdt.managedbuild.config.gnu.macosx.exe.debug.1043399644.1294514338" name="DEBUG-GCC92-UTF16signed">
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
<language-scope id="org.eclipse.cdt.core.gcc"/> <provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<language-scope id="org.eclipse.cdt.core.g++"/> <provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="135643083198160313" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
</provider> <language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</extension> </provider>
</extension>
</configuration> </configuration>
<configuration id="cdt.managedbuild.config.gnu.macosx.exe.debug.1043399644.1294514338.1821388193" name="DEBUG-GCC92-UTF32">
<configuration id="cdt.managedbuild.config.gnu.macosx.exe.debug.1043399644.1294514338" name="DEBUG-GCC92-UTF16signed"> <extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider"> <provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/> <provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="135643083198160313" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/> <language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/> </extension>
</configuration>
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="-1802065524358914809" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true"> </project>
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
</extension>
</configuration>
<configuration id="cdt.managedbuild.config.gnu.macosx.exe.debug.1043399644.1294514338.1821388193" name="DEBUG-GCC92-UTF32">
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="-1802065524358914809" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
</extension>
</configuration>
</project>

View File

@ -2047,6 +2047,7 @@ printf("%s", "");
XBool PowerTimeoutKernelPanic = false; XBool PowerTimeoutKernelPanic = false;
XBool ThirdPartyDrives = false; XBool ThirdPartyDrives = false;
XBool XhciPortLimit = false; XBool XhciPortLimit = false;
#if __cplusplus > 201703L #if __cplusplus > 201703L
XBool operator == (const OcKernelQuirksClass&) const = default; XBool operator == (const OcKernelQuirksClass&) const = default;
@ -2064,6 +2065,7 @@ printf("%s", "");
if ( !(PowerTimeoutKernelPanic == other.PowerTimeoutKernelPanic) ) return false; if ( !(PowerTimeoutKernelPanic == other.PowerTimeoutKernelPanic) ) return false;
if ( !(ThirdPartyDrives == other.ThirdPartyDrives) ) return false; if ( !(ThirdPartyDrives == other.ThirdPartyDrives) ) return false;
if ( !(XhciPortLimit == other.XhciPortLimit) ) return false; if ( !(XhciPortLimit == other.XhciPortLimit) ) return false;
return true; return true;
} }
void takeValueFrom(const ConfigPlistClass::Quirks_Class::OcKernelQuirks_Class& other) void takeValueFrom(const ConfigPlistClass::Quirks_Class::OcKernelQuirks_Class& other)
@ -2079,6 +2081,7 @@ printf("%s", "");
PowerTimeoutKernelPanic = other.dgetPowerTimeoutKernelPanic(); PowerTimeoutKernelPanic = other.dgetPowerTimeoutKernelPanic();
ThirdPartyDrives = other.dgetThirdPartyDrives(); ThirdPartyDrives = other.dgetThirdPartyDrives();
XhciPortLimit = other.dgetXhciPortLimit(); XhciPortLimit = other.dgetXhciPortLimit();
} }
}; };
@ -2103,6 +2106,7 @@ printf("%s", "");
XBool SignalAppleOS = false; XBool SignalAppleOS = false;
XBool SyncRuntimePermissions = false; XBool SyncRuntimePermissions = false;
int8_t ResizeAppleGpuBars = 0; // 0 is NOT the default value if not set in config.plist. Default value if not set is returned by dgetResizeAppleGpuBars() int8_t ResizeAppleGpuBars = 0; // 0 is NOT the default value if not set in config.plist. Default value if not set is returned by dgetResizeAppleGpuBars()
XBool ForceOcWriteFlash = false;
#if __cplusplus > 201703L #if __cplusplus > 201703L
XBool operator == (const OcBooterQuirksClass&) const = default; XBool operator == (const OcBooterQuirksClass&) const = default;
@ -2127,7 +2131,7 @@ printf("%s", "");
if ( !(SetupVirtualMap == other.SetupVirtualMap) ) return false; if ( !(SetupVirtualMap == other.SetupVirtualMap) ) return false;
if ( !(SignalAppleOS == other.SignalAppleOS) ) return false; if ( !(SignalAppleOS == other.SignalAppleOS) ) return false;
if ( !(SyncRuntimePermissions == other.SyncRuntimePermissions) ) return false; if ( !(SyncRuntimePermissions == other.SyncRuntimePermissions) ) return false;
if ( !(ForceOcWriteFlash == other.ForceOcWriteFlash) ) return false;
return true; return true;
} }
void takeValueFrom(const ConfigPlistClass::Quirks_Class::OcBooterQuirks_Class& other) void takeValueFrom(const ConfigPlistClass::Quirks_Class::OcBooterQuirks_Class& other)
@ -2150,6 +2154,7 @@ printf("%s", "");
SetupVirtualMap = other.dgetSetupVirtualMap(); SetupVirtualMap = other.dgetSetupVirtualMap();
SignalAppleOS = other.dgetSignalAppleOS(); SignalAppleOS = other.dgetSignalAppleOS();
SyncRuntimePermissions = other.dgetSyncRuntimePermissions(); SyncRuntimePermissions = other.dgetSyncRuntimePermissions();
ForceOcWriteFlash = other.dgetForceOcWriteFlash();
} }
}; };

View File

@ -102,6 +102,7 @@ public:
XmlBool SetupVirtualMap = XmlBool(); XmlBool SetupVirtualMap = XmlBool();
XmlBool SignalAppleOS = XmlBool(); XmlBool SignalAppleOS = XmlBool();
XmlBool SyncRuntimePermissions = XmlBool(); XmlBool SyncRuntimePermissions = XmlBool();
XmlBool ForceOcWriteFlash = XmlBool();
XBool dgetAvoidRuntimeDefrag() const { return parent.isDefined() ? AvoidRuntimeDefrag.isDefined() ? AvoidRuntimeDefrag.value() : XBool(true) : XBool(false); }; // TODO: different default value if section is not defined XBool dgetAvoidRuntimeDefrag() const { return parent.isDefined() ? AvoidRuntimeDefrag.isDefined() ? AvoidRuntimeDefrag.value() : XBool(true) : XBool(false); }; // TODO: different default value if section is not defined
XBool dgetDevirtualiseMmio() const { return DevirtualiseMmio.isDefined() ? DevirtualiseMmio.value() : DevirtualiseMmio.nullValue; }; XBool dgetDevirtualiseMmio() const { return DevirtualiseMmio.isDefined() ? DevirtualiseMmio.value() : DevirtualiseMmio.nullValue; };
@ -121,7 +122,7 @@ public:
XBool dgetSignalAppleOS() const { return SignalAppleOS.isDefined() ? SignalAppleOS.value() : SignalAppleOS.nullValue; }; XBool dgetSignalAppleOS() const { return SignalAppleOS.isDefined() ? SignalAppleOS.value() : SignalAppleOS.nullValue; };
XBool dgetSyncRuntimePermissions() const { return parent.isDefined() ? SyncRuntimePermissions.isDefined() ? SyncRuntimePermissions.value() : XBool(true) : XBool(false); }; // TODO: different default value if section is not defined XBool dgetSyncRuntimePermissions() const { return parent.isDefined() ? SyncRuntimePermissions.isDefined() ? SyncRuntimePermissions.value() : XBool(true) : XBool(false); }; // TODO: different default value if section is not defined
int8_t dgetResizeAppleGpuBars() const { return parent.isDefined() && ResizeAppleGpuBars.isDefined() ? ResizeAppleGpuBars.value() : -1; }; int8_t dgetResizeAppleGpuBars() const { return parent.isDefined() && ResizeAppleGpuBars.isDefined() ? ResizeAppleGpuBars.value() : -1; };
XBool dgetForceOcWriteFlash() const { return ForceOcWriteFlash.isDefined() ? ForceOcWriteFlash.value() : XBool(false); };
OcBooterQuirks_Class(const Quirks_Class& _parent) : parent(_parent) {} OcBooterQuirks_Class(const Quirks_Class& _parent) : parent(_parent) {}
}; };
XmlArray<Quirks_MmioWhitelist_Class> MmioWhitelist = XmlArray<Quirks_MmioWhitelist_Class>(); XmlArray<Quirks_MmioWhitelist_Class> MmioWhitelist = XmlArray<Quirks_MmioWhitelist_Class>();
@ -133,7 +134,7 @@ public:
OcKernelQuirks_Class OcKernelQuirks; OcKernelQuirks_Class OcKernelQuirks;
OcBooterQuirks_Class OcBooterQuirks; OcBooterQuirks_Class OcBooterQuirks;
XmlDictField m_fields[32] = { XmlDictField m_fields[33] = {
{"AvoidRuntimeDefrag", OcBooterQuirks.AvoidRuntimeDefrag}, {"AvoidRuntimeDefrag", OcBooterQuirks.AvoidRuntimeDefrag},
{"DevirtualiseMmio", OcBooterQuirks.DevirtualiseMmio}, {"DevirtualiseMmio", OcBooterQuirks.DevirtualiseMmio},
{"DisableSingleUser", OcBooterQuirks.DisableSingleUser}, {"DisableSingleUser", OcBooterQuirks.DisableSingleUser},
@ -142,6 +143,7 @@ public:
{"EnableSafeModeSlide", OcBooterQuirks.EnableSafeModeSlide}, {"EnableSafeModeSlide", OcBooterQuirks.EnableSafeModeSlide},
{"EnableWriteUnprotector", OcBooterQuirks.EnableWriteUnprotector}, {"EnableWriteUnprotector", OcBooterQuirks.EnableWriteUnprotector},
{"ForceExitBootServices", OcBooterQuirks.ForceExitBootServices}, {"ForceExitBootServices", OcBooterQuirks.ForceExitBootServices},
{"ForceOcWriteFlash", OcBooterQuirks.ForceOcWriteFlash},
{"ProtectMemoryRegions", OcBooterQuirks.ProtectMemoryRegions}, {"ProtectMemoryRegions", OcBooterQuirks.ProtectMemoryRegions},
{"ProtectSecureBoot", OcBooterQuirks.ProtectSecureBoot}, {"ProtectSecureBoot", OcBooterQuirks.ProtectSecureBoot},
{"ProtectUefiServices", OcBooterQuirks.ProtectUefiServices}, {"ProtectUefiServices", OcBooterQuirks.ProtectUefiServices},
@ -166,6 +168,7 @@ public:
{"PowerTimeoutKernelPanic", OcKernelQuirks.PowerTimeoutKernelPanic}, {"PowerTimeoutKernelPanic", OcKernelQuirks.PowerTimeoutKernelPanic},
{"ThirdPartyDrives", OcKernelQuirks.ThirdPartyDrives}, {"ThirdPartyDrives", OcKernelQuirks.ThirdPartyDrives},
{"XhciPortLimit", OcKernelQuirks.XhciPortLimit}, {"XhciPortLimit", OcKernelQuirks.XhciPortLimit},
}; };
Quirks_Class() : OcKernelQuirks(*this), OcBooterQuirks(*this) {} Quirks_Class() : OcKernelQuirks(*this), OcBooterQuirks(*this) {}

View File

@ -980,6 +980,9 @@ void LOADER_ENTRY::StartLoader()
#ifdef USE_OC_SECTION_Nvram #ifdef USE_OC_SECTION_Nvram
mOpenCoreConfiguration.Nvram.WriteFlash = true; mOpenCoreConfiguration.Nvram.WriteFlash = true;
#endif #endif
#ifndef USE_OC_SECTION_Uefi
mOpenCoreConfiguration.Uefi.Quirks.ForceOcWriteFlash = gSettings.Quirks.OcBooterQuirks.ForceOcWriteFlash;
#endif
#ifndef USE_OC_SECTION_Booter #ifndef USE_OC_SECTION_Booter