Jump to content

Clover problems report & features request


ErmaC
953 posts in this topic

Recommended Posts

Problem Report:

Clover is not following the settings of my config.plist at boot? C6 and drop _DSM Permanently checked in clover boot. Config.plist has no effect.

Is my bios somehow corrupt?

For example, whenever I first boot up into clover, and go to the clover settings option, I notice that EnableC6 is always checked, even though I have all C-States unchecked in my clover config.plist. Same happens with drop _DSM.

 

It seems like clover has a mind of its own, and this concerns me, because how do I know it's not automatically changing other settings that I don't know about? Why is this happening and how can I fix it? Does it have anything to do with my bios settings? Below I have attached my clover config.plist, pics of my bios settings, my clover boot logs, my AppleIntelInfo.dat output, my IOReg, and the screenshots of clover checking things that aren't checked in the config.plist. Please help me!

config-2.plist.zip

IOREG PM install.ioreg.zip

BIOS Config.zip

Clover Logs.zip

CPU tuning IS THIS RIGHT?.jpg.zip

Drop OEM _DSM IS THIS RIGHT?.jpg.zip

Link to comment
Share on other sites

  • 2 weeks later...

Hi, latest clover installed, i think 4411.

After a reboot all entries lost. I try to access uefi shell but it stuck.

Tried to boot from external clover on usb but it shows no entries either. I cant understand how and why this suddenly happen...

The machine is a HP probook 6460b and OSX 10.13 with apfs.

Link to comment
Share on other sites

  • 3 weeks later...
  • 4 weeks later...

A request for ig platform ID in the graphics section for AMD 2200g and 2400g Ryzen Vega chipsets.   Current Clover Graphics screen/Menu only allows Fake ID.   I have managed to spoof the Vega IGPU to KBL CRB and load 3 Intel frame buffers but no accelerators.   I have done this by editing info.plist of KBL kexts.   Having a ig platform option may allow for acceleration for these graphics by spoofing Iris graphics.?

Link to comment
Share on other sites

On 5/7/2018 at 12:09 AM, Hackmac101 said:

Ability to have bigger font size with Text Only mode, and have the menu in the center not top left. On 4K monitors text is very hard to see because the text is too small.

 

The text is based on the EFI console mode, so the reason it's so small is because that's the size your firmware sets. Usually there's only one or two modes and they don't really change the size of the text, they just draw in differently sized rectangles to allow more characters to be drawn. So changing your resolution to something smaller will make the text bigger, there's no other way to  change the size of the text.

 

On 5/7/2018 at 2:01 AM, Gigamaxx said:

A request for ig platform ID in the graphics section for AMD 2200g and 2400g Ryzen Vega chipsets.   Current Clover Graphics screen/Menu only allows Fake ID.   I have managed to spoof the Vega IGPU to KBL CRB and load 3 Intel frame buffers but no accelerators.   I have done this by editing info.plist of KBL kexts.   Having a ig platform option may allow for acceleration for these graphics by spoofing Iris graphics.?

 

You can inject properties into the _DSM of the device's ACPI with Devices/AddProperties (or you can create your own SSDT that does this and inject it), although not sure that it can do that for those. Also, there is no support for those graphics so you won't be getting it working without another kext to support it. You are confusing the Vega 8 and 11 in those CPUs with the Vega M in the Intels, they are not the same.

  • Like 1
Link to comment
Share on other sites

On 5/8/2018 at 10:47 AM, apianti said:

 

The text is based on the EFI console mode, so the reason it's so small is because that's the size your firmware sets. Usually there's only one or two modes and they don't really change the size of the text, they just draw in differently sized rectangles to allow more characters to be drawn. So changing your resolution to something smaller will make the text bigger, there's no other way to  change the size of the text.

 

 

You can inject properties into the _DSM of the device's ACPI with Devices/AddProperties (or you can create your own SSDT that does this and inject it), although not sure that it can do that for those. Also, there is no support for those graphics so you won't be getting it working without another kext to support it. You are confusing the Vega 8 and 11 in those CPUs with the Vega M in the Intels, they are not the same.

 

I am pretty clear on the Intel vs. AMD Vega chips, not confused .   I am testing both and unfortunately both have only 7mb support so far.  

 

The Intel  i7 8705G has HBM2 and HD 630 but it doesn't have native AMD graphics support.   The closest Vega IDs are 0x69A0, and 0x69AF but neither works to activate the graphics.   These Intel chips have 630 graphics but they are not dsesigned to get acceleration only quick synch so accelerators won't load for these Kaby Lake graphics.

 

The AMD 2200g and 2400g vega chips are using DDR4 memory much like Intel chipsets and cost about 1/5 the price.   However I have been able to edit the info.plist of the Kaby Lake graphics kexts and get KBL CRB listing and Intel frame buffers loaded, but again only 7mb support.   I tested all the AMD kexts edits and Intel as well only the Kaby Lake registers.   Having a ig platform for ATI graphics in Clover would be a nice "trick" tool for testing and may get these chips to achieve acceleration.    ig ID 0x59E30003 may link the accelerators and get these working but I have no option for this.    Could you provide an example on how to do this in Add properties using clover?

 

***Look at the device IDs and Vendor info in the DCPIManager it has both AMD and intel codes.

 

 

Screen Shot 2018-05-10 at 9.27.21 AM.png

Screen Shot 2018-05-11 at 12.07.55 AM.png

Edited by Gigamaxx
Link to comment
Share on other sites

  • 2 weeks later...

Fix for 32-bit builds with CLANG38 (stock EDK2, no patches; same as vit's fix for kernel_patcher.c):

 

Spoiler

diff --git a/rEFIt_UEFI/Platform/kext_patcher.c b/rEFIt_UEFI/Platform/kext_patcher.c
index c1b46e82..ddcbf182 100755
--- a/rEFIt_UEFI/Platform/kext_patcher.c
+++ b/rEFIt_UEFI/Platform/kext_patcher.c
@@ -28,7 +28,7 @@ UINTN SearchAndCount(UINT8 *Source, UINT64 SourceSize, UINT8 *Search, UINTN Sear
 {
   UINTN     NumFounds = 0;
   UINT8     *End = Source + SourceSize;
-  
+
   while (Source < End) {
     if (CompareMem(Source, Search, SearchSize) == 0) {
       NumFounds++;
@@ -55,7 +55,7 @@ UINTN SearchAndReplace(UINT8 *Source, UINT64 SourceSize, UINT8 *Search, UINTN Se
   if (!Source || !Search || !Replace || !SearchSize) {
     return 0;
   }
-  
+
   while ((Source < End) && (NoReplacesRestriction || (MaxReplaces > 0))) {
     if (CompareMem(Source, Search, SearchSize) == 0) {
       CopyMem(Source, Replace, SearchSize);
@@ -81,7 +81,7 @@ UINTN SearchAndReplaceTxt(UINT8 *Source, UINT64 SourceSize, UINT8 *Search, UINTN
   if (!Source || !Search || !Replace || !SearchSize) {
     return 0;
   }
-  
+
   while (((Source + SearchSize) <= End) &&
          (NoReplacesRestriction || (MaxReplaces > 0))) { // num replaces
     while (*Source != '\0') {  //comparison
@@ -101,19 +101,19 @@ UINTN SearchAndReplaceTxt(UINT8 *Source, UINT64 SourceSize, UINT8 *Search, UINTN
         Source++;
         Pos++;
       }
-      
+
       if (Pos == SearchEnd) { // pattern found
         Pos = FirstMatch;
         break;
       }
       else
         Pos = NULL;
-      
+
       Source = FirstMatch + 1;
 /*      if (Pos != Search) {
         AsciiPrint("\n");
       } */
-      
+
     }
 
     if (!Pos) {
@@ -138,10 +138,10 @@ VOID ExtractKextBundleIdentifier(CHAR8 *Plist)
   CHAR8     *BIStart;
   CHAR8     *BIEnd;
   INTN      DictLevel = 0;
-  
-  
+
+
   gKextBundleIdentifier[0] = '\0';
-  
+
   // start with first <dict>
   Tag = AsciiStrStr(Plist, "<dict>");
   if (Tag == NULL) {
@@ -149,19 +149,19 @@ VOID ExtractKextBundleIdentifier(CHAR8 *Plist)
   }
   Tag += 6;
   DictLevel++;
-  
+
   while (*Tag != '\0') {
-    
+
     if (AsciiStrnCmp(Tag, "<dict>", 6) == 0) {
       // opening dict
       DictLevel++;
       Tag += 6;
-      
+
     } else if (AsciiStrnCmp(Tag, "</dict>", 7) == 0) {
       // closing dict
       DictLevel--;
       Tag += 7;
-      
+
     } else if (DictLevel == 1 && AsciiStrnCmp(Tag, "<key>CFBundleIdentifier</key>", 29) == 0) {
       // BundleIdentifier is next <string>...</string>
       BIStart = AsciiStrStr(Tag + 29, "<string>");
@@ -178,7 +178,7 @@ VOID ExtractKextBundleIdentifier(CHAR8 *Plist)
     } else {
       Tag++;
     }
-    
+
     // advance to next tag
     while (*Tag != '<' && *Tag != '\0') {
       Tag++;
@@ -221,7 +221,7 @@ VOID ATIConnectorsPatchInit(LOADER_ENTRY *Entry)
   //
   // prepar boundle ids
   //
-  
+
   // Lion, SnowLeo 10.6.7 2011 MBP
   AsciiSPrint(ATIKextBundleId[0],
               sizeof(ATIKextBundleId[0]),
@@ -234,9 +234,9 @@ VOID ATIConnectorsPatchInit(LOADER_ENTRY *Entry)
               "com.apple.kext.AMD%sController",
               Entry->KernelAndKextPatches->KPATIConnectorsController
               );
-  
+
   ATIConnectorsPatchInited = TRUE;
-  
+
   //DBG(L"Bundle1: %a\n", ATIKextBundleId[0]);
   //DBG(L"Bundle2: %a\n", ATIKextBundleId[1]);
   //gBS->Stall(10000000);
@@ -247,7 +247,7 @@ VOID ATIConnectorsPatchInit(LOADER_ENTRY *Entry)
 //
 VOID ATIConnectorsPatchRegisterKexts(FSINJECTION_PROTOCOL *FSInject, FSI_STRING_LIST *ForceLoadKexts, LOADER_ENTRY *Entry)
 {
-  
+
   // for future?
   FSInject->AddStringToList(ForceLoadKexts,
                             PoolPrint(L"\\AMD%sController.kext\\Contents\\Info.plist", Entry->KernelAndKextPatches->KPATIConnectorsController)
@@ -259,7 +259,7 @@ VOID ATIConnectorsPatchRegisterKexts(FSINJECTION_PROTOCOL *FSInject, FSI_STRING_
   // SnowLeo
   FSInject->AddStringToList(ForceLoadKexts, L"\\ATIFramebuffer.kext\\Contents\\Info.plist");
   FSInject->AddStringToList(ForceLoadKexts, L"\\AMDFramebuffer.kext\\Contents\\Info.plist");
-  
+
   // dependencies
   FSInject->AddStringToList(ForceLoadKexts, L"\\IOGraphicsFamily.kext\\Info.plist");
   FSInject->AddStringToList(ForceLoadKexts, L"\\ATISupport.kext\\Contents\\Info.plist");
@@ -274,14 +274,14 @@ VOID ATIConnectorsPatchRegisterKexts(FSINJECTION_PROTOCOL *FSInject, FSI_STRING_
 //
 VOID ATIConnectorsPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 InfoPlistSize, LOADER_ENTRY *Entry)
 {
-  
+
   UINTN   Num = 0;
-  
+
   DBG_RT(Entry, "\nATIConnectorsPatch: driverAddr = %x, driverSize = %x\nController = %s\n",
          Driver, DriverSize, Entry->KernelAndKextPatches->KPATIConnectorsController);
   ExtractKextBundleIdentifier(InfoPlist);
   DBG_RT(Entry, "Kext: %a\n", gKextBundleIdentifier);
-  
+
   // number of occurences od Data should be 1
   Num = SearchAndCount(Driver, DriverSize, Entry->KernelAndKextPatches->KPATIConnectorsData, Entry->KernelAndKextPatches->KPATIConnectorsDataLen);
   if (Num > 1) {
@@ -290,7 +290,7 @@ VOID ATIConnectorsPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT
     gBS->Stall(5*1000000);
     return;
   }
-  
+
   // patch
   Num = SearchAndReplace(Driver,
                          DriverSize,
@@ -322,9 +322,9 @@ VOID ATIConnectorsPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT
 // Rehabman corrections 2014
 //
 
-UINT8   MovlE2ToEcx[] = { 0xB9, 0xE2, 0x00, 0x00, 0x00 };
-UINT8   MovE2ToCx[]   = { 0x66, 0xB9, 0xE2, 0x00 };
-UINT8   Wrmsr[]       = { 0x0F, 0x30 };
+STATIC UINT8   MovlE2ToEcx[] = { 0xB9, 0xE2, 0x00, 0x00, 0x00 };
+STATIC UINT8   MovE2ToCx[]   = { 0x66, 0xB9, 0xE2, 0x00 };
+STATIC UINT8   Wrmsr[]       = { 0x0F, 0x30 };
 
 VOID AppleIntelCPUPMPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 InfoPlistSize, LOADER_ENTRY *Entry)
 {
@@ -397,18 +397,18 @@ VOID AppleIntelCPUPMPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UI
 // http://www.insanelymac.com/forum/index.php?showtopic=276066
 //
 
-UINT8   LionSearch_X64[]  = { 0x75, 0x30, 0x44, 0x89, 0xf8 };
-UINT8   LionReplace_X64[] = { 0xeb, 0x30, 0x44, 0x89, 0xf8 };
+STATIC UINT8   LionSearch_X64[]  = { 0x75, 0x30, 0x44, 0x89, 0xf8 };
+STATIC UINT8   LionReplace_X64[] = { 0xeb, 0x30, 0x44, 0x89, 0xf8 };
 
-UINT8   LionSearch_i386[]  = { 0x75, 0x3d, 0x8b, 0x75, 0x08 };
-UINT8   LionReplace_i386[] = { 0xeb, 0x3d, 0x8b, 0x75, 0x08 };
+STATIC UINT8   LionSearch_i386[]  = { 0x75, 0x3d, 0x8b, 0x75, 0x08 };
+STATIC UINT8   LionReplace_i386[] = { 0xeb, 0x3d, 0x8b, 0x75, 0x08 };
 
-UINT8   MLSearch[]  = { 0x75, 0x30, 0x89, 0xd8 };
-UINT8   MLReplace[] = { 0xeb, 0x30, 0x89, 0xd8 };
+STATIC UINT8   MLSearch[]  = { 0x75, 0x30, 0x89, 0xd8 };
+STATIC UINT8   MLReplace[] = { 0xeb, 0x30, 0x89, 0xd8 };
 
 //SunKi
-UINT8   MavSearch[]  = { 0x75, 0x2e, 0x0f, 0xb6 };
-UINT8   MavReplace[] = { 0xeb, 0x2e, 0x0f, 0xb6 };
+STATIC UINT8   MavSearch[]  = { 0x75, 0x2e, 0x0f, 0xb6 };
+STATIC UINT8   MavReplace[] = { 0xeb, 0x2e, 0x0f, 0xb6 };
 
 //
 // We can not rely on OSVersion global variable for OS version detection,
@@ -420,19 +420,19 @@ UINT8   MavReplace[] = { 0xeb, 0x2e, 0x0f, 0xb6 };
 
 VOID AppleRTCPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 InfoPlistSize, LOADER_ENTRY *Entry)
 {
-  
+
   UINTN   Num = 0;
   UINTN   NumLion_X64 = 0;
   UINTN   NumLion_i386 = 0;
   UINTN   NumML = 0;
   UINTN   NumMav = 0;
-  
+
   DBG_RT(Entry, "\nAppleRTCPatch: driverAddr = %x, driverSize = %x\n", Driver, DriverSize);
   if (Entry->KernelAndKextPatches->KPDebug) {
     ExtractKextBundleIdentifier(InfoPlist);
   }
   DBG_RT(Entry, "Kext: %a\n", gKextBundleIdentifier);
-  
+
   if (is64BitKernel) {
     NumLion_X64 = SearchAndCount(Driver, DriverSize, LionSearch_X64, sizeof(LionSearch_X64));
     NumML  = SearchAndCount(Driver, DriverSize, MLSearch,  sizeof(MLSearch));
@@ -440,7 +440,7 @@ VOID AppleRTCPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 In
   } else {
     NumLion_i386 = SearchAndCount(Driver, DriverSize, LionSearch_i386, sizeof(LionSearch_i386));
   }
-  
+
   if (NumLion_X64 + NumLion_i386 + NumML + NumMav > 1) {
     // more then one pattern found - we do not know what to do with it
     // and we'll skipp it
@@ -449,7 +449,7 @@ VOID AppleRTCPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 In
     gBS->Stall(5000000);
     return;
   }
-  
+
   if (NumLion_X64 == 1) {
     Num = SearchAndReplace(Driver, DriverSize, LionSearch_X64, sizeof(LionSearch_X64), LionReplace_X64, 1);
     DBG_RT(Entry, "==> Lion X64: %d replaces done.\n", Num);
@@ -508,8 +508,8 @@ VOID CheckForFakeSMC(CHAR8 *InfoPlist, LOADER_ENTRY *Entry)
 //
 // EB9D2D31-2D88-11D3-9A16-0090273F -> EB9D2D35-2D88-11D3-9A16-0090273F
 //
-UINT8   DELL_SMBIOS_GUID_Search[]  = { 0x45, 0x42, 0x39, 0x44, 0x32, 0x44, 0x33, 0x31 };
-UINT8   DELL_SMBIOS_GUID_Replace[] = { 0x45, 0x42, 0x39, 0x44, 0x32, 0x44, 0x33, 0x35 };
+STATIC STATIC UINT8   DELL_SMBIOS_GUID_Search[]  = { 0x45, 0x42, 0x39, 0x44, 0x32, 0x44, 0x33, 0x31 };
+STATIC STATIC UINT8   DELL_SMBIOS_GUID_Replace[] = { 0x45, 0x42, 0x39, 0x44, 0x32, 0x44, 0x33, 0x35 };
 
 //
 // EB9D2D31-2D88-11D3-9A16-0090273F is the standard SMBIOS Table Type 1 for
@@ -525,19 +525,19 @@ VOID DellSMBIOSPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32
     // than Yosemite, they are all pure 64bit platforms
     //
     UINTN gPatchCount = 0;
-    
+
     DBG_RT(Entry, "\nDellSMBIOSPatch: driverAddr = %x, driverSize = %x\n", Driver, DriverSize);
     if (Entry->KernelAndKextPatches->KPDebug)
     {
         ExtractKextBundleIdentifier(InfoPlist);
     }
     DBG_RT(Entry, "Kext: %a\n", gKextBundleIdentifier);
-    
+
     //
     // now, let's patch it!
     //
     gPatchCount = SearchAndReplace(Driver, DriverSize, DELL_SMBIOS_GUID_Search, sizeof(DELL_SMBIOS_GUID_Search), DELL_SMBIOS_GUID_Replace, 1);
-    
+
     if (gPatchCount == 1)
     {
         DBG_RT(Entry, "==> AppleSMBIOS: %d replaces done.\n", gPatchCount);
@@ -564,24 +564,24 @@ VOID SNBE_AICPUPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32
 {
     UINT32 i;
     UINT64 os_ver = AsciiOSVersionToUint64(Entry->OSVersion);
-    
+
     DBG_RT(Entry, "\nSNBE_AICPUPatch: driverAddr = %x, driverSize = %x\n", Driver, DriverSize);
     if (Entry->KernelAndKextPatches->KPDebug) {
         ExtractKextBundleIdentifier(InfoPlist);
     }
-    
+
     DBG_RT(Entry, "Kext: %a\n", gKextBundleIdentifier);
-    
+
     // now let's patch it
     if (os_ver < AsciiOSVersionToUint64("10.9") || os_ver >= AsciiOSVersionToUint64("10.14")) {
         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")) {
         // 10.9.x
-        UINT8 find[][3] = {
+        STATIC UINT8 find[][3] = {
             { 0x84, 0x2F, 0x01 },
             { 0x3E, 0x75, 0x3A },
             { 0x84, 0x5F, 0x01 },
@@ -590,7 +590,7 @@ VOID SNBE_AICPUPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32
             { 0xFC, 0x02, 0x74 },
             { 0x01, 0x74, 0x58 }
         };
-        UINT8 repl[][3] = {
+        STATIC UINT8 repl[][3] = {
             { 0x85, 0x2F, 0x01 },
             { 0x3E, 0x90, 0x90 },
             { 0x85, 0x5F, 0x01 },
@@ -599,7 +599,7 @@ VOID SNBE_AICPUPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32
             { 0xFC, 0x02, 0xEB },
             { 0x01, 0xEB, 0x58 }
         };
-        
+
         for (i = 0; i < 7; i++) {
             if (SearchAndReplace(Driver, DriverSize, find[i], sizeof(find[i]), repl[i], 0)) {
                 DBG("SNBE_AICPUPatch (%d/7) applied\n", i);
@@ -609,12 +609,12 @@ VOID SNBE_AICPUPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32
         }
     } else if (os_ver < AsciiOSVersionToUint64("10.11")) {
         // 10.10.x
-        UINT8 find[][3] = {
+        STATIC UINT8 find[][3] = {
             { 0x3E, 0x75, 0x39 },
             { 0x74, 0x11, 0xB9 },
             { 0x01, 0x74, 0x56 }
         };
-        UINT8 repl[][3] = {
+        STATIC UINT8 repl[][3] = {
             { 0x3E, 0x90, 0x90 },
             { 0xEB, 0x11, 0xB9 },
             { 0x01, 0xEB, 0x56 }
@@ -626,34 +626,34 @@ VOID SNBE_AICPUPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32
                 DBG("SNBE_AICPUPatch (%d/7) not apply\n", i);
             }
         }
-        
-        UINT8 find_1[] = { 0xFF, 0x0F, 0x84, 0x2D };
-        UINT8 repl_1[] = { 0xFF, 0x0F, 0x85, 0x2D };
+
+        STATIC UINT8 find_1[] = { 0xFF, 0x0F, 0x84, 0x2D };
+        STATIC UINT8 repl_1[] = { 0xFF, 0x0F, 0x85, 0x2D };
         if (SearchAndReplace(Driver, DriverSize, find_1, sizeof(find_1), repl_1, 0)) {
             DBG("SNBE_AICPUPatch (4/7) applied\n");
         } else {
             DBG("SNBE_AICPUPatch (4/7) not apply\n");
         }
-        
-        
-        UINT8 find_2[] = { 0x01, 0x00, 0x01, 0x0F, 0x84 };
-        UINT8 repl_2[] = { 0x01, 0x00, 0x01, 0x0F, 0x85 };
+
+
+        STATIC UINT8 find_2[] = { 0x01, 0x00, 0x01, 0x0F, 0x84 };
+        STATIC UINT8 repl_2[] = { 0x01, 0x00, 0x01, 0x0F, 0x85 };
         if (SearchAndReplace(Driver, DriverSize, find_2, sizeof(find_2), repl_2, 0)) {
             DBG("SNBE_AICPUPatch (5/7) applied\n");
         } else {
             DBG("SNBE_AICPUPatch (5/7) not apply\n");
         }
-        
-        UINT8 find_3[] = { 0x02, 0x74, 0x0B, 0x41, 0x83, 0xFC, 0x03, 0x75, 0x22, 0xB9, 0x02, 0x06 };
-        UINT8 repl_3[] = { 0x02, 0xEB, 0x0B, 0x41, 0x83, 0xFC, 0x03, 0x75, 0x22, 0xB9, 0x02, 0x06 };
+
+        STATIC UINT8 find_3[] = { 0x02, 0x74, 0x0B, 0x41, 0x83, 0xFC, 0x03, 0x75, 0x22, 0xB9, 0x02, 0x06 };
+        STATIC UINT8 repl_3[] = { 0x02, 0xEB, 0x0B, 0x41, 0x83, 0xFC, 0x03, 0x75, 0x22, 0xB9, 0x02, 0x06 };
         if (SearchAndReplace(Driver, DriverSize, find_3, sizeof(find_3), repl_3, 0)) {
             DBG("SNBE_AICPUPatch (6/7) applied\n");
         } else {
             DBG("SNBE_AICPUPatch (6/7) not apply\n");
         }
-        
-        UINT8 find_4[] = { 0x74, 0x0B, 0x41, 0x83, 0xFC, 0x03, 0x75, 0x11, 0xB9, 0x42, 0x06, 0x00 };
-        UINT8 repl_4[] = { 0xEB, 0x0B, 0x41, 0x83, 0xFC, 0x03, 0x75, 0x11, 0xB9, 0x42, 0x06, 0x00 };
+
+        STATIC UINT8 find_4[] = { 0x74, 0x0B, 0x41, 0x83, 0xFC, 0x03, 0x75, 0x11, 0xB9, 0x42, 0x06, 0x00 };
+        STATIC UINT8 repl_4[] = { 0xEB, 0x0B, 0x41, 0x83, 0xFC, 0x03, 0x75, 0x11, 0xB9, 0x42, 0x06, 0x00 };
         if (SearchAndReplace(Driver, DriverSize, find_4, sizeof(find_4), repl_4, 0)) {
             DBG("SNBE_AICPUPatch (7/7) applied\n");
         } else {
@@ -661,12 +661,12 @@ VOID SNBE_AICPUPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32
         }
     } else if (os_ver < AsciiOSVersionToUint64("10.12")) {
         // 10.11
-        UINT8 find[][3] = {
+        STATIC UINT8 find[][3] = {
             { 0x3E, 0x75, 0x39 },
             { 0x75, 0x11, 0xB9 },
             { 0x01, 0x74, 0x5F }
         };
-        UINT8 repl[][3] = {
+        STATIC UINT8 repl[][3] = {
             { 0x3E, 0x90, 0x90 },
             { 0xEB, 0x11, 0xB9 },
             { 0x01, 0xEB, 0x5F }
@@ -678,33 +678,33 @@ VOID SNBE_AICPUPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32
                 DBG("SNBE_AICPUPatch (%d/7) not apply\n", i);
             }
         }
-        
-        UINT8 find_1[] = { 0xFF, 0x0F, 0x84, 0x2D };
-        UINT8 repl_1[] = { 0xFF, 0x0F, 0x85, 0x2D };
+
+        STATIC UINT8 find_1[] = { 0xFF, 0x0F, 0x84, 0x2D };
+        STATIC UINT8 repl_1[] = { 0xFF, 0x0F, 0x85, 0x2D };
         if (SearchAndReplace(Driver, DriverSize, find_1, sizeof(find_1), repl_1, 0)) {
             DBG("SNBE_AICPUPatch (4/7) applied\n");
         } else {
             DBG("SNBE_AICPUPatch (4/7) not apply\n");
         }
-        
-        UINT8 find_2[] = { 0x01, 0x00, 0x01, 0x0F, 0x84 };
-        UINT8 repl_2[] = { 0x01, 0x00, 0x01, 0x0F, 0x85 };
+
+        STATIC UINT8 find_2[] = { 0x01, 0x00, 0x01, 0x0F, 0x84 };
+        STATIC UINT8 repl_2[] = { 0x01, 0x00, 0x01, 0x0F, 0x85 };
         if (SearchAndReplace(Driver, DriverSize, find_2, sizeof(find_2), repl_2, 0)) {
             DBG("SNBE_AICPUPatch (5/7) applied\n");
         } else {
             DBG("SNBE_AICPUPatch (5/7) not apply\n");
         }
-        
-        UINT8 find_3[] = { 0xC9, 0x74, 0x16, 0x0F, 0x32, 0x48, 0x25, 0xFF, 0x0F, 0x00, 0x00, 0x48 };
-        UINT8 repl_3[] = { 0xC9, 0xEB, 0x16, 0x0F, 0x32, 0x48, 0x25, 0xFF, 0x0F, 0x00, 0x00, 0x48 };
+
+        STATIC UINT8 find_3[] = { 0xC9, 0x74, 0x16, 0x0F, 0x32, 0x48, 0x25, 0xFF, 0x0F, 0x00, 0x00, 0x48 };
+        STATIC UINT8 repl_3[] = { 0xC9, 0xEB, 0x16, 0x0F, 0x32, 0x48, 0x25, 0xFF, 0x0F, 0x00, 0x00, 0x48 };
         if (SearchAndReplace(Driver, DriverSize, find_3, sizeof(find_3), repl_3, 0)) {
             DBG("SNBE_AICPUPatch (6/7) applied\n");
         } else {
             DBG("SNBE_AICPUPatch (6/7) not apply\n");
         }
-        
-        UINT8 find_4[] = { 0xC9, 0x74, 0x0C, 0x0F, 0x32, 0x83, 0xE0, 0x1F, 0x42, 0x89, 0x44, 0x3B };
-        UINT8 repl_4[] = { 0xC9, 0xEB, 0x0C, 0x0F, 0x32, 0x83, 0xE0, 0x1F, 0x42, 0x89, 0x44, 0x3B };
+
+        STATIC UINT8 find_4[] = { 0xC9, 0x74, 0x0C, 0x0F, 0x32, 0x83, 0xE0, 0x1F, 0x42, 0x89, 0x44, 0x3B };
+        STATIC UINT8 repl_4[] = { 0xC9, 0xEB, 0x0C, 0x0F, 0x32, 0x83, 0xE0, 0x1F, 0x42, 0x89, 0x44, 0x3B };
         if (SearchAndReplace(Driver, DriverSize, find_4, sizeof(find_4), repl_4, 0)) {
             DBG("SNBE_AICPUPatch (7/7) applied\n");
         } else {
@@ -712,12 +712,12 @@ VOID SNBE_AICPUPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32
         }
     } else if (os_ver < AsciiOSVersionToUint64("10.13")) {
         // 10.12
-        UINT8 find[][3] = {
+        STATIC UINT8 find[][3] = {
             { 0x01, 0x74, 0x61 },
             { 0x3E, 0x75, 0x38 },
             { 0x75, 0x11, 0xB9 }
         };
-        UINT8 repl[][3] = {
+        STATIC UINT8 repl[][3] = {
             { 0x01, 0xEB, 0x61 },
             { 0x3E, 0x90, 0x90 },
             { 0xEB, 0x11, 0xB9 }
@@ -729,33 +729,33 @@ VOID SNBE_AICPUPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32
                 DBG("SNBE_AICPUPatch (%d/7) not apply\n", i);
             }
         }
-        
-        UINT8 find_1[] = { 0xFF, 0x0F, 0x84, 0x2D };
-        UINT8 repl_1[] = { 0xFF, 0x0F, 0x85, 0x2D };
+
+        STATIC UINT8 find_1[] = { 0xFF, 0x0F, 0x84, 0x2D };
+        STATIC UINT8 repl_1[] = { 0xFF, 0x0F, 0x85, 0x2D };
         if (SearchAndReplace(Driver, DriverSize, find_1, sizeof(find_1), repl_1, 0)) {
             DBG("SNBE_AICPUPatch (4/7) applied\n");
         } else {
             DBG("SNBE_AICPUPatch (4/7) not apply\n");
         }
 
-        UINT8 find_2[] = { 0x01, 0x00, 0x01, 0x0F, 0x84 };
-        UINT8 repl_2[] = { 0x01, 0x00, 0x01, 0x0F, 0x85 };
+        STATIC UINT8 find_2[] = { 0x01, 0x00, 0x01, 0x0F, 0x84 };
+        STATIC UINT8 repl_2[] = { 0x01, 0x00, 0x01, 0x0F, 0x85 };
         if (SearchAndReplace(Driver, DriverSize, find_2, sizeof(find_2), repl_2, 0)) {
             DBG("SNBE_AICPUPatch (5/7) applied\n");
         } else {
             DBG("SNBE_AICPUPatch (5/7) not apply\n");
         }
-        
-        UINT8 find_3[] = { 0xC9, 0x74, 0x15, 0x0F, 0x32, 0x25, 0xFF, 0x0F, 0x00, 0x00, 0x48 };
-        UINT8 repl_3[] = { 0xC9, 0xEB, 0x15, 0x0F, 0x32, 0x25, 0xFF, 0x0F, 0x00, 0x00, 0x48 };
+
+        STATIC UINT8 find_3[] = { 0xC9, 0x74, 0x15, 0x0F, 0x32, 0x25, 0xFF, 0x0F, 0x00, 0x00, 0x48 };
+        STATIC UINT8 repl_3[] = { 0xC9, 0xEB, 0x15, 0x0F, 0x32, 0x25, 0xFF, 0x0F, 0x00, 0x00, 0x48 };
         if (SearchAndReplace(Driver, DriverSize, find_3, sizeof(find_3), repl_3, 0)) {
             DBG("SNBE_AICPUPatch (6/7) applied\n");
         } else {
             DBG("SNBE_AICPUPatch (6/7) not apply\n");
         }
 
-        UINT8 find_4[] = { 0xC9, 0x74, 0x0C, 0x0F, 0x32, 0x83, 0xE0, 0x1F, 0x42, 0x89, 0x44, 0x3B };
-        UINT8 repl_4[] = { 0xC9, 0xEB, 0x0C, 0x0F, 0x32, 0x83, 0xE0, 0x1F, 0x42, 0x89, 0x44, 0x3B };
+        STATIC UINT8 find_4[] = { 0xC9, 0x74, 0x0C, 0x0F, 0x32, 0x83, 0xE0, 0x1F, 0x42, 0x89, 0x44, 0x3B };
+        STATIC UINT8 repl_4[] = { 0xC9, 0xEB, 0x0C, 0x0F, 0x32, 0x83, 0xE0, 0x1F, 0x42, 0x89, 0x44, 0x3B };
         if (SearchAndReplace(Driver, DriverSize, find_4, sizeof(find_4), repl_4, 0)) {
             DBG("SNBE_AICPUPatch (7/7) applied\n");
         } else {
@@ -763,12 +763,12 @@ VOID SNBE_AICPUPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32
         }
     } else if (os_ver < AsciiOSVersionToUint64("10.14")) {
         // 10.13
-        UINT8 find[][3] = {
+        STATIC UINT8 find[][3] = {
             { 0x01, 0x74, 0x61 },
             { 0x3E, 0x75, 0x38 },
             { 0x75, 0x11, 0xB9 }
         };
-        UINT8 repl[][3] = {
+        STATIC UINT8 repl[][3] = {
             { 0x01, 0xEB, 0x61 },
             { 0x3E, 0x90, 0x90 },
             { 0xEB, 0x11, 0xB9 }
@@ -780,40 +780,40 @@ VOID SNBE_AICPUPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32
                 DBG("SNBE_AICPUPatch (%d/7) not apply\n", i);
             }
         }
-        
-        UINT8 find_1[] = { 0xFF, 0x0F, 0x84, 0xD3 };
-        UINT8 repl_1[] = { 0xFF, 0x0F, 0x85, 0xD3 };
+
+        STATIC UINT8 find_1[] = { 0xFF, 0x0F, 0x84, 0xD3 };
+        STATIC UINT8 repl_1[] = { 0xFF, 0x0F, 0x85, 0xD3 };
         if (SearchAndReplace(Driver, DriverSize, find_1, sizeof(find_1), repl_1, 0)) {
             DBG("SNBE_AICPUPatch (4/7) applied\n");
         } else {
             DBG("SNBE_AICPUPatch (4/7) not apply\n");
         }
-        
-        UINT8 find_2[] = { 0x01, 0x00, 0x01, 0x0F, 0x84 };
-        UINT8 repl_2[] = { 0x01, 0x00, 0x01, 0x0F, 0x85 };
+
+        STATIC UINT8 find_2[] = { 0x01, 0x00, 0x01, 0x0F, 0x84 };
+        STATIC UINT8 repl_2[] = { 0x01, 0x00, 0x01, 0x0F, 0x85 };
         if (SearchAndReplace(Driver, DriverSize, find_2, sizeof(find_2), repl_2, 0)) {
             DBG("SNBE_AICPUPatch (5/7) applied\n");
         } else {
             DBG("SNBE_AICPUPatch (5/7) not apply\n");
         }
-        
-        UINT8 find_3[] = { 0xC9, 0x74, 0x14, 0x0F, 0x32, 0x25, 0xFF, 0x0F, 0x00, 0x00, 0x6B };
-        UINT8 repl_3[] = { 0xC9, 0xEB, 0x14, 0x0F, 0x32, 0x25, 0xFF, 0x0F, 0x00, 0x00, 0x6B};
+
+        STATIC UINT8 find_3[] = { 0xC9, 0x74, 0x14, 0x0F, 0x32, 0x25, 0xFF, 0x0F, 0x00, 0x00, 0x6B };
+        STATIC UINT8 repl_3[] = { 0xC9, 0xEB, 0x14, 0x0F, 0x32, 0x25, 0xFF, 0x0F, 0x00, 0x00, 0x6B};
         if (SearchAndReplace(Driver, DriverSize, find_3, sizeof(find_3), repl_3, 0)) {
             DBG("SNBE_AICPUPatch (6/7) applied\n");
         } else {
             DBG("SNBE_AICPUPatch (6/7) not apply\n");
         }
-        
-        UINT8 find_4[] = { 0xC9, 0x74, 0x0C, 0x0F, 0x32, 0x83, 0xE0, 0x1F, 0x42, 0x89, 0x44, 0x3B };
-        UINT8 repl_4[] = { 0xC9, 0xEB, 0x0C, 0x0F, 0x32, 0x83, 0xE0, 0x1F, 0x42, 0x89, 0x44, 0x3B };
+
+        STATIC UINT8 find_4[] = { 0xC9, 0x74, 0x0C, 0x0F, 0x32, 0x83, 0xE0, 0x1F, 0x42, 0x89, 0x44, 0x3B };
+        STATIC UINT8 repl_4[] = { 0xC9, 0xEB, 0x0C, 0x0F, 0x32, 0x83, 0xE0, 0x1F, 0x42, 0x89, 0x44, 0x3B };
         if (SearchAndReplace(Driver, DriverSize, find_4, sizeof(find_4), repl_4, 0)) {
             DBG("SNBE_AICPUPatch (7/7) applied\n");
         } else {
             DBG("SNBE_AICPUPatch (7/7) not apply\n");
         }
     }
-    
+
     if (Entry->KernelAndKextPatches->KPDebug) {
         gBS->Stall(5000000);
     }
@@ -828,31 +828,31 @@ VOID SNBE_AICPUPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32
 // find: 0x48, 0x81, 0xFB, 0x00, 0x00, 0x00, 0x40
 // repl: 0x48, 0x81, 0xFB, 0x00, 0x00, 0x00, 0x80
 //
-UINT8 BroadwellE_IOPCI_Find[] = { 0x48, 0x81, 0xFB, 0x00, 0x00, 0x00, 0x40 };
-UINT8 BroadwellE_IOPCI_Repl[] = { 0x48, 0x81, 0xFB, 0x00, 0x00, 0x00, 0x80 };
+STATIC UINT8 BroadwellE_IOPCI_Find[] = { 0x48, 0x81, 0xFB, 0x00, 0x00, 0x00, 0x40 };
+STATIC UINT8 BroadwellE_IOPCI_Repl[] = { 0x48, 0x81, 0xFB, 0x00, 0x00, 0x00, 0x80 };
 
 VOID BDWE_IOPCIPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 InfoPlistSize, LOADER_ENTRY *Entry)
 {
     UINTN count = 0;
-    
+
     DBG_RT(Entry, "\nBDWE_IOPCIPatch: driverAddr = %x, driverSize = %x\n", Driver, DriverSize);
     if (Entry->KernelAndKextPatches->KPDebug) {
         ExtractKextBundleIdentifier(InfoPlist);
     }
-    
+
     DBG_RT(Entry, "Kext: %a\n", gKextBundleIdentifier);
     //
     // now, let's patch it!
     //
     count = SearchAndReplace(Driver, DriverSize, BroadwellE_IOPCI_Find, sizeof(BroadwellE_IOPCI_Find), BroadwellE_IOPCI_Repl, 0);
-    
+
     if (count) {
         DBG_RT(Entry, "==> IOPCIFamily: %d replaces done.\n", count);
     }
     else {
         DBG_RT(Entry, "==> Patterns not found - patching NOT done.\n");
     }
-    
+
     if (Entry->KernelAndKextPatches->KPDebug) {
         gBS->Stall(5000000);
     }
@@ -878,7 +878,7 @@ VOID AnyKextPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 Inf
 {
   UINTN   Num = 0;
   INTN    Ind;
-  
+
   DBG_RT(Entry, "\nAnyKextPatch %d: driverAddr = %x, driverSize = %x\nAnyKext = %a\n",
          N, Driver, DriverSize, Entry->KernelAndKextPatches->KextPatches[N].Label);
 
@@ -914,7 +914,7 @@ VOID AnyKextPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 Inf
       DBG_RT(Entry, "%c", Entry->KernelAndKextPatches->KextPatches[N].Patch[Ind]);
     }
     DBG_RT(Entry, "' \n");
-    
+
     Num = SearchAndReplaceTxt((UINT8*)InfoPlist,
                            InfoPlistSize,
                            Entry->KernelAndKextPatches->KextPatches[N].Data,
@@ -922,7 +922,7 @@ VOID AnyKextPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 Inf
                            Entry->KernelAndKextPatches->KextPatches[N].Patch,
                            -1);
   }
-  
+
   if (Entry->KernelAndKextPatches->KPDebug) {
     if (Num > 0) {
       DBG_RT(Entry, "==> patched %d times!\n", Num);
@@ -940,17 +940,17 @@ VOID AnyKextPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 Inf
 VOID KextPatcherRegisterKexts(FSINJECTION_PROTOCOL *FSInject, FSI_STRING_LIST *ForceLoadKexts, LOADER_ENTRY *Entry)
 {
   INTN i;
-  
+
   if (Entry->KernelAndKextPatches->KPATIConnectorsController != NULL) {
     ATIConnectorsPatchRegisterKexts(FSInject, ForceLoadKexts, Entry);
   }
-  
+
   for (i = 0; i < Entry->KernelAndKextPatches->NrKexts; i++) {
     FSInject->AddStringToList(ForceLoadKexts,
                               PoolPrint(L"\\%a.kext\\Contents\\Info.plist",
                                         Entry->KernelAndKextPatches->KextPatches[i].Name) );
   }
-  
+
 }
 
 //
@@ -960,7 +960,7 @@ VOID KextPatcherRegisterKexts(FSINJECTION_PROTOCOL *FSInject, FSI_STRING_LIST *F
 VOID PatchKext(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 InfoPlistSize, LOADER_ENTRY *Entry)
 {
   INT32 i;
-  
+
   if (Entry->KernelAndKextPatches->KPATIConnectorsController != NULL) {
     //
     // ATIConnectors
@@ -977,9 +977,9 @@ VOID PatchKext(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 InfoPl
       return;
     }
   }
-  
+
   ExtractKextBundleIdentifier(InfoPlist);
-  
+
   if (Entry->KernelAndKextPatches->KPAppleIntelCPUPM &&
       (AsciiStrStr(InfoPlist,
                    "<string>com.apple.driver.AppleIntelCPUPowerManagement</string>") != NULL)) {
@@ -1034,7 +1034,7 @@ VOID PatchKext(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 InfoPl
       }
     }
 //  }
-  
+
   //
   // Check for FakeSMC (InjectKexts if no FakeSMC)
   //
@@ -1071,43 +1071,43 @@ UINT64 GetPlistHexValue(CHAR8 *Plist, CHAR8 *Key, CHAR8 *WholePlist)
   UINTN     IDLen;
   CHAR8     Buffer[48];
   //static INTN   DbgCount = 0;
-  
+
   // search for Key
   Value = AsciiStrStr(Plist, Key);
   if (Value == NULL) {
     //DBG(L"\nNo key: %a\n", Key);
     return 0;
   }
-  
+
   // search for <integer
   IntTag = AsciiStrStr(Value, "<integer");
   if (IntTag == NULL) {
     DBG(L"\nNo integer\n");
     return 0;
   }
-  
+
   // find <integer end
   Value = AsciiStrStr(IntTag, ">");
   if (Value == NULL) {
     DBG(L"\nNo <integer end\n");
     return 0;
   }
-  
+
   if (Value[-1] != '/') {
-    
+
     // normal case: value is here
     NumValue = AsciiStrHexToUint64(Value + 1);
     return NumValue;
-    
+
   }
-  
+
   // it might be a reference: IDREF="173"/>
   Value = AsciiStrStr(IntTag, "<integer IDREF=\"");
   if (Value != IntTag) {
     DBG(L"\nNo <integer IDREF=\"\n");
     return 0;
   }
-  
+
   // compose <integer ID="xxx" in the Buffer
   IDStart = AsciiStrStr(IntTag, "\"") + 1;
   IDEnd = AsciiStrStr(IDStart, "\"");
@@ -1130,14 +1130,14 @@ UINT64 GetPlistHexValue(CHAR8 *Plist, CHAR8 *Key, CHAR8 *WholePlist)
    DBG(L"Searching: '%a'\n", Buffer);
    }
    */
-  
+
   // and search whole plist for ID
   IntTag = AsciiStrStr(WholePlist, Buffer);
   if (IntTag == NULL) {
     DBG(L"\nNo %a\n", Buffer);
     return 0;
   }
-  
+
   // got it. find closing >
   /*
    if (DbgCount < 3) {
@@ -1154,10 +1154,10 @@ UINT64 GetPlistHexValue(CHAR8 *Plist, CHAR8 *Key, CHAR8 *WholePlist)
     DBG(L"\nInvalid <integer IDREF end\n");
     return 0;
   }
-  
+
   // we should have value now
   NumValue = AsciiStrHexToUint64(Value + 1);
-  
+
   /*
    if (DbgCount < 3) {
    AsciiStrnCpy(Buffer, IntTag, sizeof(Buffer) - 1);
@@ -1166,7 +1166,7 @@ UINT64 GetPlistHexValue(CHAR8 *Plist, CHAR8 *Key, CHAR8 *WholePlist)
    }
    DbgCount++;
    */
-  
+
   return NumValue;
 }
 
@@ -1208,10 +1208,10 @@ VOID PatchPrelinkedKexts(LOADER_ENTRY *Entry)
   //INTN      DbgCount = 0;
   UINT32    KextAddr;
   UINT32    KextSize;
-  
-  
+
+
   WholePlist = (CHAR8*)(UINTN)PrelinkInfoAddr;
-  
+
   //
   // Detect FakeSMC and if present then
   // disable kext injection InjectKexts().
@@ -1222,12 +1222,12 @@ VOID PatchPrelinkedKexts(LOADER_ENTRY *Entry)
   // But searching through the whole prelink info
   // works and that's the reason why it is here.
   //
-  
+
   //Slice
   // I see no reason to disable kext injection if FakeSMC found in cache
   //since rev4240 we have manual kext inject disable
   CheckForFakeSMC(WholePlist, Entry);
-  
+
   DictPtr = WholePlist;
   while ((DictPtr = AsciiStrStr(DictPtr, "dict>")) != NULL) {
     if (DictPtr[-1] == '<') {
@@ -1238,16 +1238,16 @@ VOID PatchPrelinkedKexts(LOADER_ENTRY *Entry)
         InfoPlistStart = DictPtr - 1;
       }
     } else if (DictPtr[-2] == '<' && DictPtr[-1] == '/') {
-      
+
       // closing dict
       if (DictLevel == 2 && InfoPlistStart != NULL) {
         // kext end
         InfoPlistEnd = DictPtr + 5 /* "dict>" */;
-        
+
         // terminate Info.plist with 0
         SavedValue = *InfoPlistEnd;
         *InfoPlistEnd = '\0';
-        
+
         // get kext address from _PrelinkExecutableSourceAddr
         // truncate to 32 bit to get physical addr
         KextAddr = (UINT32)GetPlistHexValue(InfoPlistStart, kPrelinkExecutableSourceKey, WholePlist);
@@ -1256,9 +1256,9 @@ VOID PatchPrelinkedKexts(LOADER_ENTRY *Entry)
         KextAddr += KernelSlide;
         // and adjust for AptioFixDrv's KernelRelocBase
         KextAddr += (UINT32)KernelRelocBase;
-        
+
         KextSize = (UINT32)GetPlistHexValue(InfoPlistStart, kPrelinkExecutableSizeKey, WholePlist);
-        
+
         /*if (DbgCount < 3
          || DbgCount == 100 || DbgCount == 101 || DbgCount == 102
          ) {
@@ -1267,7 +1267,7 @@ VOID PatchPrelinkedKexts(LOADER_ENTRY *Entry)
          gBS->Stall(20000000);
          }
          */
-        
+
         // patch it
         PatchKext(
                   (UINT8*)(UINTN)KextAddr,
@@ -1276,7 +1276,7 @@ VOID PatchPrelinkedKexts(LOADER_ENTRY *Entry)
                   (UINT32)(InfoPlistEnd - InfoPlistStart),
                   Entry
                   );
-        
+
         // return saved char
         *InfoPlistEnd = SavedValue;
         //DbgCount++;
@@ -1302,16 +1302,16 @@ VOID PatchLoadedKexts(LOADER_ENTRY *Entry)
 	struct OpaqueDTPropertyIterator OPropIter;
 	DTPropertyIterator	PropIter = &OPropIter;
 	//UINTN               DbgCount = 0;
-  
-  
+
+
   DBG(L"\nPatchLoadedKexts ... dtRoot = %p\n", dtRoot);
-  
+
   if (!dtRoot) {
     return;
   }
-  
+
   DTInit(dtRoot);
-  
+
   if (DTLookupEntry(NULL,"/chosen/memory-map", &MMEntry) == kSuccess) {
     if (DTCreatePropertyIteratorNoAlloc(MMEntry, PropIter) == kSuccess) {
       while (DTIterateProperties(PropIter, &PropName) == kSuccess) {
@@ -1320,15 +1320,15 @@ VOID PatchLoadedKexts(LOADER_ENTRY *Entry)
           // PropEntry _DeviceTreeBuffer is the value of Driver-XXXXXX property
           PropEntry = (_DeviceTreeBuffer*)(((UINT8*)PropIter->currentProperty) + sizeof(DeviceTreeNodeProperty));
           //if (DbgCount < 3) DBG(L"%a: paddr = %x, length = %x\n", PropName, PropEntry->paddr, PropEntry->length);
-          
+
           // PropEntry->paddr points to _BooterKextFileInfo
           KextFileInfo = (_BooterKextFileInfo *)(UINTN)PropEntry->paddr;
-          
+
           // Info.plist should be terminated with 0, but will also do it just in case
           InfoPlist = (CHAR8*)(UINTN)KextFileInfo->infoDictPhysAddr;
           SavedValue = InfoPlist[KextFileInfo->infoDictLength];
           InfoPlist[KextFileInfo->infoDictLength] = '\0';
-          
+
           PatchKext(
                     (UINT8*)(UINTN)KextFileInfo->executablePhysAddr,
                     KextFileInfo->executableLength,

 

 

Edited by TheRacerMaster
  • Like 2
Link to comment
Share on other sites

Clover 4482 has broken kext injection of my ApplePS2SmartTouchPad.kext so i have no touchpad. External mouse works fine but trackpad is no longer detected. Was working fine with 4480 not sure about 4481 as i don't have it.

Edited by SavageAUS
Link to comment
Share on other sites

×
×
  • Create New...