Jump to content

Clover General discussion


ErmaC
30,157 posts in this topic

Recommended Posts

ok, the time to compile Clover with this:

 

UINT8   KBESieSearchEXT[]        = { 0xE8, 0x25, 0x00, 0x00, 0x00, 0xEB, 0x05, 0xE8, 0x9E, 0x05, 0x00, 0x00 };

UINT8   KBESieReplaceEXT[]       = { 0xE8, 0x25, 0x00, 0x00, 0x00, 0x90, 0x90, 0xE8, 0x9E, 0x05, 0x00, 0x00 }

 

//UINT8   KBESieSearchEXT[]        = { 0xE8, 0x25, 0x00, 0x00, 0x00, 0xEB, 0x05, 0xE8, 0x7E, 0x05, 0x00, 0x00 };

//UINT8   KBESieReplaceEXT[]       = { 0xE8, 0x25, 0x00, 0x00, 0x00, 0x90, 0x90, 0xE8, 0x7E, 0x05, 0x00, 0x00 };

 

2 minutes..

Warning: this will fail to boot extensions in 10.12, 10.12.1, 10.12.2 and 10.12.3 from Clover dir. You should try to boot only 10.12.4 from usb. If works later will be udjusted

Hi. Why not delete 'e8 9e 05 00 00'? The only thing we should do is 'eb 05' ==> '90 90'. And I can assure that only one set of this data can be found.

 

BTW. Tested. KernelPm/KernelCPU/KernelLapic/AppleRTC/FakeCPUID will still work.  :)

Link to comment
Share on other sites

@Micky1979

 

nice work. thank you :)

 

@Slice i cleaned up kext_inject.c.

 

we dont need 

 

 

 

 

+// Sierra debug kernel
+UINT8 KBESieDebugSearchEXT[] = { 0xE8, 0x47, 0x00, 0x00, 0x00, 0xE9, 0x09, 0x00, 0x00, 0x00, 0x48, 0x8B, 0x7D, 0xE8, 0xE8, 0xD9 };
+UINT8 KBESieDebugReplaceEXT[] = { 0xE8, 0x47, 0x00, 0x00, 0x00, 0x90, 0x90, 0x00, 0x00, 0x00, 0x48, 0x8B, 0x7D, 0xE8, 0xE8, 0xD9 };
+UINT8 KBESieDebugSearchSIP[] = { 0x31, 0xC9, 0x39, 0xC1, 0x0F, 0x85, 0x3C, 0x00, 0x00, 0x00, 0x48, 0x8B, 0x85, 0xF8, 0xFE, 0xFF };
+UINT8 KBESieDebugReplaceSIP[] = { 0x31, 0xC9, 0x39, 0xC1, 0xEB, 0x80, 0x90, 0x90, 0x90, 0x90, 0x48, 0x8B, 0x85, 0xF8, 0xFE, 0xFF };
+
+// Sierra develop kernel
+UINT8 KBESieDevelSearchEXT[] = { 0xE8, 0x47, 0x00, 0x00, 0x00, 0xE9, 0x09, 0x00, 0x00, 0x00, 0x48, 0x8B, 0x7D, 0xE8, 0xE8, 0xD9 };
+UINT8 KBESieDevelReplaceEXT[] = { 0xE8, 0x47, 0x00, 0x00, 0x00, 0x90, 0x90, 0x00, 0x00, 0x00, 0x48, 0x8B, 0x7D, 0xE8, 0xE8, 0xD9 };
+UINT8 KBESieDevelSearchSIP[] = { 0x31, 0xC9, 0x39, 0xC1, 0x0F, 0x85, 0x3C, 0x00, 0x00, 0x00, 0x48, 0x8B, 0x85, 0xF8, 0xFE, 0xFF };
+UINT8 KBESieDevelReplaceSIP[] = { 0x31, 0xC9, 0x39, 0xC1, 0xEB, 0x80, 0x90, 0x90, 0x90, 0x90, 0x48, 0x8B, 0x85, 0xF8, 0xFE, 0xFF };

 

 

it's same hex code. we have to choose one(just prefer to choose name name. not important name)

clover always enter + else if (NumSieDebug == 1) {

 

 

+ else if (NumSieDebug == 1) {
+ Num = SearchAndReplace(Kernel, KERNEL_MAX_SIZE, KBESieDebugSearchEXT, sizeof(KBESieDebugSearchEXT), KBESieDebugReplaceEXT, 1) +
+ SearchAndReplace(Kernel, KERNEL_MAX_SIZE, KBESieDebugSearchSIP, sizeof(KBESieDebugSearchSIP), KBESieDebugReplaceSIP, 1);
+ DBG_RT(Entry, "==> kernel Sierra Debug: %d replaces done.\n", Num);
+ }
+ else if (NumSieDevel == 1) {
+ Num = SearchAndReplace(Kernel, KERNEL_MAX_SIZE, KBESieDevelSearchEXT, sizeof(KBESieDevelSearchEXT), KBESieDevelReplaceEXT, 1) +
+ SearchAndReplace(Kernel, KERNEL_MAX_SIZE, KBESieDevelSearchSIP, sizeof(KBESieDevelSearchSIP), KBESieDevelReplaceSIP, 1);
+ DBG_RT(Entry, "==> kernel Sierra Development: %d replaces done.\n", Num);
+ }
+

 

never enter + else if (NumSieDevel == 1) {.

because same hex code.

if one of hex code has difference, i never mention it now

 

i remove this one

 

and added 10.12.4+ hex code by micky

 

thank you

kext_inject.c-clean2.zip

  • Like 2
Link to comment
Share on other sites

@Micky1979

 

nice work. thank you :)

 

@Slice i cleaned up kext_inject.c.

 

we dont need 

 

 

it's same hex code. we have to choose one(just prefer to choose name name. not important name)

clover always enter + else if (NumSieDebug == 1) {

 

never enter + else if (NumSieDevel == 1) {.

because same hex code.

 

i remove this one

 

and added 10.12.4+ hex code by micky

 

thank you

I think there's a typo...

KBESie4*EXT is for 10.12.0 - 10.12.3, and KBESie*EXT is for 10.12.4+... You can check the hex code.  :)

(Previously it's 'e8 7e' and now it's 'e8 9e'.)

 

BTW. I think the code for KBESieDebugReplaceEXT is wrong. Only NOP out 'e9 09' is not enough. Actually the 'e9 09 00 00 00' is the integrated jmpq and thus we should fill it with '90 90 90 90 90' (5x NOPs).

 

Edit: Here is the fixed one..

 

Edited by PMheart
  • Like 1
Link to comment
Share on other sites

I think there's a typo...

KBESie4*EXT is for 10.12.0 - 10.12.3, and KBESie*EXT is for 10.12.4+... You can check the hex code.  :)

(Previously it's 'e8 7e' and now it's 'e8 9e'.)

 

Edit: Here is the fixed one..

attachicon.gifnew_kext_inject.c.zip

 

i take a micky code. your are right. i checked old hex code. i changed kext_inject.c now

  • Like 2
Link to comment
Share on other sites

I updated it. Check above.

 

checked. you just did change hex order. "(Previously it's 'e8 7e' and now it's 'e8 9e'.)"

 

 

UINT8   KBESieSearchEXT[]        = { 0xE8, 0x25, 0x00, 0x00, 0x00, 0xEB, 0x05, 0xE8, 0x9E, 0x05, 0x00, 0x00 };

UINT8   KBESieReplaceEXT[]       = { 0xE8, 0x25, 0x00, 0x00, 0x00, 0x90, 0x90, 0xE8, 0x9E, 0x05, 0x00, 0x00 };

UINT8   KBESie4SearchEXT[]       = { 0xE8, 0x25, 0x00, 0x00, 0x00, 0xEB, 0x05, 0xE8, 0x7E, 0x05, 0x00, 0x00 };

UINT8   KBESie4ReplaceEXT[]      = { 0xE8, 0x25, 0x00, 0x00, 0x00, 0x90, 0x90, 0xE8, 0x7E, 0x05, 0x00, 0x00 };

to

 

UINT8   KBESieSearchEXT[]        = { 0xE8, 0x25, 0x00, 0x00, 0x00, 0xEB, 0x05, 0xE8, 0x7E, 0x05, 0x00, 0x00 };

UINT8   KBESieReplaceEXT[]       = { 0xE8, 0x25, 0x00, 0x00, 0x00, 0x90, 0x90, 0xE8, 0x7E, 0x05, 0x00, 0x00 };

UINT8   KBESie4SearchEXT[]       = { 0xE8, 0x25, 0x00, 0x00, 0x00, 0xEB, 0x05, 0xE8, 0x9E, 0x05, 0x00, 0x00 };

UINT8   KBESie4ReplaceEXT[]      = { 0xE8, 0x25, 0x00, 0x00, 0x00, 0x90, 0x90, 0xE8, 0x9E, 0x05, 0x00, 0x00 };

 

it's not important order. but it help more clear.

 

thank you

kext_inject.c-clean2.zip

  • Like 2
Link to comment
Share on other sites

Please distribute new unstable kernel patch version pattern via "KernelToPatch" (this features exists for this kind of purposes) and not into source, they will be junk someday IMHO

 

EDIT: Im trying to patch Smbios Table134 days ago to store smc revision. They exist in header & seems didnt do anything. Am I doing wrong / this completely unnecessary?

Edited by cecekpawon
  • Like 6
Link to comment
Share on other sites

Please distribute new unstable kernel patch version pattern via "KernelToPatch" (this features exists for this kind of purposes) and not into source, they will be junk someday IMHO

 

 

Yes!

	<key>KernelAndKextPatches</key>
	<dict>
		<key>KernelToPatch</key>
		<array>
			<dict>
				<key>Comment</key>
				<string>Kext inject allowed</string>
				<key>MatchOS</key>
				<string>10.12.4</string>
				<key>Find</key>
				<data>6CUAAADrBeieBQAA</data>
				<key>Replace</key>
				<data>6CUAAACQkOieBQAA</data>
			</dict>
		</array>

Screen Shot 2017-01-25 at 10.25.31.png

  • Like 5
Link to comment
Share on other sites

Rev 3879

Skylake support, by goodwin_c.

	<key>CPU</key>
	<dict>
		<key>HWPEnable</key>
		<true/>
	</dict>

 

This variable switches on Intel Speed Shift technology.

Also named Hardware-Controlled Performance States

Present on MacBook9,1

 

Is this needed to be set on skylake if using an ssdt?

Does checking the box (clover configurator) enable this feature? or disable it?

 

Never mind, trialled it and setting the checkbox set my CPU @ 4ghz and stayed at that.

Link to comment
Share on other sites

i take a micky code. your are right. i checked old hex code. i changed kext_inject.c now

 

Please distribute new unstable kernel patch version pattern via "KernelToPatch" (this features exists for this kind of purposes) and not into source, they will be junk someday IMHO

 

EDIT: Im trying to patch Smbios Table134 days ago to store smc revision. They exist in header & seems didnt do anything. Am I doing wrong / this completely unnecessary?

 

 

No

pity.

 

Guys why not like this?

 

else if (NumSie == 1) {

      Num = SearchAndReplace(Kernel, KERNEL_MAX_SIZE, KBESieSearchSIP, sizeof(KBESieSearchSIP), KBESieReplaceSIP, 1);

      

      if ((Num +1) != (Num + SearchAndReplace(Kernel, KERNEL_MAX_SIZE, KBESieSearchEXT, sizeof(KBESieSearchEXT), KBESieReplaceEXT, 1))) {

          // this is for 10.12.4 beta and may (or not) be changed.

          // to avoid an additional search that takes time (even if little), do that only if SearchAndReplace return 0

          Num = Num + SearchAndReplace(Kernel, KERNEL_MAX_SIZE, KBESie4SearchEXT, sizeof(KBESie4SearchEXT), KBESie4ReplaceEXT, 1);

          // but if the patch will be confirmed, swap KBESie4* with KBESie* to be faster in newer version of Sierra!

      }

      else

      {

          Num ++;

      }

      DBG_RT(Entry, "==> kernel Sierra: %d replaces done.\n", Num);

  }

 

will speed up the process (not tested, and off course if SearchAndReplace respect the MaxReplaces  given)

Link to comment
Share on other sites

but ...we have the "decode kernel" function in Clover?
No

this is the same: Get_PreLink() ...should be a good place to dinamically patching the kernel (LC_SEGMENT/LC_SEGMENT_64), since we already iterates through the kernel in that function.

Everythings needs is already in loader.h

Link to comment
Share on other sites

×
×
  • Create New...