InfiniteMac OSx86

InfiniteMac OSx86 (http://infinitemac.com/forum.php)
-   10.X (http://infinitemac.com/forumdisplay.php?f=36)
-   -   Blackknight (AnV/Qoopz-based) kernel w/corrected Phenom FSB detection (http://infinitemac.com/showthread.php?t=5112)

blackknight 01-03-2010 06:50 PM

Blackknight (AnV/Qoopz-based) kernel w/corrected Phenom FSB detection
 
Hi guys,

I am making available a kernel that I modified from the 10.2.0 AnV/Qoopz diff file that includes a corrected FSB detection specifically for Phenoms. I did not alter the diff in any other way, so they deserve most of the credit for this one. Basically, my change checks for whether the processor is a Phenom or Shanghai and if it is, doubles the detected FSB speed. If it isn't, the kernel is then the same as AnV/Qoopz's. I've included the diff file in case anyone wants to use what I've done in other kernels.

The reason it doubles the FSB is that the busratio is then detected as the actual CPU multiplier set in the BIOS and not double it. This means that you are no longer capped to 3.0 GHz as a maximum CPU clock speed since the kernel has a busratio cap of 30. Now, you can be able overclock your Phenom to up to 6GHz (theoretically) and the kernel won't panic due to the cap.

I hope this benefits all you Phenom users out there!!

http://www.innovativecinemasystems.c.../10.2.0-BK.zip

*EDIT*
Had to remove Shanghai support. I'll keep working on adding it and post an update when I think it'll work. I don't have one so I can't test, but when I added it to the kernel, it broke the Phenom support. When I get that fixed, I'll re-upload so people with Shanghais can test it.

*UPDATE 03/23/2010*
I changed the patch a little to try to add Shanghai support back in and I think it's working, but I don't have a Shanghai to test (please test if you have one and let me know). Also, the kernel has been updated using Andy's new Release2. I need to know if this still works with Intel (any) and Athlon (older than Athlon 2 and Phenoms). Please test and let me know.

Also, I have updated the diff file to only apply to xnu-1486.2.11 that has already been patched by one of the other methods. This should really just help Andy incorporate it into his future kernels and doesn't really apply to others unless they are already patching the kernel using the Voodoo methods. All it does is add the Phenom/Shanghai detection.

*UPDATE* now available for 10.6.3
Here's the new kernel and diff file for 10.3.0:http://www.innovativecinemasystems.c.../10.3.0-BK.zip

Let me know if it works for you. Also, -force64 is still not working correctly for AMD and I think it has something to do with one of Andy's mods, but I don't know for sure.

toanbk 01-04-2010 06:09 AM

does it work well with fly - cpuid and AMD ATHLON ?

blackknight 01-04-2010 06:19 AM

No, all it does is correctly identify the FSB in addition to all of the other AnV features. You can read about AnV's kernel in his thread.

RetroRen 01-05-2010 12:19 AM

Thanks for thre kernel but It doesnt work for me yet, same as with Andys kernel:

I put system.kext that Andy provided with kernel in S/L/E and installed thekernel but my boot just stops. When I try to boot to safe mode i get KP.

This is where my boot stops:
http://www.imagesforme.com/thumb/thumb_b2e5d91c.jpg

blackknight 01-05-2010 02:30 AM

I just use the vanilla System.kext. I actually don't have any modified Apple kexts in my system. Try that and see if it works. Also, make sure you're using PC_EFIv10.5 as it seems to work the best.

RetroRen 01-05-2010 08:27 AM

Quote:

Originally Posted by blackknight (Post 42424)
I just use the vanilla System.kext. I actually don't have any modified Apple kexts in my system. Try that and see if it works. Also, make sure you're using PC_EFIv10.5 as it seems to work the best.

I knew it was a bad idea to use a modified kext.
Will replace it as soon as a find vanilla System.kext, because I was stupid enough not to back it up :D

I guess it's that modified kext, I'm using PC_EFIv10.5.

andyvand 01-23-2010 09:10 PM

Thanks Black Knight for the fixes to Shanghai/Phenom.
Feel free to redistribute the patches etc...
Anybody may use my code as they see fit ;)
Keep up the great work. :)

blackknight 01-23-2010 10:12 PM

Quote:

Originally Posted by andyvand (Post 43649)
Thanks Black Knight for the fixes to Shanghai/Phenom.
Feel free to redistribute the patches etc...
Anybody may use my code as they see fit ;)
Keep up the great work. :)

Glad I could help. I hope that this feature is added to future kernels too so I don't have to modify it every time. Thanks for the code to start with Andy and you keep up the great work too!!

bhokuto 03-19-2010 05:33 AM

Quote:

Originally Posted by blackknight (Post 42320)
Hi guys,

I am making available a kernel that I modified from the 10.2.0 AnV/Qoopz diff file that includes a corrected FSB detection specifically for Phenoms. I did not alter the diff in any other way, so they deserve most of the credit for this one. Basically, my change checks for whether the processor is a Phenom or Shanghai and if it is, doubles the detected FSB speed. If it isn't, the kernel is then the same as AnV/Qoopz's. I've included the diff file in case anyone wants to use what I've done in other kernels.

The reason it doubles the FSB is that the busratio is then detected as the actual CPU multiplier set in the BIOS and not double it. This means that you are no longer capped to 3.0 GHz as a maximum CPU clock speed since the kernel has a busratio cap of 30. Now, you can be able overclock your Phenom to up to 6GHz (theoretically) and the kernel won't panic due to the cap.

I hope this benefits all you Phenom users out there!!

http://www.innovativecinemasystems.c.../10.2.0-BK.zip

*EDIT*
Had to remove Shanghai support. I'll keep working on adding it and post an update when I think it'll work. I don't have one so I can't test, but when I added it to the kernel, it broke the Phenom support. When I get that fixed, I'll re-upload so people with Shanghais can test it.

thanks mang

andyvand 03-19-2010 05:08 PM

http://rapidshare.com/files/36547018..._rel2.diff.zip
Could you update this with your patch?
It corrects a little mistake I've made with the first release...
You may then upload that version (will work with AppleIntelCPUPowerManagement, previous one didn't... also sets core detection better)

blackknight 03-24-2010 03:01 AM

bump for an update

gedna 03-26-2010 04:26 PM

thank you, works great, jus wondering, its suppose to work faster, than previous version? what is the main differences between this and older?

blackknight 03-30-2010 09:00 PM

Quote:

Originally Posted by gedna (Post 46652)
thank you, works great, jus wondering, its suppose to work faster, than previous version? what is the main differences between this and older?

The only thing my mod does is correctly detect the FSB speed for AMD Phenoms and Shanghai processors allowing them to run at speeds higher than 3.0 GHz without kernel panic. If you have a Phenom I or II with a clock speed lower than 3.0 GHz and don't overclock, it doesn't really make a difference, but if you're is higher, it will no longer kernel panic at boot-up.

m28ew 03-31-2010 04:11 PM

any new patched mach_kernel 10.3.0 ?
 
@ blackknight :

could you build a new patched mach_kernel 10.3.0 for the AMD system ?

fyi, now I'm running the Snow Leo Server 10.6.3 with your latest patched kernel (the blackknight's darwin 10.2.0)

http://i39.tinypic.com/2a66z6d.jpg


thanks for your great efforts :)

blackknight 03-31-2010 04:48 PM

Quote:

Originally Posted by m28ew (Post 46858)
@ blackknight :

could you build a new patched mach_kernel 10.3.0 for the AMD system ?

fyi, now I'm running the Snow Leo Server 10.6.3 with your latest patched kernel (the blackknight's darwin 10.2.0)

http://i39.tinypic.com/2a66z6d.jpg


thanks for your great efforts :)

Could you please post your system specs? I noticed that you have 64 bit mode working, which I haven't been able to do with snow 10.6.2.

Also, the darwin 10.3.0 kernel sources haven't been posted yet, so we can't make new kernels yet.

m28ew 03-31-2010 05:50 PM

Quote:

Originally Posted by blackknight (Post 46860)
Could you please post your system specs? I noticed that you have 64 bit mode working, which I haven't been able to do with snow 10.6.2.

Also, the darwin 10.3.0 kernel sources haven't been posted yet, so we can't make new kernels yet.

thanks for the answer :)

and here is my specs :

- AMD Phenom II x4 965 BE c3
- Biostar TA790GX A3+
- 2X2GB OCZ AMD Platinum DDR3 PC12800 Dual Channel 7-7-7-24
- ATI HD3300 onboard (no QE/CI support) :D

RayFlower 03-31-2010 08:26 PM

Hey, this didn't work for me after upgrading to 10.6.3 and replacing the mach_kernel with this one i get the following kernel panic:

http://img62.imageshack.us/img62/8563/dsc02060a.th.jpg

Using a Phenom II X4 945
Gigabyte GA-MA790X-UD3P

blackknight 04-03-2010 12:48 AM

Quote:

Originally Posted by RayFlower (Post 46871)
Hey, this didn't work for me after upgrading to 10.6.3 and replacing the mach_kernel with this one i get the following kernel panic:

http://img62.imageshack.us/img62/8563/dsc02060a.th.jpg

Using a Phenom II X4 945
Gigabyte GA-MA790X-UD3P

Did you notice that the kernel is for 10.6.2 and not 10.6.3? Wait for a new kernel based on 10.6.3.

eMatoS 04-03-2010 01:55 AM

Over insanelymac there's a release by qoopz/nawcom of the new 10.3.0 kernel.

RayFlower 04-03-2010 03:10 AM

Quote:

Originally Posted by blackknight (Post 46987)
Did you notice that the kernel is for 10.6.2 and not 10.6.3? Wait for a new kernel based on 10.6.3.

Yes, that I'm fully aware of, however i did a clean install, turns out my cpuids that i "fixed" with marvins tool caused a lot of touble, anyhow now i can boot into 10.6.3 just fine with this kernel, I'll check out the new kernel later today:)

ceti 04-15-2010 01:55 PM

Quote:

Originally Posted by m28ew (Post 46864)
thanks for the answer :)

and here is my specs :

- AMD Phenom II x4 965 BE c3
- Biostar TA790GX A3+
- 2X2GB OCZ AMD Platinum DDR3 PC12800 Dual Channel 7-7-7-24
- ATI HD3300 onboard (no QE/CI support) :D

How did you get 64bit enable.

andyvand 04-17-2010 10:00 AM

Can you please build a 10.6.3 kernel?
The patches go in cleanly... I've checked...

ceti 04-17-2010 02:40 PM

andyvand,
what kind of file is this AnV_Qoopz_snow_leopard_xnu_rel2.diff, what do you
do with it.

ceti 04-17-2010 02:47 PM

m28we,
How did you get 64bit enable. are the apps running.

blackknight 04-18-2010 06:28 AM

I've built the a new kernel based on 10.3.0 and added the link and diff to the first post. So far it's working for my Phenom 9950, though -force64 still doesn't work and I now think it might have to do with one of Andy's mods. When I made my change to the 10.3.0 legacy kernel by nawcom/qoopz, -force64 sort of worked, but now I can't boot into the GUI with Andy's.

Enjoy!

-BK

jazZbaR 04-18-2010 10:54 AM

works great with my phenom II x4 and now without the busratio flag.

thx

blackknight 04-18-2010 08:21 PM

Glad to hear it jazZbaR!

sulphide 04-18-2010 09:11 PM

vmware fusion 3.0.2 is not working with 10.3.0 of this kernel - always get kp on launch... with 10.3.0 Legacy Kernel for INTEL/AMD by qoopz/nawcom everything is ok, currently running win xp... don't know maybe reinstalling vmware will help? didn't try...
ps phenom II x4 925 ddr3 4gb, latest 10.6.3 osx

gipo 04-18-2010 10:51 PM

Running great for me... very smooth.
My mouse run perfectly without lags... that were present with 10.3 by nawcom/qoopz
Xbench even raised up.

m28ew 04-19-2010 05:56 PM

32-bits applications: quit unexpectedly
 
@ blackknight :

thanks for the new patched kernel :)

1. in 32-bits mode (using flag: arch=i386) : all kexts & applications run OK


2. in 64-bits mode (using flag: -force64) :

+ both 32 & 64-bits kexts run OK
+ only 64-bits applications run OK

- all 32-bits application crash & quit unexpectedly with these errors :

Code:

Exception Type:  EXC_BAD_INSTRUCTION (SIGILL)
Exception Codes: 0x0000000000000001, 0x0000000000000000
Crashed Thread:  0

Thread 0 Crashed:
0  dyld                              0x8fe2b7af _sysenter_trap + 3
1  dyld                              0x8fe2d5da mach_init + 47
2  dyld                              0x8fe01766 dyldbootstrap::start(macho_header const*, int, char const**, long) + 448
3  dyld                              0x8fe01057 _dyld_start + 39

Thread 0 crashed with X86 Thread State (32-bit):
  eax: 0xffffffe4  ebx: 0x8fe2d49c  ecx: 0xbffffabc  edx: 0x8fe2dce2
  edi: 0x00000000  esi: 0x00000000  ebp: 0xbffffb08  esp: 0xbffffabc
  ss: 0x0000001f  efl: 0x00010286  eip: 0x8fe2b7af  cs: 0x00000017
  ds: 0x0000001f  es: 0x0000001f  fs: 0x00000000  gs: 0x00000000
  cr2: 0x8fe2b7ac

Binary Images:
0x8fe00000 - 0x8fe4162b  dyld 132.1 (???) <211AF0DD-42D9-79C8-BB6A-1F4BEEF4B4AB> /usr/lib/dyld


andyvand 04-21-2010 09:10 PM

It has to do with the sysenter instruction being unavailable on AMD.
We need sysenter emu / replacement code in custom dyld...

RayFlower 04-21-2010 11:49 PM

Thanks, this kernel works fine for me with the exception of 64bit of course, however about the dyld fix, was this something that worked in leopard and can be backwards engineered or is this something completely different that will be hard to implement?

SL is still not an option to me because the experience is too unstable but i always keep a partition of it on a old ide drive to play around with, my main issue now is that some AudioUnit plugins(from ikmultimedia only) kills /usr/bin/avaltool which is the tool Logic and Logic Express uses to verify AudioUnits, this wasn't a problem with my previous SL install but i have no idea what causes this.

Otherwise SL on amd is now pretty stable after removing the necessary cpuids, so a big thumbs up for everyone who are involved with the development of this kernel and the kernels its based on:)

blackknight 05-03-2010 11:00 PM

I am sure both Andy and I are glad to help. Andy definitely knows more about the kernel than I do.

As far as the on-the-fly CPUID patcher, is anyone working on this? Did the Voodoo team die or something? This is one thing that makes AMD installs so difficult. If it wasn't for the fact that my Radeon HD 4550 won't work in Leopard, I would be using it exclusively as it is rock-solid and easy to setup. If someone would give me some help in building a kernel for 10.5, I would have my Phenom patch working with it too. At least with Leopard, I can get my ALC889a working with 7.1 analog surround sound whereas I can't get any sound to work in SL. I wonder if it has something to do with the kernel though.

RayFlower 05-03-2010 11:29 PM

A phenom optimized leopard kernel would be most welcome!

gotytytyty 05-27-2010 03:04 AM

@ m28ew : Hi, how did you manage to install SL? I have the same motherboard as yours but mine gets stuck at " controller will be unloaded across sleep ".

Thanks in advance!

andyvand 05-27-2010 12:17 PM

This evening I'll make a full and complete kernel with otf patcher (cpuid + sysenter patcher). I'll post it when done... keep you posted ;)
update:
voodoobuild.sh 60 procent done
dyld patch ready

eMatoS 05-28-2010 08:47 PM

I'll be waiting to test that :)

RayFlower 05-28-2010 11:09 PM

Great, thats lovely news!

Imkantus 05-28-2010 11:11 PM

Me, too! :)

Can't wait to try this... :cool:

Quote:

Originally Posted by andyvand (Post 48498)
dyld patch ready

Just for my interest & better understanding as kind of N00b regarding these things: dyld is used to load libraries, frameworks, etc needed by a process? And SYSENTER is an Opcode that is required by dyld to peform some kind of operation (64-Bit related??), but SYSENTER is not supported by AMD CPUs right?
So even with having that dyld Patch - I would still need to patch CPUIDs? And CPUID means that the software is checking if the machine is using a GenuineIntel CPU?

Sorry for that many (dumb?) questions & if I might be totally wrong - but I would realy appreciate to get some help with understanding things better. :)

andyvand 05-29-2010 10:30 AM

sysenter is used by dyld to map the app and then run it.
the custom dyld uses syscall 8 (used to be old creat call in Tiger and older, customized to map segment).
Here is an update:
voodoobuild about 85 procent done
fixed Libc build issue, it now builds correct
fixed libsyscall, added dependencies from iokit and the required headers which were missing from IOUSBFamily and IOFireWireFamily, it now builds too.
Now all that is left is libsystem static libc build, dyld and then I can work on the kernel.
dyld will thus be finished today ;)

blackknight 05-29-2010 04:20 PM

Awesome Andy!!! I am so happy that someone even attempted to get this working and I pretty much knew it had to be you. Also, thanks for the updates. I can't stand it when someone promises to do something that everybody has been waiting for and it ends up being vaporware because they don't let people know what's going on with it. Thanks man.

timberwolf5 05-31-2010 03:58 AM

hows the progress andy?

andyvand 06-03-2010 07:22 AM

progress:
fixed voodoobuild.sh for sl
fixed dyld, it now builds correct with patches applied
fixed libkld build (optional since sl)
still to do: xnu
I will first implement custom amd dyld + syscall 8 (for mapping the segment, required by amd dyld), then I'll focus on the cpuid + sysenter patcher.
just 2 more things to do on the checklist ;)
I'll keep you posted on progress

RayFlower 06-03-2010 07:15 PM

Awesome, can't wait!

Considered making a sourceforge account with svn/cvs/git or something when its done so people can easier contribute to the project opposed to rapidsharing thing?
Just a suggestion anyway, glad to see that someone is dedicated to make osx available and more accessible to all x86/64 users!

blackknight 06-04-2010 07:00 AM

Hey Andy,

I'm wondering if my AMD CPU FSB detection is now implemented as standard in your code. Also, is there any work by anyone on getting full 64-bit mode working on AMD?

andyvand 06-04-2010 07:57 AM

I am working on full 32 + 64 bit amd xnu
@blackknight: can you post a diff (your patch only, diff between my patch and yours)

blackknight 06-04-2010 10:08 AM

Quote:

Originally Posted by andyvand (Post 48650)
I am working on full 32 + 64 bit amd xnu
@blackknight: can you post a diff (your patch only, diff between my patch and yours)

At the moment, the graphics card on my system has died, so all I can do is paste the part of the full diff I posted in the first post that applies.

Code:

-    busFreq = EFI_FSB_frequency();
-
+    if (!PE_parse_boot_argn("fsb", &busFreq, sizeof(busFreq))) {
+        // blackknight; added for corrected FSB detection for Phenoms and Shanghais
+        switch (cpuid_family()) {
+            case CPU_FAMILY_AMD_PHENOM:
+            case CPU_FAMILY_AMD_SHANGHAI: {
+                busFreq = 2 * EFI_FSB_frequency();
+            }
+            break;
+            default:
+                busFreq = EFI_FSB_frequency();
+        }
+    }
+   
    switch (cpuid_cpufamily()) {

Look for this code in the tsc.c file. It shouldn't be hard to find. As you can see, it's just a check to see if it's an AMD Phenom or Shanghai or not and doubles the detected EFI_FSB_frequency if it is.

ashp 06-04-2010 05:33 PM

groundbreaking stuff i'm really excited been search ages for work like this on kernels I feel bad that i'm not as capable if there is any way i can help andy, please let me know.

Regards,
Ash

gotytytyty 06-09-2010 02:41 AM

Thanks, Andy! I'm very excited to hear the news :)
I'm using 10.3.0 Blackknight kernel. So far, everythings works wonderful, of course, i still can't run 32bit app in 64bit mode. However, I have a problem with installing After Effect CS5. It keep on asking for 64bit system for it to be installed. I've tried to install it in x64 mode, but I cant even run the installer in this mode.
I dont know if it's a kernel's problem or something else, and I really need After Effect.

Here is my specs:
AMD PHENOM II X4 B50 @3.6ghz (It's originally X2 but I unlocked it to X4. I still feel lucky! )
Mainboard BIOSTAR A3+

Thanks Andy and Blackknight for everything you guys have done so far! It's so meaningful to the OSX86 community :)

timberwolf5 06-09-2010 11:28 PM

Thanks for the update Andy! Cant wait!