overdue-scratch

Author Topic: Chameleon lapic fix  (Read 15584 times)

0 Members and 1 Guest are viewing this topic.

yehia2amer

  • Observer
  • Posts: 15
Chameleon lapic fix
« on: August 16, 2010, 12:30:11 AM »
there is a common issues with all new HP laptops
which is lapic.c in the path xnu-1504.3.12/osmfk/i386/lapic.c
use search to find : /* ExtINT */ and after the third instance [inside the lapic_configure() ] you add 2 lines of code :

/* NMI: ummasked, off course */
LAPIC_WRITE(LVT_LINT1, LAPIC_LVT_DM_NMI);

for more info : http://www.projectosx.com/forum/index.php?showtopic=1210

meklort said that he plans on including a fix for this in Chameleon

Quote
It's a kernel patch that chameleon applies, it has nothing to do with the DSDT. The support code that I need to write is to locate the correct patch location. Once it's located you need to replace
002af296   movl   _lapic_start,%edx
002af29c   addl   $0x00000320,%edx
002af2a2   movl   _lapic_interrupt_base,%eax
002af2a7   addl   $0x0e,%eax
002af2aa   movl   %eax,(%edx)
002af2ac   movl   _lapic_start,%edx
002af2b2   addl   $0x00000340,%edx
002af2b8   movl   _lapic_interrupt_base,%eax
002af2bd   addl   $0x0f,%eax
002af2c0   movl   %eax,(%edx)
002af2c2   movl   _lapic_start,%edx
002af2c8   addl   $0x00000330,%edx
002af2ce   movl   _lapic_interrupt_base,%eax

with this:

movl   _lapic_start,%edx
addl   $0x00000360,%edx
movl   $0x00000400,(%eax)
subl   $0x00000040,%edx
movl   _lapic_interrupt_base,%eax
addl   $0x0e,%eax
movl   %eax,(%edx)
addl   $0x00000020,%edx
addl   $0x0f,%eax
movl   %eax,(%edx)
subl   $0x00000330,%edx
addl   $0x0c,%eax
movl   %eax,(%edx)

You also need to ensure that the extra space saved (about 10 bytes) is filled in with nops.

So i hope that this fix is added to the chameleon RC5

ricardoq

  • Entrant
  • Posts: 4
Re: Chameleon lapic fix
« Reply #1 on: August 24, 2010, 03:58:43 PM »
I hope that the patch will add so early to chameleon, It's so really important. I hope;)

yehia2amer

  • Observer
  • Posts: 15
Re: Chameleon lapic fix
« Reply #2 on: August 31, 2010, 01:33:10 AM »
it will be the best thing ever added to chameleon RC5 , i really hope to add this patch

meklort

  • VoodooLabs
  • Posts: 65
Re: Chameleon lapic fix
« Reply #3 on: August 31, 2010, 01:40:35 AM »
Take a look in my branch in svn, it's not the best of patches, but my machine still boots, so I'm hoping it works (aka, would you like to test it?) Note that I've only tested this on the 10.0.0 kernel so if the structure of lapic_configure changed, the patch won't work, let me know what happens.

The kernel patcher is implemented as a chameleon module, so you need to do a few things to get it working.
1) Install boot, boot0, and boot1 as usual (If you were not using a recent version of chameleon RC5, please install all of them to be safe, there have been changes to boot1).
2) Create a /Extra/modules/ folder
3) Copy Symbols.dylib and KernelPatcher.dylib to the /Extra/modules/ folder, reboot and hope it works (make sure to boot using the vanilla kernel, bad things might happen with an already patched kernel.

Please make sure you have an external boot device with a known working version of chameleon or a way to delete the KernelPatcher.dylib module file.

EDIT:  Do note that this is a 32bit only patch at the moment.
« Last Edit: August 31, 2010, 01:47:30 AM by meklort »
return c ? c : !c;

yehia2amer

  • Observer
  • Posts: 15
Re: Chameleon lapic fix
« Reply #4 on: August 31, 2010, 03:55:11 PM »
thanks meklort for your efforts

of course i want to test, i don't get my wireless working on mac , so i can't download the files & the bootloader

please give me a direct link

thanks in advance, and again great job :)

meklort

  • VoodooLabs
  • Posts: 65
Re: Chameleon lapic fix
« Reply #5 on: September 02, 2010, 12:14:48 AM »
Best way is to checkout the svn branch and compile it yourself.... but since I had some free time, here you go: http://dl.dropbox.com/u/863180/test/Chameleon_w_modules.zip
return c ? c : !c;

ricardoq

  • Entrant
  • Posts: 4
Re: Chameleon lapic fix
« Reply #6 on: September 03, 2010, 12:07:01 AM »
Hi meklort, what's the key for the com.apple.Boot.plist to start the patch of kernel?


meklort

  • VoodooLabs
  • Posts: 65
Re: Chameleon lapic fix
« Reply #7 on: September 03, 2010, 12:41:08 AM »
There is none, it does it automatically if you place the files in the right location.
return c ? c : !c;

yehia2amer

  • Observer
  • Posts: 15
Re: Chameleon lapic fix
« Reply #8 on: September 04, 2010, 03:02:41 AM »
finally i am running the vanillia kernel :D, great work meklort

but there is some problems there are no memory or cpu detection although it is RC5 !!!!
also it will be great to be a 64bit also

and as ricardoq said we hope to add the patch to the default chameleon RC5 version

@ ricardoq
1) replace "boot, boot0, boot0hfs, boot1f32, boot1h, boot1he, boot1hp, cdboot, chain0" in \usr\standalone\i386 with the new ones
2) Create a /Extra/modules/
3) Copy Symbols.dylib and KernelPatcher.dylib only to the /Extra/modules/, reboot
4) run with -x32 boot flag and hope it works
(make sure to boot using the vanilla kernel, bad things might happen with an already patched kernel)

meklort

  • VoodooLabs
  • Posts: 65
Re: Chameleon lapic fix
« Reply #9 on: September 04, 2010, 03:29:14 AM »
I wouldn't call it a vanilla kernel myself... You *are* running a modified kernel, aka not a vanilla kernel.

RC5 has been around for a long time, my branch was last synced with trunk a month or two ago, well before the detection code. Anyway, the version uploaded here is already outdated. Things have been fixed / improved on, aka, use svn.

64bit will arrive sometime, probably within a week or two.

I've said this before, the kernel patcher will not be included with Chameleon. The module system, however, will be. I still want to make a few changes to it before I add it to trunk. Anyways, once it's there, you can install modules as you see fit, including this one.


return c ? c : !c;

yehia2amer

  • Observer
  • Posts: 15
Re: Chameleon lapic fix
« Reply #10 on: September 30, 2010, 08:53:38 PM »
I wouldn't call it a vanilla kernel myself... You *are* running a modified kernel, aka not a vanilla kernel.

RC5 has been around for a long time, my branch was last synced with trunk a month or two ago, well before the detection code. Anyway, the version uploaded here is already outdated. Things have been fixed / improved on, aka, use svn.

64bit will arrive sometime, probably within a week or two.

I've said this before, the kernel patcher will not be included with Chameleon. The module system, however, will be. I still want to make a few changes to it before I add it to trunk. Anyways, once it's there, you can install modules as you see fit, including this one.

i just compiled your new version of chameleon but it didn't work with me , after the kernel load it seams to hang "attached"
do i do anything wrong !!!!??, also any news about the 64bit version

meklort

  • VoodooLabs
  • Posts: 65
Re: Chameleon lapic fix
« Reply #11 on: September 30, 2010, 09:31:31 PM »
I haven't worked on 64bit support. You also need to add in the ACPI module as well as any other ones you might want (but specifically the acpi one).
return c ? c : !c;

yehia2amer

  • Observer
  • Posts: 15
Re: Chameleon lapic fix
« Reply #12 on: October 26, 2010, 12:06:41 AM »
Please Meklort give this more Priority ,a lot of us needs it

thanks in advance and i hope you even begin supporting X64bit code
« Last Edit: November 22, 2010, 04:01:45 PM by yehia2amer »

mammoth

  • Observer
  • Posts: 12
Re: Chameleon lapic fix
« Reply #13 on: January 07, 2011, 01:11:41 AM »
Hello Meklort (and all)!

I am working to release the next version of my installation guides and CD, and shooting for an end of January release date.

It would be ideal if your lapic fix was 64-bit and ready for primetime. What would you say the chances are of that happening Meklort (hopefully great)? Downloads of my current guides and CD are approaching 1,000, so there are indeed a lot of people who will benefit from your work.

Thank you very much!