Chameleon

Chameleon Commit Details

Date:2010-09-14 08:20:18 (9 years 8 months ago)
Author:Evan Lojewski
Commit:523
Parents: 522
Message:Memory.dylib module now works properly.
Changes:
M/branches/meklort/i386/modules/Memory/Memory.c

File differences

branches/meklort/i386/modules/Memory/Memory.c
1919
2020
2121
22
2223
2324
2425
2526
26
27
2728
2829
2930
3031
31
3232
3333
3434
35
36
3735
3836
3937
4038
4139
4240
43
4441
45
46
4742
4843
4944
5045
5146
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
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;
}
}

Archive Download the corresponding diff file

Revision: 523