Author Topic: Backporting the Meklort patches for auto patching mach_kernel's CPUID panic etc.  (Read 63895 times)

0 Members and 1 Guest are viewing this topic.

Azimutz

  • VoodooLabs
  • Posts: 420
  • Paranoid Android
Mek,

on execKernel(), the "Kernel Start" hook needs to be moved before setupBooterLog() or anything that uses it, will not print to the log. After doing so on my working copy of your branch, i was able to check that the USBfix module is indeed working but it's only resetting 2 of my 4 uhci controllers:
Code: [Select]
UHCI controller [8086:27ca] at 00:1d.2 base 7e8(fd01)
UHCI controller [8086:27cb] at 00:1d.3 base 7e0(fc01)
instead of
Code: [Select]
UHCI controller [8086:27c8] at 00:1d.0 base 7f8(ff01)
UHCI controller [8086:27c9] at 00:1d.1 base 7f0(fe01)
UHCI controller [8086:27ca] at 00:1d.2 base 7e8(fd01)
UHCI controller [8086:27cb] at 00:1d.3 base 7e0(fc01)
 System & Patches: http://goo.gl/i961
 Chameleon:
- trunk builds: http://goo.gl/9G1Hq
- pref pane: http://goo.gl/OL2UT

meklort

  • VoodooLabs
  • Posts: 65
I'll take a look
return c ? c : !c;

Azimutz

  • VoodooLabs
  • Posts: 420
  • Paranoid Android
HPET module is also working... i spoke too soon :P needed time to check the code and enable debug.
Gave another look to USBfix; everything seems to work as expected, except for the UHCI controllers issue.

Going to try adding some more modules to my branch...
 System & Patches: http://goo.gl/i961
 Chameleon:
- trunk builds: http://goo.gl/9G1Hq
- pref pane: http://goo.gl/OL2UT

yehia2amer

  • Observer
  • Posts: 15
Hi Meklort, hope you're fine

I want to know if there is any news about a 64bit version of the lapic fix to run 64bit kernel ????

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

you said two weeks and it's been two months!!!???

this will really help us HP users alot

thanks alot for all your work :)
« Last Edit: January 09, 2011, 03:38:31 PM by yehia2amer »

meklort

  • VoodooLabs
  • Posts: 65
It'll get done when it gets done. It's not very high on my list (esp since it doesn't affect me), so it won't happen any time soon.
return c ? c : !c;

Azimutz

  • VoodooLabs
  • Posts: 420
  • Paranoid Android
Hi Meklort..
last rev i can boot is 671; is 690 still work in progress or can i call it a bug?
I had to enable debug on modules.c to get this; i get instant reboot right after all modules are loaded, when executing ModulesLoaded hook; e.g.
Code: [Select]
Attempting to execute hook ModulesLoaded
Executing ModulesLoaded with callback 0x8398EA5
Also, while modules are loading there's a constant check for a "Symbols.dylib.dylib" (yep, dylib x 2) which of course, always fails... normal?

Rev 671, has the same problems i mentioned before, mainly the uhci problem; only the last two controllers seem to be reset.

That's it.. stay safe :)
« Last Edit: January 25, 2011, 07:09:23 PM by Azimutz »
 System & Patches: http://goo.gl/i961
 Chameleon:
- trunk builds: http://goo.gl/9G1Hq
- pref pane: http://goo.gl/OL2UT

meklort

  • VoodooLabs
  • Posts: 65
It's a work in progress. I fixed the Symbols.dylib.dylib issue (makefile bug) as well as a few other things in my last commit. At the same time i just broke a lot of things as well.
return c ? c : !c;

Slice

  • VoodooLabs
  • Posts: 52
@meklort
Thanks for Symbols.dylib fixing. I immediately apply this to my branch and it works! I also ported back acpi_patcher so now my boot file may works alone, without any modules and without GUI.
Some other problems with my bootloader mostly common for all branches I reported at the forum.

@Azimutz
I am not understanding this assertion
Quote
"Kernel Start" hook needs to be moved before setupBooterLog()
It is very old claim. How for now?

meklort

  • VoodooLabs
  • Posts: 65
I must have missed that post / line about the boot log. I fixed the code as you mentioned.
return c ? c : !c;

Azimutz

  • VoodooLabs
  • Posts: 420
  • Paranoid Android
It's a work in progress.
I see... i thought so.

I fixed the Symbols.dylib.dylib issue (makefile bug) as well as a few other things in my last commit. At the same time i just broke a lot of things as well.
yep.. with the Symbols.dylib.dylib check corrected, debug output is pretty much the same on the last commit (712) or 671; so, checking 671 boot-log, is easy to figure that the ModulesLoaded callback i mentioned is added by the GUI module; removing the module, i was able to go to boot prompt and start boot; as you mention there are still problems.. boot hangs while executing ScanMemory hook, after printing the memory modules info; these
Code: [Select]
Hook 'ScanMemory' callback executed, next is 0x0.
Hook 'ScanMemory' executed.
are never printed; it just sits there, cursor blinking, no keyboard available.
Attached is a 671 bdmesg with modules debug enabled.

I must have missed that post / line about the boot log. I fixed the code as you mentioned.
No problem... even i was already missing this :)

@Azimutz
I am not understanding this assertion
Quote
"Kernel Start" hook needs to be moved before setupBooterLog()
It is very old claim. How for now?
Slice, i'm not sure if i understand;
if you're asking "why Kernel Start hook needs to be moved before setupBooterLog()"? the answer is on the post:
Quote
...or anything that uses it, will not print to the log.
If that is not the question, you'll have to explain me :P
Anyway, Mek fixed it on rev 712.
 System & Patches: http://goo.gl/i961
 Chameleon:
- trunk builds: http://goo.gl/9G1Hq
- pref pane: http://goo.gl/OL2UT

Slice

  • VoodooLabs
  • Posts: 52

if you're asking "why Kernel Start hook needs to be moved before setupBooterLog()"? the answer is on the post:
If that is not the question, you'll have to explain me :P
Anyway, Mek fixed it on rev 712.
I understand and apply Mek's correction.

About modules system I found a bug
Quote
//Slice
// ignored   first node where hooks->name == name ?!
/*      
      while(hooks->next && strcmp(name, hooks->next->name) < 0)  // <0 comparison is wrong, should be !=
      {
         hooks = hooks->next;
      }
*/      
      moduleHook_t* backHook = moduleCallbacks; //I need to remember last node in chain if next=NULL
      do {
         DBG("register_hook_callback: found = %s\n", hooks->name);
         if (strcmp(name, hooks->name) == 0) {
            break;
         }
         backHook = hooks;
         hooks = hooks->next;
      } while (hooks);
// There are only two variants: hooks found or not
// if not found then hooks=NULL so remember backHook      
Now I have a problem with GUI not started. And Memory.dylib crashes with speed=0. While before it works.

Next problem is related to klibc.dylib. Because of Symbols.dylib embedded?
I got message "Divide by 0" calculating (uint32_t)x / 50000;
What to do?
« Last Edit: January 28, 2011, 11:46:58 AM by Slice »

Slice

  • VoodooLabs
  • Posts: 52
Mek,

on execKernel(), the "Kernel Start" hook needs to be moved before setupBooterLog() or anything that uses it, will not print to the log. After doing so on my working copy of your branch, i was able to check that the USBfix module is indeed working but it's only resetting 2 of my 4 uhci controllers:
Code: [Select]
UHCI controller [8086:27ca] at 00:1d.2 base 7e8(fd01)
UHCI controller [8086:27cb] at 00:1d.3 base 7e0(fc01)
instead of
Code: [Select]
UHCI controller [8086:27c8] at 00:1d.0 base 7f8(ff01)
UHCI controller [8086:27c9] at 00:1d.1 base 7f0(fe01)
UHCI controller [8086:27ca] at 00:1d.2 base 7e8(fd01)
UHCI controller [8086:27cb] at 00:1d.3 base 7e0(fc01)
After my corrections I see
Code: [Select]
Starting Darwin i386
UHCI controller [8086:2834] at 00:1a.0 base 379(6f21) reset
UHCI controller [8086:2835] at 00:1a.1 base 378(6f01) reset
Setting Legacy USB Off on controller [8086:283a] at 00:1a.7
Legacy USB Off Done
EHCI controller [8086:283a] at 00:1a.7 DMA @fed1c400
EHCI Acquire OS Ownership done
UHCI controller [8086:2830] at 00:1d.0 base 37c(6f81) reset
UHCI controller [8086:2831] at 00:1d.1 base 37b(6f61) reset
UHCI controller [8086:2832] at 00:1d.2 base 37a(6f41) reset
Setting Legacy USB Off on controller [8086:2836] at 00:1d.7
Legacy USB Off Done
EHCI controller [8086:2836] at 00:1d.7 DMA @fed1c000
EHCI Acquire OS Ownership done
execute_hook: Hook 'Kernel Start' executed.
That's OK.

THe KiNG

  • Observer
  • Posts: 10
Since we are on USB stuff can someone add OHCI reset?
An example is on AppleUSBOHCI.cpp -> AppleUSBOHCI::InitializeOperationalRegisters(bool fromReset)
Thanks!

Slice

  • VoodooLabs
  • Posts: 52
Since we are on USB stuff can someone add OHCI reset?
An example is on AppleUSBOHCI.cpp -> AppleUSBOHCI::InitializeOperationalRegisters(bool fromReset)
Thanks!
Already here
Code: [Select]
while(current)
{
switch (pci_config_read8(current->pciDev->dev.addr, PCI_CLASS_PROG))
{
// EHCI
case 0x20:
    if(fix_legacy) retVal &= legacy_off(current->pciDev);
    if(fix_ehci)   retVal &= ehci_acquire(current->pciDev);

break;
// OHCI
case 0x10: //same

// UHCI
case 0x00:
if (fix_uhci) retVal &= uhci_reset(current->pciDev);

break;
}

current = current->next;
}
return retVal;
}

THe KiNG

  • Observer
  • Posts: 10
Oh, I missed that in your branch, going to try it, I really hate apple spamming my log :P
Thanks for tip.

Another question for you, does boot loader affect in any way USB on resume, after hibernate I get dead USB 2.0?
Trying to figure out who's fault is, driver, boot loader or both...