From 7871ef692a29402ba8e3f03b3ee8940233e67e4e Mon Sep 17 00:00:00 2001 From: stefan Date: Fri, 26 Nov 2010 18:15:09 +0000 Subject: [PATCH] - add workaround to run the apic code correctly on qemu 12.5 git-svn-id: http://svn.lfbs.rwth-aachen.de/svn/scc/trunk/MetalSVM@290 315a16e6-25f9-4109-90ae-ca3045a26c18 --- arch/x86/kernel/apic.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/arch/x86/kernel/apic.c b/arch/x86/kernel/apic.c index 60f506f7..7649770d 100644 --- a/arch/x86/kernel/apic.c +++ b/arch/x86/kernel/apic.c @@ -55,11 +55,13 @@ static inline void apic_write(uint32_t addr, uint32_t value) #ifndef CONFIG_MULTIBOOT static unsigned int* search_apic(unsigned int base, unsigned int limit) { - unsigned int *ptr; + uint32_t* ptr; - for (ptr = (unsigned int *) base; (unsigned int) ptr < limit; ptr++) { - if (*ptr == MP_FLT_SIGNATURE) - return ptr; + for (ptr = (uint32_t*) base; (uint32_t) ptr < limit; ptr++) { + if (*ptr == MP_FLT_SIGNATURE) { + if (!(((apic_mp_t*)ptr)->version > 4) && ((apic_mp_t*)ptr)->features[0]) + return ptr; + } } return NULL; @@ -163,9 +165,10 @@ static int apic_probe(void) addr = mmap->addr; for(i=0; ilen; i++, addr++) { - if (strncmp((void*)addr, "_MP_", 4) == 0) { + if (*((uint32_t*) addr) == MP_FLT_SIGNATURE) { apic_mp = (apic_mp_t*) addr; - goto found_mp; + if (!(apic_mp->version > 4) && apic_mp->features[0]) + goto found_mp; } } @@ -183,8 +186,8 @@ found_mp: if (!apic_mp) goto no_mp; - kprintf("System uses Multiprocessing Specification 1.%d\n", apic_mp->version); - kprintf("MP features 1: %d\n", apic_mp->features[0]); + kprintf("System uses Multiprocessing Specification 1.%u\n", apic_mp->version); + kprintf("MP features 1: %u\n", apic_mp->features[0]); if (apic_mp->features[0]) { kputs("Currently, MetalSVM supports only multiprocessing via the MP config tables!\n"); @@ -208,7 +211,7 @@ found_mp: addr += 20; } else addr += 8; } - kprintf("Found %d cores\n", count); + kprintf("Found %u cores\n", count); if (count > MAX_CORES) { kputs("Found too many cores! Increase the macro MAX_CORES!\n");