diff --git a/rEFIt_UEFI/Platform/DataHubCpu.cpp b/rEFIt_UEFI/Platform/DataHubCpu.cpp index c260dc180..ca79bf8e3 100644 --- a/rEFIt_UEFI/Platform/DataHubCpu.cpp +++ b/rEFIt_UEFI/Platform/DataHubCpu.cpp @@ -537,6 +537,8 @@ SetupDataForOSX(BOOLEAN Hibernate) // all current settings XBuffer xb = gSettings.serialize(); LogDataHub(&gEfiMiscSubClassGuid, L"Settings", xb.data(), (UINT32)xb.size()); + }else{ + MsgLog("DataHub protocol not located. Smbios not send to datahub\n"); } if (!gAppleSmc) { return; diff --git a/rEFIt_UEFI/Platform/MemoryOperation.c b/rEFIt_UEFI/Platform/MemoryOperation.c index 56ea85bed..b48c37114 100644 --- a/rEFIt_UEFI/Platform/MemoryOperation.c +++ b/rEFIt_UEFI/Platform/MemoryOperation.c @@ -65,7 +65,21 @@ UINTN SearchAndReplace(UINT8 *Source, UINT64 SourceSize, const UINT8 *Search, UI while ((Source < End) && (NoReplacesRestriction || (MaxReplaces > 0))) { if (CompareMem(Source, Search, SearchSize) == 0) { // printf(" found pattern at %llx\n", (UINTN)(Source - Begin)); + + DBG("Replace " ); + for (UINTN Index = 0; Index < SearchSize; ++Index) { + DBG("%02X", Search[Index]); + } + DBG(" by " ); + + CopyMem(Source, Replace, SearchSize); + + + for (UINTN Index = 0; Index < SearchSize; ++Index) { + DBG("%02X", Replace[Index]); + } + NumReplaces++; MaxReplaces--; Source += SearchSize; diff --git a/rEFIt_UEFI/Platform/Settings.h b/rEFIt_UEFI/Platform/Settings.h index 1c18ff9fd..19afb76ce 100644 --- a/rEFIt_UEFI/Platform/Settings.h +++ b/rEFIt_UEFI/Platform/Settings.h @@ -6,6 +6,7 @@ #include "../gui/menu_items/menu_items.h" #include "../Platform/plist/plist.h" +#include "../Platform/guid.h" #include "MacOsVersion.h" //// SysVariables @@ -647,12 +648,15 @@ public: const XString8& getUUID(); const XString8& getUUID(EFI_GUID* efiGuid); + // If CustomUuid is defined, return false by default + // If SmUUID is defined, return true by default. bool ShouldInjectSystemID() { - if ( CustomUuid.notEmpty() ){ + if ( CustomUuid.notEmpty() && CustomUuid != nullGuid ) { if ( InjectSystemID_ == 2 ) return false; else return InjectSystemID_; } - if ( SmUUID.notEmpty() && InjectSystemID_ == 2 ) return false; + if ( SmUUID.isEmpty() || SmUUID == nullGuid ) return false; + if ( InjectSystemID_ == 2 ) return true; return InjectSystemID_; } }; diff --git a/rEFIt_UEFI/Platform/smbios.cpp b/rEFIt_UEFI/Platform/smbios.cpp index 3be9c8fb1..4285a34df 100644 --- a/rEFIt_UEFI/Platform/smbios.cpp +++ b/rEFIt_UEFI/Platform/smbios.cpp @@ -337,6 +337,7 @@ EFI_STATUS UpdateSmbiosString(OUT APPLE_SMBIOS_STRUCTURE_POINTER SmbiosTableN, *C2 = 0; *(--C2) = 0; //end of table } + //DBG("UpdateSmbiosString() -> CopyMem %s %lld\n", Buffer.c_str(), BLength); CopyMem(AString, Buffer.c_str(), BLength); *(AString + BLength) = 0; // not sure there is 0 @@ -2165,8 +2166,36 @@ void FinalizeSmbios() //continue SmbiosEpsNew->IntermediateChecksum = (UINT8)(256 - Checksum8((UINT8*)SmbiosEpsNew + 0x10, SmbiosEpsNew->EntryPointLength - 0x10)); SmbiosEpsNew->EntryPointStructureChecksum = 0; SmbiosEpsNew->EntryPointStructureChecksum = (UINT8)(256 - Checksum8((UINT8*)SmbiosEpsNew, SmbiosEpsNew->EntryPointLength)); - // DBG("SmbiosEpsNew->EntryPointLength = %d\n", SmbiosEpsNew->EntryPointLength); - // DBG("DMI checksum = %d\n", Checksum8((UINT8*)SmbiosEpsNew, SmbiosEpsNew->EntryPointLength)); +//DBG("SmbiosEpsNew->TableLength = %d\n", SmbiosEpsNew->TableLength); +//DBG("SmbiosEpsNew->EntryPointLength = %d\n", SmbiosEpsNew->EntryPointLength); +//DBG("SmbiosEpsNew->MaxStructureSize = %d\n", SmbiosEpsNew->MaxStructureSize); +//DBG("DMI checksum = %d\n", Checksum8((UINT8*)SmbiosEpsNew, SmbiosEpsNew->EntryPointLength)); +//XString8 tmpDbg; +//XString8 tmptmpDbg; +//tmpDbg.dataSized(SmbiosEpsNew->TableLength*3+5*SmbiosEpsNew->TableLength/32+128); +//for ( size_t i = 0 ; i < SmbiosEpsNew->TableLength ; ) { +// size_t j; +// for ( j = 0 ; j < SmbiosEpsNew->TableLength && j < 32 ; j++ ) { +//// DBG("%02x ", ((UINT8*)(SmbiosEpsNew+1))[i+j] ); +// tmptmpDbg.S8Printf("%02x ", ((UINT8*)(SmbiosEpsNew+1))[i+j] ); +// tmpDbg.strcat(tmptmpDbg); +// } +//// DBG(" - "); +// tmptmpDbg.S8Printf(" - "); +// tmpDbg.strcat(tmptmpDbg); +// for ( j = 0 ; j < SmbiosEpsNew->TableLength && j < 32 ; j++ ) { +// UINT8 c = ((UINT8*)(SmbiosEpsNew+1))[i+j]; +//// DBG("%c ", c > 32 ? c : '.'); +// tmptmpDbg.S8Printf("%c", c > 32 ? c : '.'); +// tmpDbg.strcat(tmptmpDbg); +// } +//// DBG("\n"); +// tmptmpDbg.S8Printf("\n"); +// tmpDbg.strcat(tmptmpDbg); +// i += j; +//} +//DBG("%s", tmpDbg.c_str()); +//auto foo = SmbiosEpsNew; // // syscl: one more step: check if we need remap SMBIOS Table Type 1 Guid diff --git a/rEFIt_UEFI/refit/main.cpp b/rEFIt_UEFI/refit/main.cpp index 0355773bd..472c7f89a 100644 --- a/rEFIt_UEFI/refit/main.cpp +++ b/rEFIt_UEFI/refit/main.cpp @@ -80,9 +80,13 @@ #ifndef DEBUG_ALL -#define DEBUG_MAIN 1 +# ifdef DEBUG_ERALY_CRASH +# define DEBUG_MAIN 2 +# else +# define DEBUG_MAIN 1 +# endif #else -#define DEBUG_MAIN DEBUG_ALL +# define DEBUG_MAIN DEBUG_ALL #endif #if DEBUG_MAIN == 0 @@ -698,6 +702,7 @@ void LOADER_ENTRY::DelegateKernelPatches() mOpenCoreConfiguration.Kernel.Patch.ValueSize = sizeof(__typeof_am__(**mOpenCoreConfiguration.Kernel.Patch.Values)); mOpenCoreConfiguration.Kernel.Patch.Values = (__typeof_am__(*mOpenCoreConfiguration.Kernel.Patch.Values)*)malloc(mOpenCoreConfiguration.Kernel.Patch.AllocCount*sizeof(__typeof_am__(*mOpenCoreConfiguration.Kernel.Patch.Values))); memset(mOpenCoreConfiguration.Kernel.Patch.Values, 0, mOpenCoreConfiguration.Kernel.Patch.AllocCount*sizeof(*mOpenCoreConfiguration.Kernel.Patch.Values)); + for (size_t kextPatchIdx = 0 ; kextPatchIdx < selectedPathArray.size() ; kextPatchIdx++ ) { const KEXT_PATCH& kextPatch = selectedPathArray[kextPatchIdx]; //as well as kernel patches @@ -1108,9 +1113,7 @@ DBG("Beginning OC\n"); #endif #ifndef USE_OC_SECTION_PlatformInfo - // This is not read by Clover and should always be false. Which is what need if Clover takes care of SmBios - // If SmBios should be delegated to OC, this setting should initialised depending of SMUUID and InjectSystemID, I suppose - mOpenCoreConfiguration.Kernel.Quirks.CustomSmbiosGuid = false; //already done by CLover. + mOpenCoreConfiguration.Kernel.Quirks.CustomSmbiosGuid = gSettings.KernelAndKextPatches.KPDELLSMBIOS; #endif mOpenCoreConfiguration.Uefi.Output.ProvideConsoleGop = gSettings.ProvideConsoleGop; OC_STRING_ASSIGN(mOpenCoreConfiguration.Uefi.Output.Resolution, XString8(GlobalConfig.ScreenResolution).c_str()); @@ -2348,6 +2351,11 @@ RefitMain (IN EFI_HANDLE ImageHandle, ConsoleInHandle = SystemTable->ConsoleInHandle; +#ifdef DEBUG_ERALY_CRASH + SystemTable->ConOut->OutputString(SystemTable->ConOut, L"Start"); + PauseForKey(L"1) press any key\n"); +#endif + #ifdef DEBUG_ON_SERIAL_PORT SerialPortInitialize(); #endif @@ -2623,6 +2631,10 @@ RefitMain (IN EFI_HANDLE ImageHandle, gEmuVariableControl->InstallEmulation(gEmuVariableControl); } +#ifdef DEBUG_ERALY_CRASH + PauseForKey(L"2) press any key\n"); +#endif + DbgHeader("InitScreen"); if (!GlobalConfig.FastBoot) {