diff --git a/arch/x86/kernel/apic.c b/arch/x86/kernel/apic.c index b996cb7b..0f0ee985 100644 --- a/arch/x86/kernel/apic.c +++ b/arch/x86/kernel/apic.c @@ -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 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; ilen; i++, addr++) { + for(i=0; ilen-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