Index: branches/meklort/i386/modules/Memory/Memory.c =================================================================== --- branches/meklort/i386/modules/Memory/Memory.c (revision 522) +++ branches/meklort/i386/modules/Memory/Memory.c (revision 523) @@ -19,33 +19,66 @@ void Memory_hook(void* arg1, void* arg2, void* arg3, void* arg4); void Memory_PCIDevice_hook(void* arg1, void* arg2, void* arg3, void* arg4); + void Memory_start() { register_hook_callback("PCIDevice", &Memory_PCIDevice_hook); register_hook_callback("ScanMemory", &Memory_hook); - + } void Memory_PCIDevice_hook(void* arg1, void* arg2, void* arg3, void* arg4) { - printf("PCIDevice hook\n"); pci_dt_t* current = arg1; if(current->class_id == PCI_CLASS_BRIDGE_HOST) { - printf(" PCI_CLASS_BRIDGE_HOST located\n"); - dram_controller_dev = current; } } void Memory_hook(void* arg1, void* arg2, void* arg3, void* arg4) { - printf("ScanMemory hook\n"); if (dram_controller_dev!=NULL) { - printf(" scan_dram_controller\n"); - scan_dram_controller(dram_controller_dev); // Rek: pci dev ram controller direct and fully informative scan ... } scan_memory(&Platform); // unfortunately still necesary for some comp where spd cant read correct speed scan_spd(&Platform); } + + + +/* Nedded to devide 64bit numbers correctly. TODO: look into why the module needs this + * And why it isn't needed when compiled into boot2 + */ + +uint64_t __udivdi3(uint64_t numerator, uint64_t denominator) +{ + uint64_t quotient = 0, qbit = 1; + + if (denominator) + { + while ((int64_t) denominator >= 0) + { + denominator <<= 1; + qbit <<= 1; + } + + while (denominator) + { + if (denominator <= numerator) + { + numerator -= denominator; + quotient += qbit; + } + denominator >>= 1; + qbit >>= 1; + } + + return quotient; + } + else { + stop("Divide by 0"); + return 0; + } + +}