mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2024-11-26 12:05:36 +01:00
Create object MacOsVersion.
This commit is contained in:
parent
0bbc1e343b
commit
7f1b87c92f
@ -968,7 +968,7 @@ DEFINE JIEF_DEBUG_FLAG = -DJIEF_DEBUG
|
||||
!endif
|
||||
|
||||
|
||||
DEFINE BUILD_OPTIONS=-DMDEPKG_NDEBUG -DCLOVER_BUILD $(VBIOS_PATCH_CLOVEREFI_FLAG) $(ONLY_SATA_0_FLAG) $(BLOCKIO_FLAG) $(NOUSB_FLAG) $(NOUDMA_FLAG) $(AMD_FLAG) $(SECURE_BOOT_FLAG) $(ANDX86_FLAG) $(PS2MOUSE_LEGACYBOOT_FLAG) $(DEBUG_ON_SERIAL_PORT_FLAG) $(EXIT_USBKB_FLAG) $(JIEF_DEBUG_FLAG)
|
||||
DEFINE BUILD_OPTIONS=-DIS_UEFI_MODULE -DMDEPKG_NDEBUG -DCLOVER_BUILD $(VBIOS_PATCH_CLOVEREFI_FLAG) $(ONLY_SATA_0_FLAG) $(BLOCKIO_FLAG) $(NOUSB_FLAG) $(NOUDMA_FLAG) $(AMD_FLAG) $(SECURE_BOOT_FLAG) $(ANDX86_FLAG) $(PS2MOUSE_LEGACYBOOT_FLAG) $(DEBUG_ON_SERIAL_PORT_FLAG) $(EXIT_USBKB_FLAG) $(JIEF_DEBUG_FLAG)
|
||||
|
||||
#MSFT:*_*_*_CC_FLAGS = /FAcs /FR$(@R).SBR /wd4701 /wd4703 $(BUILD_OPTIONS)
|
||||
MSFT:*_*_*_CC_FLAGS = /FAcs $(BUILD_OPTIONS) -Dinline=__inline /Zi -D DISABLE_NEW_DEPRECATED_INTERFACES -D OC_TARGET_DEBUG
|
||||
|
@ -555,9 +555,9 @@ static void print_ulonglong(UINT_BIGGEST_TYPE v, unsigned int base, PrintfParams
|
||||
|
||||
#if PRINTF_LITE_TIMESTAMP_SUPPORT == 1
|
||||
|
||||
#if defined(EFIAPI)
|
||||
#if defined(IS_UEFI_MODULE)
|
||||
|
||||
extern uint32_t getUptimeInMilliseconds();
|
||||
extern uint32_t getUptimeInMilliseconds(void);
|
||||
|
||||
#elif defined(__APPLE__)
|
||||
|
||||
@ -608,7 +608,7 @@ static void print_longlong(INT_BIGGEST_TYPE v, unsigned int base, PrintfParams*
|
||||
#if PRINTF_LITE_TIMESTAMP_SUPPORT == 1 && PRINTF_LITE_TIMESTAMP_CUSTOM_FUNCTION == 0
|
||||
static void print_timestamp(PrintfParams* printfParams)
|
||||
{
|
||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(WIN64) || defined(__NT__)
|
||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(WIN64) || defined(__NT__)
|
||||
SYSTEMTIME systime;
|
||||
GetSystemTime(&systime);
|
||||
uint32_t ms = systime.wMilliseconds;
|
||||
|
@ -168,6 +168,8 @@
|
||||
9A4185BA2439F29D00BEAFB8 /* LoadOptions_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A4185B52439F29D00BEAFB8 /* LoadOptions_test.cpp */; };
|
||||
9A4185BB2439F29D00BEAFB8 /* LoadOptions_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A4185B52439F29D00BEAFB8 /* LoadOptions_test.cpp */; };
|
||||
9A4185BC2439F29D00BEAFB8 /* LoadOptions_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A4185B52439F29D00BEAFB8 /* LoadOptions_test.cpp */; };
|
||||
9A4C5777255ACAE8004F0B21 /* MacOsVersion.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A4C5775255ACAE7004F0B21 /* MacOsVersion.cpp */; };
|
||||
9A4C5778255ACAE8004F0B21 /* MacOsVersion.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A4C5776255ACAE8004F0B21 /* MacOsVersion.h */; };
|
||||
9A4F68562449D4AE004B2F7E /* stdio.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A105B4C24483AE30006DE06 /* stdio.cpp */; };
|
||||
9A4F68572449D4AE004B2F7E /* stdio.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A105B4C24483AE30006DE06 /* stdio.cpp */; };
|
||||
9A4F68592449D4B4004B2F7E /* abort.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A105B4D24483AE30006DE06 /* abort.cpp */; };
|
||||
@ -335,14 +337,12 @@
|
||||
9AC7807F24176C04005CDD5C /* menu.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F9C24176C04005CDD5C /* menu.h */; };
|
||||
9AC7808024176C04005CDD5C /* screen.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F9D24176C04005CDD5C /* screen.h */; };
|
||||
9AC7808124176C04005CDD5C /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F9E24176C04005CDD5C /* main.cpp */; };
|
||||
9AC7808224176C04005CDD5C /* memory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77FA024176C04005CDD5C /* memory.cpp */; };
|
||||
9AC7808324176C04005CDD5C /* globals_dtor.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77FA124176C04005CDD5C /* globals_dtor.h */; };
|
||||
9AC7808424176C04005CDD5C /* globals_dtor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77FA224176C04005CDD5C /* globals_dtor.cpp */; };
|
||||
9AC7808524176C04005CDD5C /* operatorNewDelete.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77FA324176C04005CDD5C /* operatorNewDelete.h */; };
|
||||
9AC7808624176C04005CDD5C /* globals_ctor.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77FA424176C04005CDD5C /* globals_ctor.h */; };
|
||||
9AC7808724176C04005CDD5C /* globals_ctor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77FA524176C04005CDD5C /* globals_ctor.cpp */; };
|
||||
9AC7808924176C04005CDD5C /* operatorNewDelete.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77FA724176C04005CDD5C /* operatorNewDelete.cpp */; };
|
||||
9AC7808A24176C04005CDD5C /* memory.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77FA824176C04005CDD5C /* memory.h */; };
|
||||
9AC7808B24176C04005CDD5C /* abort.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77FA924176C04005CDD5C /* abort.h */; };
|
||||
9AC7808C24176C04005CDD5C /* remove_ref.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77FAA24176C04005CDD5C /* remove_ref.h */; };
|
||||
9AC7808D24176C04005CDD5C /* XStringArray.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77FAC24176C04005CDD5C /* XStringArray.h */; };
|
||||
@ -419,7 +419,6 @@
|
||||
9AF415CA242CD75C00D2644C /* libegint.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F6124176C04005CDD5C /* libegint.h */; };
|
||||
9AF415CB242CD75C00D2644C /* memvendors.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F1D24176C04005CDD5C /* memvendors.h */; };
|
||||
9AF415CC242CD75C00D2644C /* kernel_patcher.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F2224176C04005CDD5C /* kernel_patcher.h */; };
|
||||
9AF415CD242CD75C00D2644C /* memory.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77FA824176C04005CDD5C /* memory.h */; };
|
||||
9AF415CE242CD75C00D2644C /* menu.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F9C24176C04005CDD5C /* menu.h */; };
|
||||
9AF415CF242CD75C00D2644C /* MSUEFICADB.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F7C24176C04005CDD5C /* MSUEFICADB.h */; };
|
||||
9AF415D0242CD75C00D2644C /* Hibernate.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F1A24176C04005CDD5C /* Hibernate.h */; };
|
||||
@ -484,7 +483,6 @@
|
||||
9AF4161C242CD75C00D2644C /* securevars.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F7F24176C04005CDD5C /* securevars.cpp */; };
|
||||
9AF4161E242CD75C00D2644C /* loader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F8A24176C04005CDD5C /* loader.cpp */; };
|
||||
9AF4161F242CD75C00D2644C /* XObjArray_tests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77ED524176C04005CDD5C /* XObjArray_tests.cpp */; };
|
||||
9AF41621242CD75C00D2644C /* memory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77FA024176C04005CDD5C /* memory.cpp */; };
|
||||
9AF41622242CD75C00D2644C /* cpu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F5224176C04005CDD5C /* cpu.cpp */; };
|
||||
9AF41623242CD75C00D2644C /* LegacyBoot.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F1824176C04005CDD5C /* LegacyBoot.cpp */; };
|
||||
9AF41624242CD75C00D2644C /* REFIT_MENU_SCREEN.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F9124176C04005CDD5C /* REFIT_MENU_SCREEN.cpp */; };
|
||||
@ -580,7 +578,6 @@
|
||||
9AF416A7242CDA5800D2644C /* libegint.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F6124176C04005CDD5C /* libegint.h */; };
|
||||
9AF416A8242CDA5800D2644C /* memvendors.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F1D24176C04005CDD5C /* memvendors.h */; };
|
||||
9AF416A9242CDA5800D2644C /* kernel_patcher.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F2224176C04005CDD5C /* kernel_patcher.h */; };
|
||||
9AF416AA242CDA5800D2644C /* memory.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77FA824176C04005CDD5C /* memory.h */; };
|
||||
9AF416AB242CDA5800D2644C /* menu.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F9C24176C04005CDD5C /* menu.h */; };
|
||||
9AF416AC242CDA5800D2644C /* MSUEFICADB.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F7C24176C04005CDD5C /* MSUEFICADB.h */; };
|
||||
9AF416AD242CDA5800D2644C /* Hibernate.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F1A24176C04005CDD5C /* Hibernate.h */; };
|
||||
@ -645,7 +642,6 @@
|
||||
9AF416F9242CDA5800D2644C /* securevars.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F7F24176C04005CDD5C /* securevars.cpp */; };
|
||||
9AF416FB242CDA5800D2644C /* loader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F8A24176C04005CDD5C /* loader.cpp */; };
|
||||
9AF416FC242CDA5800D2644C /* XObjArray_tests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77ED524176C04005CDD5C /* XObjArray_tests.cpp */; };
|
||||
9AF416FE242CDA5800D2644C /* memory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77FA024176C04005CDD5C /* memory.cpp */; };
|
||||
9AF416FF242CDA5800D2644C /* cpu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F5224176C04005CDD5C /* cpu.cpp */; };
|
||||
9AF41700242CDA5800D2644C /* LegacyBoot.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F1824176C04005CDD5C /* LegacyBoot.cpp */; };
|
||||
9AF41701242CDA5800D2644C /* REFIT_MENU_SCREEN.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F9124176C04005CDD5C /* REFIT_MENU_SCREEN.cpp */; };
|
||||
@ -782,6 +778,8 @@
|
||||
9A36E5E024F7EF20007A1107 /* string.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = string.cpp; sourceTree = "<group>"; };
|
||||
9A4185B42439F29D00BEAFB8 /* LoadOptions_test.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LoadOptions_test.h; sourceTree = "<group>"; };
|
||||
9A4185B52439F29D00BEAFB8 /* LoadOptions_test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LoadOptions_test.cpp; sourceTree = "<group>"; };
|
||||
9A4C5775255ACAE7004F0B21 /* MacOsVersion.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MacOsVersion.cpp; sourceTree = "<group>"; };
|
||||
9A4C5776255ACAE8004F0B21 /* MacOsVersion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MacOsVersion.h; sourceTree = "<group>"; };
|
||||
9A61B2FE2522165100AEE0FA /* Self.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Self.cpp; sourceTree = "<group>"; };
|
||||
9A61B2FF2522165100AEE0FA /* Self.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Self.h; sourceTree = "<group>"; };
|
||||
9A63C6CA24EBEF78000EB836 /* Version.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Version.h; path = ../../Version.h; sourceTree = "<group>"; };
|
||||
@ -931,15 +929,12 @@
|
||||
9AC77F9C24176C04005CDD5C /* menu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = menu.h; sourceTree = "<group>"; };
|
||||
9AC77F9D24176C04005CDD5C /* screen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = screen.h; sourceTree = "<group>"; };
|
||||
9AC77F9E24176C04005CDD5C /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = "<group>"; };
|
||||
9AC77FA024176C04005CDD5C /* memory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = memory.cpp; sourceTree = "<group>"; };
|
||||
9AC77FA124176C04005CDD5C /* globals_dtor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = globals_dtor.h; sourceTree = "<group>"; };
|
||||
9AC77FA224176C04005CDD5C /* globals_dtor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = globals_dtor.cpp; sourceTree = "<group>"; };
|
||||
9AC77FA324176C04005CDD5C /* operatorNewDelete.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = operatorNewDelete.h; sourceTree = "<group>"; };
|
||||
9AC77FA424176C04005CDD5C /* globals_ctor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = globals_ctor.h; sourceTree = "<group>"; };
|
||||
9AC77FA524176C04005CDD5C /* globals_ctor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = globals_ctor.cpp; sourceTree = "<group>"; };
|
||||
9AC77FA624176C04005CDD5C /* panic.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = panic.cpp; sourceTree = "<group>"; };
|
||||
9AC77FA724176C04005CDD5C /* operatorNewDelete.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = operatorNewDelete.cpp; sourceTree = "<group>"; };
|
||||
9AC77FA824176C04005CDD5C /* memory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = memory.h; sourceTree = "<group>"; };
|
||||
9AC77FA924176C04005CDD5C /* abort.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = abort.h; sourceTree = "<group>"; };
|
||||
9AC77FAA24176C04005CDD5C /* remove_ref.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = remove_ref.h; sourceTree = "<group>"; };
|
||||
9AC77FAC24176C04005CDD5C /* XStringArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XStringArray.h; sourceTree = "<group>"; };
|
||||
@ -1152,13 +1147,6 @@
|
||||
9AC77F1624176C04005CDD5C /* Platform */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9AC44EDC253AE78C00326488 /* MemoryOperation.c */,
|
||||
9AC44EDB253AE78C00326488 /* MemoryOperation.h */,
|
||||
9AABBE1A2524863D0033A009 /* SelfOem.cpp */,
|
||||
9AABBE1B2524863E0033A009 /* SelfOem.h */,
|
||||
9A61B2FE2522165100AEE0FA /* Self.cpp */,
|
||||
9A61B2FF2522165100AEE0FA /* Self.h */,
|
||||
9A36E57324F56156007A1107 /* plist */,
|
||||
9AC77F2024176C04005CDD5C /* AcpiPatcher.cpp */,
|
||||
9A105B4424483AE20006DE06 /* AcpiPatcher.h */,
|
||||
9AC77F2324176C04005CDD5C /* AmlGenerator.cpp */,
|
||||
@ -1216,6 +1204,10 @@
|
||||
9AC77F4B24176C04005CDD5C /* LegacyBiosThunk.h */,
|
||||
9AC77F1824176C04005CDD5C /* LegacyBoot.cpp */,
|
||||
9A105B4324483AE00006DE06 /* LegacyBoot.h */,
|
||||
9A4C5775255ACAE7004F0B21 /* MacOsVersion.cpp */,
|
||||
9A4C5776255ACAE8004F0B21 /* MacOsVersion.h */,
|
||||
9AC44EDC253AE78C00326488 /* MemoryOperation.c */,
|
||||
9AC44EDB253AE78C00326488 /* MemoryOperation.h */,
|
||||
9AC77F1D24176C04005CDD5C /* memvendors.h */,
|
||||
9AC77F3E24176C04005CDD5C /* Net.cpp */,
|
||||
9A105B3D24483ADF0006DE06 /* Net.h */,
|
||||
@ -1228,7 +1220,12 @@
|
||||
9A105B5B24483AE40006DE06 /* platformdata.h */,
|
||||
9AC77F2724176C04005CDD5C /* PlatformDriverOverride.cpp */,
|
||||
9A105B5924483AE30006DE06 /* PlatformDriverOverride.h */,
|
||||
9A36E57324F56156007A1107 /* plist */,
|
||||
9A105B4724483AE30006DE06 /* Posix */,
|
||||
9A61B2FE2522165100AEE0FA /* Self.cpp */,
|
||||
9A61B2FF2522165100AEE0FA /* Self.h */,
|
||||
9AABBE1A2524863D0033A009 /* SelfOem.cpp */,
|
||||
9AABBE1B2524863E0033A009 /* SelfOem.h */,
|
||||
9AC77F5924176C04005CDD5C /* Settings.cpp */,
|
||||
9AC77F2524176C04005CDD5C /* Settings.h */,
|
||||
9AC77F5124176C04005CDD5C /* smbios.cpp */,
|
||||
@ -1366,11 +1363,8 @@
|
||||
9AC77FA424176C04005CDD5C /* globals_ctor.h */,
|
||||
9AC77FA224176C04005CDD5C /* globals_dtor.cpp */,
|
||||
9AC77FA124176C04005CDD5C /* globals_dtor.h */,
|
||||
9AC77FA024176C04005CDD5C /* memory.cpp */,
|
||||
9AC77FA824176C04005CDD5C /* memory.h */,
|
||||
9AC77FA724176C04005CDD5C /* operatorNewDelete.cpp */,
|
||||
9AC77FA324176C04005CDD5C /* operatorNewDelete.h */,
|
||||
9AC77FA624176C04005CDD5C /* panic.cpp */,
|
||||
9AC77FAA24176C04005CDD5C /* remove_ref.h */,
|
||||
);
|
||||
path = cpp_util;
|
||||
@ -1409,6 +1403,7 @@
|
||||
9A105B1E244644C50006DE06 /* XCinema.h in Headers */,
|
||||
9AC7807224176C04005CDD5C /* menu_items.h in Headers */,
|
||||
A5E326322428F4EE002240E8 /* XTheme.h in Headers */,
|
||||
9A4C5778255ACAE8004F0B21 /* MacOsVersion.h in Headers */,
|
||||
9A105B7924483AE40006DE06 /* guid.h in Headers */,
|
||||
9AC7801C24176C04005CDD5C /* nvidia.h in Headers */,
|
||||
9AC7808524176C04005CDD5C /* operatorNewDelete.h in Headers */,
|
||||
@ -1497,7 +1492,6 @@
|
||||
9A36E58C24F5616F007A1107 /* plist.h in Headers */,
|
||||
9AC7800624176C04005CDD5C /* memvendors.h in Headers */,
|
||||
9AC7800B24176C04005CDD5C /* kernel_patcher.h in Headers */,
|
||||
9AC7808A24176C04005CDD5C /* memory.h in Headers */,
|
||||
9AC7807F24176C04005CDD5C /* menu.h in Headers */,
|
||||
9AC7806224176C04005CDD5C /* MSUEFICADB.h in Headers */,
|
||||
9AC7800324176C04005CDD5C /* Hibernate.h in Headers */,
|
||||
@ -1618,7 +1612,6 @@
|
||||
9A36E59C24F5616F007A1107 /* TagKey.h in Headers */,
|
||||
9AF415CB242CD75C00D2644C /* memvendors.h in Headers */,
|
||||
9AF415CC242CD75C00D2644C /* kernel_patcher.h in Headers */,
|
||||
9AF415CD242CD75C00D2644C /* memory.h in Headers */,
|
||||
9AF415CE242CD75C00D2644C /* menu.h in Headers */,
|
||||
9AF415CF242CD75C00D2644C /* MSUEFICADB.h in Headers */,
|
||||
9A36E5BD24F5616F007A1107 /* base64.h in Headers */,
|
||||
@ -1720,7 +1713,6 @@
|
||||
9A36E59D24F5616F007A1107 /* TagKey.h in Headers */,
|
||||
9AF416A8242CDA5800D2644C /* memvendors.h in Headers */,
|
||||
9AF416A9242CDA5800D2644C /* kernel_patcher.h in Headers */,
|
||||
9AF416AA242CDA5800D2644C /* memory.h in Headers */,
|
||||
9AF416AB242CDA5800D2644C /* menu.h in Headers */,
|
||||
9AF416AC242CDA5800D2644C /* MSUEFICADB.h in Headers */,
|
||||
9A36E5BE24F5616F007A1107 /* base64.h in Headers */,
|
||||
@ -1962,7 +1954,6 @@
|
||||
9AC7807024176C04005CDD5C /* loader.cpp in Sources */,
|
||||
9AC77FC224176C04005CDD5C /* XObjArray_tests.cpp in Sources */,
|
||||
9A36E5E124F7EF20007A1107 /* string.cpp in Sources */,
|
||||
9AC7808224176C04005CDD5C /* memory.cpp in Sources */,
|
||||
9AC7803B24176C04005CDD5C /* cpu.cpp in Sources */,
|
||||
9AC7800124176C04005CDD5C /* LegacyBoot.cpp in Sources */,
|
||||
9AC7807524176C04005CDD5C /* REFIT_MENU_SCREEN.cpp in Sources */,
|
||||
@ -2016,6 +2007,7 @@
|
||||
9A9AEB94243F7B5600FBD7D8 /* unicode_conversions.cpp in Sources */,
|
||||
9AC7806C24176C04005CDD5C /* bootscreen.cpp in Sources */,
|
||||
9AC7801424176C04005CDD5C /* Console.cpp in Sources */,
|
||||
9A4C5777255ACAE8004F0B21 /* MacOsVersion.cpp in Sources */,
|
||||
9AC7802E24176C04005CDD5C /* StartupSound.cpp in Sources */,
|
||||
9AC7808724176C04005CDD5C /* globals_ctor.cpp in Sources */,
|
||||
9AC7807724176C04005CDD5C /* screen.cpp in Sources */,
|
||||
@ -2086,7 +2078,6 @@
|
||||
9A36E5D224F5616F007A1107 /* plist.cpp in Sources */,
|
||||
9AF4161E242CD75C00D2644C /* loader.cpp in Sources */,
|
||||
9AF4161F242CD75C00D2644C /* XObjArray_tests.cpp in Sources */,
|
||||
9AF41621242CD75C00D2644C /* memory.cpp in Sources */,
|
||||
9A36E59324F5616F007A1107 /* TagBool.cpp in Sources */,
|
||||
9AF41622242CD75C00D2644C /* cpu.cpp in Sources */,
|
||||
9AF41623242CD75C00D2644C /* LegacyBoot.cpp in Sources */,
|
||||
@ -2209,7 +2200,6 @@
|
||||
9A36E5D324F5616F007A1107 /* plist.cpp in Sources */,
|
||||
9AF416FB242CDA5800D2644C /* loader.cpp in Sources */,
|
||||
9AF416FC242CDA5800D2644C /* XObjArray_tests.cpp in Sources */,
|
||||
9AF416FE242CDA5800D2644C /* memory.cpp in Sources */,
|
||||
9A36E59424F5616F007A1107 /* TagBool.cpp in Sources */,
|
||||
9AF416FF242CDA5800D2644C /* cpu.cpp in Sources */,
|
||||
9AF41700242CDA5800D2644C /* LegacyBoot.cpp in Sources */,
|
||||
|
40
Xcode/cpp_tests/Include/BootLog.h
Executable file
40
Xcode/cpp_tests/Include/BootLog.h
Executable file
@ -0,0 +1,40 @@
|
||||
/*
|
||||
Headers collection for procedures
|
||||
*/
|
||||
|
||||
#ifndef __BOOTLOG__H__
|
||||
#define __BOOTLOG__H__
|
||||
|
||||
#define MsgLog ::printf
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define __attribute__(x)
|
||||
#endif
|
||||
|
||||
void
|
||||
EFIAPI
|
||||
DebugLog (
|
||||
IN INTN DebugMode,
|
||||
IN CONST CHAR8 *FormatString, ...) __attribute__((format(printf, 2, 3)));
|
||||
|
||||
|
||||
/** Prints series of bytes. */
|
||||
void
|
||||
PrintBytes (
|
||||
IN void *Bytes,
|
||||
IN UINTN Number
|
||||
);
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
@ -17,7 +17,8 @@
|
||||
#include "../Include/Library/Base.h"
|
||||
#include "../Include/Library/BaseLib.h"
|
||||
#include "../Include/Library/BaseMemoryLib.h"
|
||||
#include "../../../rEFIt_UEFI/Platform/Utils.h"
|
||||
#include <BootLog.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <limits.h>
|
||||
#include <stdarg.h>
|
||||
@ -37,15 +38,17 @@ typedef uint16_t char16_t;
|
||||
|
||||
#include "../../../rEFIt_UEFI/Platform/Posix/abort.h"
|
||||
#include "../../../rEFIt_UEFI/cpp_foundation/unicode_conversions.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include "../../../rEFIt_UEFI/cpp_foundation/XString.h"
|
||||
#include "../../../rEFIt_UEFI/cpp_foundation/XObjArray.h"
|
||||
#endif
|
||||
#include "../../../rEFIt_UEFI/Platform/Utils.h"
|
||||
|
||||
#include "xcode_utf_fixed.h"
|
||||
|
||||
|
||||
void CpuDeadLoop(void);
|
||||
void DebugLog(INTN DebugMode, const char *FormatString, ...);
|
||||
#define MsgLog ::printf
|
||||
|
||||
void PauseForKey(const wchar_t* msg);
|
||||
|
||||
@ -67,5 +70,7 @@ void FreePool(const void* Buffer);
|
||||
|
||||
CHAR16* EfiStrDuplicate (IN CONST CHAR16 *Src);
|
||||
|
||||
#define DEBUG_VERBOSE 0
|
||||
#define DEBUG( expression )
|
||||
|
||||
#endif /* Platform_h_h */
|
||||
|
@ -124,6 +124,14 @@
|
||||
9A4185C02439F73A00BEAFB8 /* XStringArray.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A4185BE2439F73A00BEAFB8 /* XStringArray.cpp */; };
|
||||
9A4185C12439F73A00BEAFB8 /* XStringArray.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A4185BE2439F73A00BEAFB8 /* XStringArray.cpp */; };
|
||||
9A4185C22439F73A00BEAFB8 /* XStringArray.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A4185BE2439F73A00BEAFB8 /* XStringArray.cpp */; };
|
||||
9A4C576B255AAD07004F0B21 /* MacOsVersion.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A4C5769255AAD07004F0B21 /* MacOsVersion.cpp */; };
|
||||
9A4C576C255AAD07004F0B21 /* MacOsVersion.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A4C5769255AAD07004F0B21 /* MacOsVersion.cpp */; };
|
||||
9A4C576D255AAD07004F0B21 /* MacOsVersion.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A4C5769255AAD07004F0B21 /* MacOsVersion.cpp */; };
|
||||
9A4C576E255AAD07004F0B21 /* MacOsVersion.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A4C5769255AAD07004F0B21 /* MacOsVersion.cpp */; };
|
||||
9A4C5771255AB280004F0B21 /* MacOsVersion_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A4C5770255AB280004F0B21 /* MacOsVersion_test.cpp */; };
|
||||
9A4C5772255AB280004F0B21 /* MacOsVersion_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A4C5770255AB280004F0B21 /* MacOsVersion_test.cpp */; };
|
||||
9A4C5773255AB280004F0B21 /* MacOsVersion_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A4C5770255AB280004F0B21 /* MacOsVersion_test.cpp */; };
|
||||
9A4C5774255AB280004F0B21 /* MacOsVersion_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A4C5770255AB280004F0B21 /* MacOsVersion_test.cpp */; };
|
||||
9A4FFA7E2451C8330050B38B /* XString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A4FFA7C2451C8330050B38B /* XString.cpp */; };
|
||||
9A4FFA812451C88D0050B38B /* XString_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A4FFA802451C88D0050B38B /* XString_test.cpp */; };
|
||||
9A4FFA822451C88D0050B38B /* XString_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A4FFA802451C88D0050B38B /* XString_test.cpp */; };
|
||||
@ -233,12 +241,10 @@
|
||||
9A28CD06241B8DD400F3D247 /* strcmp_test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = strcmp_test.cpp; sourceTree = "<group>"; };
|
||||
9A28CD07241B8DD400F3D247 /* strcmp_test.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = strcmp_test.h; sourceTree = "<group>"; };
|
||||
9A28CD08241B8DD400F3D247 /* strncmp_test.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = strncmp_test.h; sourceTree = "<group>"; };
|
||||
9A28CD13241B9FEE00F3D247 /* posix.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = posix.h; sourceTree = "<group>"; };
|
||||
9A28CD14241BACBB00F3D247 /* strlen_test.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = strlen_test.h; sourceTree = "<group>"; };
|
||||
9A28CD15241BACBB00F3D247 /* strlen_test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = strlen_test.cpp; sourceTree = "<group>"; };
|
||||
9A28CD1D241BB61B00F3D247 /* abort.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = abort.cpp; sourceTree = "<group>"; };
|
||||
9A28CD1E241BB61B00F3D247 /* strlen.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = strlen.cpp; sourceTree = "<group>"; };
|
||||
9A28CD49241F437C00F3D247 /* xcode_utf_fixed.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = xcode_utf_fixed.h; sourceTree = "<group>"; };
|
||||
9A28CD4A241F4CCE00F3D247 /* xcode_utf_fixed.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = xcode_utf_fixed.cpp; sourceTree = "<group>"; };
|
||||
9A2A7C8624576CCE00422263 /* cpp_tests UTF32 c++17 */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "cpp_tests UTF32 c++17"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
9A36E4DA24F3B536007A1107 /* TagBool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TagBool.h; sourceTree = "<group>"; };
|
||||
@ -275,6 +281,21 @@
|
||||
9A4185B02439E4D600BEAFB8 /* LoadOptions_test.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LoadOptions_test.h; sourceTree = "<group>"; };
|
||||
9A4185BE2439F73A00BEAFB8 /* XStringArray.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XStringArray.cpp; sourceTree = "<group>"; };
|
||||
9A4185BF2439F73A00BEAFB8 /* XStringArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XStringArray.h; sourceTree = "<group>"; };
|
||||
9A4C575E255AAC0A004F0B21 /* Platform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Platform.h; sourceTree = "<group>"; };
|
||||
9A4C575F255AAC0A004F0B21 /* printf_lite-conf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "printf_lite-conf.h"; sourceTree = "<group>"; };
|
||||
9A4C5760255AAC0A004F0B21 /* poolprint-test-cpp_conf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "poolprint-test-cpp_conf.h"; sourceTree = "<group>"; };
|
||||
9A4C5761255AAC0A004F0B21 /* Uefi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Uefi.h; sourceTree = "<group>"; };
|
||||
9A4C5762255AAC0A004F0B21 /* XToolsConf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XToolsConf.h; sourceTree = "<group>"; };
|
||||
9A4C5763255AAC0A004F0B21 /* printlib-test-cpp_conf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "printlib-test-cpp_conf.h"; sourceTree = "<group>"; };
|
||||
9A4C5764255AAC0A004F0B21 /* poolprintfloat-test-cpp_conf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "poolprintfloat-test-cpp_conf.h"; sourceTree = "<group>"; };
|
||||
9A4C5765255AAC0A004F0B21 /* printf_lite-test-cpp_conf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "printf_lite-test-cpp_conf.h"; sourceTree = "<group>"; };
|
||||
9A4C5766255AAC0A004F0B21 /* posix.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = posix.h; sourceTree = "<group>"; };
|
||||
9A4C5767255AAC0A004F0B21 /* xcode_utf_fixed.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = xcode_utf_fixed.h; sourceTree = "<group>"; };
|
||||
9A4C5768255AAC31004F0B21 /* BootLog.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BootLog.h; sourceTree = "<group>"; };
|
||||
9A4C5769255AAD07004F0B21 /* MacOsVersion.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MacOsVersion.cpp; sourceTree = "<group>"; };
|
||||
9A4C576A255AAD07004F0B21 /* MacOsVersion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MacOsVersion.h; sourceTree = "<group>"; };
|
||||
9A4C576F255AB280004F0B21 /* MacOsVersion_test.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MacOsVersion_test.h; sourceTree = "<group>"; };
|
||||
9A4C5770255AB280004F0B21 /* MacOsVersion_test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MacOsVersion_test.cpp; sourceTree = "<group>"; };
|
||||
9A4FFA7C2451C8330050B38B /* XString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XString.cpp; sourceTree = "<group>"; };
|
||||
9A4FFA7F2451C88C0050B38B /* XString_test.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XString_test.h; sourceTree = "<group>"; };
|
||||
9A4FFA802451C88D0050B38B /* XString_test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XString_test.cpp; sourceTree = "<group>"; };
|
||||
@ -296,7 +317,6 @@
|
||||
9A838CA3253423F0008303F5 /* find_replace_mask_OC_tests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = find_replace_mask_OC_tests.cpp; sourceTree = "<group>"; };
|
||||
9A838CAA25342626008303F5 /* MemoryOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MemoryOperation.h; sourceTree = "<group>"; };
|
||||
9A838CB325347C36008303F5 /* MemoryOperation.c */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp.preprocessed; fileEncoding = 4; path = MemoryOperation.c; sourceTree = "<group>"; };
|
||||
9A838CB52534808A008303F5 /* Uefi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Uefi.h; sourceTree = "<group>"; };
|
||||
9A838CB825348237008303F5 /* BaseMemoryLib.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BaseMemoryLib.h; sourceTree = "<group>"; };
|
||||
9A838CB925348237008303F5 /* BaseMemoryLib.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = BaseMemoryLib.c; sourceTree = "<group>"; };
|
||||
9A838CBE253485C8008303F5 /* BaseLib.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BaseLib.h; sourceTree = "<group>"; };
|
||||
@ -308,7 +328,6 @@
|
||||
9A838CC62534946C008303F5 /* ProcessorBind.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ProcessorBind.h; sourceTree = "<group>"; };
|
||||
9A92232D2402FD1000483CBA /* cpp_tests UTF16 signed char */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "cpp_tests UTF16 signed char"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
9A9223302402FD1000483CBA /* main.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = "<group>"; };
|
||||
9A92234D2402FD9500483CBA /* Platform.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Platform.h; sourceTree = "<group>"; };
|
||||
9A9AEB8B243F73CE00FBD7D8 /* unicode_conversions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = unicode_conversions.h; sourceTree = "<group>"; };
|
||||
9A9AEB8C243F73CE00FBD7D8 /* unicode_conversions.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.c.preprocessed; fileEncoding = 4; path = unicode_conversions.cpp; sourceTree = "<group>"; };
|
||||
9A9EA7F6245AAB310076EC02 /* XToolsCommon_test.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XToolsCommon_test.h; sourceTree = "<group>"; };
|
||||
@ -320,17 +339,11 @@
|
||||
9ACAB1182426240C00BDB3CF /* printf_lite.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = printf_lite.h; path = ../../Include/Library/printf_lite.h; sourceTree = "<group>"; };
|
||||
9AD469472452B33700D6D0DB /* shared_with_menu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = shared_with_menu.cpp; sourceTree = "<group>"; };
|
||||
9AD469482452B33700D6D0DB /* shared_with_menu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = shared_with_menu.h; sourceTree = "<group>"; };
|
||||
9AD469592452B7C000D6D0DB /* XToolsConf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XToolsConf.h; sourceTree = "<group>"; };
|
||||
9AD4695A2452B7C000D6D0DB /* poolprintfloat-test-cpp_conf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "poolprintfloat-test-cpp_conf.h"; sourceTree = "<group>"; };
|
||||
9AF4156B242CBB5600D2644C /* printf_lite-test-cpp_conf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "printf_lite-test-cpp_conf.h"; sourceTree = "<group>"; };
|
||||
9AF4156D242CBC4900D2644C /* printf_lite-conf.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "printf_lite-conf.h"; path = "../../Include/Library/printf_lite-conf.h"; sourceTree = "<group>"; };
|
||||
9AF4156E242CBC6000D2644C /* printf_lite-conf.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "printf_lite-conf.h"; sourceTree = "<group>"; };
|
||||
9AF4156F242CBE7500D2644C /* printlib-test.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "printlib-test.h"; sourceTree = "<group>"; };
|
||||
9AF41570242CBE7500D2644C /* printlib-test-cpp_conf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "printlib-test-cpp_conf.h"; sourceTree = "<group>"; };
|
||||
9AF41573242CBE7600D2644C /* printlib-test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "printlib-test.cpp"; sourceTree = "<group>"; };
|
||||
9AF41574242CBE7600D2644C /* printf_lite-test-cpp_conf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "printf_lite-test-cpp_conf.h"; sourceTree = "<group>"; };
|
||||
9AF41578242CBED700D2644C /* poolprint-test-cpp_conf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "poolprint-test-cpp_conf.h"; sourceTree = "<group>"; };
|
||||
9AF41579242CBED700D2644C /* printlib-test-cpp_conf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "printlib-test-cpp_conf.h"; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
@ -425,6 +438,8 @@
|
||||
9A9EA7F6245AAB310076EC02 /* XToolsCommon_test.h */,
|
||||
9A670D1B24E535AB00B5D780 /* XBuffer_tests.cpp */,
|
||||
9A670D1A24E535AB00B5D780 /* XBuffer_tests.h */,
|
||||
9A4C5770255AB280004F0B21 /* MacOsVersion_test.cpp */,
|
||||
9A4C576F255AB280004F0B21 /* MacOsVersion_test.h */,
|
||||
);
|
||||
path = cpp_unit_test;
|
||||
sourceTree = "<group>";
|
||||
@ -444,6 +459,8 @@
|
||||
9A28CCAC241B816400F3D247 /* Platform */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9A4C5769255AAD07004F0B21 /* MacOsVersion.cpp */,
|
||||
9A4C576A255AAD07004F0B21 /* MacOsVersion.h */,
|
||||
9A838CB325347C36008303F5 /* MemoryOperation.c */,
|
||||
9A838CAA25342626008303F5 /* MemoryOperation.h */,
|
||||
9A36E51E24F3B82A007A1107 /* b64cdecode.cpp */,
|
||||
@ -545,6 +562,17 @@
|
||||
9A838CB6253481F5008303F5 /* Include */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9A4C5768255AAC31004F0B21 /* BootLog.h */,
|
||||
9A4C575E255AAC0A004F0B21 /* Platform.h */,
|
||||
9A4C5760255AAC0A004F0B21 /* poolprint-test-cpp_conf.h */,
|
||||
9A4C5764255AAC0A004F0B21 /* poolprintfloat-test-cpp_conf.h */,
|
||||
9A4C5766255AAC0A004F0B21 /* posix.h */,
|
||||
9A4C575F255AAC0A004F0B21 /* printf_lite-conf.h */,
|
||||
9A4C5765255AAC0A004F0B21 /* printf_lite-test-cpp_conf.h */,
|
||||
9A4C5763255AAC0A004F0B21 /* printlib-test-cpp_conf.h */,
|
||||
9A4C5761255AAC0A004F0B21 /* Uefi.h */,
|
||||
9A4C5767255AAC0A004F0B21 /* xcode_utf_fixed.h */,
|
||||
9A4C5762255AAC0A004F0B21 /* XToolsConf.h */,
|
||||
9A838CB7253481FF008303F5 /* Library */,
|
||||
);
|
||||
path = Include;
|
||||
@ -592,19 +620,9 @@
|
||||
9A92232F2402FD1000483CBA /* Main */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9AD469592452B7C000D6D0DB /* XToolsConf.h */,
|
||||
9AD4695A2452B7C000D6D0DB /* poolprintfloat-test-cpp_conf.h */,
|
||||
9AF41578242CBED700D2644C /* poolprint-test-cpp_conf.h */,
|
||||
9AF41579242CBED700D2644C /* printlib-test-cpp_conf.h */,
|
||||
9A9223302402FD1000483CBA /* main.cpp */,
|
||||
9A0B085D240300E000E2B470 /* Platform.cpp */,
|
||||
9A92234D2402FD9500483CBA /* Platform.h */,
|
||||
9A28CD13241B9FEE00F3D247 /* posix.h */,
|
||||
9AF4156E242CBC6000D2644C /* printf_lite-conf.h */,
|
||||
9AF4156B242CBB5600D2644C /* printf_lite-test-cpp_conf.h */,
|
||||
9A28CD4A241F4CCE00F3D247 /* xcode_utf_fixed.cpp */,
|
||||
9A28CD49241F437C00F3D247 /* xcode_utf_fixed.h */,
|
||||
9A838CB52534808A008303F5 /* Uefi.h */,
|
||||
);
|
||||
name = Main;
|
||||
path = src;
|
||||
@ -743,6 +761,8 @@
|
||||
9A36E51924F3B537007A1107 /* TagKey.cpp in Sources */,
|
||||
9A9EA7F9245AAB310076EC02 /* XToolsCommon_test.cpp in Sources */,
|
||||
9A36E52724F3BB6B007A1107 /* FloatLib.cpp in Sources */,
|
||||
9A4C576C255AAD07004F0B21 /* MacOsVersion.cpp in Sources */,
|
||||
9A4C5772255AB280004F0B21 /* MacOsVersion_test.cpp in Sources */,
|
||||
9A838CB125345E93008303F5 /* find_replace_mask_Clover_tests.cpp in Sources */,
|
||||
9A28CD23241BB61B00F3D247 /* strlen.cpp in Sources */,
|
||||
9A28CD4C241F4CCE00F3D247 /* xcode_utf_fixed.cpp in Sources */,
|
||||
@ -790,6 +810,8 @@
|
||||
9A36E51B24F3B537007A1107 /* TagKey.cpp in Sources */,
|
||||
9A9EA7FB245AAB310076EC02 /* XToolsCommon_test.cpp in Sources */,
|
||||
9A36E52924F3BB6B007A1107 /* FloatLib.cpp in Sources */,
|
||||
9A4C576E255AAD07004F0B21 /* MacOsVersion.cpp in Sources */,
|
||||
9A4C5774255AB280004F0B21 /* MacOsVersion_test.cpp in Sources */,
|
||||
9A838CB225345E94008303F5 /* find_replace_mask_Clover_tests.cpp in Sources */,
|
||||
9A2A7C7124576CCE00422263 /* strlen.cpp in Sources */,
|
||||
9A2A7C7224576CCE00422263 /* xcode_utf_fixed.cpp in Sources */,
|
||||
@ -837,6 +859,8 @@
|
||||
9A36E51A24F3B537007A1107 /* TagKey.cpp in Sources */,
|
||||
9A9EA7FA245AAB310076EC02 /* XToolsCommon_test.cpp in Sources */,
|
||||
9A36E52824F3BB6B007A1107 /* FloatLib.cpp in Sources */,
|
||||
9A4C576D255AAD07004F0B21 /* MacOsVersion.cpp in Sources */,
|
||||
9A4C5773255AB280004F0B21 /* MacOsVersion_test.cpp in Sources */,
|
||||
9A838CB025345E93008303F5 /* find_replace_mask_Clover_tests.cpp in Sources */,
|
||||
9A28CD24241BB61B00F3D247 /* strlen.cpp in Sources */,
|
||||
9A28CD4D241F4CCE00F3D247 /* xcode_utf_fixed.cpp in Sources */,
|
||||
@ -873,6 +897,7 @@
|
||||
files = (
|
||||
9A36E50424F3B537007A1107 /* TagInt64.cpp in Sources */,
|
||||
9A36E50024F3B537007A1107 /* TagDict.cpp in Sources */,
|
||||
9A4C576B255AAD07004F0B21 /* MacOsVersion.cpp in Sources */,
|
||||
9A36E50C24F3B537007A1107 /* TagData.cpp in Sources */,
|
||||
9A0B085A2402FF8400E2B470 /* XObjArray_tests.cpp in Sources */,
|
||||
9A7D518424FC32F700FA1CC3 /* XBuffer.cpp in Sources */,
|
||||
@ -908,6 +933,7 @@
|
||||
9A4185C02439F73A00BEAFB8 /* XStringArray.cpp in Sources */,
|
||||
9A36E51024F3B537007A1107 /* TagArray.cpp in Sources */,
|
||||
9A36E4F024F3B537007A1107 /* TagString8.cpp in Sources */,
|
||||
9A4C5771255AB280004F0B21 /* MacOsVersion_test.cpp in Sources */,
|
||||
9A36E50824F3B537007A1107 /* TagDate.cpp in Sources */,
|
||||
9A36E51F24F3B82A007A1107 /* b64cdecode.cpp in Sources */,
|
||||
9A838CC3253485DC008303F5 /* DebugLib.c in Sources */,
|
||||
@ -1011,7 +1037,7 @@
|
||||
CLANG_WARN_CXX0X_EXTENSIONS = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = NO;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_FLOAT_CONVERSION = YES;
|
||||
@ -1076,11 +1102,15 @@
|
||||
"$(PROJECT_DIR)/src",
|
||||
"$(PROJECT_DIR)/Include",
|
||||
);
|
||||
INCLUDED_SOURCE_FILE_NAMES = "";
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.13;
|
||||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||
MTL_FAST_MATH = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
OTHER_CFLAGS = "";
|
||||
OTHER_CFLAGS = (
|
||||
"-include",
|
||||
Platform.h,
|
||||
);
|
||||
SDKROOT = macosx;
|
||||
USE_HEADERMAP = NO;
|
||||
};
|
||||
@ -1105,7 +1135,7 @@
|
||||
CLANG_WARN_CXX0X_EXTENSIONS = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = NO;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_FLOAT_CONVERSION = YES;
|
||||
@ -1165,10 +1195,14 @@
|
||||
"$(PROJECT_DIR)/src",
|
||||
"$(PROJECT_DIR)/Include",
|
||||
);
|
||||
INCLUDED_SOURCE_FILE_NAMES = "";
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.13;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
MTL_FAST_MATH = YES;
|
||||
OTHER_CFLAGS = "";
|
||||
OTHER_CFLAGS = (
|
||||
"-include",
|
||||
Platform.h,
|
||||
);
|
||||
SDKROOT = macosx;
|
||||
USE_HEADERMAP = NO;
|
||||
};
|
||||
|
@ -1672,7 +1672,7 @@ void LoadAllPatchedAML(const XStringW& acpiPathUnderOem, UINTN Pass)
|
||||
}
|
||||
}
|
||||
|
||||
EFI_STATUS PatchACPI(IN REFIT_VOLUME *Volume, const XString8& OSVersion)
|
||||
EFI_STATUS PatchACPI(IN REFIT_VOLUME *Volume, const MacOsVersion& OSVersion)
|
||||
{
|
||||
EFI_STATUS Status = EFI_SUCCESS;
|
||||
UINTN Index;
|
||||
|
@ -44,7 +44,7 @@ extern UINT64 machineSignature;
|
||||
|
||||
//ACPI
|
||||
EFI_STATUS
|
||||
PatchACPI(IN REFIT_VOLUME *Volume, const XString8& OSVersion);
|
||||
PatchACPI(IN REFIT_VOLUME *Volume, const MacOsVersion& OSVersion);
|
||||
|
||||
EFI_STATUS
|
||||
PatchACPI_OtherOS(CONST CHAR16* OsSubdir, BOOLEAN DropSSDT);
|
||||
|
@ -28,7 +28,7 @@ extern "C" {
|
||||
void
|
||||
InitBooterLog (void);
|
||||
|
||||
void closeDebugLog();
|
||||
void closeDebugLog(void);
|
||||
|
||||
EFI_STATUS
|
||||
SetupBooterLog (
|
||||
|
@ -38,6 +38,7 @@
|
||||
|
||||
|
||||
#include <Platform.h> // Only use angled for Platform, else, xcode project won't compile
|
||||
#include "../include/OsType.h"
|
||||
#include "Nvram.h"
|
||||
#include "platformdata.h"
|
||||
#include "smbios.h"
|
||||
@ -212,7 +213,7 @@ SetVariablesForOSX(LOADER_ENTRY *Entry)
|
||||
CONST CHAR16 *KbdPrevLang;
|
||||
UINTN LangLen;
|
||||
void *OldData;
|
||||
UINT64 os_version = AsciiOSVersionToUint64(Entry->OSVersion);
|
||||
// UINT64 os_version = AsciiOSVersionToUint64(Entry->OSVersion);
|
||||
CHAR8 *PlatformLang;
|
||||
|
||||
EFI_GUID uuid;
|
||||
@ -407,7 +408,7 @@ SetVariablesForOSX(LOADER_ENTRY *Entry)
|
||||
|
||||
// Sherlocks: to fix "OSInstall.mpkg appears to be missing or damaged" in 10.13+, we should remove this variables.
|
||||
if (Entry->LoaderType == OSTYPE_OSX_INSTALLER) {
|
||||
if (os_version > AsciiOSVersionToUint64("10.12"_XS8)) {
|
||||
if (Entry->OSVersion.isEmpty() || Entry->OSVersion > MacOsVersion("10.12"_XS8)) {
|
||||
DeleteNvramVariable(L"install-product-url", &gEfiAppleBootGuid);
|
||||
DeleteNvramVariable(L"previous-system-uuid", &gEfiAppleBootGuid);
|
||||
}
|
||||
|
@ -3741,7 +3741,7 @@ UINT32 FIXFirewire (UINT8 *dsdt, UINT32 len)
|
||||
return len;
|
||||
}
|
||||
|
||||
UINT32 AddHDEF (UINT8 *dsdt, UINT32 len, const XString8& OSVersion)
|
||||
UINT32 AddHDEF (UINT8 *dsdt, UINT32 len, const MacOsVersion& OSVersion)
|
||||
{
|
||||
UINT32 i, k;
|
||||
UINT32 PCIADR, PCISIZE = 0;
|
||||
@ -3814,7 +3814,7 @@ UINT32 AddHDEF (UINT8 *dsdt, UINT32 len, const XString8& OSVersion)
|
||||
aml_add_string_buffer(pack, "onboard-1");
|
||||
}
|
||||
if (!CustProperties(pack, DEV_HDA)) {
|
||||
if ((OSVersion != NULL && AsciiOSVersionToUint64(OSVersion) < AsciiOSVersionToUint64("10.8")) || (gSettings.HDALayoutId > 0)) {
|
||||
if ( ( OSVersion.notEmpty() && OSVersion < AsciiOSVersionToUint64("10.8") ) || gSettings.HDALayoutId > 0 ) {
|
||||
aml_add_string(pack, "layout-id");
|
||||
aml_add_byte_buffer(pack, (CHAR8*)&HDAlayoutId, 4);
|
||||
}
|
||||
@ -5331,7 +5331,7 @@ void RenameDevices(UINT8* table)
|
||||
MsgLog(" %lld replacements\n", Num);
|
||||
}
|
||||
|
||||
void FixBiosDsdt(UINT8* temp, EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE* fadt, const XString8& OSVersion)
|
||||
void FixBiosDsdt(UINT8* temp, EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE* fadt, const MacOsVersion& OSVersion)
|
||||
{
|
||||
UINT32 DsdtLen;
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
#define PLATFORM_FIXBIOSDSDT_H_
|
||||
|
||||
#include "../cpp_foundation/XBuffer.h"
|
||||
|
||||
#include "../Platform/MacOsVersion.h"
|
||||
|
||||
//DSDT fixes MASK
|
||||
//0x00FF
|
||||
@ -61,7 +61,7 @@ void
|
||||
FixBiosDsdt (
|
||||
UINT8 *Dsdt,
|
||||
EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *fadt,
|
||||
const XString8& OSVersion
|
||||
const MacOsVersion& OSVersion
|
||||
);
|
||||
|
||||
|
||||
|
20
rEFIt_UEFI/Platform/MacOsVersion.cpp
Executable file
20
rEFIt_UEFI/Platform/MacOsVersion.cpp
Executable file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
Some helper string functions
|
||||
JrCs 2014
|
||||
*/
|
||||
|
||||
#include <Platform.h> // Only use angled for Platform, else, xcode project won't compile
|
||||
#include "../include/OsType.h"
|
||||
#include "../cpp_foundation/XString.h"
|
||||
#include "MacOsVersion.h"
|
||||
|
||||
MacOsVersion nullMacOsVersion;
|
||||
|
||||
|
||||
const XString8 getSuffixForMacOsVersion(int LoaderType)
|
||||
{
|
||||
if (OSTYPE_IS_OSX_INSTALLER(LoaderType)) return "install"_XS8;
|
||||
if (OSTYPE_IS_OSX_RECOVERY(LoaderType)) return "recovery"_XS8;
|
||||
if (OSTYPE_IS_OSX(LoaderType)) return "normal"_XS8;
|
||||
return NullXString8;
|
||||
}
|
288
rEFIt_UEFI/Platform/MacOsVersion.h
Normal file
288
rEFIt_UEFI/Platform/MacOsVersion.h
Normal file
@ -0,0 +1,288 @@
|
||||
#ifndef __MacOsVersion_H__
|
||||
#define __MacOsVersion_H__
|
||||
|
||||
#include "../cpp_foundation/XStringArray.h"
|
||||
|
||||
const XString8 getSuffixForMacOsVersion(int LoaderType);
|
||||
|
||||
class AbstractMacOsVersion
|
||||
{
|
||||
public:
|
||||
static const int nbMaxElement = 5; // if you modify, update the initializer/
|
||||
XString8 lastError = ""_XS8; // to silence warning effc++
|
||||
protected:
|
||||
int versionsNumber[nbMaxElement] = { -1, -1, -1, -1, -1 };
|
||||
|
||||
public:
|
||||
|
||||
AbstractMacOsVersion() {};
|
||||
AbstractMacOsVersion(int _versionsNumber[nbMaxElement]) {
|
||||
size_t idx;
|
||||
for ( idx=0 ; idx < nbMaxElement && _versionsNumber[idx] != -1 ; idx++ ) versionsNumber[idx] = _versionsNumber[idx];
|
||||
for ( ; idx < nbMaxElement ; idx++ ) if ( _versionsNumber[idx] != -1 ) panic("MacOsVersion::ctor _versionsNumber[%zu] != -1", idx);
|
||||
};
|
||||
|
||||
int nbElement() const { int idx; for ( idx=0 ; idx < nbMaxElement && versionsNumber[idx] != -1 ; idx++ ) {}; return idx; }
|
||||
int lastElement() const { int idx; for ( idx=1 ; idx < nbMaxElement && versionsNumber[idx] != -1 ; idx++ ) {}; return versionsNumber[idx-1]; }
|
||||
void setEmpty() { lastError.setEmpty(); for ( size_t idx=0 ; idx < nbMaxElement ; idx++ ) versionsNumber[idx] = -1; }
|
||||
bool isEmpty() const { return versionsNumber[0] == -1; }
|
||||
bool notEmpty() const { return !isEmpty(); }
|
||||
|
||||
template<typename IntegralType, enable_if(is_integral(IntegralType))>
|
||||
int elementAt(IntegralType i) const {
|
||||
if (i < 0) {
|
||||
panic("MacOsVersion::elementAt : i < 0. System halted\n");
|
||||
}
|
||||
if ( (unsigned_type(IntegralType))i >= nbMaxElement ) {
|
||||
panic("MacOsVersion::elementAt : i >= nbMaxElement. System halted\n");
|
||||
}
|
||||
return versionsNumber[(unsigned_type(IntegralType))i];
|
||||
}
|
||||
|
||||
template<typename IntegralType, enable_if(is_integral(IntegralType))>
|
||||
XString8 asString(IntegralType i) const {
|
||||
if (i <= 0) {
|
||||
panic("MacOsVersion::asString : i < 0. System halted\n");
|
||||
}
|
||||
if ( (unsigned_type(IntegralType))i > nbMaxElement ) {
|
||||
panic("MacOsVersion::asString : i > nbMaxElement. System halted\n");
|
||||
}
|
||||
if ( versionsNumber[0] == -1 ) return NullXString8;
|
||||
XString8 returnValue;
|
||||
if ( versionsNumber[0] == -2 ) {
|
||||
returnValue.S8Printf("x");
|
||||
}else{
|
||||
returnValue.S8Printf("%d", versionsNumber[0]);
|
||||
}
|
||||
for ( size_t idx=1 ; idx < (unsigned_type(IntegralType))i && versionsNumber[idx] != -1 ; idx++ ) {
|
||||
if ( versionsNumber[idx] == -2 ) {
|
||||
returnValue.S8Catf(".x");
|
||||
}else{
|
||||
returnValue.S8Catf(".%d", versionsNumber[idx]);
|
||||
}
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
XString8 asString() const { return asString(nbMaxElement); }
|
||||
|
||||
};
|
||||
|
||||
class MacOsVersionPattern : public AbstractMacOsVersion
|
||||
{
|
||||
public:
|
||||
|
||||
MacOsVersionPattern() : AbstractMacOsVersion() {};
|
||||
MacOsVersionPattern(int _versionsNumber[nbMaxElement]) : AbstractMacOsVersion(_versionsNumber) {};
|
||||
|
||||
template <class XStringClass, enable_if( is___String(XStringClass) || is___LString(XStringClass) ) >
|
||||
MacOsVersionPattern(const XStringClass& versionAsString)
|
||||
{
|
||||
this->takeValueFrom(versionAsString);
|
||||
}
|
||||
|
||||
template <class XStringClass, enable_if( is___String(XStringClass) || is___LString(XStringClass) ) >
|
||||
// MacOsVersionPattern& operator = ( const XStringClass& versionAsString)
|
||||
MacOsVersionPattern& takeValueFrom(const XStringClass& versionAsString)
|
||||
{
|
||||
setEmpty(); // we call our own setEmpty although we already are empty (this is a ctor). That's because in case of nbMaxElement is increased and there is a missing value in versionsNumber array initializer.
|
||||
size_t currentElementIdx = 0;
|
||||
int* currentElementPtr = &versionsNumber[currentElementIdx];
|
||||
size_t idx;
|
||||
for ( idx=0 ; idx < versionAsString.length(); idx++ )
|
||||
{
|
||||
if ( *currentElementPtr == -2 ) {
|
||||
if ( versionAsString[idx] == 'x' || versionAsString[idx] == 'X' ) {
|
||||
// ok. we allow multiple following x.
|
||||
}else
|
||||
if ( versionAsString[idx] == '.' ) {
|
||||
currentElementIdx += 1;
|
||||
if ( currentElementIdx >= nbMaxElement ) {
|
||||
setEmpty();
|
||||
lastError.S8Printf("Version number cannot be more than %d numbers.", nbMaxElement);
|
||||
return *this;
|
||||
}
|
||||
currentElementPtr = &versionsNumber[currentElementIdx];
|
||||
}else{
|
||||
setEmpty();
|
||||
lastError.S8Printf("Version number wildcard ('x') must be followed by a dot.");
|
||||
return *this;
|
||||
}
|
||||
}else
|
||||
if ( *currentElementPtr == -1 ) {
|
||||
if ( versionAsString[idx] == 'x' || versionAsString[idx] == 'X' ) {
|
||||
*currentElementPtr = -2;
|
||||
}else
|
||||
if ( IS_DIGIT(versionAsString[idx]) ) {
|
||||
*currentElementPtr = ((int)versionAsString[idx]) - '0'; // safe cast because versionAsString[idx] is a digit.
|
||||
}else
|
||||
{
|
||||
setEmpty();
|
||||
lastError.S8Printf("Version number must be numbers separated with one dot.");
|
||||
return *this;
|
||||
}
|
||||
}else{
|
||||
if ( versionAsString[idx] == '.' ) {
|
||||
currentElementIdx += 1;
|
||||
if ( currentElementIdx >= nbMaxElement ) {
|
||||
setEmpty();
|
||||
lastError.S8Printf("Version number cannot be more than %d numbers.", nbMaxElement);
|
||||
return *this;
|
||||
}
|
||||
currentElementPtr = &versionsNumber[currentElementIdx];
|
||||
}else
|
||||
if ( IS_DIGIT(versionAsString[idx]) ) {
|
||||
*currentElementPtr = *currentElementPtr * 10 + ((int)versionAsString[idx]) - '0'; // safe cast because versionAsString[idx] is a digit.
|
||||
}else{
|
||||
setEmpty();
|
||||
lastError.S8Printf("Version number must be numbers separated with one dot.");
|
||||
return *this;
|
||||
}
|
||||
}
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename CharType, enable_if(is_char(CharType))>
|
||||
MacOsVersionPattern& operator = ( const CharType* p) { return *this = LString8(p); }
|
||||
|
||||
|
||||
MacOsVersionPattern(const MacOsVersionPattern& other)
|
||||
{
|
||||
lastError = other.lastError;
|
||||
memcpy(versionsNumber, other.versionsNumber, sizeof(versionsNumber));
|
||||
}
|
||||
MacOsVersionPattern& operator = ( const MacOsVersionPattern& other)
|
||||
{
|
||||
lastError = other.lastError;
|
||||
memcpy(versionsNumber, other.versionsNumber, sizeof(versionsNumber));
|
||||
return *this;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
class MacOsVersion : public AbstractMacOsVersion
|
||||
{
|
||||
public:
|
||||
|
||||
MacOsVersion() : AbstractMacOsVersion() {};
|
||||
MacOsVersion(int _versionsNumber[nbMaxElement]) : AbstractMacOsVersion(_versionsNumber) {};
|
||||
|
||||
template <class XStringClass, enable_if( is___String(XStringClass) || is___LString(XStringClass) ) >
|
||||
MacOsVersion(const XStringClass& versionAsString)
|
||||
{
|
||||
this->takeValueFrom(versionAsString);
|
||||
}
|
||||
|
||||
template <class XStringClass, enable_if( is___String(XStringClass) || is___LString(XStringClass) ) >
|
||||
// MacOsVersion& operator = ( const XStringClass& versionAsString)
|
||||
MacOsVersion& takeValueFrom(const XStringClass& versionAsString)
|
||||
{
|
||||
setEmpty(); // we call our own setEmpty although we already are empty (this is a ctor). That's because in case of nbMaxElement is increased and there is a missing value in versionsNumber array initializer.
|
||||
size_t currentElementIdx = 0;
|
||||
int* currentElementPtr = &versionsNumber[currentElementIdx];
|
||||
for ( size_t idx=0 ; idx < versionAsString.length(); idx++ )
|
||||
{
|
||||
if ( *currentElementPtr == -1 ) {
|
||||
if ( !IS_DIGIT(versionAsString[idx]) ) {
|
||||
setEmpty();
|
||||
lastError.S8Printf("Version number must be numbers separated with one dot.");
|
||||
return *this;
|
||||
}
|
||||
*currentElementPtr = ((int)versionAsString[idx]) - '0'; // safe cast because versionAsString[idx] is a digit.
|
||||
}else{
|
||||
if ( versionAsString[idx] == '.' ) {
|
||||
currentElementIdx += 1;
|
||||
if ( currentElementIdx >= nbMaxElement ) {
|
||||
setEmpty();
|
||||
lastError.S8Printf("Version number cannot be more than %d numbers.", nbMaxElement);
|
||||
return *this;
|
||||
}
|
||||
currentElementPtr = &versionsNumber[currentElementIdx];
|
||||
}else
|
||||
if ( IS_DIGIT(versionAsString[idx]) ) {
|
||||
*currentElementPtr = *currentElementPtr * 10 + ((int)versionAsString[idx]) - '0'; // safe cast because versionAsString[idx] is a digit.
|
||||
}else{
|
||||
setEmpty();
|
||||
lastError.S8Printf("Version number must be numbers separated with one dot.");
|
||||
return *this;
|
||||
}
|
||||
}
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename CharType, enable_if(is_char(CharType))>
|
||||
MacOsVersion& operator = ( const CharType* p) { return *this = LString8(p); }
|
||||
|
||||
MacOsVersion(const MacOsVersion& other)
|
||||
{
|
||||
lastError = other.lastError;
|
||||
memcpy(versionsNumber, other.versionsNumber, sizeof(versionsNumber));
|
||||
}
|
||||
MacOsVersion& operator = ( const MacOsVersion& other)
|
||||
{
|
||||
lastError = other.lastError;
|
||||
memcpy(versionsNumber, other.versionsNumber, sizeof(versionsNumber));
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
bool match(const MacOsVersionPattern& pattern) const
|
||||
{
|
||||
// int nbMax = nbElemen() <= pattern.nbMaxElement ? nbMaxElement : pattern.nbMaxElement;
|
||||
int idx;
|
||||
for ( idx=0 ; idx < nbMaxElement && versionsNumber[idx] != -1 && pattern.elementAt(idx) != -1 ; idx++ ) {
|
||||
if ( pattern.elementAt(idx) == -2 ) continue;
|
||||
if ( versionsNumber[idx] == pattern.elementAt(idx) ) continue;
|
||||
return false;
|
||||
}
|
||||
if ( idx >= nbMaxElement ) return true; // the whole pattern was macthed => ok.
|
||||
if ( versionsNumber[idx] == -1 ) {
|
||||
// self is shorter than pattern
|
||||
if ( pattern.elementAt(idx) == -1 ) return true; // pattern and self are the same length, and they matched.
|
||||
if ( pattern.nbElement() == idx+1 && pattern.lastElement() == -2 ) return true;
|
||||
}else{
|
||||
// pattern is short then self
|
||||
if ( pattern.lastElement() == -2 ) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool operator ==(const MacOsVersion &other) const
|
||||
{
|
||||
for ( size_t idx=0 ; idx < nbMaxElement ; idx++ ) {
|
||||
if ( versionsNumber[idx] != other.elementAt(idx) ) return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
bool operator !=(const MacOsVersion &other) const { return ! ( *this == other); }
|
||||
|
||||
bool operator <(const MacOsVersion &other) const
|
||||
{
|
||||
for ( size_t idx=0 ; idx < nbMaxElement ; idx++ ) {
|
||||
if ( versionsNumber[idx] < other.elementAt(idx) ) return true;
|
||||
if ( versionsNumber[idx] > other.elementAt(idx) ) return false;
|
||||
}
|
||||
return false; // here, means it's equal
|
||||
};
|
||||
bool operator >=(const MacOsVersion &other) const { return ! ( *this < other); }
|
||||
|
||||
bool operator >(const MacOsVersion &other) const
|
||||
{
|
||||
for ( size_t idx=0 ; idx < nbMaxElement ; idx++ ) {
|
||||
if ( versionsNumber[idx] > other.elementAt(idx) ) return true;
|
||||
if ( versionsNumber[idx] < other.elementAt(idx) ) return false;
|
||||
}
|
||||
return false; // here, means it's equal
|
||||
};
|
||||
bool operator <=(const MacOsVersion &other) const { return ! ( *this > other); }
|
||||
};
|
||||
|
||||
|
||||
|
||||
extern MacOsVersion nullMacOsVersion;
|
||||
|
||||
#endif // __MacOsVersion_H__
|
||||
|
@ -9,7 +9,11 @@
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
|
||||
#ifndef DEBUG_MEMORYOPERATION
|
||||
#define DEBUG_MEMORYOPERATION 1
|
||||
# ifdef UNIT_TESTS
|
||||
# define DEBUG_MEMORYOPERATION 0
|
||||
# else
|
||||
# define DEBUG_MEMORYOPERATION 1
|
||||
# endif
|
||||
#else
|
||||
#define DEBUG_MAIN DEBUG_ALL
|
||||
#endif
|
||||
@ -128,7 +132,9 @@ UINTN SearchAndReplaceMask(UINT8 *Source, UINT64 SourceSize, const UINT8 *Search
|
||||
{
|
||||
UINTN NumReplaces = 0;
|
||||
BOOLEAN NoReplacesRestriction = MaxReplaces <= 0;
|
||||
#if DEBUG_MEMORYOPERATION > 0
|
||||
UINT8* SourceBak = Source;
|
||||
#endif
|
||||
UINT8 *End = Source + SourceSize;
|
||||
if (!Source || !Search || !Replace || !SearchSize) {
|
||||
return 0;
|
||||
|
@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
#include <Platform.h> // Only use angled for Platform, else, xcode project won't compile
|
||||
#include "../include/OsType.h"
|
||||
#include "Nvram.h"
|
||||
#include "BootOptions.h"
|
||||
#include "guid.h"
|
||||
|
@ -36,6 +36,8 @@
|
||||
#include "Self.h"
|
||||
#include "SelfOem.h"
|
||||
#include "Net.h"
|
||||
#include "MacOsVersion.h"
|
||||
#include "../include/OsType.h"
|
||||
|
||||
|
||||
#ifndef DEBUG_ALL
|
||||
@ -1510,8 +1512,37 @@ FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
BOOLEAN
|
||||
IsPatchEnabled (const XString8& MatchOSEntry, const XString8& CurrOS)
|
||||
IsPatchEnabledByBuildNumber(const XString8& MatchOSEntry, const XString8& Build)
|
||||
{
|
||||
BOOLEAN ret = FALSE;
|
||||
|
||||
if (MatchOSEntry.isEmpty() || Build.isEmpty()) {
|
||||
return TRUE; //undefined matched corresponds to old behavior
|
||||
}
|
||||
|
||||
XString8Array mos = Split<XString8Array>(MatchOSEntry, ","_XS8).trimEachString();
|
||||
|
||||
if ( mos[0] == "All"_XS8) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < mos.size(); ++i) {
|
||||
// dot represent MatchOS
|
||||
MacOsVersion mosv = mos[i];
|
||||
if ( mos[i].contains(Build) ) { // MatchBuild
|
||||
//DBG("\nthis patch will activated for OS %ls!\n", mos->array[i]);
|
||||
ret = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
BOOLEAN
|
||||
IsPatchEnabled(const XString8& MatchOSEntry, const MacOsVersion& CurrOS)
|
||||
{
|
||||
BOOLEAN ret = FALSE;
|
||||
|
||||
@ -1527,10 +1558,8 @@ IsPatchEnabled (const XString8& MatchOSEntry, const XString8& CurrOS)
|
||||
|
||||
for (size_t i = 0; i < mos.size(); ++i) {
|
||||
// dot represent MatchOS
|
||||
if (
|
||||
( mos[i].contains("."_XS8) && IsOSValid(mos[i], CurrOS)) || // MatchOS
|
||||
( mos[i].contains(CurrOS) ) // MatchBuild
|
||||
) {
|
||||
MacOsVersion mosv = mos[i];
|
||||
if ( CurrOS.match(mos[i]) ) {
|
||||
//DBG("\nthis patch will activated for OS %ls!\n", mos->array[i]);
|
||||
ret = TRUE;
|
||||
break;
|
||||
@ -1540,61 +1569,61 @@ IsPatchEnabled (const XString8& MatchOSEntry, const XString8& CurrOS)
|
||||
}
|
||||
|
||||
|
||||
BOOLEAN IsOSValid(const XString8& MatchOS, const XString8& CurrOS)
|
||||
{
|
||||
/* example for valid matches are:
|
||||
10.7, only 10.7 (10.7.1 will be skipped)
|
||||
10.10.2 only 10.10.2 (10.10.1 or 10.10.5 will be skipped)
|
||||
10.10.x (or 10.10.X), in this case is valid for all minor version of 10.10 (10.10.(0-9))
|
||||
*/
|
||||
|
||||
BOOLEAN ret = FALSE;
|
||||
|
||||
if (MatchOS.isEmpty() || CurrOS.isEmpty()) {
|
||||
return TRUE; //undefined matched corresponds to old behavior
|
||||
}
|
||||
|
||||
// osToc = GetStrArraySeparatedByChar(MatchOS, '.');
|
||||
XString8Array osToc = Split<XString8Array>(MatchOS, "."_XS8).trimEachString();
|
||||
XString8Array currOStoc = Split<XString8Array>(CurrOS, "."_XS8).trimEachString();
|
||||
|
||||
if ( osToc.size() > 0 && currOStoc.size() > 0 && osToc[0] == "11"_XS8 && currOStoc[0] == "11"_XS8 ) {
|
||||
if (osToc.size() == 1 ) return true;
|
||||
if (osToc.size() == 2 ) {
|
||||
if ( osToc[1].equalIC("x") ) return true;
|
||||
if ( currOStoc.size() == 2 && osToc[1] == currOStoc[1] ) return true;
|
||||
}
|
||||
}
|
||||
if (osToc.size() == 2) {
|
||||
if (currOStoc.size() == 2) {
|
||||
if ( osToc[0] == currOStoc[0] && osToc[1] == currOStoc[1]) {
|
||||
ret = TRUE;
|
||||
}
|
||||
}
|
||||
} else if (osToc.size() == 3) {
|
||||
if (currOStoc.size() == 3) {
|
||||
if ( osToc[0] == currOStoc[0]
|
||||
&& osToc[1] == currOStoc[1]
|
||||
&& osToc[2] == currOStoc[2]) {
|
||||
ret = TRUE;
|
||||
} else if ( osToc[0] == currOStoc[0]
|
||||
&& osToc[1] == currOStoc[1]
|
||||
&& osToc[2].equalIC("x") ) {
|
||||
ret = TRUE;
|
||||
}
|
||||
} else if (currOStoc.size() == 2) {
|
||||
if ( osToc[0] == currOStoc[0]
|
||||
&& osToc[1] == currOStoc[1] ) {
|
||||
ret = TRUE;
|
||||
} else if ( osToc[0] == currOStoc[0]
|
||||
&& osToc[1] == currOStoc[1]
|
||||
&& osToc[2].equalIC("x") == 0 ) {
|
||||
ret = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
//BOOLEAN IsOSValid(const XString8& MatchOS, const MacOsVersion& CurrOS)
|
||||
//{
|
||||
// /* example for valid matches are:
|
||||
// 10.7, only 10.7 (10.7.1 will be skipped)
|
||||
// 10.10.2 only 10.10.2 (10.10.1 or 10.10.5 will be skipped)
|
||||
// 10.10.x (or 10.10.X), in this case is valid for all minor version of 10.10 (10.10.(0-9))
|
||||
// */
|
||||
//
|
||||
// BOOLEAN ret = FALSE;
|
||||
//
|
||||
// if (MatchOS.isEmpty() || CurrOS.isEmpty()) {
|
||||
// return TRUE; //undefined matched corresponds to old behavior
|
||||
// }
|
||||
//
|
||||
//// osToc = GetStrArraySeparatedByChar(MatchOS, '.');
|
||||
// XString8Array osToc = Split<XString8Array>(MatchOS, "."_XS8).trimEachString();
|
||||
// XString8Array currOStoc = Split<XString8Array>(CurrOS, "."_XS8).trimEachString();
|
||||
//
|
||||
// if ( osToc.size() > 0 && currOStoc.size() > 0 && osToc[0] == "11"_XS8 && currOStoc[0] == "11"_XS8 ) {
|
||||
// if (osToc.size() == 1 ) return true;
|
||||
// if (osToc.size() == 2 ) {
|
||||
// if ( osToc[1].equalIC("x") ) return true;
|
||||
// if ( currOStoc.size() == 2 && osToc[1] == currOStoc[1] ) return true;
|
||||
// }
|
||||
// }
|
||||
// if (osToc.size() == 2) {
|
||||
// if (currOStoc.size() == 2) {
|
||||
// if ( osToc[0] == currOStoc[0] && osToc[1] == currOStoc[1]) {
|
||||
// ret = TRUE;
|
||||
// }
|
||||
// }
|
||||
// } else if (osToc.size() == 3) {
|
||||
// if (currOStoc.size() == 3) {
|
||||
// if ( osToc[0] == currOStoc[0]
|
||||
// && osToc[1] == currOStoc[1]
|
||||
// && osToc[2] == currOStoc[2]) {
|
||||
// ret = TRUE;
|
||||
// } else if ( osToc[0] == currOStoc[0]
|
||||
// && osToc[1] == currOStoc[1]
|
||||
// && osToc[2].equalIC("x") ) {
|
||||
// ret = TRUE;
|
||||
// }
|
||||
// } else if (currOStoc.size() == 2) {
|
||||
// if ( osToc[0] == currOStoc[0]
|
||||
// && osToc[1] == currOStoc[1] ) {
|
||||
// ret = TRUE;
|
||||
// } else if ( osToc[0] == currOStoc[0]
|
||||
// && osToc[1] == currOStoc[1]
|
||||
// && osToc[2].equalIC("x") == 0 ) {
|
||||
// ret = TRUE;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return ret;
|
||||
//}
|
||||
|
||||
UINT8 CheckVolumeType(UINT8 VolumeType, const TagStruct* Prop)
|
||||
{
|
||||
@ -6260,7 +6289,7 @@ static CONST CHAR8 *SearchString(
|
||||
return NULL;
|
||||
}
|
||||
*/
|
||||
XString8 GetOSVersion(IN LOADER_ENTRY *Entry)
|
||||
MacOsVersion GetOSVersion(IN LOADER_ENTRY *Entry)
|
||||
{
|
||||
XString8 OSVersion;
|
||||
EFI_STATUS Status = EFI_NOT_FOUND;
|
||||
@ -6322,17 +6351,27 @@ XString8 GetOSVersion(IN LOADER_ENTRY *Entry)
|
||||
|
||||
// 1st stage - 1
|
||||
// Check for plist - createinstallmedia/BaseSystem/InstallDVD/InstallESD
|
||||
CONST CHAR16 *InstallerPlist = L"\\.IABootFilesSystemVersion.plist"; // 10.9 - 10.13.3
|
||||
if (!FileExists (Entry->Volume->RootDir, InstallerPlist) && FileExists (Entry->Volume->RootDir, L"\\System\\Library\\CoreServices\\boot.efi") &&
|
||||
((FileExists (Entry->Volume->RootDir, L"\\BaseSystem.dmg") && FileExists (Entry->Volume->RootDir, L"\\mach_kernel")) || // 10.7/10.8
|
||||
FileExists (Entry->Volume->RootDir, L"\\System\\Installation\\CDIS\\Mac OS X Installer.app") || // 10.6/10.7
|
||||
FileExists (Entry->Volume->RootDir, L"\\System\\Installation\\CDIS\\OS X Installer.app") || // 10.8 - 10.11
|
||||
FileExists (Entry->Volume->RootDir, L"\\System\\Installation\\CDIS\\macOS Installer.app") || // 10.12+
|
||||
FileExists (Entry->Volume->RootDir, L"\\.IAPhysicalMedia"))) { // 10.13.4+
|
||||
InstallerPlist = L"\\System\\Library\\CoreServices\\SystemVersion.plist";
|
||||
|
||||
XStringW InstallerPlist;
|
||||
|
||||
if ( Entry->APFSTargetUUID.notEmpty() ) {
|
||||
InstallerPlist = SWPrintf("%ls\\System\\Library\\CoreServices\\SystemVersion.plist", Entry->APFSTargetUUID.wc_str());
|
||||
if ( !FileExists(Entry->Volume->RootDir, InstallerPlist) ) InstallerPlist.setEmpty();
|
||||
}
|
||||
|
||||
if ( InstallerPlist.isEmpty() ) {
|
||||
InstallerPlist = SWPrintf("\\.IABootFilesSystemVersion.plist"); // 10.9 - 10.13.3
|
||||
if (!FileExists(Entry->Volume->RootDir, InstallerPlist) && FileExists (Entry->Volume->RootDir, L"\\System\\Library\\CoreServices\\boot.efi") &&
|
||||
((FileExists(Entry->Volume->RootDir, L"\\BaseSystem.dmg") && FileExists (Entry->Volume->RootDir, L"\\mach_kernel")) || // 10.7/10.8
|
||||
FileExists(Entry->Volume->RootDir, L"\\System\\Installation\\CDIS\\Mac OS X Installer.app") || // 10.6/10.7
|
||||
FileExists(Entry->Volume->RootDir, L"\\System\\Installation\\CDIS\\OS X Installer.app") || // 10.8 - 10.11
|
||||
FileExists(Entry->Volume->RootDir, L"\\System\\Installation\\CDIS\\macOS Installer.app") || // 10.12+
|
||||
FileExists(Entry->Volume->RootDir, L"\\.IAPhysicalMedia"))) { // 10.13.4+
|
||||
InstallerPlist = SWPrintf("\\System\\Library\\CoreServices\\SystemVersion.plist");
|
||||
}
|
||||
}
|
||||
if (FileExists (Entry->Volume->RootDir, InstallerPlist)) {
|
||||
Status = egLoadFile(Entry->Volume->RootDir, InstallerPlist, (UINT8 **)&PlistBuffer, &PlistLen);
|
||||
Status = egLoadFile(Entry->Volume->RootDir, InstallerPlist.wc_str(), (UINT8 **)&PlistBuffer, &PlistLen);
|
||||
if (!EFI_ERROR(Status) && PlistBuffer != NULL && ParseXML(PlistBuffer, &Dict, 0) == EFI_SUCCESS) {
|
||||
Prop = Dict->propertyForKey("ProductVersion");
|
||||
if ( Prop != NULL ) {
|
||||
@ -6358,20 +6397,20 @@ XString8 GetOSVersion(IN LOADER_ENTRY *Entry)
|
||||
}
|
||||
}
|
||||
|
||||
if ( OSVersion.isEmpty() )
|
||||
{
|
||||
if ( FileExists(Entry->Volume->RootDir, SWPrintf("\\%ls\\com.apple.installer\\BridgeVersion.plist", Entry->APFSTargetUUID.wc_str()).wc_str()) ) {
|
||||
OSVersion = "11.0"_XS8;
|
||||
// TODO sa far, is there is a BridgeVersion.plist, it's version 11.0. Has to be improved with next releases.
|
||||
}
|
||||
}
|
||||
// if ( OSVersion.isEmpty() )
|
||||
// {
|
||||
// if ( FileExists(Entry->Volume->RootDir, SWPrintf("\\%ls\\com.apple.installer\\BridgeVersion.plist", Entry->APFSTargetUUID.wc_str()).wc_str()) ) {
|
||||
// OSVersion = "11.0"_XS8;
|
||||
// // TODO so far, is there is a BridgeVersion.plist, it's version 11.0. Has to be improved with next releases.
|
||||
// }
|
||||
// }
|
||||
|
||||
// 1st stage - 2
|
||||
// Check for plist - createinstallmedia/NetInstall
|
||||
if (OSVersion.isEmpty()) {
|
||||
InstallerPlist = L"\\.IABootFiles\\com.apple.Boot.plist"; // 10.9 - ...
|
||||
InstallerPlist = SWPrintf("\\.IABootFiles\\com.apple.Boot.plist"); // 10.9 - ...
|
||||
if (FileExists (Entry->Volume->RootDir, InstallerPlist)) {
|
||||
Status = egLoadFile(Entry->Volume->RootDir, InstallerPlist, (UINT8 **)&PlistBuffer, &PlistLen);
|
||||
Status = egLoadFile(Entry->Volume->RootDir, InstallerPlist.wc_str(), (UINT8 **)&PlistBuffer, &PlistLen);
|
||||
if (!EFI_ERROR(Status) && PlistBuffer != NULL && ParseXML(PlistBuffer, &Dict, 0) == EFI_SUCCESS) {
|
||||
Prop = Dict->propertyForKey("Kernel Flags");
|
||||
if ( Prop != NULL ) {
|
||||
@ -6410,27 +6449,27 @@ XString8 GetOSVersion(IN LOADER_ENTRY *Entry)
|
||||
// 2nd stage - 1
|
||||
// Check for plist - AppStore/createinstallmedia/startosinstall/Fusion Drive
|
||||
if (OSVersion.isEmpty()) {
|
||||
InstallerPlist = L"\\macOS Install Data\\Locked Files\\Boot Files\\SystemVersion.plist"; // 10.12.4+
|
||||
InstallerPlist = SWPrintf("\\macOS Install Data\\Locked Files\\Boot Files\\SystemVersion.plist"); // 10.12.4+
|
||||
if (!FileExists (Entry->Volume->RootDir, InstallerPlist)) {
|
||||
InstallerPlist = L"\\macOS Install Data\\InstallInfo.plist"; // 10.12+
|
||||
InstallerPlist = SWPrintf("\\macOS Install Data\\InstallInfo.plist"); // 10.12+
|
||||
if (!FileExists (Entry->Volume->RootDir, InstallerPlist)) {
|
||||
InstallerPlist = L"\\com.apple.boot.R\\SystemVersion.plist"; // 10.12+
|
||||
InstallerPlist = SWPrintf("\\com.apple.boot.R\\SystemVersion.plist)"); // 10.12+
|
||||
if (!FileExists (Entry->Volume->RootDir, InstallerPlist)) {
|
||||
InstallerPlist = L"\\com.apple.boot.P\\SystemVersion.plist"; // 10.12+
|
||||
InstallerPlist = SWPrintf("\\com.apple.boot.P\\SystemVersion.plist"); // 10.12+
|
||||
if (!FileExists (Entry->Volume->RootDir, InstallerPlist)) {
|
||||
InstallerPlist = L"\\com.apple.boot.S\\SystemVersion.plist"; // 10.12+
|
||||
InstallerPlist = SWPrintf("\\com.apple.boot.S\\SystemVersion.plist"); // 10.12+
|
||||
if (!FileExists (Entry->Volume->RootDir, InstallerPlist) &&
|
||||
(FileExists (Entry->Volume->RootDir, L"\\com.apple.boot.R\\System\\Library\\PrelinkedKernels\\prelinkedkernel") ||
|
||||
FileExists (Entry->Volume->RootDir, L"\\com.apple.boot.P\\System\\Library\\PrelinkedKernels\\prelinkedkernel") ||
|
||||
FileExists (Entry->Volume->RootDir, L"\\com.apple.boot.S\\System\\Library\\PrelinkedKernels\\prelinkedkernel"))) {
|
||||
InstallerPlist = L"\\System\\Library\\CoreServices\\SystemVersion.plist"; // 10.11
|
||||
InstallerPlist = SWPrintf("\\System\\Library\\CoreServices\\SystemVersion.plist"); // 10.11
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (FileExists (Entry->Volume->RootDir, InstallerPlist)) {
|
||||
Status = egLoadFile(Entry->Volume->RootDir, InstallerPlist, (UINT8 **)&PlistBuffer, &PlistLen);
|
||||
Status = egLoadFile(Entry->Volume->RootDir, InstallerPlist.wc_str(), (UINT8 **)&PlistBuffer, &PlistLen);
|
||||
if (!EFI_ERROR(Status) && PlistBuffer != NULL && ParseXML(PlistBuffer, &Dict, 0) == EFI_SUCCESS) {
|
||||
Prop = Dict->propertyForKey("ProductVersion");
|
||||
if ( Prop != NULL ) {
|
||||
@ -6624,51 +6663,56 @@ XString8 GetOSVersion(IN LOADER_ENTRY *Entry)
|
||||
|
||||
//constexpr XStringW iconMac = L"mac"_XSW;
|
||||
CONST XStringW
|
||||
GetOSIconName (const XString8& OSVersion)
|
||||
GetOSIconName (const MacOsVersion& OSVersion)
|
||||
{
|
||||
XStringW OSIconName;
|
||||
if (OSVersion.isEmpty()) {
|
||||
OSIconName = L"mac"_XSW;
|
||||
} else if (OSVersion.contains("10.16") ||
|
||||
(OSVersion.contains("11.0") != 0)) {
|
||||
} else if ( (OSVersion.elementAt(0) == 10 && OSVersion.elementAt(1) == 16 ) ||
|
||||
(OSVersion.elementAt(0) == 11 && OSVersion.elementAt(1) == 0 )
|
||||
) {
|
||||
// Big Sur
|
||||
OSIconName = L"bigsur,mac"_XSW;
|
||||
} else if (OSVersion.contains("10.15") != 0) {
|
||||
// Catalina
|
||||
OSIconName = L"cata,mac"_XSW;
|
||||
} else if (OSVersion.contains("10.14") != 0) {
|
||||
// Mojave
|
||||
OSIconName = L"moja,mac"_XSW;
|
||||
} else if (OSVersion.contains("10.13") != 0) {
|
||||
// High Sierra
|
||||
OSIconName = L"hsierra,mac"_XSW;
|
||||
} else if (OSVersion.contains("10.12") != 0) {
|
||||
// Sierra
|
||||
OSIconName = L"sierra,mac"_XSW;
|
||||
} else if (OSVersion.contains("10.11") != 0) {
|
||||
// El Capitan
|
||||
OSIconName = L"cap,mac"_XSW;
|
||||
} else if (OSVersion.contains("10.10") != 0) {
|
||||
// Yosemite
|
||||
OSIconName = L"yos,mac"_XSW;
|
||||
} else if (OSVersion.contains("10.9") != 0) {
|
||||
// Mavericks
|
||||
OSIconName = L"mav,mac"_XSW;
|
||||
} else if (OSVersion.contains("10.8") != 0) {
|
||||
// Mountain Lion
|
||||
OSIconName = L"cougar,mac"_XSW;
|
||||
} else if (OSVersion.contains("10.7") != 0) {
|
||||
// Lion
|
||||
OSIconName = L"lion,mac"_XSW;
|
||||
} else if (OSVersion.contains("10.6") != 0) {
|
||||
// Snow Leopard
|
||||
OSIconName = L"snow,mac"_XSW;
|
||||
} else if (OSVersion.contains("10.5") != 0) {
|
||||
// Leopard
|
||||
OSIconName = L"leo,mac"_XSW;
|
||||
} else if (OSVersion.contains("10.4") != 0) {
|
||||
// Tiger
|
||||
OSIconName = L"tiger,mac"_XSW;
|
||||
}else if ( OSVersion.elementAt(0) == 10 ) {
|
||||
if ( OSVersion.elementAt(1) == 15 ) {
|
||||
// Catalina
|
||||
OSIconName = L"cata,mac"_XSW;
|
||||
} else if ( OSVersion.elementAt(1) == 14 ) {
|
||||
// Mojave
|
||||
OSIconName = L"moja,mac"_XSW;
|
||||
} else if ( OSVersion.elementAt(1) == 13 ) {
|
||||
// High Sierra
|
||||
OSIconName = L"hsierra,mac"_XSW;
|
||||
} else if ( OSVersion.elementAt(1) == 12 ) {
|
||||
// Sierra
|
||||
OSIconName = L"sierra,mac"_XSW;
|
||||
} else if ( OSVersion.elementAt(1) == 11 ) {
|
||||
// El Capitan
|
||||
OSIconName = L"cap,mac"_XSW;
|
||||
} else if ( OSVersion.elementAt(1) == 10 ) {
|
||||
// Yosemite
|
||||
OSIconName = L"yos,mac"_XSW;
|
||||
} else if ( OSVersion.elementAt(1) == 9 ) {
|
||||
// Mavericks
|
||||
OSIconName = L"mav,mac"_XSW;
|
||||
} else if ( OSVersion.elementAt(1) == 8 ) {
|
||||
// Mountain Lion
|
||||
OSIconName = L"cougar,mac"_XSW;
|
||||
} else if ( OSVersion.elementAt(1) == 7 ) {
|
||||
// Lion
|
||||
OSIconName = L"lion,mac"_XSW;
|
||||
} else if ( OSVersion.elementAt(1) == 6 ) {
|
||||
// Snow Leopard
|
||||
OSIconName = L"snow,mac"_XSW;
|
||||
} else if ( OSVersion.elementAt(1) == 5 ) {
|
||||
// Leopard
|
||||
OSIconName = L"leo,mac"_XSW;
|
||||
} else if ( OSVersion.elementAt(1) == 4 ) {
|
||||
// Tiger
|
||||
OSIconName = L"tiger,mac"_XSW;
|
||||
} else {
|
||||
OSIconName = L"mac"_XSW;
|
||||
}
|
||||
} else {
|
||||
OSIconName = L"mac"_XSW;
|
||||
}
|
||||
@ -8139,25 +8183,25 @@ XStringW GetOtherKextsDir (BOOLEAN On)
|
||||
|
||||
//dmazar
|
||||
// Jief 2020-10: this is only called by SetFSInjection(). SetFSInjection() doesn't check for return value emptiness.
|
||||
XStringW GetOSVersionKextsDir(const XString8& OSVersion)
|
||||
XStringW GetOSVersionKextsDir(const MacOsVersion& OSVersion)
|
||||
{
|
||||
XString8 FixedVersion;
|
||||
CHAR8 *DotPtr;
|
||||
// XString8 FixedVersion;
|
||||
// CHAR8 *DotPtr;
|
||||
|
||||
if ( !selfOem.isKextsDirFound() ) return NullXStringW;
|
||||
|
||||
if (OSVersion.notEmpty()) {
|
||||
FixedVersion.strncpy(OSVersion.c_str(), 5);
|
||||
// DBG("%s\n", FixedVersion);
|
||||
// OSVersion may contain minor version too (can be 10.x or 10.x.y)
|
||||
if ((DotPtr = AsciiStrStr (FixedVersion.c_str(), ".")) != NULL) {
|
||||
DotPtr = AsciiStrStr (DotPtr+1, "."); // second dot
|
||||
}
|
||||
|
||||
if (DotPtr != NULL) {
|
||||
*DotPtr = 0;
|
||||
}
|
||||
}
|
||||
// if (OSVersion.notEmpty()) {
|
||||
// FixedVersion.strncpy(OSVersion.c_str(), 5);
|
||||
// // DBG("%s\n", FixedVersion);
|
||||
// // OSVersion may contain minor version too (can be 10.x or 10.x.y)
|
||||
// if ((DotPtr = AsciiStrStr (FixedVersion.c_str(), ".")) != NULL) {
|
||||
// DotPtr = AsciiStrStr (DotPtr+1, "."); // second dot
|
||||
// }
|
||||
//
|
||||
// if (DotPtr != NULL) {
|
||||
// *DotPtr = 0;
|
||||
// }
|
||||
// }
|
||||
|
||||
//MsgLog ("OS=%ls\n", OSTypeStr);
|
||||
|
||||
@ -8165,7 +8209,7 @@ XStringW GetOSVersionKextsDir(const XString8& OSVersion)
|
||||
// note: we are just checking for existance of particular folder, not checking if it is empty or not
|
||||
// check OEM subfolders: version specific or default to Other
|
||||
// Jief : NOTE selfOem.getKextsFullPath() return a path under OEM if exists, or in Clover if not.
|
||||
XStringW SrcDir = SWPrintf("%ls\\%s", selfOem.getKextsFullPath().wc_str(), FixedVersion.c_str());
|
||||
XStringW SrcDir = SWPrintf("%ls\\%s", selfOem.getKextsFullPath().wc_str(), OSVersion.asString(2).c_str());
|
||||
if (FileExists (&self.getSelfVolumeRootDir(), SrcDir)) return SrcDir;
|
||||
return NullXStringW;
|
||||
}
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include "../gui/menu_items/menu_items.h"
|
||||
#include "../Platform/plist/plist.h"
|
||||
#include "MacOsVersion.h"
|
||||
|
||||
//// SysVariables
|
||||
//typedef struct SYSVARIABLES SYSVARIABLES;
|
||||
@ -910,7 +911,7 @@ void
|
||||
SetBootCurrent(REFIT_MENU_ITEM_BOOTNUM *LoadedEntry);
|
||||
|
||||
|
||||
XString8
|
||||
MacOsVersion
|
||||
GetOSVersion (
|
||||
IN LOADER_ENTRY *Entry
|
||||
);
|
||||
@ -936,7 +937,7 @@ GetDevices(void);
|
||||
|
||||
CONST XStringW
|
||||
GetOSIconName (
|
||||
const XString8& OSVersion
|
||||
const MacOsVersion& OSVersion
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
@ -961,10 +962,7 @@ InitTheme (
|
||||
XStringW
|
||||
GetOtherKextsDir (BOOLEAN On);
|
||||
|
||||
XStringW
|
||||
GetOSVersionKextsDir (
|
||||
CHAR8 *OSVersion
|
||||
);
|
||||
XStringW GetOSVersionKextsDir(const MacOsVersion& OSVersion);
|
||||
|
||||
EFI_STATUS
|
||||
InjectKextsFromDir (
|
||||
@ -984,12 +982,13 @@ SaveSettings (void);
|
||||
|
||||
|
||||
/** Returns a boolean and then enable disable the patch if MachOSEntry have a match for the booted OS. */
|
||||
BOOLEAN IsPatchEnabled(const XString8& MatchOSEntry, const XString8& CurrOS);
|
||||
BOOLEAN IsPatchEnabledByBuildNumber(const XString8& MatchOSEntry, const XString8& Build);
|
||||
BOOLEAN IsPatchEnabled(const XString8& MatchOSEntry, const MacOsVersion& CurrOS);
|
||||
|
||||
/** return true if a given os contains '.' as separator,
|
||||
and then match components of the current booted OS. Also allow 10.10.x format meaning all revisions
|
||||
of the 10.10 OS */
|
||||
BOOLEAN IsOSValid(const XString8& MatchOS, const XString8& CurrOS);
|
||||
//BOOLEAN IsOSValid(const XString8& MatchOS, const MacOsVersion& CurrOS);
|
||||
|
||||
|
||||
//get default boot
|
||||
|
@ -16,18 +16,6 @@
|
||||
#ifndef _UTILS_H_
|
||||
#define _UTILS_H_
|
||||
|
||||
#include "../cpp_foundation/XString.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <Library/BaseLib.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
//Unicode
|
||||
#define IS_COMMA(a) ((a) == L',')
|
||||
@ -50,34 +38,26 @@ extern "C" {
|
||||
UINT32 hex2bin(IN const CHAR8 *hex, OUT UINT8 *bin, UINT32 len);
|
||||
BOOLEAN IsHexDigit (CHAR8 c);
|
||||
UINT8 hexstrtouint8 (CONST CHAR8* buf); //one or two hex letters to one byte
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "../cpp_foundation/XString.h"
|
||||
|
||||
|
||||
XString8 Bytes2HexStr(UINT8 *data, UINTN len);
|
||||
|
||||
inline
|
||||
UINT64
|
||||
EFIAPI
|
||||
AsciiStrHexToUint64 (
|
||||
const XString8& String
|
||||
)
|
||||
inline UINT64 EFIAPI AsciiStrHexToUint64(const XString8& String)
|
||||
{
|
||||
return AsciiStrHexToUint64(String.c_str());
|
||||
}
|
||||
|
||||
inline
|
||||
UINTN
|
||||
EFIAPI
|
||||
AsciiStrHexToUintn (
|
||||
const XString8& String
|
||||
)
|
||||
inline UINTN EFIAPI AsciiStrHexToUintn(const XString8& String)
|
||||
{
|
||||
return AsciiStrHexToUintn(String.c_str());
|
||||
}
|
||||
|
||||
inline
|
||||
UINTN
|
||||
EFIAPI
|
||||
AsciiStrDecimalToUintn (
|
||||
const XString8& String
|
||||
)
|
||||
inline UINTN EFIAPI AsciiStrDecimalToUintn(const XString8& String)
|
||||
{
|
||||
return AsciiStrDecimalToUintn(String.c_str());
|
||||
}
|
||||
@ -88,10 +68,6 @@ extern BOOLEAN haveError;
|
||||
BOOLEAN CheckFatalError(IN EFI_STATUS Status, IN CONST CHAR16 *where);
|
||||
BOOLEAN CheckError(IN EFI_STATUS Status, IN CONST CHAR16 *where);
|
||||
|
||||
//EFI_DEVICE_PATH_PROTOCOL *
|
||||
//EFIAPI
|
||||
//NextDevicePathNode (
|
||||
// IN void *Node
|
||||
// );
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif
|
||||
#endif // _UTILS_H_
|
||||
|
@ -1549,13 +1549,13 @@ void free_val(value_t *val )
|
||||
value_t default_val;
|
||||
} AtiDevProp;
|
||||
*/
|
||||
void devprop_add_list(AtiDevProp devprop_list[], const XString8& OSVersion)
|
||||
void devprop_add_list(AtiDevProp devprop_list[], const MacOsVersion& OSVersion)
|
||||
{
|
||||
INTN i, pnum;
|
||||
BOOLEAN Sier;
|
||||
value_t *val = (__typeof__(val))AllocateZeroPool(sizeof(value_t));
|
||||
|
||||
Sier = (AsciiOSVersionToUint64(OSVersion) >= AsciiOSVersionToUint64("10.12"_XS8));
|
||||
Sier = ( OSVersion.isEmpty() || OSVersion >= MacOsVersion("10.12"_XS8));
|
||||
|
||||
for (i = 0; devprop_list[i].name != NULL; i++) {
|
||||
if ((devprop_list[i].flags & card->flags) != 0) {
|
||||
|
@ -967,7 +967,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
|
||||
UINT8 BuiltIn = 0x00;
|
||||
UINT32 FakeID;
|
||||
UINT32 DualLink = 1;
|
||||
UINT64 os_version = AsciiOSVersionToUint64(Entry->OSVersion);
|
||||
// UINT64 os_version = AsciiOSVersionToUint64(Entry->OSVersion);
|
||||
BOOLEAN SetUGAWidth = FALSE;
|
||||
BOOLEAN SetUGAHeight = FALSE;
|
||||
BOOLEAN Injected = FALSE;
|
||||
@ -2592,8 +2592,8 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
|
||||
break;
|
||||
}
|
||||
|
||||
// if wakes up with an HDMI connected, somtimes this value causes force reboot in 10.14+
|
||||
if (os_version < AsciiOSVersionToUint64("10.14"_XS8)) {
|
||||
// if wakes up with an HDMI connected, sometimes this value causes force reboot in 10.14+
|
||||
if ( Entry->OSVersion.notEmpty() && Entry->OSVersion < MacOsVersion("10.14"_XS8) ) {
|
||||
devprop_add_value(device, "AAPL,GfxYTile", skylake_hd_vals[1], 4);
|
||||
}
|
||||
break;
|
||||
@ -2645,7 +2645,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
|
||||
switch (gma_dev->device_id) {
|
||||
case 0x5902:
|
||||
case 0x5906:
|
||||
if (os_version < AsciiOSVersionToUint64("10.12.6"_XS8)) {
|
||||
if ( Entry->OSVersion.notEmpty() && Entry->OSVersion < MacOsVersion("10.12.6"_XS8) ) {
|
||||
if (!SetFake) {
|
||||
FakeID = 0x19028086 >> 16;
|
||||
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
|
||||
@ -2672,7 +2672,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
|
||||
}
|
||||
break;
|
||||
case 0x5912:
|
||||
if (os_version < AsciiOSVersionToUint64("10.12.6"_XS8)) {
|
||||
if ( Entry->OSVersion.notEmpty() && Entry->OSVersion < MacOsVersion("10.12.6"_XS8)) {
|
||||
if (!SetFake) {
|
||||
FakeID = 0x19128086 >> 16;
|
||||
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
|
||||
@ -2700,7 +2700,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
|
||||
break;
|
||||
case 0x5916:
|
||||
case 0x5917:
|
||||
if (os_version < AsciiOSVersionToUint64("10.12.6"_XS8)) {
|
||||
if ( Entry->OSVersion.notEmpty() && Entry->OSVersion < MacOsVersion("10.12.6"_XS8)) {
|
||||
if (!SetFake) {
|
||||
FakeID = 0x19168086 >> 16;
|
||||
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
|
||||
@ -2729,7 +2729,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
|
||||
case 0x591A:
|
||||
case 0x591B:
|
||||
case 0x591D:
|
||||
if (os_version < AsciiOSVersionToUint64("10.12.6"_XS8)) {
|
||||
if ( Entry->OSVersion.notEmpty() && Entry->OSVersion < MacOsVersion("10.12.6"_XS8)) {
|
||||
if (!SetFake) {
|
||||
FakeID = 0x191B8086 >> 16;
|
||||
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
|
||||
@ -2757,7 +2757,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
|
||||
break;
|
||||
case 0x591C:
|
||||
case 0x591E:
|
||||
if (os_version < AsciiOSVersionToUint64("10.12.6"_XS8)) {
|
||||
if ( Entry->OSVersion.notEmpty() && Entry->OSVersion < MacOsVersion("10.12.6"_XS8)) {
|
||||
if (!SetFake) {
|
||||
FakeID = 0x191E8086 >> 16;
|
||||
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
|
||||
@ -2784,7 +2784,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
|
||||
}
|
||||
break;
|
||||
case 0x5923:
|
||||
if (os_version < AsciiOSVersionToUint64("10.12.6"_XS8)) {
|
||||
if ( Entry->OSVersion.notEmpty() && Entry->OSVersion < MacOsVersion("10.12.6"_XS8)) {
|
||||
if (!SetFake) {
|
||||
FakeID = 0x19168086 >> 16;
|
||||
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
|
||||
@ -2811,7 +2811,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
|
||||
}
|
||||
break;
|
||||
case 0x5926:
|
||||
if (os_version < AsciiOSVersionToUint64("10.12.6"_XS8)) {
|
||||
if ( Entry->OSVersion.notEmpty() && Entry->OSVersion < MacOsVersion("10.12.6"_XS8)) {
|
||||
if (!SetFake) {
|
||||
FakeID = 0x19268086 >> 16;
|
||||
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
|
||||
@ -2838,7 +2838,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
|
||||
}
|
||||
break;
|
||||
case 0x5927:
|
||||
if (os_version < AsciiOSVersionToUint64("10.12.6"_XS8)) {
|
||||
if ( Entry->OSVersion.notEmpty() && Entry->OSVersion < MacOsVersion("10.12.6"_XS8)) {
|
||||
if (!SetFake) {
|
||||
FakeID = 0x19278086 >> 16;
|
||||
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
|
||||
@ -2866,7 +2866,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
|
||||
break;
|
||||
case 0x87C0:
|
||||
case 0x87CA:
|
||||
if (os_version < AsciiOSVersionToUint64("10.12.6"_XS8)) {
|
||||
if ( Entry->OSVersion.notEmpty() && Entry->OSVersion < MacOsVersion("10.12.6"_XS8)) {
|
||||
if (!SetFake) {
|
||||
FakeID = 0x191E8086 >> 16;
|
||||
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
|
||||
@ -2878,7 +2878,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
|
||||
devprop_add_value(device, "AAPL,ig-platform-id", skylake_ig_vals[8], 4);
|
||||
DBG(" Found ig-platform-id = 0x191E0000\n");
|
||||
}
|
||||
} else if (os_version < AsciiOSVersionToUint64("10.14"_XS8)) {
|
||||
} else if ( Entry->OSVersion.notEmpty() && Entry->OSVersion < MacOsVersion("10.14"_XS8)) {
|
||||
if (!SetFake) {
|
||||
FakeID = 0x591E8086 >> 16;
|
||||
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
|
||||
@ -2949,7 +2949,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
|
||||
}
|
||||
|
||||
// if wakes up with an HDMI connected, somtimes this value causes force reboot in 10.14+
|
||||
if (os_version < AsciiOSVersionToUint64("10.14"_XS8)) {
|
||||
if ( Entry->OSVersion.notEmpty() && Entry->OSVersion < MacOsVersion("10.14"_XS8)) {
|
||||
devprop_add_value(device, "AAPL,GfxYTile", kabylake_hd_vals[1], 4);
|
||||
}
|
||||
break;
|
||||
@ -3008,7 +3008,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
|
||||
switch (gma_dev->device_id) {
|
||||
case 0x3E90:
|
||||
case 0x3E93:
|
||||
if ((os_version >= AsciiOSVersionToUint64("10.14"_XS8)) || ((os_version == AsciiOSVersionToUint64("10.13.6"_XS8)) &&
|
||||
if (( Entry->OSVersion >= MacOsVersion("10.14"_XS8)) || (( Entry->OSVersion == MacOsVersion("10.13.6"_XS8)) &&
|
||||
(Entry->BuildVersion.contains("17G2") || FileExists(Entry->Volume->RootDir, CFLFBPath)))) {
|
||||
if (!SetFake) {
|
||||
FakeID = 0x3E908086 >> 16;
|
||||
@ -3036,7 +3036,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
|
||||
}
|
||||
break;
|
||||
case 0x3E91:
|
||||
if ((os_version >= AsciiOSVersionToUint64("10.14"_XS8)) || ((os_version == AsciiOSVersionToUint64("10.13.6"_XS8)) &&
|
||||
if (( Entry->OSVersion >= MacOsVersion("10.14"_XS8)) || (( Entry->OSVersion == MacOsVersion("10.13.6"_XS8)) &&
|
||||
(Entry->BuildVersion.contains("17G2") || FileExists(Entry->Volume->RootDir, CFLFBPath)))) {
|
||||
if (!SetFake) {
|
||||
FakeID = 0x3E918086 >> 16;
|
||||
@ -3065,7 +3065,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
|
||||
break;
|
||||
case 0x3E92:
|
||||
case 0x3E98:
|
||||
if ((os_version >= AsciiOSVersionToUint64("10.14"_XS8)) || ((os_version == AsciiOSVersionToUint64("10.13.6"_XS8)) &&
|
||||
if (( Entry->OSVersion >= MacOsVersion("10.14"_XS8)) || (( Entry->OSVersion == MacOsVersion("10.13.6"_XS8)) &&
|
||||
(Entry->BuildVersion.contains("17G2") || FileExists(Entry->Volume->RootDir, CFLFBPath)))) {
|
||||
if (!SetFake) {
|
||||
FakeID = 0x3E928086 >> 16;
|
||||
@ -3096,7 +3096,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
|
||||
case 0x3EA0:
|
||||
case 0x9B41:
|
||||
case 0x9BCA:
|
||||
if ((os_version >= AsciiOSVersionToUint64("10.14"_XS8)) || ((os_version == AsciiOSVersionToUint64("10.13.6"_XS8)) &&
|
||||
if (( Entry->OSVersion >= MacOsVersion("10.14"_XS8)) || (( Entry->OSVersion == MacOsVersion("10.13.6"_XS8)) &&
|
||||
(Entry->BuildVersion.contains("17G2") || FileExists(Entry->Volume->RootDir, CFLFBPath)))) {
|
||||
if (!SetFake) {
|
||||
FakeID = 0x3E9B8086 >> 16;
|
||||
@ -3124,7 +3124,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
|
||||
}
|
||||
break;
|
||||
case 0x3EA5:
|
||||
if ((os_version >= AsciiOSVersionToUint64("10.14"_XS8)) || ((os_version == AsciiOSVersionToUint64("10.13.6"_XS8)) &&
|
||||
if (( Entry->OSVersion >= MacOsVersion("10.14"_XS8)) || (( Entry->OSVersion == MacOsVersion("10.13.6"_XS8)) &&
|
||||
(Entry->BuildVersion.contains("17G2") || FileExists(Entry->Volume->RootDir, CFLFBPath)))) {
|
||||
if (!SetFake) {
|
||||
FakeID = 0x3EA58086 >> 16;
|
||||
@ -3190,7 +3190,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
|
||||
}
|
||||
|
||||
// if wakes up with an HDMI connected, somtimes this value causes force reboot in 10.14+
|
||||
if (os_version < AsciiOSVersionToUint64("10.14"_XS8)) {
|
||||
if ( Entry->OSVersion.notEmpty() && Entry->OSVersion < MacOsVersion("10.14"_XS8)) {
|
||||
devprop_add_value(device, "AAPL,GfxYTile", coffeelake_hd_vals[1], 4);
|
||||
}
|
||||
break;
|
||||
@ -3355,7 +3355,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
|
||||
}*/
|
||||
|
||||
// if wakes up with an HDMI connected, somtimes this value causes force reboot in 10.14+
|
||||
if (os_version < AsciiOSVersionToUint64("10.14"_XS8)) {
|
||||
if ( Entry->OSVersion.notEmpty() && Entry->OSVersion < MacOsVersion("10.14"_XS8)) {
|
||||
devprop_add_value(device, "AAPL,GfxYTile", cannonlake_hd_vals[1], 4);
|
||||
}
|
||||
break;
|
||||
|
@ -151,7 +151,7 @@ BOOLEAN EFIAPI IsHDMIAudio(EFI_HANDLE PciDevHandle)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOLEAN setup_hda_devprop(EFI_PCI_IO_PROTOCOL *PciIo, pci_dt_t *hda_dev, const XString8& OSVersion)
|
||||
BOOLEAN setup_hda_devprop(EFI_PCI_IO_PROTOCOL *PciIo, pci_dt_t *hda_dev, const MacOsVersion& OSVersion)
|
||||
{
|
||||
DevPropDevice *device = NULL;
|
||||
UINT32 layoutId = 0;
|
||||
@ -243,7 +243,7 @@ BOOLEAN setup_hda_devprop(EFI_PCI_IO_PROTOCOL *PciIo, pci_dt_t *hda_dev, const X
|
||||
}
|
||||
}
|
||||
if (!Injected) {
|
||||
if ((OSVersion.notEmpty() && AsciiOSVersionToUint64(OSVersion) < AsciiOSVersionToUint64("10.8"_XS8)) || (gSettings.HDALayoutId > 0)) {
|
||||
if ( (OSVersion.notEmpty() && OSVersion < MacOsVersion("10.8"_XS8)) || gSettings.HDALayoutId > 0 ) {
|
||||
devprop_add_value(device, "layout-id", (UINT8 *)&layoutId, 4);
|
||||
}
|
||||
layoutId = 0; // reuse variable
|
||||
|
@ -327,7 +327,7 @@ BOOLEAN
|
||||
setup_hda_devprop (
|
||||
EFI_PCI_IO_PROTOCOL *PciIo,
|
||||
pci_dt_t *hda_dev,
|
||||
const XString8& OSVersion
|
||||
const MacOsVersion& OSVersion
|
||||
);
|
||||
|
||||
BOOLEAN EFIAPI IsHDMIAudio(EFI_HANDLE PciDevHandle);
|
||||
|
@ -403,7 +403,7 @@ void LOADER_ENTRY::KernelPatcher_64()
|
||||
UINT32 switchaddr=0;
|
||||
UINT32 mask_family=0, mask_model=0;
|
||||
UINT32 cpuid_family_addr=0, cpuid_model_addr=0;
|
||||
UINT64 os_version;
|
||||
// UINT64 os_version;
|
||||
|
||||
// DBG_RT( "Looking for _cpuid_set_info _panic ...\n");
|
||||
|
||||
@ -423,15 +423,15 @@ void LOADER_ENTRY::KernelPatcher_64()
|
||||
return;
|
||||
}
|
||||
|
||||
os_version = AsciiOSVersionToUint64(OSVersion);
|
||||
// os_version = AsciiOSVersionToUint64(OSVersion);
|
||||
|
||||
// make sure only kernels for OSX 10.6.0 to 10.7.3 are being patched by this approach
|
||||
if (os_version >= AsciiOSVersionToUint64("10.6") && os_version <= AsciiOSVersionToUint64("10.7.3")) {
|
||||
if (OSVersion >= AsciiOSVersionToUint64("10.6") && OSVersion <= AsciiOSVersionToUint64("10.7.3")) {
|
||||
|
||||
// DBG_RT( "will patch kernel for macOS 10.6.0 to 10.7.3\n");
|
||||
|
||||
// remove tsc_init: unknown CPU family panic for kernels prior to 10.6.2 which still had Atom support
|
||||
if (os_version < AsciiOSVersionToUint64("10.6.2")) {
|
||||
if (OSVersion < AsciiOSVersionToUint64("10.6.2")) {
|
||||
for (i=0; i<0x1000000; i++) {
|
||||
// find _tsc_init panic address by byte sequence 488d3df4632a00
|
||||
if (bytes[i] == 0x48 && bytes[i+1] == 0x8D && bytes[i+2] == 0x3D && bytes[i+3] == 0xF4 &&
|
||||
@ -476,11 +476,11 @@ void LOADER_ENTRY::KernelPatcher_64()
|
||||
|
||||
// Determine cpuid_model address
|
||||
// for 10.6.2 kernels it's offset by 299 bytes from cpuid_family address
|
||||
if (os_version == AsciiOSVersionToUint64("10.6.2")) {
|
||||
if (OSVersion == AsciiOSVersionToUint64("10.6.2")) {
|
||||
cpuid_model_addr = cpuid_family_addr - 0X12B;
|
||||
}
|
||||
// for 10.6.3 to 10.6.7 it's offset by 303 bytes
|
||||
else if (os_version <= AsciiOSVersionToUint64("10.6.7")) {
|
||||
else if (OSVersion <= AsciiOSVersionToUint64("10.6.7")) {
|
||||
cpuid_model_addr = cpuid_family_addr - 0X12F;
|
||||
}
|
||||
// for 10.6.8 to 10.7.3 kernels - by 339 bytes
|
||||
@ -538,7 +538,7 @@ void LOADER_ENTRY::KernelPatcher_64()
|
||||
|
||||
// all 10.7.4+ kernels share common CPUID switch statement logic,
|
||||
// it needs to be exploited in diff manner due to the lack of space
|
||||
else if (os_version >= AsciiOSVersionToUint64("10.7.4")) {
|
||||
else if (OSVersion >= AsciiOSVersionToUint64("10.7.4")) {
|
||||
|
||||
DBG_RT( "will patch kernel for macOS 10.7.4+\n");
|
||||
|
||||
@ -1063,7 +1063,7 @@ BOOLEAN LOADER_ENTRY::KernelLapicPatch_64()
|
||||
// address: 002e4a2f
|
||||
// bytes:658b04251c0000003b058bb97b00
|
||||
// call _panic -> change to nop {90,90,90,90,90}
|
||||
if (AsciiOSVersionToUint64(OSVersion) >= AsciiOSVersionToUint64("10.10"_XS8)) {
|
||||
if ( OSVersion >= MacOsVersion("10.10"_XS8) ) {
|
||||
UINTN procAddr = searchProc("lapic_interrupt"_XS8);
|
||||
patchLocation1 = searchProc("_panic"_XS8);
|
||||
patchLocation2 = FindRelative32(KernelData, procAddr, 0x140, patchLocation1);
|
||||
@ -1277,9 +1277,9 @@ void LOADER_ENTRY::applyKernPatch(const UINT8 *find, UINTN size, const UINT8 *re
|
||||
// Global XCPM patches compatibility
|
||||
// Currently 10.8.5 - 10.15
|
||||
//
|
||||
static inline BOOLEAN IsXCPMOSVersionCompat(UINT64 os_version)
|
||||
static inline BOOLEAN IsXCPMOSVersionCompat(const MacOsVersion& OSVersion)
|
||||
{
|
||||
return (os_version >= AsciiOSVersionToUint64("10.8.5"_XS8)) && (os_version < AsciiOSVersionToUint64("11.1.0"_XS8));
|
||||
return OSVersion >= MacOsVersion("10.8.5"_XS8) && OSVersion < MacOsVersion("11.1.0"_XS8);
|
||||
}
|
||||
|
||||
//
|
||||
@ -1304,10 +1304,10 @@ BOOLEAN LOADER_ENTRY::HaswellEXCPM()
|
||||
XString8 comment;
|
||||
// UINT32 i;
|
||||
UINTN patchLocation;
|
||||
UINT64 os_version = AsciiOSVersionToUint64(OSVersion);
|
||||
// UINT64 os_version = AsciiOSVersionToUint64(OSVersion);
|
||||
|
||||
// check OS version suit for patches
|
||||
if (!IsXCPMOSVersionCompat(os_version)) {
|
||||
if (!IsXCPMOSVersionCompat(OSVersion)) {
|
||||
DBG("HaswellEXCPM(): Unsupported macOS.\n");
|
||||
DBG("HaswellEXCPM() <===FALSE\n");
|
||||
return FALSE;
|
||||
@ -1315,17 +1315,17 @@ BOOLEAN LOADER_ENTRY::HaswellEXCPM()
|
||||
|
||||
// _cpuid_set_info
|
||||
comment = "_cpuid_set_info"_XS8;
|
||||
if (os_version <= AsciiOSVersionToUint64("10.8.5"_XS8)) {
|
||||
if (OSVersion.notEmpty() && OSVersion <= MacOsVersion("10.8.5"_XS8)) {
|
||||
// 10.8.5
|
||||
const UINT8 find[] = { 0x83, 0xF8, 0x3C, 0x74, 0x2D };
|
||||
const UINT8 repl[] = { 0x83, 0xF8, 0x3F, 0x74, 0x2D };
|
||||
applyKernPatch(find, sizeof(find), repl, comment.c_str());
|
||||
} else if (os_version < AsciiOSVersionToUint64("10.10"_XS8)) {
|
||||
} else if (OSVersion.notEmpty() && OSVersion < MacOsVersion("10.10"_XS8)) {
|
||||
// 10.9.x
|
||||
const UINT8 find[] = { 0x83, 0xF8, 0x3C, 0x75, 0x07 };
|
||||
const UINT8 repl[] = { 0x83, 0xF8, 0x3F, 0x75, 0x07 };
|
||||
applyKernPatch(find, sizeof(find), repl, comment.c_str());
|
||||
} else if (os_version <= AsciiOSVersionToUint64("10.10.1"_XS8)) {
|
||||
} else if (OSVersion.notEmpty() && OSVersion <= MacOsVersion("10.10.1"_XS8)) {
|
||||
// 10.10 - 10.10.1
|
||||
const UINT8 find[] = { 0x74, 0x11, 0x83, 0xF8, 0x3C };
|
||||
const UINT8 repl[] = { 0x74, 0x11, 0x83, 0xF8, 0x3F };
|
||||
@ -1334,32 +1334,32 @@ BOOLEAN LOADER_ENTRY::HaswellEXCPM()
|
||||
|
||||
// _xcpm_bootstrap
|
||||
comment = "_xcpm_bootstrap"_XS8;
|
||||
if (os_version <= AsciiOSVersionToUint64("10.8.5"_XS8)) {
|
||||
if (OSVersion.notEmpty() && OSVersion <= MacOsVersion("10.8.5"_XS8)) {
|
||||
// 10.8.5
|
||||
const UINT8 find[] = { 0x83, 0xFB, 0x3C, 0x75, 0x54 };
|
||||
const UINT8 repl[] = { 0x83, 0xFB, 0x3F, 0x75, 0x54 };
|
||||
applyKernPatch(find, sizeof(find), repl, comment.c_str());
|
||||
} else if (os_version < AsciiOSVersionToUint64("10.10"_XS8)) {
|
||||
} else if (OSVersion.notEmpty() && OSVersion < MacOsVersion("10.10"_XS8)) {
|
||||
// 10.9.x
|
||||
const UINT8 find[] = { 0x83, 0xFB, 0x3C, 0x75, 0x68 };
|
||||
const UINT8 repl[] = { 0x83, 0xFB, 0x3F, 0x75, 0x68 };
|
||||
applyKernPatch(find, sizeof(find), repl, comment.c_str());
|
||||
} else if (os_version <= AsciiOSVersionToUint64("10.10.2"_XS8)) {
|
||||
} else if (OSVersion.notEmpty() && OSVersion <= MacOsVersion("10.10.2"_XS8)) {
|
||||
// 10.10 - 10.10.2
|
||||
const UINT8 find[] = { 0x83, 0xFB, 0x3C, 0x75, 0x63 };
|
||||
const UINT8 repl[] = { 0x83, 0xFB, 0x3F, 0x75, 0x63 };
|
||||
applyKernPatch(find, sizeof(find), repl, comment.c_str());
|
||||
} else if (os_version <= AsciiOSVersionToUint64("10.10.5"_XS8)) {
|
||||
} else if (OSVersion.notEmpty() && OSVersion <= MacOsVersion("10.10.5"_XS8)) {
|
||||
// 10.10.3 - 10.10.5
|
||||
const UINT8 find[] = { 0x83, 0xC3, 0xC6, 0x83, 0xFB, 0x0D };
|
||||
const UINT8 repl[] = { 0x83, 0xC3, 0xC3, 0x83, 0xFB, 0x0D };
|
||||
applyKernPatch(find, sizeof(find), repl, comment.c_str());
|
||||
} else if (os_version <= AsciiOSVersionToUint64("10.11"_XS8)) {
|
||||
} else if (OSVersion.notEmpty() && OSVersion <= MacOsVersion("10.11"_XS8)) {
|
||||
// 10.11 DB/PB - 10.11.0
|
||||
const UINT8 find[] = { 0x83, 0xC3, 0xC6, 0x83, 0xFB, 0x0D };
|
||||
const UINT8 repl[] = { 0x83, 0xC3, 0xC3, 0x83, 0xFB, 0x0D };
|
||||
applyKernPatch(find, sizeof(find), repl, comment.c_str());
|
||||
} else if (os_version <= AsciiOSVersionToUint64("10.11.6"_XS8)) {
|
||||
} else if (OSVersion.notEmpty() && OSVersion <= MacOsVersion("10.11.6"_XS8)) {
|
||||
// 10.11.1 - 10.11.6
|
||||
const UINT8 find[] = { 0x83, 0xC3, 0xBB, 0x83, 0xFB, 0x09 };
|
||||
const UINT8 repl[] = { 0x83, 0xC3, 0xB8, 0x83, 0xFB, 0x09 };
|
||||
@ -1378,28 +1378,28 @@ BOOLEAN LOADER_ENTRY::HaswellEXCPM()
|
||||
}
|
||||
}
|
||||
|
||||
/*if (os_version <= AsciiOSVersionToUint64("10.12.5")) {
|
||||
/*if (OSVersion.notEmpty() && OSVersion <= AsciiOSVersionToUint64("10.12.5")) {
|
||||
// 10.12 - 10.12.5
|
||||
const UINT8 find[] = { 0x83, 0xC3, 0xC4, 0x83, 0xFB, 0x22 };
|
||||
const UINT8 repl[] = { 0x83, 0xC3, 0xC1, 0x83, 0xFB, 0x22 };
|
||||
applyKernPatch(find, sizeof(find), repl, comment);
|
||||
} else if (os_version < AsciiOSVersionToUint64("10.13")) {
|
||||
} else if (OSVersion.notEmpty() && OSVersion < AsciiOSVersionToUint64("10.13")) {
|
||||
// 10.12.6
|
||||
const UINT8 find[] = { 0x8D, 0x43, 0xC4, 0x83, 0xF8, 0x22 };
|
||||
const UINT8 repl[] = { 0x8D, 0x43, 0xC1, 0x83, 0xF8, 0x22 };
|
||||
applyKernPatch(find, sizeof(find), repl, comment);
|
||||
// PMheart: attempt to add 10.14 compatibility
|
||||
} else if (os_version < AsciiOSVersionToUint64("10.15")) {
|
||||
} else if (OSVersion.notEmpty() && OSVersion < AsciiOSVersionToUint64("10.15")) {
|
||||
// 10.13/10.14
|
||||
const UINT8 find[] = { 0x89, 0xD8, 0x04, 0xC4, 0x3C, 0x22 };
|
||||
const UINT8 repl[] = { 0x89, 0xD8, 0x04, 0xC1, 0x3C, 0x22 };
|
||||
applyKernPatch(find, sizeof(find), repl, comment);
|
||||
// PMheart: attempt to add 10.15 compatibility
|
||||
} else if (os_version < AsciiOSVersionToUint64("10.15.4")) {
|
||||
} else if (OSVersion.notEmpty() && OSVersion < AsciiOSVersionToUint64("10.15.4")) {
|
||||
const UINT8 find[] = { 0x8D, 0x43, 0xC4, 0x3C, 0x22 };
|
||||
const UINT8 repl[] = { 0x8D, 0x43, 0xC1, 0x3C, 0x22 };
|
||||
applyKernPatch(find, sizeof(find), repl, comment);
|
||||
} else if (os_version < AsciiOSVersionToUint64("10.16")) {
|
||||
} else if (OSVersion.notEmpty() && OSVersion < AsciiOSVersionToUint64("10.16")) {
|
||||
// vector sigma: 10.15.5 Beta 2 build 19F62f and 10.15.4 build 19E287
|
||||
const UINT8 find[] = { 0x3B, 0x7E, 0x2E, 0x80, 0xC3, 0xC4, 0x80, 0xFB, 0x42 };
|
||||
const UINT8 repl[] = { 0x00, 0x7E, 0x2E, 0x80, 0xC3, 0xC1, 0x80, 0xFB, 0x42 };
|
||||
@ -1409,7 +1409,7 @@ BOOLEAN LOADER_ENTRY::HaswellEXCPM()
|
||||
|
||||
DBG("Searching _xcpm_pkg_scope_msr ...\n");
|
||||
comment = "_xcpm_pkg_scope_msrs"_XS8;
|
||||
if (os_version <= AsciiOSVersionToUint64("10.8.5"_XS8)) {
|
||||
if (OSVersion.notEmpty() && OSVersion <= MacOsVersion("10.8.5"_XS8)) {
|
||||
// 10.8.5
|
||||
const UINT8 find[] = {
|
||||
0x48, 0x8D, 0x3D, 0x02, 0x71, 0x55, 0x00, 0xBE,
|
||||
@ -1424,7 +1424,7 @@ BOOLEAN LOADER_ENTRY::HaswellEXCPM()
|
||||
0x00, 0x00, 0x31, 0xD2, 0x90, 0x90, 0x90, 0x90, 0x90
|
||||
};
|
||||
applyKernPatch(find, sizeof(find), repl, comment.c_str());
|
||||
} else if (os_version < AsciiOSVersionToUint64("10.10"_XS8)) {
|
||||
} else if (OSVersion.notEmpty() && OSVersion < MacOsVersion("10.10"_XS8)) {
|
||||
// 10.9.x
|
||||
const UINT8 find[] = { 0xBE, 0x07, 0x00, 0x00, 0x00, 0x74, 0x13, 0x31, 0xD2, 0xE8, 0x5F, 0x02, 0x00, 0x00 };
|
||||
const UINT8 repl[] = { 0xBE, 0x07, 0x00, 0x00, 0x00, 0x90, 0x90, 0x31, 0xD2, 0x90, 0x90, 0x90, 0x90, 0x90 };
|
||||
@ -1470,16 +1470,16 @@ BOOLEAN LOADER_ENTRY::BroadwellEPM()
|
||||
|
||||
UINT32 i;
|
||||
UINTN patchLocation;
|
||||
UINT64 os_version = AsciiOSVersionToUint64(OSVersion);
|
||||
// UINT64 os_version = AsciiOSVersionToUint64(OSVersion);
|
||||
|
||||
// check OS version suit for patches
|
||||
if (!IsXCPMOSVersionCompat(os_version)) {
|
||||
if (!IsXCPMOSVersionCompat(OSVersion)) {
|
||||
DBG("BroadwellEPM(): Unsupported macOS.\n");
|
||||
DBG("BroadwellEPM() <===FALSE\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
KernelAndKextPatches.FakeCPUID = (UINT32)(os_version < AsciiOSVersionToUint64("10.10.3"_XS8) ? 0x0306C0 : 0x040674);
|
||||
KernelAndKextPatches.FakeCPUID = (UINT32)(OSVersion.notEmpty() && OSVersion < MacOsVersion("10.10.3"_XS8) ? 0x0306C0 : 0x040674);
|
||||
KernelCPUIDPatch();
|
||||
|
||||
DBG("Searching _xcpm_pkg_scope_msr ...\n");
|
||||
@ -1488,7 +1488,7 @@ BOOLEAN LOADER_ENTRY::BroadwellEPM()
|
||||
// ffffff800046882c BE07000000 mov esi, 0x7
|
||||
// ffffff8000468831 31D2 xor edx, edx
|
||||
// ffffff8000468833 E838FDFFFF call sub_ffffff8000468570
|
||||
if (os_version >= AsciiOSVersionToUint64("10.12"_XS8)) {
|
||||
if (OSVersion >= MacOsVersion("10.12"_XS8)) {
|
||||
// 10.12+
|
||||
// patchLocation = 0; // clean out the value just in case
|
||||
// for (i = 0; i < 0x1000000; i++) {
|
||||
@ -1526,11 +1526,11 @@ BOOLEAN LOADER_ENTRY::BroadwellEPM()
|
||||
BOOLEAN LOADER_ENTRY::HaswellLowEndXCPM()
|
||||
{
|
||||
DBG("HaswellLowEndXCPM() ===>\n");
|
||||
UINT64 os_version = AsciiOSVersionToUint64(OSVersion);
|
||||
// UINT64 os_version = AsciiOSVersionToUint64(OSVersion);
|
||||
XString8 comment;
|
||||
|
||||
// check OS version suit for patches
|
||||
if (!IsXCPMOSVersionCompat(os_version)) {
|
||||
if (!IsXCPMOSVersionCompat(OSVersion)) {
|
||||
DBG("HaswellLowEndXCPM(): Unsupported macOS.\n");
|
||||
DBG("HaswellLowEndXCPM() <===FALSE\n");
|
||||
return FALSE;
|
||||
@ -1540,7 +1540,7 @@ BOOLEAN LOADER_ENTRY::HaswellLowEndXCPM()
|
||||
KernelCPUIDPatch();
|
||||
|
||||
// 10.8.5 - 10.11.x no need the following kernel patches on Haswell Celeron/Pentium
|
||||
if (os_version >= AsciiOSVersionToUint64("10.8.5"_XS8) && os_version < AsciiOSVersionToUint64("10.12"_XS8)) {
|
||||
if (OSVersion >= MacOsVersion("10.8.5"_XS8) && OSVersion < MacOsVersion("10.12"_XS8)) {
|
||||
DBG("HaswellLowEndXCPM() <===\n");
|
||||
return TRUE;
|
||||
}
|
||||
@ -1568,17 +1568,17 @@ BOOLEAN LOADER_ENTRY::HaswellLowEndXCPM()
|
||||
}
|
||||
}
|
||||
/*
|
||||
if (os_version <= AsciiOSVersionToUint64("10.12.5")) {
|
||||
if (OSVersion.notEmpty() && OSVersion <= AsciiOSVersionToUint64("10.12.5")) {
|
||||
// 10.12 - 10.12.5
|
||||
const UINT8 find[] = { 0x83, 0xC3, 0xC4, 0x83, 0xFB, 0x22 };
|
||||
const UINT8 repl[] = { 0x83, 0xC3, 0xC6, 0x83, 0xFB, 0x22 };
|
||||
applyKernPatch(find, sizeof(find), repl, comment);
|
||||
} else if (os_version < AsciiOSVersionToUint64("10.13")) {
|
||||
} else if (OSVersion.notEmpty() && OSVersion < AsciiOSVersionToUint64("10.13")) {
|
||||
// 10.12.6
|
||||
const UINT8 find[] = { 0x8D, 0x43, 0xC4, 0x83, 0xF8, 0x22 };
|
||||
const UINT8 repl[] = { 0x8D, 0x43, 0xC6, 0x83, 0xF8, 0x22 };
|
||||
applyKernPatch(find, sizeof(find), repl, comment);
|
||||
} else if (os_version < AsciiOSVersionToUint64("10.15")) {
|
||||
} else if (OSVersion.notEmpty() && OSVersion < AsciiOSVersionToUint64("10.15")) {
|
||||
// 10.13/10.14
|
||||
// ; Basic Block Input Regs: rbx - Killed Regs: rax
|
||||
// ffffff80004fa0f7 89D8 mov eax, ebx
|
||||
@ -1589,11 +1589,11 @@ BOOLEAN LOADER_ENTRY::HaswellLowEndXCPM()
|
||||
const UINT8 repl[] = { 0x89, 0xD8, 0x04, 0xC6, 0x3C, 0x22 };
|
||||
applyKernPatch(find, sizeof(find), repl, comment);
|
||||
// PMheart: attempt to add 10.15 compatibility
|
||||
} else if (os_version < AsciiOSVersionToUint64("10.15.4")) {
|
||||
} else if (OSVersion.notEmpty() && OSVersion < AsciiOSVersionToUint64("10.15.4")) {
|
||||
const UINT8 find[] = { 0x8D, 0x43, 0xC4, 0x3C, 0x22 };
|
||||
const UINT8 repl[] = { 0x8D, 0x43, 0xC6, 0x3C, 0x22 };
|
||||
applyKernPatch(find, sizeof(find), repl, comment);
|
||||
} else if (os_version < AsciiOSVersionToUint64("10.16")) {
|
||||
} else if (OSVersion.notEmpty() && OSVersion < AsciiOSVersionToUint64("10.16")) {
|
||||
// vector sigma: 10.15.5 Beta 2 build 19F62f and 10.15.4 build 19E287
|
||||
const UINT8 find[] = { 0x3B, 0x7E, 0x2E, 0x80, 0xC3, 0xC4, 0x80, 0xFB, 0x42 };
|
||||
const UINT8 repl[] = { 0x00, 0x7E, 0x2E, 0x80, 0xC3, 0xC6, 0x80, 0xFB, 0x42 };
|
||||
@ -1602,7 +1602,7 @@ BOOLEAN LOADER_ENTRY::HaswellLowEndXCPM()
|
||||
*/
|
||||
comment = "_cpuid_set_info_rdmsr"_XS8;
|
||||
// PMheart: bytes seem stable as of 10.12
|
||||
if (os_version >= AsciiOSVersionToUint64("10.12"_XS8)) {
|
||||
if (OSVersion >= MacOsVersion("10.12"_XS8)) {
|
||||
// 10.12+
|
||||
const UINT8 find[] = { 0xB9, 0xA0, 0x01, 0x00, 0x00, 0x0F, 0x32 };
|
||||
const UINT8 repl[] = { 0xB9, 0xA0, 0x01, 0x00, 0x00, 0x31, 0xC0 };
|
||||
@ -1621,7 +1621,7 @@ BOOLEAN LOADER_ENTRY::KernelIvyBridgeXCPM()
|
||||
XString8 comment;
|
||||
// UINT32 i;
|
||||
UINTN patchLocation;
|
||||
UINT64 os_version = AsciiOSVersionToUint64(OSVersion);
|
||||
// UINT64 os_version = AsciiOSVersionToUint64(OSVersion);
|
||||
|
||||
// check whether Ivy Bridge
|
||||
if (gCPUStructure.Model != CPU_MODEL_IVY_BRIDGE) {
|
||||
@ -1632,18 +1632,18 @@ BOOLEAN LOADER_ENTRY::KernelIvyBridgeXCPM()
|
||||
|
||||
// check OS version suit for patches
|
||||
// PMheart: attempt to add 10.14 compatibility
|
||||
if (!IsXCPMOSVersionCompat(os_version)) {
|
||||
if (!IsXCPMOSVersionCompat(OSVersion)) {
|
||||
DBG("KernelIvyBridgeXCPM():Unsupported macOS.\n");
|
||||
DBG("KernelIvyBridgeXCPM() <===FALSE\n");
|
||||
return FALSE;
|
||||
} else if (os_version >= AsciiOSVersionToUint64("10.8.5"_XS8) && os_version < AsciiOSVersionToUint64("10.12"_XS8)) {
|
||||
} else if (OSVersion >= MacOsVersion("10.8.5"_XS8) && OSVersion < MacOsVersion("10.12"_XS8)) {
|
||||
// 10.8.5 - 10.11.x no need the following kernel patches on Ivy Bridge - we just use -xcpm boot-args
|
||||
DBG("KernelIvyBridgeXCPM() <===\n");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
DBG("Searching _xcpm_pkg_scope_msr ...\n");
|
||||
if (os_version >= AsciiOSVersionToUint64("10.12"_XS8)) {
|
||||
if (OSVersion >= MacOsVersion("10.12"_XS8)) {
|
||||
// 10.12+
|
||||
/* patchLocation = 0; // clean out the value just in case
|
||||
for (i = 0; i < 0x1000000; i++) {
|
||||
@ -1685,28 +1685,28 @@ BOOLEAN LOADER_ENTRY::KernelIvyBridgeXCPM()
|
||||
}
|
||||
}
|
||||
/*
|
||||
if (os_version <= AsciiOSVersionToUint64("10.12.5")) {
|
||||
if (OSVersion.notEmpty() && OSVersion <= AsciiOSVersionToUint64("10.12.5")) {
|
||||
// 10.12 - 10.12.5
|
||||
const UINT8 find[] = { 0x83, 0xC3, 0xC4, 0x83, 0xFB, 0x22 };
|
||||
const UINT8 repl[] = { 0x83, 0xC3, 0xC6, 0x83, 0xFB, 0x22 };
|
||||
applyKernPatch(find, sizeof(find), repl, comment);
|
||||
} else if (os_version < AsciiOSVersionToUint64("10.13")) {
|
||||
} else if (OSVersion.notEmpty() && OSVersion < AsciiOSVersionToUint64("10.13")) {
|
||||
// 10.12.6
|
||||
const UINT8 find[] = { 0x8D, 0x43, 0xC4, 0x83, 0xF8, 0x22 };
|
||||
const UINT8 repl[] = { 0x8D, 0x43, 0xC6, 0x83, 0xF8, 0x22 };
|
||||
applyKernPatch(find, sizeof(find), repl, comment);
|
||||
// PMheart: attempt to add 10.14 compatibility
|
||||
} else if (os_version < AsciiOSVersionToUint64("10.15")) {
|
||||
} else if (OSVersion.notEmpty() && OSVersion < AsciiOSVersionToUint64("10.15")) {
|
||||
// 10.13/10.14
|
||||
const UINT8 find[] = { 0x89, 0xD8, 0x04, 0xC4, 0x3C, 0x22 };
|
||||
const UINT8 repl[] = { 0x89, 0xD8, 0x04, 0xC6, 0x3C, 0x22 };
|
||||
applyKernPatch(find, sizeof(find), repl, comment);
|
||||
// PMheart: attempt to add 10.15 compatibility
|
||||
} else if (os_version < AsciiOSVersionToUint64("10.15.4")) {
|
||||
} else if (OSVersion.notEmpty() && OSVersion < AsciiOSVersionToUint64("10.15.4")) {
|
||||
const UINT8 find[] = { 0x8D, 0x43, 0xC4, 0x3C, 0x22 };
|
||||
const UINT8 repl[] = { 0x8D, 0x43, 0xC6, 0x3C, 0x22 };
|
||||
applyKernPatch(find, sizeof(find), repl, comment);
|
||||
} else if (os_version < AsciiOSVersionToUint64("10.16")) {
|
||||
} else if (OSVersion.notEmpty() && OSVersion < AsciiOSVersionToUint64("10.16")) {
|
||||
// vector sigma: 10.15.5 Beta 2 build 19F62f and 10.15.4 build 19E287
|
||||
const UINT8 find[] = { 0x3B, 0x7E, 0x2E, 0x80, 0xC3, 0xC4, 0x80, 0xFB, 0x42 };
|
||||
const UINT8 repl[] = { 0x00, 0x7E, 0x2E, 0x80, 0xC3, 0xC6, 0x80, 0xFB, 0x42 };
|
||||
@ -1727,7 +1727,7 @@ BOOLEAN LOADER_ENTRY::KernelIvyE5XCPM()
|
||||
XString8 comment;
|
||||
// UINT32 i;
|
||||
UINTN patchLocation;
|
||||
UINT64 os_version = AsciiOSVersionToUint64(OSVersion);
|
||||
// UINT64 os_version = AsciiOSVersionToUint64(OSVersion);
|
||||
|
||||
// check whether Ivy Bridge-E5
|
||||
if (gCPUStructure.Model != CPU_MODEL_IVY_BRIDGE_E5) {
|
||||
@ -1738,7 +1738,7 @@ BOOLEAN LOADER_ENTRY::KernelIvyE5XCPM()
|
||||
|
||||
// check OS version suit for patches
|
||||
// PMheart: attempt to add 10.15 compatibility
|
||||
if (!IsXCPMOSVersionCompat(os_version)) {
|
||||
if (!IsXCPMOSVersionCompat(OSVersion)) {
|
||||
DBG("KernelIvyE5XCPM(): Unsupported macOS.\n");
|
||||
DBG("KernelIvyE5XCPM() <===FALSE\n");
|
||||
return FALSE;
|
||||
@ -1747,12 +1747,12 @@ BOOLEAN LOADER_ENTRY::KernelIvyE5XCPM()
|
||||
// _cpuid_set_info
|
||||
// TODO: should we use FakeCPUID instead?
|
||||
comment = "_cpuid_set_info"_XS8;
|
||||
if (os_version <= AsciiOSVersionToUint64("10.8.5"_XS8)) {
|
||||
if (OSVersion.notEmpty() && OSVersion <= MacOsVersion("10.8.5"_XS8)) {
|
||||
// 10.8.5
|
||||
const UINT8 find[] = { 0x83, 0xF8, 0x3C, 0x74, 0x2D };
|
||||
const UINT8 repl[] = { 0x83, 0xF8, 0x3E, 0x74, 0x2D };
|
||||
applyKernPatch(find, sizeof(find), repl, comment.c_str());
|
||||
} else if (os_version == AsciiOSVersionToUint64("10.9"_XS8) || os_version == AsciiOSVersionToUint64("10.9.1"_XS8)) {
|
||||
} else if ( OSVersion == MacOsVersion("10.9"_XS8) || OSVersion == MacOsVersion("10.9.1"_XS8) ) {
|
||||
// 10.9.0 - 10.9.1
|
||||
const UINT8 find[] = { 0x83, 0xF8, 0x3C, 0x75, 0x07 };
|
||||
const UINT8 repl[] = { 0x83, 0xF8, 0x3E, 0x75, 0x07 };
|
||||
@ -1762,7 +1762,7 @@ BOOLEAN LOADER_ENTRY::KernelIvyE5XCPM()
|
||||
// _xcpm_pkg_scope_msrs
|
||||
DBG("Searching _xcpm_pkg_scope_msrs ...\n");
|
||||
comment = "_xcpm_pkg_scope_msrs"_XS8;
|
||||
if (os_version <= AsciiOSVersionToUint64("10.8.5"_XS8)) {
|
||||
if (OSVersion.notEmpty() && OSVersion <= MacOsVersion("10.8.5"_XS8)) {
|
||||
// 10.8.5
|
||||
const UINT8 find[] = {
|
||||
0x48, 0x8D, 0x3D, 0x02, 0x71, 0x55, 0x00, 0xBE,
|
||||
@ -1777,7 +1777,7 @@ BOOLEAN LOADER_ENTRY::KernelIvyE5XCPM()
|
||||
0x00, 0x00, 0x31, 0xD2, 0x90, 0x90, 0x90, 0x90, 0x90
|
||||
};
|
||||
applyKernPatch(find, sizeof(find), repl, comment.c_str());
|
||||
} else if (os_version < AsciiOSVersionToUint64("10.10"_XS8)) {
|
||||
} else if (OSVersion.notEmpty() && OSVersion < MacOsVersion("10.10"_XS8)) {
|
||||
// 10.9.x
|
||||
const UINT8 find[] = { 0xBE, 0x07, 0x00, 0x00, 0x00, 0x74, 0x13, 0x31, 0xD2, 0xE8, 0x5F, 0x02, 0x00, 0x00 };
|
||||
const UINT8 repl[] = { 0xBE, 0x07, 0x00, 0x00, 0x00, 0x90, 0x90, 0x31, 0xD2, 0x90, 0x90, 0x90, 0x90, 0x90 };
|
||||
@ -1812,32 +1812,32 @@ BOOLEAN LOADER_ENTRY::KernelIvyE5XCPM()
|
||||
|
||||
// _xcpm_bootstrap
|
||||
comment = "_xcpm_bootstrap"_XS8;
|
||||
if (os_version <= AsciiOSVersionToUint64("10.8.5"_XS8)) {
|
||||
if (OSVersion.notEmpty() && OSVersion <= MacOsVersion("10.8.5"_XS8)) {
|
||||
// 10.8.5
|
||||
const UINT8 find[] = { 0x83, 0xFB, 0x3C, 0x75, 0x54 };
|
||||
const UINT8 repl[] = { 0x83, 0xFB, 0x3E, 0x75, 0x54 };
|
||||
applyKernPatch(find, sizeof(find), repl, comment.c_str());
|
||||
} else if (os_version < AsciiOSVersionToUint64("10.10"_XS8)) {
|
||||
} else if (OSVersion.notEmpty() && OSVersion < MacOsVersion("10.10"_XS8)) {
|
||||
// 10.9.x
|
||||
const UINT8 find[] = { 0x83, 0xFB, 0x3C, 0x75, 0x68 };
|
||||
const UINT8 repl[] = { 0x83, 0xFB, 0x3E, 0x75, 0x68 };
|
||||
applyKernPatch(find, sizeof(find), repl, comment.c_str());
|
||||
} else if (os_version <= AsciiOSVersionToUint64("10.10.2"_XS8)) {
|
||||
} else if (OSVersion.notEmpty() && OSVersion <= MacOsVersion("10.10.2"_XS8)) {
|
||||
// 10.10 - 10.10.2
|
||||
const UINT8 find[] = { 0x83, 0xFB, 0x3C, 0x75, 0x63 };
|
||||
const UINT8 repl[] = { 0x83, 0xFB, 0x3E, 0x75, 0x63 };
|
||||
applyKernPatch(find, sizeof(find), repl, comment.c_str());
|
||||
} else if (os_version <= AsciiOSVersionToUint64("10.10.5"_XS8)) {
|
||||
} else if (OSVersion.notEmpty() && OSVersion <= MacOsVersion("10.10.5"_XS8)) {
|
||||
// 10.10.3 - 10.10.5
|
||||
const UINT8 find[] = { 0x83, 0xC3, 0xC6, 0x83, 0xFB, 0x0D };
|
||||
const UINT8 repl[] = { 0x83, 0xC3, 0xC4, 0x83, 0xFB, 0x0D };
|
||||
applyKernPatch(find, sizeof(find), repl, comment.c_str());
|
||||
} else if (os_version <= AsciiOSVersionToUint64("10.11"_XS8)) {
|
||||
} else if (OSVersion.notEmpty() && OSVersion <= MacOsVersion("10.11"_XS8)) {
|
||||
// 10.11 DB/PB - 10.11.0
|
||||
const UINT8 find[] = { 0x83, 0xC3, 0xC6, 0x83, 0xFB, 0x0D };
|
||||
const UINT8 repl[] = { 0x83, 0xC3, 0xC4, 0x83, 0xFB, 0x0D };
|
||||
applyKernPatch(find, sizeof(find), repl, comment.c_str());
|
||||
} else if (os_version <= AsciiOSVersionToUint64("10.11.6"_XS8)) {
|
||||
} else if (OSVersion.notEmpty() && OSVersion <= MacOsVersion("10.11.6"_XS8)) {
|
||||
// 10.11.1 - 10.11.6
|
||||
const UINT8 find[] = { 0x83, 0xC3, 0xBB, 0x83, 0xFB, 0x09 };
|
||||
const UINT8 repl[] = { 0x83, 0xC3, 0xB9, 0x83, 0xFB, 0x09 };
|
||||
@ -1857,28 +1857,28 @@ BOOLEAN LOADER_ENTRY::KernelIvyE5XCPM()
|
||||
}
|
||||
}
|
||||
|
||||
/* if (os_version <= AsciiOSVersionToUint64("10.12.5")) {
|
||||
/* if (OSVersion.notEmpty() && OSVersion <= MacOsVersion("10.12.5")) {
|
||||
// 10.12 - 10.12.5
|
||||
const UINT8 find[] = { 0x83, 0xC3, 0xC4, 0x83, 0xFB, 0x22 };
|
||||
const UINT8 repl[] = { 0x83, 0xC3, 0xC2, 0x83, 0xFB, 0x22 };
|
||||
applyKernPatch(find, sizeof(find), repl, comment);
|
||||
} else if (os_version < AsciiOSVersionToUint64("10.13")) {
|
||||
} else if (OSVersion.notEmpty() && OSVersion < MacOsVersion("10.13")) {
|
||||
// 10.12.6
|
||||
const UINT8 find[] = { 0x8D, 0x43, 0xC4, 0x83, 0xF8, 0x22 };
|
||||
const UINT8 repl[] = { 0x8D, 0x43, 0xC2, 0x83, 0xF8, 0x22 };
|
||||
applyKernPatch(find, sizeof(find), repl, comment);
|
||||
// PMheart: attempt to add 10.14 compatibility
|
||||
} else if (os_version < AsciiOSVersionToUint64("10.15")) {
|
||||
} else if (OSVersion.notEmpty() && OSVersion < MacOsVersion("10.15")) {
|
||||
// 10.13/10.14
|
||||
const UINT8 find[] = { 0x89, 0xD8, 0x04, 0xC4, 0x3C, 0x22 };
|
||||
const UINT8 repl[] = { 0x89, 0xD8, 0x04, 0xC1, 0x3C, 0x22 };
|
||||
applyKernPatch(find, sizeof(find), repl, comment);
|
||||
// PMheart: attempt to add 10.15 compatibility
|
||||
} else if (os_version < AsciiOSVersionToUint64("10.15.4")) {
|
||||
} else if (OSVersion.notEmpty() && OSVersion < MacOsVersion("10.15.4")) {
|
||||
const UINT8 find[] = { 0x8D, 0x43, 0xC4, 0x3C, 0x22 };
|
||||
const UINT8 repl[] = { 0x8D, 0x43, 0xC1, 0x3C, 0x22 };
|
||||
applyKernPatch(find, sizeof(find), repl, comment);
|
||||
} else if (os_version < AsciiOSVersionToUint64("10.16")) {
|
||||
} else if (OSVersion.notEmpty() && OSVersion < MacOsVersion("10.16")) {
|
||||
// vector sigma: 10.15.5 Beta 2 build 19F62f and 10.15.4 build 19E287
|
||||
const UINT8 find[] = { 0x3B, 0x7E, 0x2E, 0x80, 0xC3, 0xC4, 0x80, 0xFB, 0x42 };
|
||||
const UINT8 repl[] = { 0x00, 0x7E, 0x2E, 0x80, 0xC3, 0xC1, 0x80, 0xFB, 0x42 };
|
||||
@ -2512,9 +2512,9 @@ LOADER_ENTRY::KernelAndKextPatcherInit()
|
||||
// for AptioFix booting - it's always at KernelRelocBase + 0x00200000
|
||||
|
||||
// UINT64 os_version = AsciiOSVersionToUint64(OSVersion);
|
||||
DBG("os_version=%s\n", OSVersion.c_str());
|
||||
DBG("OSVersion=%s\n", OSVersion.asString().c_str());
|
||||
|
||||
// if (os_version < AsciiOSVersionToUint64("10.6")) {
|
||||
// if (OSVersion.notEmpty() && OSVersion < AsciiOSVersionToUint64("10.6")) {
|
||||
// KernelData = (UINT8*)(UINTN)(KernelSlide + KernelRelocBase + 0x00111000);
|
||||
// } else {
|
||||
KernelData = (UINT8*)(UINTN)(KernelSlide + KernelRelocBase + 0x00200000);
|
||||
|
@ -12,6 +12,7 @@ extern "C" {
|
||||
#include "../Platform/guid.h"
|
||||
#include "../Platform/SelfOem.h"
|
||||
#include "MemoryOperation.h"
|
||||
#include "../include/OsType.h"
|
||||
|
||||
#ifndef DEBUG_ALL
|
||||
#define KEXT_INJECT_DEBUG 1
|
||||
@ -479,10 +480,10 @@ void LOADER_ENTRY::AddKextsInArray(XObjArray<SIDELOAD_KEXT>* kextArray)
|
||||
} else if (LoadOptions.contains("arch=i386")) {
|
||||
archCpuType = CPU_TYPE_I386;
|
||||
} else if (OSVersion.notEmpty()) {
|
||||
UINT64 os_version = AsciiOSVersionToUint64(OSVersion);
|
||||
if (os_version >= AsciiOSVersionToUint64("10.8"_XS8)) {
|
||||
// UINT64 os_version = AsciiOSVersionToUint64(OSVersion);
|
||||
if (OSVersion.isEmpty() || OSVersion >= MacOsVersion("10.8"_XS8)) {
|
||||
archCpuType = CPU_TYPE_X86_64; // For OSVersion >= 10.8, only x86_64 exists
|
||||
} else if (os_version < AsciiOSVersionToUint64("10.7"_XS8)) {
|
||||
} else if (OSVersion < MacOsVersion("10.7"_XS8)) {
|
||||
archCpuType = CPU_TYPE_I386; // For OSVersion < 10.7, use default of i386
|
||||
}
|
||||
}
|
||||
@ -517,22 +518,22 @@ void LOADER_ENTRY::AddKextsInArray(XObjArray<SIDELOAD_KEXT>* kextArray)
|
||||
}
|
||||
}
|
||||
|
||||
XStringW UniOSVersion;
|
||||
UniOSVersion = OSVersion;
|
||||
DBG("UniOSVersion == %ls\n", UniOSVersion.wc_str());
|
||||
|
||||
XStringW UniShortOSVersion;
|
||||
// XString8 ShortOSVersion;
|
||||
if (AsciiOSVersionToUint64(OSVersion) < AsciiOSVersionToUint64("10.10"_XS8)) {
|
||||
// OSVersion that are earlier than 10.10(form: 10.x.y)
|
||||
// ShortOSVersion.strncpy(OSVersion.c_str(), 4);
|
||||
UniShortOSVersion.strncpy(OSVersion.c_str(), 4);
|
||||
} else {
|
||||
// ShortOSVersion.strncpy(OSVersion.c_str(), 5);
|
||||
UniShortOSVersion.strncpy(OSVersion.c_str(), 5);
|
||||
}
|
||||
// DBG("ShortOSVersion == %s\n", ShortOSVersion.c_str());
|
||||
DBG("UniShortOSVersion == %ls\n", UniShortOSVersion.wc_str());
|
||||
// XStringW UniOSVersion;
|
||||
// UniOSVersion = OSVersion;
|
||||
// DBG("UniOSVersion == %ls\n", UniOSVersion.wc_str());
|
||||
//
|
||||
// XStringW UniShortOSVersion;
|
||||
//// XString8 ShortOSVersion;
|
||||
// if ( OSVersion < MacOsVersion("10.10"_XS8)) {
|
||||
// // OSVersion that are earlier than 10.10(form: 10.x.y)
|
||||
//// ShortOSVersion.strncpy(OSVersion.c_str(), 4);
|
||||
// UniShortOSVersion.strncpy(OSVersion.c_str(), 4);
|
||||
// } else {
|
||||
//// ShortOSVersion.strncpy(OSVersion.c_str(), 5);
|
||||
// UniShortOSVersion.strncpy(OSVersion.c_str(), 5);
|
||||
// }
|
||||
//// DBG("ShortOSVersion == %s\n", ShortOSVersion.c_str());
|
||||
// DBG("UniShortOSVersion == %ls\n", UniShortOSVersion.wc_str());
|
||||
|
||||
// syscl - allow specific load inject kext
|
||||
// Clover/Kexts/Other is for general injection thus we need to scan both Other and OSVersion folder
|
||||
@ -550,43 +551,44 @@ void LOADER_ENTRY::AddKextsInArray(XObjArray<SIDELOAD_KEXT>* kextArray)
|
||||
DBG("GetOtherKextsDir(FALSE) return NULL\n");
|
||||
}
|
||||
|
||||
if ( OSVersion.contains(".") )
|
||||
if ( OSVersion.notEmpty() )
|
||||
{
|
||||
// Add kext from 10 or 11
|
||||
XStringW osMajorVersion = OSVersion.subString(0, OSVersion.indexOf('.'));
|
||||
XStringW osMajorVersion = OSVersion.asString(1);
|
||||
|
||||
XStringW OSAllVersionKextsDir;
|
||||
XStringW OSShortVersionKextsDir;
|
||||
XStringW OSVersionKextsDirName;
|
||||
XStringW DirName;
|
||||
XStringW DirPath;
|
||||
|
||||
OSAllVersionKextsDir = SWPrintf("%ls", osMajorVersion.wc_str());
|
||||
AddKextsFromDirInArray(OSAllVersionKextsDir, osMajorVersion, archCpuType, kextArray);
|
||||
DirName = S8Printf("%ls_%s", osMajorVersion.wc_str(), getSuffixForMacOsVersion(LoaderType).c_str());
|
||||
|
||||
if (OSTYPE_IS_OSX_INSTALLER(LoaderType)) {
|
||||
DirName = SWPrintf("%ls_install", osMajorVersion.wc_str());
|
||||
} else if (OSTYPE_IS_OSX_RECOVERY(LoaderType)) {
|
||||
DirName = SWPrintf("%ls_recovery", osMajorVersion.wc_str());
|
||||
} else {
|
||||
DirName = SWPrintf("%ls_normal", osMajorVersion.wc_str());
|
||||
}
|
||||
// if (OSTYPE_IS_OSX_INSTALLER(LoaderType)) {
|
||||
// DirName = SWPrintf("%ls_install", osMajorVersion.wc_str());
|
||||
// } else if (OSTYPE_IS_OSX_RECOVERY(LoaderType)) {
|
||||
// DirName = SWPrintf("%ls_recovery", osMajorVersion.wc_str());
|
||||
// } else {
|
||||
// DirName = SWPrintf("%ls_normal", osMajorVersion.wc_str());
|
||||
// }
|
||||
DirPath = SWPrintf("%ls", DirName.wc_str());
|
||||
AddKextsFromDirInArray(DirPath, DirName, archCpuType, kextArray);
|
||||
|
||||
|
||||
// Add kext from ${osMajorVersion}.{version}
|
||||
|
||||
OSShortVersionKextsDir = SWPrintf("%ls", UniShortOSVersion.wc_str());
|
||||
AddKextsFromDirInArray( OSShortVersionKextsDir, UniShortOSVersion, archCpuType, kextArray);
|
||||
OSShortVersionKextsDir = OSVersion.asString(2);
|
||||
AddKextsFromDirInArray( OSShortVersionKextsDir, OSShortVersionKextsDir, archCpuType, kextArray);
|
||||
DirName = S8Printf("%ls_%s", OSShortVersionKextsDir.wc_str(), getSuffixForMacOsVersion(LoaderType).c_str());
|
||||
|
||||
if (OSTYPE_IS_OSX_INSTALLER(LoaderType)) {
|
||||
DirName = SWPrintf("%ls_install", UniShortOSVersion.wc_str());
|
||||
} else if (OSTYPE_IS_OSX_RECOVERY(LoaderType)) {
|
||||
DirName = SWPrintf("%ls_recovery", UniShortOSVersion.wc_str());
|
||||
} else {
|
||||
DirName = SWPrintf("%ls_normal", UniShortOSVersion.wc_str());
|
||||
}
|
||||
// if (OSTYPE_IS_OSX_INSTALLER(LoaderType)) {
|
||||
// DirName = SWPrintf("%ls_install", OSShortVersionKextsDir.wc_str());
|
||||
// } else if (OSTYPE_IS_OSX_RECOVERY(LoaderType)) {
|
||||
// DirName = SWPrintf("%ls_recovery", OSShortVersionKextsDir.wc_str());
|
||||
// } else {
|
||||
// DirName = SWPrintf("%ls_normal", OSShortVersionKextsDir.wc_str());
|
||||
// }
|
||||
DirPath = SWPrintf("%ls", DirName.wc_str());
|
||||
AddKextsFromDirInArray(DirPath, DirName, archCpuType, kextArray);
|
||||
|
||||
@ -595,90 +597,90 @@ void LOADER_ENTRY::AddKextsInArray(XObjArray<SIDELOAD_KEXT>* kextArray)
|
||||
// ${osMajorVersion}.{version}.0 if NO minor version
|
||||
// ${osMajorVersion}.{version}.{minor version} if minor version is > 0
|
||||
|
||||
if ( UniShortOSVersion == OSVersion ) {
|
||||
OSVersionKextsDirName = SWPrintf("%s.0", OSVersion.c_str());
|
||||
} else {
|
||||
OSVersionKextsDirName = SWPrintf("%s", OSVersion.c_str());
|
||||
}
|
||||
XString8 OSVersionKextsDirName;
|
||||
OSVersionKextsDirName = OSVersion.asString(3);
|
||||
if ( OSVersion.elementAt(2) == -1 ) OSVersionKextsDirName.S8Catf(".0");
|
||||
|
||||
DirPath = SWPrintf("%ls", OSVersionKextsDirName.wc_str());
|
||||
DirPath = SWPrintf("%s", OSVersionKextsDirName.c_str());
|
||||
AddKextsFromDirInArray(DirPath, OSVersionKextsDirName, archCpuType, kextArray);
|
||||
DirName = S8Printf("%s_%s", OSVersionKextsDirName.c_str(), getSuffixForMacOsVersion(LoaderType).c_str());
|
||||
|
||||
if ( OSTYPE_IS_OSX_INSTALLER(LoaderType)) {
|
||||
DirName = SWPrintf("%ls_install", OSVersionKextsDirName.wc_str());
|
||||
} else if (OSTYPE_IS_OSX_RECOVERY(LoaderType)) {
|
||||
DirName = SWPrintf("%ls_recovery", OSVersionKextsDirName.wc_str());
|
||||
} else {
|
||||
DirName = SWPrintf("%ls_normal", OSVersionKextsDirName.wc_str());
|
||||
}
|
||||
// if ( OSTYPE_IS_OSX_INSTALLER(LoaderType)) {
|
||||
// DirName = SWPrintf("%s_install", OSVersionKextsDirName.c_str());
|
||||
// } else if (OSTYPE_IS_OSX_RECOVERY(LoaderType)) {
|
||||
// DirName = SWPrintf("%s_recovery", OSVersionKextsDirName.c_str());
|
||||
// } else {
|
||||
// DirName = SWPrintf("%s_normal", OSVersionKextsDirName.c_str());
|
||||
// }
|
||||
DirPath = SWPrintf("%ls", DirName.wc_str());
|
||||
AddKextsFromDirInArray(DirPath, DirName, archCpuType, kextArray);
|
||||
}else{
|
||||
//MsgLog("No os version is detected\n");
|
||||
AddKextsFromDirInArray("Unknown"_XS8, "Unknown"_XS8, archCpuType, kextArray);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
EFI_STATUS LOADER_ENTRY::LoadKexts()
|
||||
{
|
||||
XObjArray<SIDELOAD_KEXT> kextArray;
|
||||
AddKextsInArray(&kextArray);
|
||||
|
||||
|
||||
#if defined(MDE_CPU_X64)
|
||||
cpu_type_t archCpuType=CPU_TYPE_X86_64;
|
||||
#else
|
||||
cpu_type_t archCpuType=CPU_TYPE_I386;
|
||||
#endif
|
||||
// Make Arch point to the last appearance of "arch=" in LoadOptions (which is what boot.efi will use).
|
||||
// if (LoadOptions.notEmpty()) {
|
||||
// for (Ptr = StrStr(LoadOptions, L"arch="); Ptr != NULL; Arch = Ptr + StrLen(L"arch="), Ptr = StrStr(Arch, L"arch="));
|
||||
// }
|
||||
|
||||
// if (Arch != NULL && StrnCmp(Arch,L"x86_64",StrLen(L"x86_64")) == 0) {
|
||||
if (LoadOptions.contains("arch=x86_64")) {
|
||||
archCpuType = CPU_TYPE_X86_64;
|
||||
// } else if (Arch != NULL && StrnCmp(Arch,L"i386",StrLen(L"i386")) == 0) {
|
||||
} else if (LoadOptions.contains("arch=i386")) {
|
||||
archCpuType = CPU_TYPE_I386;
|
||||
} else if (OSVersion.notEmpty()) {
|
||||
UINT64 os_version = AsciiOSVersionToUint64(OSVersion);
|
||||
if (os_version >= AsciiOSVersionToUint64("10.8"_XS8)) {
|
||||
archCpuType = CPU_TYPE_X86_64; // For OSVersion >= 10.8, only x86_64 exists
|
||||
} else if (os_version < AsciiOSVersionToUint64("10.7"_XS8)) {
|
||||
archCpuType = CPU_TYPE_I386; // For OSVersion < 10.7, use default of i386
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t idx = 0 ; idx < kextArray.size() ; idx++ ) {
|
||||
AddKext(SelfVolume->RootDir, S8Printf("%ls\\%ls", kextArray[idx].KextDirNameUnderOEMPath.wc_str(), kextArray[idx].FileName.wc_str()), archCpuType);
|
||||
}
|
||||
|
||||
UINTN mm_extra_size;
|
||||
void *mm_extra;
|
||||
UINTN extra_size;
|
||||
void *extra;
|
||||
|
||||
// reserve space in the device tree
|
||||
if (GetKextCount() > 0) {
|
||||
mm_extra_size = GetKextCount() * (sizeof(DTProperty) + sizeof(_DeviceTreeBuffer));
|
||||
mm_extra = (__typeof__(mm_extra))AllocateZeroPool(mm_extra_size - sizeof(DTProperty));
|
||||
/*Status = */LogDataHub(&gEfiMiscSubClassGuid, L"mm_extra", mm_extra, (UINT32)(mm_extra_size - sizeof(DTProperty)));
|
||||
extra_size = GetKextsSize();
|
||||
extra = (__typeof__(extra))AllocateZeroPool(extra_size - sizeof(DTProperty) + EFI_PAGE_SIZE);
|
||||
/*Status = */LogDataHub(&gEfiMiscSubClassGuid, L"extra", extra, (UINT32)(extra_size - sizeof(DTProperty) + EFI_PAGE_SIZE));
|
||||
// MsgLog("count: %d \n", GetKextCount());
|
||||
// MsgLog("mm_extra_size: %d \n", mm_extra_size);
|
||||
// MsgLog("extra_size: %d \n", extra_size);
|
||||
// MsgLog("offset: %d \n", extra_size - sizeof(DTProperty) + EFI_PAGE_SIZE);
|
||||
//no more needed
|
||||
FreePool(mm_extra);
|
||||
FreePool(extra);
|
||||
}
|
||||
|
||||
// InjectKextList.setEmpty();
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
//EFI_STATUS LOADER_ENTRY::LoadKexts()
|
||||
//{
|
||||
// XObjArray<SIDELOAD_KEXT> kextArray;
|
||||
// AddKextsInArray(&kextArray);
|
||||
//
|
||||
//
|
||||
// #if defined(MDE_CPU_X64)
|
||||
// cpu_type_t archCpuType=CPU_TYPE_X86_64;
|
||||
// #else
|
||||
// cpu_type_t archCpuType=CPU_TYPE_I386;
|
||||
// #endif
|
||||
// // Make Arch point to the last appearance of "arch=" in LoadOptions (which is what boot.efi will use).
|
||||
// // if (LoadOptions.notEmpty()) {
|
||||
// // for (Ptr = StrStr(LoadOptions, L"arch="); Ptr != NULL; Arch = Ptr + StrLen(L"arch="), Ptr = StrStr(Arch, L"arch="));
|
||||
// // }
|
||||
//
|
||||
// // if (Arch != NULL && StrnCmp(Arch,L"x86_64",StrLen(L"x86_64")) == 0) {
|
||||
// if (LoadOptions.contains("arch=x86_64")) {
|
||||
// archCpuType = CPU_TYPE_X86_64;
|
||||
// // } else if (Arch != NULL && StrnCmp(Arch,L"i386",StrLen(L"i386")) == 0) {
|
||||
// } else if (LoadOptions.contains("arch=i386")) {
|
||||
// archCpuType = CPU_TYPE_I386;
|
||||
// } else if (OSVersion.notEmpty()) {
|
||||
//// UINT64 os_version = AsciiOSVersionToUint64(OSVersion);
|
||||
// if (OSVersion.isEmpty() || OSVersion >= MacOsVersion("10.8"_XS8)) {
|
||||
// archCpuType = CPU_TYPE_X86_64; // For OSVersion >= 10.8, only x86_64 exists
|
||||
// } else if (OSVersion < MacOsVersion("10.7"_XS8)) {
|
||||
// archCpuType = CPU_TYPE_I386; // For OSVersion < 10.7, use default of i386
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// for (size_t idx = 0 ; idx < kextArray.size() ; idx++ ) {
|
||||
// AddKext(SelfVolume->RootDir, S8Printf("%ls\\%ls", kextArray[idx].KextDirNameUnderOEMPath.wc_str(), kextArray[idx].FileName.wc_str()), archCpuType);
|
||||
// }
|
||||
//
|
||||
// UINTN mm_extra_size;
|
||||
// void *mm_extra;
|
||||
// UINTN extra_size;
|
||||
// void *extra;
|
||||
//
|
||||
// // reserve space in the device tree
|
||||
// if (GetKextCount() > 0) {
|
||||
// mm_extra_size = GetKextCount() * (sizeof(DTProperty) + sizeof(_DeviceTreeBuffer));
|
||||
// mm_extra = (__typeof__(mm_extra))AllocateZeroPool(mm_extra_size - sizeof(DTProperty));
|
||||
// /*Status = */LogDataHub(&gEfiMiscSubClassGuid, L"mm_extra", mm_extra, (UINT32)(mm_extra_size - sizeof(DTProperty)));
|
||||
// extra_size = GetKextsSize();
|
||||
// extra = (__typeof__(extra))AllocateZeroPool(extra_size - sizeof(DTProperty) + EFI_PAGE_SIZE);
|
||||
// /*Status = */LogDataHub(&gEfiMiscSubClassGuid, L"extra", extra, (UINT32)(extra_size - sizeof(DTProperty) + EFI_PAGE_SIZE));
|
||||
// // MsgLog("count: %d \n", GetKextCount());
|
||||
// // MsgLog("mm_extra_size: %d \n", mm_extra_size);
|
||||
// // MsgLog("extra_size: %d \n", extra_size);
|
||||
// // MsgLog("offset: %d \n", extra_size - sizeof(DTProperty) + EFI_PAGE_SIZE);
|
||||
// //no more needed
|
||||
// FreePool(mm_extra);
|
||||
// FreePool(extra);
|
||||
// }
|
||||
//
|
||||
//// InjectKextList.setEmpty();
|
||||
// return EFI_SUCCESS;
|
||||
//}
|
||||
|
||||
/*
|
||||
* Adler32 from Chameleon, not used
|
||||
|
@ -559,8 +559,10 @@ void LOADER_ENTRY::DellSMBIOSPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *Info
|
||||
void LOADER_ENTRY::SNBE_AICPUPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 InfoPlistSize)
|
||||
{
|
||||
UINT32 i;
|
||||
UINT64 os_ver = AsciiOSVersionToUint64(OSVersion);
|
||||
// UINT64 os_ver = AsciiOSVersionToUint64(OSVersion);
|
||||
|
||||
if ( OSVersion.isEmpty() ) return; // Jief : not 100% sure, but if OSVersion is unknown, it's > 11.0.1
|
||||
|
||||
DBG_RT("\nSNBE_AICPUPatch: driverAddr = %llx, driverSize = %x\n", (UINTN)Driver, DriverSize);
|
||||
if (KernelAndKextPatches.KPDebug) {
|
||||
ExtractKextBundleIdentifier(InfoPlist);
|
||||
@ -569,13 +571,13 @@ void LOADER_ENTRY::SNBE_AICPUPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *Info
|
||||
DBG_RT("Kext: %s\n", gKextBundleIdentifier);
|
||||
|
||||
// now let's patch it
|
||||
if (os_ver < AsciiOSVersionToUint64("10.9"_XS8) || os_ver >= AsciiOSVersionToUint64("10.14"_XS8)) {
|
||||
if (OSVersion < MacOsVersion("10.9"_XS8) || OSVersion >= MacOsVersion("10.14"_XS8)) {
|
||||
DBG("Unsupported macOS.\nSandyBridge-E requires macOS 10.9 - 10.13.x, aborted\n");
|
||||
DBG("SNBE_AICPUPatch() <===FALSE\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (os_ver < AsciiOSVersionToUint64("10.10"_XS8)) {
|
||||
if (OSVersion < MacOsVersion("10.10"_XS8)) {
|
||||
// 10.9.x
|
||||
const UINT8 find[][3] = {
|
||||
{ 0x84, 0x2F, 0x01 },
|
||||
@ -603,7 +605,7 @@ void LOADER_ENTRY::SNBE_AICPUPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *Info
|
||||
DBG("SNBE_AICPUPatch (%d/7) not apply\n", i);
|
||||
}
|
||||
}
|
||||
} else if (os_ver < AsciiOSVersionToUint64("10.11"_XS8)) {
|
||||
} else if (OSVersion < MacOsVersion("10.11"_XS8)) {
|
||||
// 10.10.x
|
||||
const UINT8 find[][3] = {
|
||||
{ 0x3E, 0x75, 0x39 },
|
||||
@ -655,7 +657,7 @@ void LOADER_ENTRY::SNBE_AICPUPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *Info
|
||||
} else {
|
||||
DBG("SNBE_AICPUPatch (7/7) not apply\n");
|
||||
}
|
||||
} else if (os_ver < AsciiOSVersionToUint64("10.12"_XS8)) {
|
||||
} else if (OSVersion < MacOsVersion("10.12"_XS8)) {
|
||||
// 10.11
|
||||
const UINT8 find[][3] = {
|
||||
{ 0x3E, 0x75, 0x39 },
|
||||
@ -706,7 +708,7 @@ void LOADER_ENTRY::SNBE_AICPUPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *Info
|
||||
} else {
|
||||
DBG("SNBE_AICPUPatch (7/7) not apply\n");
|
||||
}
|
||||
} else if (os_ver < AsciiOSVersionToUint64("10.13"_XS8)) {
|
||||
} else if (OSVersion < MacOsVersion("10.13"_XS8)) {
|
||||
// 10.12
|
||||
const UINT8 find[][3] = {
|
||||
{ 0x01, 0x74, 0x61 },
|
||||
@ -757,7 +759,7 @@ void LOADER_ENTRY::SNBE_AICPUPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *Info
|
||||
} else {
|
||||
DBG("SNBE_AICPUPatch (7/7) not apply\n");
|
||||
}
|
||||
} else if (os_ver < AsciiOSVersionToUint64("10.15"_XS8)) {
|
||||
} else if (OSVersion < MacOsVersion("10.15"_XS8)) {
|
||||
// 10.13/10.14
|
||||
const UINT8 find[][3] = {
|
||||
{ 0x01, 0x74, 0x61 },
|
||||
@ -835,7 +837,7 @@ const UINT8 BroadwellE_IOPCI_Repl_MojCata[] = { 0x48, 0x3D, 0x00, 0x00, 0x00,
|
||||
void LOADER_ENTRY::BDWE_IOPCIPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 InfoPlistSize)
|
||||
{
|
||||
UINTN count = 0;
|
||||
UINT64 os_ver = AsciiOSVersionToUint64(OSVersion);
|
||||
// UINT64 os_ver = AsciiOSVersionToUint64(OSVersion);
|
||||
|
||||
DBG_RT("\nBDWE_IOPCIPatch: driverAddr = %llx, driverSize = %x\n", (UINTN)Driver, DriverSize);
|
||||
if (KernelAndKextPatches.KPDebug) {
|
||||
@ -847,9 +849,9 @@ void LOADER_ENTRY::BDWE_IOPCIPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *Info
|
||||
// now, let's patch it!
|
||||
//
|
||||
|
||||
if (os_ver < AsciiOSVersionToUint64("10.12"_XS8)) {
|
||||
if (OSVersion.notEmpty() && OSVersion < MacOsVersion("10.12"_XS8)) {
|
||||
count = SearchAndReplace(Driver, DriverSize, BroadwellE_IOPCI_Find_El, sizeof(BroadwellE_IOPCI_Find_El), BroadwellE_IOPCI_Repl_El, 0);
|
||||
} else if (os_ver < AsciiOSVersionToUint64("10.14"_XS8)) {
|
||||
} else if (OSVersion.notEmpty() && OSVersion < MacOsVersion("10.14"_XS8)) {
|
||||
count = SearchAndReplace(Driver, DriverSize, BroadwellE_IOPCI_Find_SieHS, sizeof(BroadwellE_IOPCI_Find_SieHS), BroadwellE_IOPCI_Repl_SieHS, 0);
|
||||
} else {
|
||||
count = SearchAndReplace(Driver, DriverSize, BroadwellE_IOPCI_Find_MojCata, sizeof(BroadwellE_IOPCI_Find_MojCata), BroadwellE_IOPCI_Repl_MojCata, 0);
|
||||
|
@ -1212,7 +1212,9 @@ void GetTableType17()
|
||||
// DBG("SmbiosTable: Type 17 (Memory Device number %d) not found!\n", Index);
|
||||
continue;
|
||||
}
|
||||
#ifndef JIEF_DEBUG // it's all 0 in VMWare
|
||||
DBG("Type 17 Index = %llu\n", Index);
|
||||
#endif
|
||||
//gDMI->CntMemorySlots++;
|
||||
if (SmbiosTable.Type17->MemoryErrorInformationHandle < 0xFFFE) {
|
||||
DBG("Table has error information, checking\n"); //why skipping?
|
||||
@ -1274,7 +1276,9 @@ void GetTableType17()
|
||||
gRAM.Frequency = SmbiosTable.Type17->Speed;
|
||||
}
|
||||
} else {
|
||||
#ifndef JIEF_DEBUG // always the case in VMWare
|
||||
DBG("Ignoring insane frequency value %dMHz\n", SmbiosTable.Type17->Speed);
|
||||
#endif
|
||||
}
|
||||
// Fill rest of information if in use
|
||||
if (gRAM.SMBIOS[Index].InUse) {
|
||||
|
@ -73,6 +73,18 @@ public:
|
||||
vS8Printf(format, va);
|
||||
va_end(va);
|
||||
}
|
||||
void vS8Catf(const char* format, va_list va)
|
||||
{
|
||||
vprintf_with_callback(format, va, transmitS8Printf, this);
|
||||
}
|
||||
void S8Catf(const char* format, ...) __attribute__((__format__(__printf__, 2, 3)))
|
||||
{
|
||||
va_list va;
|
||||
|
||||
va_start (va, format);
|
||||
vS8Catf(format, va);
|
||||
va_end(va);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019 Jief Luce.
|
||||
* Copyright (c) 2019 Jief.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
|
276
rEFIt_UEFI/cpp_unit_test/MacOsVersion_test.cpp
Normal file
276
rEFIt_UEFI/cpp_unit_test/MacOsVersion_test.cpp
Normal file
@ -0,0 +1,276 @@
|
||||
#include <Platform.h> // Only use angled for Platform, else, xcode project won't compile
|
||||
#include "../Platform/MacOsVersion.h"
|
||||
#include "../cpp_foundation/XStringArray.h"
|
||||
|
||||
//
|
||||
//static BOOLEAN IsOSValid_OLDOLD(const XString8& MatchOS, const XString8& CurrOS)
|
||||
//{
|
||||
// /* example for valid matches are:
|
||||
// 10.7, only 10.7 (10.7.1 will be skipped)
|
||||
// 10.10.2 only 10.10.2 (10.10.1 or 10.10.5 will be skipped)
|
||||
// 10.10.x (or 10.10.X), in this case is valid for all minor version of 10.10 (10.10.(0-9))
|
||||
// */
|
||||
//
|
||||
// BOOLEAN ret = FALSE;
|
||||
//
|
||||
// if (MatchOS.isEmpty() || CurrOS.isEmpty()) {
|
||||
// return TRUE; //undefined matched corresponds to old behavior
|
||||
// }
|
||||
//
|
||||
//// osToc = GetStrArraySeparatedByChar(MatchOS, '.');
|
||||
// XString8Array macthOsToc = Split<XString8Array>(MatchOS, "."_XS8).trimEachString();
|
||||
// XString8Array currOStoc = Split<XString8Array>(CurrOS, "."_XS8).trimEachString();
|
||||
//
|
||||
// if (macthOsToc.size() == 2) {
|
||||
// if (currOStoc.size() == 2) {
|
||||
// if ( macthOsToc[0] == currOStoc[0] && macthOsToc[1] == currOStoc[1]) {
|
||||
// ret = TRUE;
|
||||
// }
|
||||
// }
|
||||
// } else if (macthOsToc.size() == 3) {
|
||||
// if (currOStoc.size() == 3) {
|
||||
// if ( macthOsToc[0] == currOStoc[0]
|
||||
// && macthOsToc[1] == currOStoc[1]
|
||||
// && macthOsToc[2] == currOStoc[2]) {
|
||||
// ret = TRUE;
|
||||
// } else if ( macthOsToc[0] == currOStoc[0]
|
||||
// && macthOsToc[1] == currOStoc[1]
|
||||
// && macthOsToc[2].equalIC("x") ) {
|
||||
// ret = TRUE;
|
||||
// }
|
||||
// } else if (currOStoc.size() == 2) {
|
||||
// if ( macthOsToc[0] == currOStoc[0]
|
||||
// && macthOsToc[1] == currOStoc[1] ) {
|
||||
// ret = TRUE;
|
||||
// } else if ( macthOsToc[0] == currOStoc[0]
|
||||
// && macthOsToc[1] == currOStoc[1]
|
||||
// && macthOsToc[2].equalIC("x") == 0 ) {
|
||||
// ret = TRUE;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return ret;
|
||||
//}
|
||||
//
|
||||
|
||||
|
||||
static BOOLEAN IsOSValid_OLD(const XString8& MatchOS, const XString8& CurrOS)
|
||||
{
|
||||
/* example for valid matches are:
|
||||
10.7, only 10.7 (10.7.1 will be skipped)
|
||||
10.10.2 only 10.10.2 (10.10.1 or 10.10.5 will be skipped)
|
||||
10.10.x (or 10.10.X), in this case is valid for all minor version of 10.10 (10.10.(0-9))
|
||||
*/
|
||||
|
||||
BOOLEAN ret = FALSE;
|
||||
|
||||
if (MatchOS.isEmpty() || CurrOS.isEmpty()) {
|
||||
return TRUE; //undefined matched corresponds to old behavior
|
||||
}
|
||||
|
||||
// osToc = GetStrArraySeparatedByChar(MatchOS, '.');
|
||||
XString8Array osToc = Split<XString8Array>(MatchOS, "."_XS8).trimEachString();
|
||||
XString8Array currOStoc = Split<XString8Array>(CurrOS, "."_XS8).trimEachString();
|
||||
|
||||
if ( osToc.size() > 0 && currOStoc.size() > 0 && osToc[0] == "11"_XS8 && currOStoc[0] == "11"_XS8 ) {
|
||||
if (osToc.size() == 1 ) return true;
|
||||
if (osToc.size() == 2 ) {
|
||||
if ( osToc[1].equalIC("x") ) return true;
|
||||
if ( currOStoc.size() == 2 && osToc[1] == currOStoc[1] ) return true;
|
||||
}
|
||||
}
|
||||
if (osToc.size() == 2) {
|
||||
if (currOStoc.size() == 2) {
|
||||
if ( osToc[0] == currOStoc[0] && osToc[1] == currOStoc[1]) {
|
||||
ret = TRUE;
|
||||
}
|
||||
}
|
||||
} else if (osToc.size() == 3) {
|
||||
if (currOStoc.size() == 3) {
|
||||
if ( osToc[0] == currOStoc[0]
|
||||
&& osToc[1] == currOStoc[1]
|
||||
&& osToc[2] == currOStoc[2]) {
|
||||
ret = TRUE;
|
||||
} else if ( osToc[0] == currOStoc[0]
|
||||
&& osToc[1] == currOStoc[1]
|
||||
&& osToc[2].equalIC("x") ) {
|
||||
ret = TRUE;
|
||||
}
|
||||
} else if (currOStoc.size() == 2) {
|
||||
if ( osToc[0] == currOStoc[0]
|
||||
&& osToc[1] == currOStoc[1] ) {
|
||||
ret = TRUE;
|
||||
} else if ( osToc[0] == currOStoc[0]
|
||||
&& osToc[1] == currOStoc[1]
|
||||
&& osToc[2].equalIC("x") == 0 ) {
|
||||
ret = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int breakpoint(int v)
|
||||
{
|
||||
return v;
|
||||
}
|
||||
|
||||
int MacOsVersion_tests()
|
||||
{
|
||||
{
|
||||
int vArray[5] = {9, 9, 9, -1, -1};
|
||||
MacOsVersion v(vArray);
|
||||
if ( v.elementAt(0) != 9 ) return breakpoint(1);
|
||||
if ( v.elementAt(1) != 9 ) return breakpoint(2);
|
||||
if ( v.elementAt(2) != 9 ) return breakpoint(3);
|
||||
if ( v.elementAt(3) != -1 ) return breakpoint(4);
|
||||
}
|
||||
{
|
||||
MacOsVersion v("10.10.10"_XS8);
|
||||
if ( v.elementAt(0) != 10 ) return breakpoint(1);
|
||||
if ( v.elementAt(1) != 10 ) return breakpoint(2);
|
||||
if ( v.elementAt(2) != 10 ) return breakpoint(3);
|
||||
if ( v.elementAt(3) != -1 ) return breakpoint(4);
|
||||
}
|
||||
|
||||
if ( ! ( MacOsVersion("10.10.10"_XS8) == MacOsVersion("10.10.10"_XS8) ) ) return breakpoint(20);
|
||||
if ( ! ( MacOsVersion("10.10.10"_XS8) != MacOsVersion("10.10.10.0"_XS8) ) ) return breakpoint(20);
|
||||
if ( ! ( MacOsVersion("10.10.10"_XS8) != MacOsVersion("10.10.9"_XS8) ) ) return breakpoint(21);
|
||||
|
||||
|
||||
if ( ! ( MacOsVersion("10.10.10"_XS8) <= MacOsVersion("10.10.10"_XS8) ) ) return breakpoint(20);
|
||||
if ( ! ( MacOsVersion("10.10.10"_XS8) >= MacOsVersion("10.10.10"_XS8) ) ) return breakpoint(20);
|
||||
|
||||
if ( ! ( MacOsVersion("9.10.10"_XS8) < MacOsVersion("10.10.10"_XS8) ) ) return breakpoint(20);
|
||||
if ( ! ( MacOsVersion("10.9.10"_XS8) < MacOsVersion("10.10.10"_XS8) ) ) return breakpoint(20);
|
||||
if ( ! ( MacOsVersion("10.10.9"_XS8) < MacOsVersion("10.10.10"_XS8) ) ) return breakpoint(20);
|
||||
if ( ! ( MacOsVersion("10.10.10"_XS8) < MacOsVersion("10.10.10.0"_XS8) ) ) return breakpoint(20);
|
||||
|
||||
if ( ! ( MacOsVersion("9.10.10"_XS8) <= MacOsVersion("10.10.10"_XS8) ) ) return breakpoint(20);
|
||||
if ( ! ( MacOsVersion("10.9.10"_XS8) <= MacOsVersion("10.10.10"_XS8) ) ) return breakpoint(20);
|
||||
if ( ! ( MacOsVersion("10.10.9"_XS8) <= MacOsVersion("10.10.10"_XS8) ) ) return breakpoint(20);
|
||||
if ( ! ( MacOsVersion("10.10.10"_XS8) <= MacOsVersion("10.10.10.0"_XS8) ) ) return breakpoint(20);
|
||||
|
||||
if ( ! ( MacOsVersion("10.10.10"_XS8) > MacOsVersion("9.10.10"_XS8) ) ) return breakpoint(20);
|
||||
if ( ! ( MacOsVersion("10.10.10"_XS8) > MacOsVersion("10.9.10"_XS8) ) ) return breakpoint(20);
|
||||
if ( ! ( MacOsVersion("10.10.10"_XS8) > MacOsVersion("10.10.9"_XS8) ) ) return breakpoint(20);
|
||||
if ( ! ( MacOsVersion("10.10.10.0"_XS8) > MacOsVersion("10.10.10"_XS8) ) ) return breakpoint(20);
|
||||
|
||||
if ( ! ( MacOsVersion("10.10.10"_XS8) >= MacOsVersion("9.10.10"_XS8) ) ) return breakpoint(20);
|
||||
if ( ! ( MacOsVersion("10.10.10"_XS8) >= MacOsVersion("10.9.10"_XS8) ) ) return breakpoint(20);
|
||||
if ( ! ( MacOsVersion("10.10.10"_XS8) >= MacOsVersion("10.10.9"_XS8) ) ) return breakpoint(20);
|
||||
if ( ! ( MacOsVersion("10.10.10.0"_XS8) >= MacOsVersion("10.10.10"_XS8) ) ) return breakpoint(20);
|
||||
|
||||
if ( ! ( MacOsVersion() == MacOsVersion() ) == true ) return breakpoint(20);
|
||||
if ( ! ( MacOsVersion() != MacOsVersion() ) == false ) return breakpoint(20);
|
||||
if ( ! ( MacOsVersion() < MacOsVersion() ) == false ) return breakpoint(20);
|
||||
if ( ! ( MacOsVersion() <= MacOsVersion() ) == true ) return breakpoint(20);
|
||||
if ( ! ( MacOsVersion() > MacOsVersion() ) == false ) return breakpoint(20);
|
||||
if ( ! ( MacOsVersion() >= MacOsVersion() ) == true ) return breakpoint(20);
|
||||
if ( ! ( MacOsVersion() < MacOsVersion("10.10.10"_XS8) ) == true ) return breakpoint(20);
|
||||
if ( ! ( MacOsVersion() <= MacOsVersion("10.10.10"_XS8) ) == true ) return breakpoint(20);
|
||||
if ( ! ( MacOsVersion() > MacOsVersion("10.10.10"_XS8) ) == false ) return breakpoint(20);
|
||||
if ( ! ( MacOsVersion() >= MacOsVersion("10.10.10"_XS8) ) == false ) return breakpoint(20);
|
||||
|
||||
|
||||
if ( ! ( MacOsVersion().asString() == ""_XS8 ) ) return breakpoint(20);
|
||||
if ( ! ( MacOsVersion("1"_XS8).asString() == "1"_XS8 ) ) return breakpoint(20);
|
||||
if ( ! ( MacOsVersion("1.2"_XS8).asString() == "1.2"_XS8 ) ) return breakpoint(20);
|
||||
if ( ! ( MacOsVersion("1.2.3"_XS8).asString() == "1.2.3"_XS8 ) ) return breakpoint(20);
|
||||
if ( ! ( MacOsVersion("10.10.10.0"_XS8).asString() == "10.10.10.0"_XS8 ) ) return breakpoint(20);
|
||||
|
||||
if ( ! ( MacOsVersion("10.10.10.0"_XS8).asString(1) == "10"_XS8 ) ) return breakpoint(20);
|
||||
if ( ! ( MacOsVersion("10.10.10.0"_XS8).asString(2) == "10.10"_XS8 ) ) return breakpoint(20);
|
||||
if ( ! ( MacOsVersion("10.10.10.0"_XS8).asString(3) == "10.10.10"_XS8 ) ) return breakpoint(20);
|
||||
|
||||
|
||||
if ( ! ( IsOSValid_OLD("10"_XS8, "10"_XS8 ) == false ) ) return breakpoint(100);
|
||||
if ( ! ( IsOSValid_OLD("10"_XS8, "10.1"_XS8 ) == false ) ) return breakpoint(100);
|
||||
if ( ! ( IsOSValid_OLD("10"_XS8, "10.1.2"_XS8) == false ) ) return breakpoint(100);
|
||||
if ( ! ( IsOSValid_OLD("10.1"_XS8, "10"_XS8 ) == false ) ) return breakpoint(100);
|
||||
if ( ! ( IsOSValid_OLD("10.1"_XS8, "10.1"_XS8 ) == true ) ) return breakpoint(100);
|
||||
if ( ! ( IsOSValid_OLD("10.1"_XS8, "10.1.2"_XS8) == false ) ) return breakpoint(100);
|
||||
if ( ! ( IsOSValid_OLD("10.x"_XS8, "10"_XS8 ) == false ) ) return breakpoint(100);
|
||||
if ( ! ( IsOSValid_OLD("10.x"_XS8, "10.1"_XS8 ) == false ) ) return breakpoint(100);
|
||||
if ( ! ( IsOSValid_OLD("10.x"_XS8, "10.1.2"_XS8) == false ) ) return breakpoint(100);
|
||||
if ( ! ( IsOSValid_OLD("10.1.2"_XS8, "10"_XS8 ) == false ) ) return breakpoint(100);
|
||||
if ( ! ( IsOSValid_OLD("10.1.2"_XS8, "10.1"_XS8 ) == true ) ) return breakpoint(100);
|
||||
if ( ! ( IsOSValid_OLD("10.1.2"_XS8, "10.1.2"_XS8) == true ) ) return breakpoint(100);
|
||||
if ( ! ( IsOSValid_OLD("10.1.x"_XS8, "10"_XS8 ) == false ) ) return breakpoint(100);
|
||||
if ( ! ( IsOSValid_OLD("10.1.x"_XS8, "10.1"_XS8 ) == true ) ) return breakpoint(100);
|
||||
if ( ! ( IsOSValid_OLD("10.1.x"_XS8, "10.1.2"_XS8) == true ) ) return breakpoint(100);
|
||||
if ( ! ( IsOSValid_OLD("10.x.2"_XS8, "10"_XS8 ) == false ) ) return breakpoint(100);
|
||||
if ( ! ( IsOSValid_OLD("10.x.2"_XS8, "10.1"_XS8 ) == false ) ) return breakpoint(100);
|
||||
if ( ! ( IsOSValid_OLD("10.x.2"_XS8, "10.1.2"_XS8) == false ) ) return breakpoint(100);
|
||||
if ( ! ( IsOSValid_OLD("10.x.x"_XS8, "10"_XS8 ) == false ) ) return breakpoint(100);
|
||||
if ( ! ( IsOSValid_OLD("10.x.x"_XS8, "10.1"_XS8 ) == false ) ) return breakpoint(100);
|
||||
if ( ! ( IsOSValid_OLD("10.x.x"_XS8, "10.1.2"_XS8) == false ) ) return breakpoint(100);
|
||||
|
||||
if ( ! ( IsOSValid_OLD("11"_XS8, "11.1"_XS8) == true ) ) return breakpoint(100); // jief : mistake?
|
||||
if ( ! ( IsOSValid_OLD("11.1"_XS8, "11.1"_XS8) == true ) ) return breakpoint(100);
|
||||
if ( ! ( IsOSValid_OLD("11.1"_XS8, "11.1.2"_XS8) == false ) ) return breakpoint(100);
|
||||
if ( ! ( IsOSValid_OLD("11.x"_XS8, "11.1.2"_XS8) == true ) ) return breakpoint(100);
|
||||
if ( ! ( IsOSValid_OLD("11.1.2"_XS8, "11.1"_XS8) == true ) ) return breakpoint(100); // I beleive this is a mistake.
|
||||
if ( ! ( IsOSValid_OLD("11.1.x"_XS8, "11.1"_XS8) == true ) ) return breakpoint(100);
|
||||
if ( ! ( IsOSValid_OLD("11.1.2"_XS8, "11.1.2"_XS8) == true ) ) return breakpoint(100);
|
||||
if ( ! ( IsOSValid_OLD("11.1.x"_XS8, "11.1.2"_XS8) == true ) ) return breakpoint(100);
|
||||
if ( ! ( IsOSValid_OLD("11"_XS8, "11.1.2"_XS8) == true ) ) return breakpoint(100); // jief : mistake?
|
||||
if ( ! ( IsOSValid_OLD("11.1"_XS8, "11.1.2"_XS8) == false ) ) return breakpoint(100);
|
||||
|
||||
|
||||
if ( ! ( MacOsVersion("10"_XS8 ).match(MacOsVersionPattern("10"_XS8)) == true ) ) return breakpoint(100);
|
||||
if ( ! ( MacOsVersion("10.1"_XS8 ).match(MacOsVersionPattern("10"_XS8)) == false ) ) return breakpoint(100);
|
||||
if ( ! ( MacOsVersion("10.1.2"_XS8).match(MacOsVersionPattern("10"_XS8)) == false ) ) return breakpoint(100);
|
||||
if ( ! ( MacOsVersion("10"_XS8 ).match(MacOsVersionPattern("10.1"_XS8)) == false ) ) return breakpoint(100);
|
||||
if ( ! ( MacOsVersion("10.1"_XS8 ).match(MacOsVersionPattern("10.1"_XS8)) == true ) ) return breakpoint(100);
|
||||
if ( ! ( MacOsVersion("10.1.2"_XS8).match(MacOsVersionPattern("10.1"_XS8)) == false ) ) return breakpoint(100);
|
||||
if ( ! ( MacOsVersion("10"_XS8 ).match(MacOsVersionPattern("10.x"_XS8)) == true ) ) return breakpoint(100);
|
||||
if ( ! ( MacOsVersion("10.1"_XS8 ).match(MacOsVersionPattern("10.x"_XS8)) == true ) ) return breakpoint(100);
|
||||
if ( ! ( MacOsVersion("10.1.2"_XS8).match(MacOsVersionPattern("10.x"_XS8)) == true ) ) return breakpoint(100);
|
||||
if ( ! ( MacOsVersion("10"_XS8 ).match(MacOsVersionPattern("10.1.2"_XS8)) == false ) ) return breakpoint(100);
|
||||
if ( ! ( MacOsVersion("10.1"_XS8 ).match(MacOsVersionPattern("10.1.2"_XS8)) == false ) ) return breakpoint(100);
|
||||
if ( ! ( MacOsVersion("10.1.2"_XS8).match(MacOsVersionPattern("10.1.2"_XS8)) == true ) ) return breakpoint(100);
|
||||
if ( ! ( MacOsVersion("10"_XS8 ).match(MacOsVersionPattern("10.1.x"_XS8)) == false ) ) return breakpoint(100);
|
||||
if ( ! ( MacOsVersion("10.1"_XS8 ).match(MacOsVersionPattern("10.1.x"_XS8)) == true ) ) return breakpoint(100);
|
||||
if ( ! ( MacOsVersion("10.1.2"_XS8).match(MacOsVersionPattern("10.1.x"_XS8)) == true ) ) return breakpoint(100);
|
||||
if ( ! ( MacOsVersion("10"_XS8 ).match(MacOsVersionPattern("10.x.2"_XS8)) == false ) ) return breakpoint(100);
|
||||
if ( ! ( MacOsVersion("10.1"_XS8 ).match(MacOsVersionPattern("10.x.2"_XS8)) == false ) ) return breakpoint(100);
|
||||
if ( ! ( MacOsVersion("10.1.2"_XS8).match(MacOsVersionPattern("10.x.2"_XS8)) == true ) ) return breakpoint(100);
|
||||
if ( ! ( MacOsVersion("10"_XS8 ).match(MacOsVersionPattern("10.x.x"_XS8)) == false ) ) return breakpoint(100);
|
||||
if ( ! ( MacOsVersion("10.1"_XS8 ).match(MacOsVersionPattern("10.x.x"_XS8)) == true ) ) return breakpoint(100);
|
||||
if ( ! ( MacOsVersion("10.1.2"_XS8).match(MacOsVersionPattern("10.x.x"_XS8)) == true ) ) return breakpoint(100);
|
||||
|
||||
if ( ! ( MacOsVersion("11"_XS8 ).match(MacOsVersionPattern("11"_XS8)) == true ) ) return breakpoint(100);
|
||||
if ( ! ( MacOsVersion("11.1"_XS8 ).match(MacOsVersionPattern("11"_XS8)) == false ) ) return breakpoint(100);
|
||||
if ( ! ( MacOsVersion("11.1.2"_XS8).match(MacOsVersionPattern("11"_XS8)) == false ) ) return breakpoint(100);
|
||||
if ( ! ( MacOsVersion("11"_XS8 ).match(MacOsVersionPattern("11.1"_XS8)) == false ) ) return breakpoint(100);
|
||||
if ( ! ( MacOsVersion("11.1"_XS8 ).match(MacOsVersionPattern("11.1"_XS8)) == true ) ) return breakpoint(100);
|
||||
if ( ! ( MacOsVersion("11.1.2"_XS8).match(MacOsVersionPattern("11.1"_XS8)) == false ) ) return breakpoint(100);
|
||||
if ( ! ( MacOsVersion("11"_XS8 ).match(MacOsVersionPattern("11.x"_XS8)) == true ) ) return breakpoint(100);
|
||||
if ( ! ( MacOsVersion("11.1"_XS8 ).match(MacOsVersionPattern("11.x"_XS8)) == true ) ) return breakpoint(100);
|
||||
if ( ! ( MacOsVersion("11.1.2"_XS8).match(MacOsVersionPattern("11.x"_XS8)) == true ) ) return breakpoint(100);
|
||||
if ( ! ( MacOsVersion("11"_XS8 ).match(MacOsVersionPattern("11.1.2"_XS8)) == false ) ) return breakpoint(100);
|
||||
if ( ! ( MacOsVersion("11.1"_XS8 ).match(MacOsVersionPattern("11.1.2"_XS8)) == false ) ) return breakpoint(100);
|
||||
if ( ! ( MacOsVersion("11.1.2"_XS8).match(MacOsVersionPattern("11.1.2"_XS8)) == true ) ) return breakpoint(100);
|
||||
if ( ! ( MacOsVersion("11"_XS8 ).match(MacOsVersionPattern("11.1.x"_XS8)) == false ) ) return breakpoint(100);
|
||||
if ( ! ( MacOsVersion("11.1"_XS8 ).match(MacOsVersionPattern("11.1.x"_XS8)) == true ) ) return breakpoint(100);
|
||||
if ( ! ( MacOsVersion("11.1.2"_XS8).match(MacOsVersionPattern("11.1.x"_XS8)) == true ) ) return breakpoint(100);
|
||||
if ( ! ( MacOsVersion("11"_XS8 ).match(MacOsVersionPattern("11.x.2"_XS8)) == false ) ) return breakpoint(100);
|
||||
if ( ! ( MacOsVersion("11.1"_XS8 ).match(MacOsVersionPattern("11.x.2"_XS8)) == false ) ) return breakpoint(100);
|
||||
if ( ! ( MacOsVersion("11.1.2"_XS8).match(MacOsVersionPattern("11.x.2"_XS8)) == true ) ) return breakpoint(100);
|
||||
if ( ! ( MacOsVersion("11"_XS8 ).match(MacOsVersionPattern("11.x.x"_XS8)) == false ) ) return breakpoint(100);
|
||||
if ( ! ( MacOsVersion("11.1"_XS8 ).match(MacOsVersionPattern("11.x.x"_XS8)) == true ) ) return breakpoint(100);
|
||||
if ( ! ( MacOsVersion("11.1.2"_XS8).match(MacOsVersionPattern("11.x.x"_XS8)) == true ) ) return breakpoint(100);
|
||||
|
||||
|
||||
|
||||
if ( ! ( MacOsVersion("10.1.2"_XS8).match(MacOsVersionPattern("x"_XS8)) == true ) ) return breakpoint(100);
|
||||
if ( ! ( MacOsVersion("10.1.2"_XS8).match(MacOsVersionPattern("x.x"_XS8)) == true ) ) return breakpoint(100);
|
||||
if ( ! ( MacOsVersion("10.1.2"_XS8).match(MacOsVersionPattern("x.1.2"_XS8)) == true ) ) return breakpoint(100);
|
||||
if ( ! ( MacOsVersion("10.1.2"_XS8).match(MacOsVersionPattern("x.x.2"_XS8)) == true ) ) return breakpoint(100);
|
||||
if ( ! ( MacOsVersion("10.1.2"_XS8).match(MacOsVersionPattern("xxX.XXx.2"_XS8)) == true ) ) return breakpoint(100);
|
||||
if ( ! ( MacOsVersion("10.1.2"_XS8).match(MacOsVersionPattern("xx.xx.XX.XX"_XS8)) == true ) ) return breakpoint(100);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
3
rEFIt_UEFI/cpp_unit_test/MacOsVersion_test.h
Normal file
3
rEFIt_UEFI/cpp_unit_test/MacOsVersion_test.h
Normal file
@ -0,0 +1,3 @@
|
||||
|
||||
|
||||
int MacOsVersion_tests();
|
@ -18,6 +18,7 @@
|
||||
#include "plist_tests.h"
|
||||
#include "find_replace_mask_Clover_tests.h"
|
||||
#include "find_replace_mask_OC_tests.h"
|
||||
#include "MacOsVersion_test.h"
|
||||
|
||||
#if defined(JIEF_DEBUG) && defined(CLOVER_BUILD)
|
||||
#include "printlib-test.h"
|
||||
@ -41,6 +42,11 @@ bool all_tests()
|
||||
// all_ok = false;
|
||||
// }
|
||||
#if defined(JIEF_DEBUG)
|
||||
ret = MacOsVersion_tests();
|
||||
if ( ret != 0 ) {
|
||||
printf("MacOsVersion_tests() failed at test %d\n", ret);
|
||||
all_ok = false;
|
||||
}
|
||||
ret = find_replace_mask_Clover_tests();
|
||||
if ( ret != 0 ) {
|
||||
printf("xml_lite_tests() failed at test %d\n", ret);
|
||||
|
@ -935,4 +935,5 @@ int plist_tests()
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -212,20 +212,20 @@ int printf_lite_tests(void)
|
||||
|
||||
|
||||
// Check %s with width specifier
|
||||
Test1arg(F("|a|"), F("|%4s|"), "a");
|
||||
Test1arg(F("|aa|"), F("|%4s|"), "aa");
|
||||
Test1arg(F("|aaa|"), F("|%4s|"), "aaa");
|
||||
Test1arg(F("|aaaa|"), F("|%4s|"), "aaaa");
|
||||
Test1arg(F("|aaaa|"), F("|%4s|"), "aaaaa");
|
||||
Test1arg(F("|aaaa|"), F("|%4s|"), "aaaaaa");
|
||||
Test1arg(F("|a|"), F("|%.4s|"), "a");
|
||||
Test1arg(F("|aa|"), F("|%.4s|"), "aa");
|
||||
Test1arg(F("|aaa|"), F("|%.4s|"), "aaa");
|
||||
Test1arg(F("|aaaa|"), F("|%.4s|"), "aaaa");
|
||||
Test1arg(F("|aaaa|"), F("|%.4s|"), "aaaaa");
|
||||
Test1arg(F("|aaaa|"), F("|%.4s|"), "aaaaaa");
|
||||
|
||||
// Check %ls with width specifier
|
||||
Test1arg(F("|a|"), F("|%4ls|"), L"a");
|
||||
Test1arg(F("|aa|"), F("|%4ls|"), L"aa");
|
||||
Test1arg(F("|aaa|"), F("|%4ls|"), L"aaa");
|
||||
Test1arg(F("|aaaa|"), F("|%4ls|"), L"aaaa");
|
||||
Test1arg(F("|aaaa|"), F("|%4ls|"), L"aaaaa");
|
||||
Test1arg(F("|aaaa|"), F("|%4ls|"), L"aaaaaa");
|
||||
Test1arg(F("|a|"), F("|%.4ls|"), L"a");
|
||||
Test1arg(F("|aa|"), F("|%.4ls|"), L"aa");
|
||||
Test1arg(F("|aaa|"), F("|%.4ls|"), L"aaa");
|
||||
Test1arg(F("|aaaa|"), F("|%.4ls|"), L"aaaa");
|
||||
Test1arg(F("|aaaa|"), F("|%.4ls|"), L"aaaaa");
|
||||
Test1arg(F("|aaaa|"), F("|%.4ls|"), L"aaaaaa");
|
||||
|
||||
|
||||
// These must always works. It also test that integer type are well defined
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include "../Platform/APFS.h"
|
||||
#include "../Platform/cpu.h"
|
||||
#include "../gui/REFIT_MENU_SCREEN.h"
|
||||
#include "../include/OsType.h"
|
||||
|
||||
#ifndef DEBUG_ALL
|
||||
#define DEBUG_COMMON_MENU 1
|
||||
|
@ -47,6 +47,7 @@
|
||||
#include "../refit/lib.h"
|
||||
#include "../gui/REFIT_MENU_SCREEN.h"
|
||||
#include "Self.h"
|
||||
#include "../include/OsType.h"
|
||||
|
||||
#ifndef DEBUG_ALL
|
||||
#define DEBUG_SCAN_LOADER 1
|
||||
@ -604,6 +605,14 @@ STATIC LOADER_ENTRY *CreateLoaderEntry(IN CONST XStringW& LoaderPath,
|
||||
|
||||
Entry->LoaderType = OSType;
|
||||
Entry->BuildVersion.setEmpty();
|
||||
#ifdef JIEF_DEBUG
|
||||
if ( Entry->LoaderPath.contains("com.apple.installer") ) {
|
||||
DBG("%s", "");
|
||||
}
|
||||
if ( Entry->APFSTargetUUID.startWith("99999999") ) {
|
||||
DBG("%s", "");
|
||||
}
|
||||
#endif
|
||||
Entry->OSVersion = GetOSVersion(Entry);
|
||||
//DBG("OSVersion=%s \n", Entry->OSVersion);
|
||||
// detect specific loaders
|
||||
@ -778,17 +787,17 @@ void LOADER_ENTRY::AddDefaultMenu()
|
||||
UINT64 VolumeSize;
|
||||
EFI_GUID *Guid = NULL;
|
||||
BOOLEAN KernelIs64BitOnly;
|
||||
UINT64 os_version = AsciiOSVersionToUint64(OSVersion);
|
||||
// UINT64 os_version = AsciiOSVersionToUint64(OSVersion);
|
||||
|
||||
constexpr LString8 quietLitteral = "quiet";
|
||||
constexpr LString8 splashLitteral = "splash";
|
||||
|
||||
// Only kernels up to 10.7 have 32-bit mode
|
||||
KernelIs64BitOnly = (OSVersion.isEmpty() ||
|
||||
os_version >= AsciiOSVersionToUint64("10.8"_XS8));
|
||||
OSVersion >= MacOsVersion("10.8"_XS8));
|
||||
|
||||
const char* macOS = (os_version < AsciiOSVersionToUint64("10.8"_XS8))? "Mac OS X" :
|
||||
(os_version < AsciiOSVersionToUint64("10.12"_XS8))? "OS X" : "macOS";
|
||||
const char* macOS = (OSVersion.notEmpty() && OSVersion < MacOsVersion("10.8"_XS8))? "Mac OS X" :
|
||||
(OSVersion.notEmpty() && OSVersion < MacOsVersion("10.12"_XS8))? "OS X" : "macOS";
|
||||
|
||||
FileName = LoaderPath.basename();
|
||||
|
||||
@ -824,7 +833,7 @@ void LOADER_ENTRY::AddDefaultMenu()
|
||||
if (LoaderType == OSTYPE_OSX ||
|
||||
LoaderType == OSTYPE_OSX_INSTALLER ||
|
||||
LoaderType == OSTYPE_RECOVERY) { // entries for Mac OS X
|
||||
SubScreen->AddMenuInfoLine_f("%s: %s", macOS, OSVersion.c_str());
|
||||
SubScreen->AddMenuInfoLine_f("%s: %s", macOS, OSVersion.asString().c_str());
|
||||
|
||||
if (OSFLAG_ISSET(Flags, OSFLAG_HIBERNATED)) {
|
||||
SubEntry = getPartiallyDuplicatedEntry();
|
||||
@ -860,7 +869,7 @@ void LOADER_ENTRY::AddDefaultMenu()
|
||||
SubScreen->AddMenuEntry(SubMenuKextInjectMgmt(), true);
|
||||
SubScreen->AddMenuInfo_f("=== boot-args ===");
|
||||
if (!KernelIs64BitOnly) {
|
||||
if (os_version < AsciiOSVersionToUint64("10.8"_XS8)) {
|
||||
if ( OSVersion.notEmpty() && OSVersion < MacOsVersion("10.8"_XS8) ) {
|
||||
SubScreen->AddMenuCheck("Mac OS X 32bit", OPT_I386, 68);
|
||||
}
|
||||
// SubScreen->AddMenuCheck(XString8().SPrintf("%s 64bit", macOS).c_str(), OPT_X64, 68);
|
||||
@ -868,7 +877,7 @@ void LOADER_ENTRY::AddDefaultMenu()
|
||||
}
|
||||
SubScreen->AddMenuCheck("Verbose (-v)", OPT_VERBOSE, 68);
|
||||
// No Caches option works on 10.6 - 10.9
|
||||
if (os_version < AsciiOSVersionToUint64("10.10"_XS8)) {
|
||||
if ( OSVersion.notEmpty() && OSVersion < MacOsVersion("10.10"_XS8) ) {
|
||||
SubScreen->AddMenuCheck("Without caches (-f)", OPT_NOCACHES, 68);
|
||||
}
|
||||
SubScreen->AddMenuCheck("Single User (-s)", OPT_SINGLE_USER, 68);
|
||||
|
@ -45,6 +45,7 @@
|
||||
#include "../../cpp_foundation/XStringArray.h"
|
||||
#include "../../cpp_foundation/XString.h"
|
||||
#include "../../libeg/XPointer.h"
|
||||
#include "../../Platform/MacOsVersion.h"
|
||||
|
||||
|
||||
//
|
||||
@ -370,7 +371,7 @@ class REFIT_ABSTRACT_MENU_ENTRY
|
||||
EFI_DEVICE_PATH *DevicePath;
|
||||
UINT16 Flags;
|
||||
UINT8 LoaderType;
|
||||
XString8 OSVersion;
|
||||
MacOsVersion OSVersion;
|
||||
XString8 BuildVersion;
|
||||
EFI_GRAPHICS_OUTPUT_BLT_PIXEL BootBgColor;
|
||||
|
||||
@ -458,7 +459,7 @@ class REFIT_ABSTRACT_MENU_ENTRY
|
||||
|
||||
EFI_STATUS SetFSInjection();
|
||||
EFI_STATUS InjectKexts(IN UINT32 deviceTreeP, IN UINT32 *deviceTreeLength);
|
||||
EFI_STATUS LoadKexts();
|
||||
// EFI_STATUS LoadKexts();
|
||||
// int is_mkext_v1(UINT8* drvPtr);
|
||||
// void patch_mkext_v1(UINT8 *drvPtr); //not used
|
||||
|
||||
|
@ -113,7 +113,7 @@ void DecodeOptions(REFIT_MENU_ITEM_BOOTNUM *Entry)
|
||||
LOADER_ENTRY* loaderEntry = Entry->getLOADER_ENTRY();
|
||||
// Only for non-legacy entries, as LEGACY_ENTRY doesn't have OSVersion
|
||||
if (gSettings.OptionsBits & OPT_NVWEBON) {
|
||||
if (AsciiOSVersionToUint64(loaderEntry->OSVersion) >= AsciiOSVersionToUint64("10.12"_XS8)) {
|
||||
if ( loaderEntry->OSVersion >= MacOsVersion("10.12"_XS8) ) {
|
||||
gSettings.NvidiaWeb = TRUE;
|
||||
} else {
|
||||
//Entry->LoadOptions = loaderEntry->LoadOptions;
|
||||
@ -122,7 +122,7 @@ void DecodeOptions(REFIT_MENU_ITEM_BOOTNUM *Entry)
|
||||
}
|
||||
}
|
||||
if ((gSettings.OptionsBits & OPT_NVWEBON) == 0) {
|
||||
if (AsciiOSVersionToUint64(loaderEntry->OSVersion) >= AsciiOSVersionToUint64("10.12"_XS8)) {
|
||||
if ( loaderEntry->OSVersion >= MacOsVersion("10.12"_XS8)) {
|
||||
gSettings.NvidiaWeb = FALSE;
|
||||
} else {
|
||||
//Entry->LoadOptions = loaderEntry->LoadOptions;
|
||||
|
45
rEFIt_UEFI/include/OsType.h
Normal file
45
rEFIt_UEFI/include/OsType.h
Normal file
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* OsType.h
|
||||
*
|
||||
* Created on: Nov 12, 2020
|
||||
* Author: jief
|
||||
*/
|
||||
|
||||
#ifndef INCLUDE_OSTYPE_H_
|
||||
#define INCLUDE_OSTYPE_H_
|
||||
|
||||
|
||||
|
||||
#define OSTYPE_OSX (1)
|
||||
#define OSTYPE_WIN (2)
|
||||
#define OSTYPE_VAR (3)
|
||||
#define OSTYPE_LIN (4)
|
||||
#define OSTYPE_LINEFI (5)
|
||||
#define OSTYPE_EFI (6)
|
||||
#define OSTYPE_WINEFI (7)
|
||||
//#define OSTYPE_BOOT_OSX (9)
|
||||
#define OSTYPE_RECOVERY (10)
|
||||
#define OSTYPE_OSX_INSTALLER (11)
|
||||
/*#define OSTYPE_TIGER (14)
|
||||
#define OSTYPE_LEO (15)
|
||||
#define OSTYPE_SNOW (16)
|
||||
#define OSTYPE_LION (17)
|
||||
#define OSTYPE_ML (18)
|
||||
#define OSTYPE_MAV (19)*/
|
||||
#define OSTYPE_OTHER (99)
|
||||
//#define OSTYPE_HIDE (100)
|
||||
|
||||
#define OSTYPE_IS_OSX(type) ((type == OSTYPE_OSX) /*|| (type == OSTYPE_BOOT_OSX) || ((type >= OSTYPE_TIGER) && (type <= OSTYPE_MAV))*/ || (type == OSTYPE_VAR))
|
||||
#define OSTYPE_IS_OSX_RECOVERY(type) ((type == OSTYPE_RECOVERY) /*|| ((type >= OSTYPE_TIGER) && (type <= OSTYPE_MAV))*/ || (type == OSTYPE_VAR))
|
||||
#define OSTYPE_IS_OSX_INSTALLER(type) ((type == OSTYPE_OSX_INSTALLER) /*|| ((type >= OSTYPE_TIGER) && (type <= OSTYPE_MAV))*/ || (type == OSTYPE_VAR))
|
||||
#define OSTYPE_IS_WINDOWS(type) ((type == OSTYPE_WIN) || (type == OSTYPE_WINEFI) || (type == OSTYPE_EFI) || (type == OSTYPE_VAR))
|
||||
#define OSTYPE_IS_LINUX(type) ((type == OSTYPE_LIN) || (type == OSTYPE_EFI) || (type == OSTYPE_VAR))
|
||||
#define OSTYPE_IS_OTHER(type) ((type == OSTYPE_OTHER) || (type == OSTYPE_EFI) || (type == OSTYPE_VAR))
|
||||
#define OSTYPE_COMPARE_IMP(comparator, type1, type2) (comparator(type1) && comparator(type2))
|
||||
#define OSTYPE_COMPARE(type1, type2) (OSTYPE_COMPARE_IMP(OSTYPE_IS_OSX, type1, type2) || OSTYPE_COMPARE_IMP(OSTYPE_IS_OSX_RECOVERY, type1, type2) || \
|
||||
OSTYPE_COMPARE_IMP(OSTYPE_IS_OSX_INSTALLER, type1, type2) || OSTYPE_COMPARE_IMP(OSTYPE_IS_WINDOWS, type1, type2) || \
|
||||
OSTYPE_COMPARE_IMP(OSTYPE_IS_LINUX, type1, type2) || OSTYPE_COMPARE_IMP(OSTYPE_IS_OTHER, type1, type2))
|
||||
|
||||
|
||||
|
||||
#endif /* INCLUDE_OSTYPE_H_ */
|
@ -180,9 +180,11 @@
|
||||
Platform/LegacyBiosThunk.cpp
|
||||
Platform/LegacyBoot.h
|
||||
Platform/LegacyBoot.cpp
|
||||
Platform/memvendors.h
|
||||
Platform/MacOsVersion.cpp
|
||||
Platform/MacOsVersion.h
|
||||
Platform/MemoryOperation.h
|
||||
Platform/MemoryOperation.c
|
||||
Platform/memvendors.h
|
||||
Platform/nvidia.h
|
||||
Platform/nvidia.cpp
|
||||
Platform/Net.h
|
||||
|
@ -35,6 +35,7 @@
|
||||
*/
|
||||
|
||||
#include <Platform.h> // Only use angled for Platform, else, xcode project won't compile
|
||||
#include "../include/OsType.h"
|
||||
#include "lib.h"
|
||||
#include "screen.h"
|
||||
#include "../Platform/guid.h"
|
||||
|
@ -88,36 +88,6 @@ extern XTheme ThemeX; //global variable defined in lib.cpp
|
||||
#define BOOTING_BY_PBR (5)
|
||||
#define BOOTING_BY_CD (6)
|
||||
|
||||
#define OSTYPE_OSX (1)
|
||||
#define OSTYPE_WIN (2)
|
||||
#define OSTYPE_VAR (3)
|
||||
#define OSTYPE_LIN (4)
|
||||
#define OSTYPE_LINEFI (5)
|
||||
#define OSTYPE_EFI (6)
|
||||
#define OSTYPE_WINEFI (7)
|
||||
//#define OSTYPE_BOOT_OSX (9)
|
||||
#define OSTYPE_RECOVERY (10)
|
||||
#define OSTYPE_OSX_INSTALLER (11)
|
||||
/*#define OSTYPE_TIGER (14)
|
||||
#define OSTYPE_LEO (15)
|
||||
#define OSTYPE_SNOW (16)
|
||||
#define OSTYPE_LION (17)
|
||||
#define OSTYPE_ML (18)
|
||||
#define OSTYPE_MAV (19)*/
|
||||
#define OSTYPE_OTHER (99)
|
||||
//#define OSTYPE_HIDE (100)
|
||||
|
||||
#define OSTYPE_IS_OSX(type) ((type == OSTYPE_OSX) /*|| (type == OSTYPE_BOOT_OSX) || ((type >= OSTYPE_TIGER) && (type <= OSTYPE_MAV))*/ || (type == OSTYPE_VAR))
|
||||
#define OSTYPE_IS_OSX_RECOVERY(type) ((type == OSTYPE_RECOVERY) /*|| ((type >= OSTYPE_TIGER) && (type <= OSTYPE_MAV))*/ || (type == OSTYPE_VAR))
|
||||
#define OSTYPE_IS_OSX_INSTALLER(type) ((type == OSTYPE_OSX_INSTALLER) /*|| ((type >= OSTYPE_TIGER) && (type <= OSTYPE_MAV))*/ || (type == OSTYPE_VAR))
|
||||
#define OSTYPE_IS_WINDOWS(type) ((type == OSTYPE_WIN) || (type == OSTYPE_WINEFI) || (type == OSTYPE_EFI) || (type == OSTYPE_VAR))
|
||||
#define OSTYPE_IS_LINUX(type) ((type == OSTYPE_LIN) || (type == OSTYPE_EFI) || (type == OSTYPE_VAR))
|
||||
#define OSTYPE_IS_OTHER(type) ((type == OSTYPE_OTHER) || (type == OSTYPE_EFI) || (type == OSTYPE_VAR))
|
||||
#define OSTYPE_COMPARE_IMP(comparator, type1, type2) (comparator(type1) && comparator(type2))
|
||||
#define OSTYPE_COMPARE(type1, type2) (OSTYPE_COMPARE_IMP(OSTYPE_IS_OSX, type1, type2) || OSTYPE_COMPARE_IMP(OSTYPE_IS_OSX_RECOVERY, type1, type2) || \
|
||||
OSTYPE_COMPARE_IMP(OSTYPE_IS_OSX_INSTALLER, type1, type2) || OSTYPE_COMPARE_IMP(OSTYPE_IS_WINDOWS, type1, type2) || \
|
||||
OSTYPE_COMPARE_IMP(OSTYPE_IS_LINUX, type1, type2) || OSTYPE_COMPARE_IMP(OSTYPE_IS_OTHER, type1, type2))
|
||||
|
||||
#define OSFLAG_ISSET(flags, flag) ((flags & flag) == flag)
|
||||
#define OSFLAG_ISUNSET(flags, flag) ((flags & flag) != flag)
|
||||
#define OSFLAG_SET(flags, flag) (flags | flag)
|
||||
|
@ -74,6 +74,7 @@
|
||||
#include "Self.h"
|
||||
#include "SelfOem.h"
|
||||
#include "../Platform/Net.h"
|
||||
#include "../include/OsType.h"
|
||||
|
||||
#include "../include/OC.h"
|
||||
|
||||
@ -427,7 +428,7 @@ void LOADER_ENTRY::FilterKextPatches()
|
||||
i,
|
||||
KernelAndKextPatches.KextPatches[i].Label.c_str(),
|
||||
KernelAndKextPatches.KextPatches[i].IsPlistPatch ? "PlistPatch" : "BinPatch",
|
||||
OSVersion.c_str(),
|
||||
OSVersion.asString().c_str(),
|
||||
KernelAndKextPatches.KextPatches[i].MatchOS.notEmpty() ? KernelAndKextPatches.KextPatches[i].MatchOS.c_str() : "All",
|
||||
KernelAndKextPatches.KextPatches[i].MatchBuild.notEmpty() ? KernelAndKextPatches.KextPatches[i].MatchBuild.c_str() : "All"
|
||||
);
|
||||
@ -438,7 +439,7 @@ void LOADER_ENTRY::FilterKextPatches()
|
||||
}
|
||||
KernelAndKextPatches.KextPatches[i].MenuItem.BValue = true;
|
||||
if ((BuildVersion.notEmpty()) && (KernelAndKextPatches.KextPatches[i].MatchBuild.notEmpty())) {
|
||||
KernelAndKextPatches.KextPatches[i].MenuItem.BValue = IsPatchEnabled(KernelAndKextPatches.KextPatches[i].MatchBuild, BuildVersion);
|
||||
KernelAndKextPatches.KextPatches[i].MenuItem.BValue = IsPatchEnabledByBuildNumber(KernelAndKextPatches.KextPatches[i].MatchBuild, BuildVersion);
|
||||
DBG(" ==> %s\n", KernelAndKextPatches.KextPatches[i].MenuItem.BValue ? "allowed" : "not allowed");
|
||||
continue;
|
||||
}
|
||||
@ -457,7 +458,7 @@ void LOADER_ENTRY::FilterKernelPatches()
|
||||
DBG(" - [%02zu]: %s :: [OS: %s | MatchOS: %s | MatchBuild: %s]",
|
||||
i,
|
||||
KernelAndKextPatches.KernelPatches[i].Label.c_str(),
|
||||
OSVersion.c_str(),
|
||||
OSVersion.asString().c_str(),
|
||||
KernelAndKextPatches.KernelPatches[i].MatchOS.notEmpty() ? KernelAndKextPatches.KernelPatches[i].MatchOS.c_str() : "All",
|
||||
KernelAndKextPatches.KernelPatches[i].MatchBuild.notEmpty() ? KernelAndKextPatches.KernelPatches[i].MatchBuild.c_str() : "no"
|
||||
);
|
||||
@ -468,7 +469,7 @@ void LOADER_ENTRY::FilterKernelPatches()
|
||||
}
|
||||
KernelAndKextPatches.KernelPatches[i].MenuItem.BValue = true;
|
||||
if ((BuildVersion.notEmpty()) && (KernelAndKextPatches.KernelPatches[i].MatchBuild.notEmpty())) {
|
||||
KernelAndKextPatches.KernelPatches[i].MenuItem.BValue = IsPatchEnabled(KernelAndKextPatches.KernelPatches[i].MatchBuild, BuildVersion);
|
||||
KernelAndKextPatches.KernelPatches[i].MenuItem.BValue = IsPatchEnabledByBuildNumber(KernelAndKextPatches.KernelPatches[i].MatchBuild, BuildVersion);
|
||||
DBG(" ==> %s by build\n", KernelAndKextPatches.KernelPatches[i].MenuItem.BValue ? "allowed" : "not allowed");
|
||||
continue;
|
||||
}
|
||||
@ -487,7 +488,7 @@ void LOADER_ENTRY::FilterBootPatches()
|
||||
DBG(" - [%02zu]: %s :: [OS: %s | MatchOS: %s | MatchBuild: %s]",
|
||||
i,
|
||||
KernelAndKextPatches.BootPatches[i].Label.c_str(),
|
||||
OSVersion.c_str(),
|
||||
OSVersion.asString().c_str(),
|
||||
KernelAndKextPatches.BootPatches[i].MatchOS.notEmpty() ? KernelAndKextPatches.BootPatches[i].MatchOS.c_str() : "All",
|
||||
KernelAndKextPatches.BootPatches[i].MatchBuild.notEmpty() ? KernelAndKextPatches.BootPatches[i].MatchBuild.c_str() : "no"
|
||||
);
|
||||
@ -497,7 +498,7 @@ void LOADER_ENTRY::FilterBootPatches()
|
||||
}
|
||||
KernelAndKextPatches.BootPatches[i].MenuItem.BValue = true;
|
||||
if ((BuildVersion.notEmpty()) && (KernelAndKextPatches.BootPatches[i].MatchBuild.notEmpty())) {
|
||||
KernelAndKextPatches.BootPatches[i].MenuItem.BValue = IsPatchEnabled(KernelAndKextPatches.BootPatches[i].MatchBuild, BuildVersion);
|
||||
KernelAndKextPatches.BootPatches[i].MenuItem.BValue = IsPatchEnabledByBuildNumber(KernelAndKextPatches.BootPatches[i].MatchBuild, BuildVersion);
|
||||
DBG(" ==> %s by build\n", KernelAndKextPatches.BootPatches[i].MenuItem.BValue ? "allowed" : "not allowed");
|
||||
continue;
|
||||
}
|
||||
@ -1018,6 +1019,8 @@ DBG("Beginning OC\n");
|
||||
// Seems that Lilu must be first.
|
||||
size_t pos = setKextAtPos(&kextArray, "Lilu.kext"_XS8, 0);
|
||||
pos = setKextAtPos(&kextArray, "VirtualSMC.kext"_XS8, pos);
|
||||
pos = setKextAtPos(&kextArray, "AMDRyzenCPUPowerManagement.kext"_XS8, pos);
|
||||
pos = setKextAtPos(&kextArray, "SMCAMDProcessor.kext"_XS8, pos);
|
||||
pos = setKextAtPos(&kextArray, "WhateverGreen.kext"_XS8, pos);
|
||||
pos = setKextAtPos(&kextArray, "AppleALC.kext"_XS8, pos);
|
||||
pos = setKextAtPos(&kextArray, "IntelMausi.kext"_XS8, pos); // not needed special order?
|
||||
@ -1238,8 +1241,8 @@ DBG("Beginning OC\n");
|
||||
InstallerVersion = NULL; // flag known version was not found
|
||||
}
|
||||
if (InstallerVersion != NULL) { // known version was found in image
|
||||
OSVersion.takeValueFrom(InstallerVersion);
|
||||
DBG("Corrected OSVersion: %s\n", OSVersion.c_str());
|
||||
OSVersion = InstallerVersion;
|
||||
DBG("Corrected OSVersion: %s\n", OSVersion.asString().c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1248,12 +1251,12 @@ DBG("Beginning OC\n");
|
||||
}
|
||||
|
||||
if (BuildVersion.notEmpty()) {
|
||||
DBG(" %s (%s)\n", OSVersion.c_str(), BuildVersion.c_str());
|
||||
DBG(" %s (%s)\n", OSVersion.asString().c_str(), BuildVersion.c_str());
|
||||
} else {
|
||||
DBG(" %s\n", OSVersion.c_str());
|
||||
DBG(" %s\n", OSVersion.asString().c_str());
|
||||
}
|
||||
|
||||
if (OSVersion.notEmpty() && (AsciiOSVersionToUint64(OSVersion) >= AsciiOSVersionToUint64("10.11"_XS8))) {
|
||||
if ( OSVersion >= MacOsVersion("10.11"_XS8) ) {
|
||||
if (OSFLAG_ISSET(Flags, OSFLAG_NOSIP)) {
|
||||
gSettings.CsrActiveConfig = (UINT32)0xB7F;
|
||||
gSettings.BooterConfig = 0x28;
|
||||
@ -1274,10 +1277,10 @@ DBG("Beginning OC\n");
|
||||
if ( OSFLAG_ISSET(Flags, OSFLAG_NOCACHES) && !LoadOptions.containsStartWithIC("Kernel=") ) {
|
||||
XString8 KernelLocation;
|
||||
|
||||
if (OSVersion.notEmpty() && AsciiOSVersionToUint64(OSVersion) <= AsciiOSVersionToUint64("10.9"_XS8)) {
|
||||
if ( OSVersion.notEmpty() && OSVersion <= MacOsVersion("10.9"_XS8) ) {
|
||||
KernelLocation.S8Printf("\"Kernel=/mach_kernel\"");
|
||||
} else {
|
||||
// used for 10.10, 10.11, and new version.
|
||||
// used for 10.10, 10.11, and new version. Jief : also for unknown version.
|
||||
KernelLocation.S8Printf("\"Kernel=/System/Library/Kernels/kernel\"");
|
||||
}
|
||||
LoadOptions.AddID(KernelLocation);
|
||||
@ -1338,8 +1341,7 @@ DBG("Beginning OC\n");
|
||||
if (KernelAndKextPatches.KPKernelXCPM &&
|
||||
gCPUStructure.Vendor == CPU_VENDOR_INTEL && gCPUStructure.Model >= CPU_MODEL_HASWELL &&
|
||||
(AsciiStrStr(gCPUStructure.BrandString, "Celeron") || AsciiStrStr(gCPUStructure.BrandString, "Pentium")) &&
|
||||
(AsciiOSVersionToUint64(OSVersion) >= AsciiOSVersionToUint64("10.8.5"_XS8)) &&
|
||||
(AsciiOSVersionToUint64(OSVersion) < AsciiOSVersionToUint64("10.12"_XS8)) &&
|
||||
OSVersion >= MacOsVersion("10.8.5"_XS8) && OSVersion < MacOsVersion("10.12"_XS8) &&
|
||||
(!LoadOptions.containsIC("-xcpm"))) {
|
||||
// add "-xcpm" argv if not present on Haswell+ Celeron/Pentium
|
||||
LoadOptions.AddID("-xcpm"_XS8);
|
||||
@ -1348,8 +1350,7 @@ DBG("Beginning OC\n");
|
||||
// add -xcpm on Ivy Bridge if set KernelXCPM and system version is 10.8.5 - 10.11.x
|
||||
if (KernelAndKextPatches.KPKernelXCPM &&
|
||||
gCPUStructure.Model == CPU_MODEL_IVY_BRIDGE &&
|
||||
(AsciiOSVersionToUint64(OSVersion) >= AsciiOSVersionToUint64("10.8.5"_XS8)) &&
|
||||
(AsciiOSVersionToUint64(OSVersion) < AsciiOSVersionToUint64("10.12"_XS8)) &&
|
||||
OSVersion >= MacOsVersion("10.8.5"_XS8) && OSVersion < MacOsVersion("10.12"_XS8) &&
|
||||
(!LoadOptions.containsIC("-xcpm"))) {
|
||||
// add "-xcpm" argv if not present on Ivy Bridge
|
||||
LoadOptions.AddID("-xcpm"_XS8);
|
||||
|
@ -1807,7 +1807,7 @@ LOADER_ENTRY* LOADER_ENTRY::SubMenuKextInjectMgmt()
|
||||
REFIT_MENU_SCREEN *SubSubScreen;
|
||||
XStringW kextDir;
|
||||
// UINTN i;
|
||||
XString8 ShortOSVersion;
|
||||
// XString8 ShortOSVersion;
|
||||
// CHAR16 *UniSysVer = NULL;
|
||||
|
||||
SubEntry = new LOADER_ENTRY();
|
||||
@ -1816,57 +1816,60 @@ LOADER_ENTRY* LOADER_ENTRY::SubMenuKextInjectMgmt()
|
||||
if (OSVersion.notEmpty()) {
|
||||
// DBG("chosen os %s\n", ChosenOS);
|
||||
//shorten os version 10.11.6 -> 10.11
|
||||
for (int i = 0; i < 8; i++) {
|
||||
if (OSVersion[i] == '\0') {
|
||||
break;
|
||||
}
|
||||
if (((i > 2) && (OSVersion[i] == '.')) || (i == 5)) {
|
||||
break;
|
||||
}
|
||||
ShortOSVersion += OSVersion[i];
|
||||
}
|
||||
// for (int i = 0; i < 8; i++) {
|
||||
// if (OSVersion[i] == '\0') {
|
||||
// break;
|
||||
// }
|
||||
// if (((i > 2) && (OSVersion[i] == '.')) || (i == 5)) {
|
||||
// break;
|
||||
// }
|
||||
// ShortOSVersion += OSVersion[i];
|
||||
// }
|
||||
|
||||
XString8 ShortOSVersion = OSVersion.asString(2);
|
||||
XString8 DirName;
|
||||
|
||||
SubSubScreen->AddMenuInfoLine_f("Block injected kexts for target version of macOS: %s", ShortOSVersion.c_str());
|
||||
|
||||
// Add kext from 10 or 11
|
||||
if ( OSVersion.contains(".") )
|
||||
{
|
||||
XString8 osMajorVersion = OSVersion.subString(0, OSVersion.indexOf('.'));
|
||||
// if ( OSVersion.contains(".") )
|
||||
// {
|
||||
// XString8 osMajorVersion = OSVersion.subString(0, OSVersion.indexOf('.'));
|
||||
|
||||
SubSubScreen->AddMenuEntry(SubMenuKextBlockInjection(osMajorVersion), true);
|
||||
SubSubScreen->AddMenuEntry(SubMenuKextBlockInjection(OSVersion.asString(1)), true);
|
||||
DirName = S8Printf("%d_%s", OSVersion.elementAt(0), getSuffixForMacOsVersion(LoaderType).c_str());
|
||||
|
||||
XString8 DirName;
|
||||
if (OSTYPE_IS_OSX_INSTALLER(LoaderType)) {
|
||||
DirName = S8Printf("%s_install", osMajorVersion.c_str());
|
||||
}
|
||||
else {
|
||||
if (OSTYPE_IS_OSX_RECOVERY(LoaderType)) {
|
||||
DirName = S8Printf("%s_recovery", osMajorVersion.c_str());
|
||||
}
|
||||
else {
|
||||
DirName = S8Printf("%s_normal", osMajorVersion.c_str());
|
||||
}
|
||||
}
|
||||
// if (OSTYPE_IS_OSX_INSTALLER(LoaderType)) {
|
||||
// DirName = S8Printf("%d_install", OSVersion.elementAt(0));
|
||||
// }
|
||||
// else {
|
||||
// if (OSTYPE_IS_OSX_RECOVERY(LoaderType)) {
|
||||
// DirName = S8Printf("%d_recovery", OSVersion.elementAt(0));
|
||||
// }
|
||||
// else {
|
||||
// DirName = S8Printf("%d_normal", OSVersion.elementAt(0));
|
||||
// }
|
||||
// }
|
||||
SubSubScreen->AddMenuEntry(SubMenuKextBlockInjection(DirName), true);
|
||||
}
|
||||
// }
|
||||
|
||||
// Add kext from 10.{version}
|
||||
{
|
||||
XString8 DirName;
|
||||
DirName.takeValueFrom(ShortOSVersion);
|
||||
SubSubScreen->AddMenuEntry(SubMenuKextBlockInjection(DirName), true);
|
||||
DirName = S8Printf("%s_%s", ShortOSVersion.c_str(), getSuffixForMacOsVersion(LoaderType).c_str());
|
||||
|
||||
if (OSTYPE_IS_OSX_INSTALLER(LoaderType)) {
|
||||
DirName.S8Printf("%s_install", ShortOSVersion.c_str());
|
||||
}
|
||||
else {
|
||||
if (OSTYPE_IS_OSX_RECOVERY(LoaderType)) {
|
||||
DirName.S8Printf("%s_recovery", ShortOSVersion.c_str());
|
||||
}
|
||||
else {
|
||||
DirName.S8Printf("%s_normal", ShortOSVersion.c_str());
|
||||
}
|
||||
}
|
||||
// if (OSTYPE_IS_OSX_INSTALLER(LoaderType)) {
|
||||
// DirName.S8Printf("%s_install", ShortOSVersion.c_str());
|
||||
// }
|
||||
// else {
|
||||
// if (OSTYPE_IS_OSX_RECOVERY(LoaderType)) {
|
||||
// DirName.S8Printf("%s_recovery", ShortOSVersion.c_str());
|
||||
// }
|
||||
// else {
|
||||
// DirName.S8Printf("%s_normal", ShortOSVersion.c_str());
|
||||
// }
|
||||
// }
|
||||
SubSubScreen->AddMenuEntry(SubMenuKextBlockInjection(DirName), true);
|
||||
}
|
||||
|
||||
@ -1875,33 +1878,31 @@ LOADER_ENTRY* LOADER_ENTRY::SubMenuKextInjectMgmt()
|
||||
// 10.{version}.{minor version} if minor version is > 0
|
||||
{
|
||||
{
|
||||
XString8 OSVersionKextsDirName;
|
||||
if ( ShortOSVersion == OSVersion ) {
|
||||
OSVersionKextsDirName.S8Printf("%s.0", OSVersion.c_str());
|
||||
}else{
|
||||
OSVersionKextsDirName = OSVersion;
|
||||
}
|
||||
XString8 OSVersionKextsDirName = OSVersion.asString(3);
|
||||
if ( OSVersion.elementAt(2) == -1 ) OSVersionKextsDirName.S8Catf(".0");
|
||||
SubSubScreen->AddMenuEntry(SubMenuKextBlockInjection(OSVersionKextsDirName), true);
|
||||
}
|
||||
DirName = S8Printf("%s_%s", OSVersion.asString(3).c_str(), getSuffixForMacOsVersion(LoaderType).c_str());
|
||||
|
||||
XString8 DirName;
|
||||
if (OSTYPE_IS_OSX_INSTALLER(LoaderType)) {
|
||||
DirName.S8Printf("%s_install", OSVersion.c_str());
|
||||
}
|
||||
else {
|
||||
if (OSTYPE_IS_OSX_RECOVERY(LoaderType)) {
|
||||
DirName.S8Printf("%s_recovery", OSVersion.c_str());
|
||||
}
|
||||
else {
|
||||
DirName.S8Printf("%s_normal", OSVersion.c_str());
|
||||
}
|
||||
}
|
||||
// if (OSTYPE_IS_OSX_INSTALLER(LoaderType)) {
|
||||
// DirName.S8Printf("%s_install", OSVersion.asString(3).c_str());
|
||||
// }
|
||||
// else {
|
||||
// if (OSTYPE_IS_OSX_RECOVERY(LoaderType)) {
|
||||
// DirName.S8Printf("%s_recovery", OSVersion.asString(3).c_str());
|
||||
// }
|
||||
// else {
|
||||
// DirName.S8Printf("%s_normal", OSVersion.asString(3).c_str());
|
||||
// }
|
||||
// }
|
||||
SubSubScreen->AddMenuEntry(SubMenuKextBlockInjection(DirName), true);
|
||||
}
|
||||
}
|
||||
else {
|
||||
SubSubScreen->AddMenuInfoLine_f("Block injected kexts for target version of macOS: %s", OSVersion.c_str());
|
||||
SubSubScreen->AddMenuInfoLine_f("Block injected kexts for unknown macOS version");
|
||||
SubSubScreen->AddMenuEntry(SubMenuKextBlockInjection("Unknown"_XS8), true);
|
||||
}
|
||||
|
||||
kextDir = GetOtherKextsDir(TRUE);
|
||||
if ( kextDir.notEmpty() ) {
|
||||
SubSubScreen->AddMenuEntry(SubMenuKextBlockInjection("Other"_XS8), true);
|
||||
|
Loading…
Reference in New Issue
Block a user