From 8d59ae60728fd0fcece7a7665fc3f79277767111 Mon Sep 17 00:00:00 2001 From: Barret Rhoden Date: Fri, 22 Jan 2010 11:25:51 -0800 Subject: [PATCH] Fixes multiboot memory detection for weird types IAW the spec, type 1 is free, all others are reserved. Some machines (the new nehalem) had types greater than our array of strings. --- kern/src/multiboot.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/kern/src/multiboot.c b/kern/src/multiboot.c index ab3994a..5c548d6 100644 --- a/kern/src/multiboot.c +++ b/kern/src/multiboot.c @@ -54,28 +54,23 @@ multiboot_detect_memory(multiboot_info_t *mbi) printk("Maximum directly addressable physical memory: %dK\n", (int)(maxaddrpa/1024)); } -void -multiboot_print_memory_map(multiboot_info_t *mbi) { - const char *NTS memory_type[] = {"", "FREE", "RESERVED", "UNDEFINED", "UNDEFINED4"}; - - +void multiboot_print_memory_map(multiboot_info_t *mbi) +{ if(CHECK_FLAG(mbi->flags, 6)) { memory_map_t *SNT mmap_b = (memory_map_t *SNT)(mbi->mmap_addr + KERNBASE); memory_map_t *SNT mmap_e = (memory_map_t *SNT)(mbi->mmap_addr + KERNBASE + mbi->mmap_length); memory_map_t *BND(mmap_b, mmap_e) mmap = TC(mmap_b); - - cprintf ("mmap_addr = 0x%x, mmap_length = 0x%x\n", (unsigned long)mbi->mmap_addr, - (unsigned long)mbi->mmap_length); - + printk("mmap_addr = 0x%x, mmap_length = 0x%x\n", + (unsigned long)mbi->mmap_addr, (unsigned long)mbi->mmap_length); while(mmap < mmap_e) { - cprintf ("base = 0x%08x%08x, length = 0x%08x%08x, type = %s\n", - (unsigned) mmap->base_addr_high, - (unsigned) mmap->base_addr_low, - (unsigned) mmap->length_high, - (unsigned) mmap->length_low, - (unsigned) memory_type[mmap->type]); + printk("base = 0x%08x%08x, length = 0x%08x%08x, type = %s\n", + (unsigned) mmap->base_addr_high, + (unsigned) mmap->base_addr_low, + (unsigned) mmap->length_high, + (unsigned) mmap->length_low, + mmap->type == 1 ? "FREE" : "RESERVED"); mmap = (memory_map_t *BND(mmap_b,mmap_e))((char *BND(mmap_b,mmap_e))mmap + mmap->size + sizeof(mmap->size)); } } -- 2.7.4