From 577300919c6bb2a92ebc8f7178f250b4ac623fb8 Mon Sep 17 00:00:00 2001 From: Stefan Lankes Date: Wed, 3 Aug 2011 07:37:57 +0200 Subject: [PATCH] fix bug in search_apic and uses function to find the MP Config Table --- arch/x86/kernel/apic.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/arch/x86/kernel/apic.c b/arch/x86/kernel/apic.c index a916222c..29033d0e 100644 --- a/arch/x86/kernel/apic.c +++ b/arch/x86/kernel/apic.c @@ -327,14 +327,17 @@ void smp_start(uint32_t id) } #endif -#ifndef CONFIG_MULTIBOOT +#if 1 static apic_mp_t* search_apic(size_t base, size_t limit) { size_t ptr; + apic_mp_t* tmp; for (ptr=base; ptr<=limit-sizeof(uint32_t); ptr++) { - if (*((uint32_t*) ptr) == MP_FLT_SIGNATURE) { - if (!(((apic_mp_t*)ptr)->version > 4) && ((apic_mp_t*)ptr)->features[0]) - return (apic_mp_t*) ptr; + tmp = (apic_mp_t*) ptr; + + if (tmp->signature == MP_FLT_SIGNATURE) { + if (!((tmp->version > 4) || tmp->features[0])) + return tmp; } } @@ -561,7 +564,7 @@ static int apic_probe(void) uint32_t i, count; int isa_bus = -1; -#ifndef CONFIG_MULTIBOOT +#if 1 apic_mp = search_apic(0xF0000, 0x100000); if (apic_mp) goto found_mp; @@ -590,7 +593,7 @@ static int apic_probe(void) for(i=0; (ilen-sizeof(uint32_t)) && (addr < 0x0FFFFF); i++, addr++) { if (*((uint32_t*) addr) == MP_FLT_SIGNATURE) { apic_mp = (apic_mp_t*) addr; - if (!(apic_mp->version > 4) && apic_mp->features[0]) + if (!((apic_mp->version > 4) || apic_mp->features[0])) goto found_mp; } }