search MP table on all systems
This commit is contained in:
parent
ee30cdd0bf
commit
27ee238684
1 changed files with 13 additions and 13 deletions
|
@ -327,7 +327,6 @@ void smp_start(uint32_t id)
|
|||
}
|
||||
#endif
|
||||
|
||||
#if MAX_CORES > 1
|
||||
static unsigned int* search_apic(unsigned int base, unsigned int limit) {
|
||||
uint32_t* ptr;
|
||||
|
||||
|
@ -341,6 +340,7 @@ static unsigned int* search_apic(unsigned int base, unsigned int limit) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
#if MAX_CORES > 1
|
||||
int smp_init(void)
|
||||
{
|
||||
uint32_t i, j;
|
||||
|
@ -362,22 +362,22 @@ int smp_init(void)
|
|||
*/
|
||||
bootaddr = (char*) SMP_SETUP_ADDR;
|
||||
memcpy(bootaddr, boot_code, sizeof(boot_code));
|
||||
for(j=0; j<sizeof(boot_code)-4; j++)
|
||||
for(j=0; j<sizeof(boot_code)-sizeof(uint32_t); j++)
|
||||
{
|
||||
// replace 0xDEADC0DE with the address of the smp entry code
|
||||
if (*((size_t*) (bootaddr+j)) == 0xDEADC0DE) {
|
||||
*((size_t*) (bootaddr+j)) = (size_t) smp_start;
|
||||
if (*((uint32_t*) (bootaddr+j)) == 0xDEADC0DE) {
|
||||
*((uint32_t*) (bootaddr+j)) = (size_t) smp_start;
|
||||
kprintf("Set entry point of the application processors at 0x%x\n", (size_t) smp_start);
|
||||
}
|
||||
|
||||
// replace APIC ID 0xDEADDEAD
|
||||
if (*((size_t*) (bootaddr+j)) == 0xDEADDEAD)
|
||||
*((size_t*) (bootaddr+j)) = i;
|
||||
if (*((uint32_t*) (bootaddr+j)) == 0xDEADDEAD)
|
||||
*((uint32_t*) (bootaddr+j)) = i;
|
||||
|
||||
// replace 0xDEADBEEF with the addres of the stack
|
||||
if (*((size_t*) (bootaddr+j)) == 0xDEADBEEF) {
|
||||
uint32_t esp = get_idle_task(i);
|
||||
*((size_t*) (bootaddr+j)) = esp;
|
||||
if (*((uint32_t*) (bootaddr+j)) == 0xDEADBEEF) {
|
||||
size_t esp = get_idle_task(i);
|
||||
*((uint32_t*) (bootaddr+j)) = (uint32_t) esp;
|
||||
if ((int) esp < 0)
|
||||
kprintf("Invalid stack value\n");
|
||||
kprintf("Set stack of the application processors to 0x%x\n", esp);
|
||||
|
@ -559,7 +559,6 @@ static int apic_probe(void)
|
|||
uint32_t i, count;
|
||||
int isa_bus = -1;
|
||||
|
||||
#if MAX_CORES > 1
|
||||
apic_mp = (apic_mp_t*) search_apic(0xF0000, 0x100000);
|
||||
if (apic_mp)
|
||||
goto found_mp;
|
||||
|
@ -577,7 +576,7 @@ static int apic_probe(void)
|
|||
if (mmap->type == MULTIBOOT_MEMORY_RESERVED) {
|
||||
addr = mmap->addr;
|
||||
|
||||
for(i=0; i<mmap->len; i++, addr++) {
|
||||
for(i=0; i<mmap->len-sizeof(uint32_t); i++, addr++) {
|
||||
if (*((uint32_t*) addr) == MP_FLT_SIGNATURE) {
|
||||
apic_mp = (apic_mp_t*) addr;
|
||||
if (!(apic_mp->version > 4) && apic_mp->features[0])
|
||||
|
@ -591,7 +590,6 @@ static int apic_probe(void)
|
|||
}
|
||||
#endif
|
||||
found_mp:
|
||||
#endif
|
||||
if (!apic_mp)
|
||||
goto no_mp;
|
||||
|
||||
|
@ -752,10 +750,12 @@ int apic_init(void)
|
|||
return ret;
|
||||
|
||||
if (ioapic) {
|
||||
uint32_t i;
|
||||
|
||||
// enable timer interrupt
|
||||
ioapic_inton(0, apic_processors[boot_processor]->id);
|
||||
// now lets turn everything else off
|
||||
for(uint32_t i=1; i<24; i++)
|
||||
for(i=1; i<24; i++)
|
||||
ioapic_intoff(i, apic_processors[boot_processor]->id);
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue