From ca978b6ed8de1199ca376bf3f007d30723b5468f Mon Sep 17 00:00:00 2001 From: Marcus Overhagen Date: Sun, 4 May 2008 01:20:22 +0000 Subject: [PATCH] make memory map printing independant of other mmu debug output git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25306 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/boot/platform/bios_ia32/mmu.cpp | 32 +++++++++++++++++++--- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/src/system/boot/platform/bios_ia32/mmu.cpp b/src/system/boot/platform/bios_ia32/mmu.cpp index 6b65434e92..0e870fba15 100644 --- a/src/system/boot/platform/bios_ia32/mmu.cpp +++ b/src/system/boot/platform/bios_ia32/mmu.cpp @@ -51,6 +51,13 @@ # define TRACE(x) ; #endif + +//#define TRACE_MEMORY_MAP + // Define this to print the memory map to serial debug, + // You also need to define ENABLE_SERIAL in serial.cpp + // for output to work. + + struct gdt_idt_descr { uint16 limit; uint32 *base; @@ -252,6 +259,22 @@ sort_addr_range(addr_range *range, int count) } + +#ifdef TRACE_MEMORY_MAP +static const char * +e820_memory_type(uint32 type) +{ + switch (type) { + case 1: return "memory"; + case 2: return "reserved"; + case 3: return "ACPI reclaim"; + case 4: return "ACPI NVS"; + default: return "unknown/reserved"; + } +} +#endif + + static uint32 get_memory_map(extended_memory **_extendedMemory) { @@ -275,11 +298,12 @@ get_memory_map(extended_memory **_extendedMemory) *_extendedMemory = block; -#ifdef TRACE_MMU +#ifdef TRACE_MEMORY_MAP dprintf("extended memory info (from 0xe820):\n"); for (uint32 i = 0; i < count; i++) { - dprintf(" base 0x%Lx, len 0x%Lx, type %lu\n", - block[i].base_addr, block[i].length, block[i].type); + dprintf(" base 0x%08Lx, len 0x%08Lx, type %lu (%s)\n", + block[i].base_addr, block[i].length, + block[i].type, e820_memory_type(block[i].type)); } #endif @@ -534,7 +558,7 @@ mmu_init_for_kernel(void) sort_addr_range(gKernelArgs.virtual_allocated_range, gKernelArgs.num_virtual_allocated_ranges); -#ifdef TRACE_MMU +#ifdef TRACE_MEMORY_MAP { uint32 i;