From: Trammell Hudson Date: Tue, 21 Oct 2008 21:49:53 +0000 (-0500) Subject: Output total memory from e820 map X-Git-Tag: 1.0^2~32^2~2 X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=commitdiff_plain;h=4298bbf36e8bb689f2817fc7616803c2fd788005 Output total memory from e820 map --- diff --git a/kitten/arch/x86_64/kernel/e820.c b/kitten/arch/x86_64/kernel/e820.c index b007356..2799607 100644 --- a/kitten/arch/x86_64/kernel/e820.c +++ b/kitten/arch/x86_64/kernel/e820.c @@ -319,10 +319,13 @@ void __init e820_print_map(char *who) { int i; char type[16]; + size_t total_size = 0; for (i = 0; i < e820.nr_map; i++) { - switch (e820.map[i].type) { + const struct e820entry * entry = &e820.map[i]; + switch (entry->type) { case E820_RAM: sprintf(type, "(usable)\n"); + total_size += entry->size; break; case E820_RESERVED: sprintf(type, "(reserved)\n"); @@ -333,16 +336,19 @@ void __init e820_print_map(char *who) case E820_NVS: sprintf(type, "(ACPI NVS)\n"); break; - default: sprintf(type, "type %u\n", e820.map[i].type); + default: sprintf(type, "type %u\n", entry->type); break; } printk(KERN_DEBUG - " %s: %016Lx - %016Lx %s", who, - (unsigned long long) e820.map[i].addr, - (unsigned long long) (e820.map[i].addr + e820.map[i].size), + " %s: %016Lx - %016Lx %s", + who, + (unsigned long long) entry->addr, + (unsigned long long) (entry->addr + entry->size), type); } + + printk( KERN_DEBUG "Total usable memory %ld bytes\n", total_size ); } /*