From 5a8765bcd2ceef21b677a7d60f9071a040e84e18 Mon Sep 17 00:00:00 2001 From: Yinghai Lu Date: Sat, 15 Dec 2012 20:59:08 -0800 Subject: [PATCH v7 09/29] x86, 64bit: Print init kernel lowmap correctly When we get end of x86_64_start_kernel. We have 1. kernel highmap 512M (KERNEL_IMAGE_SIZE) from kernel loaded address. 2. kernel lowmap: [0, 2M), and size (_end - _text) from kernel loaded address. for example, if the kernel bzImage is loaded high from 8G, will get: 1. kernel highmap: [8G, 8G+512M) 2. kernel lowmap: [0, 2M), and [8G, 8G +_end - _text) So max_pfn_mapped that is for low map pfn recording is not that simple to 512M for 64 bit. Try to print out two ranges, when kernel is loaded high. Also need to use KERNEL_IMAGE_SIZE directly for highmap cleanup. Signed-off-by: Yinghai Lu --- arch/x86/kernel/head64.c | 3 --- arch/x86/kernel/setup.c | 20 ++++++++++++++++++-- arch/x86/mm/init_64.c | 6 +++++- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c index 014b48d..2775666 100644 --- a/arch/x86/kernel/head64.c +++ b/arch/x86/kernel/head64.c @@ -158,9 +158,6 @@ void __init x86_64_start_kernel(char * real_mode_data) /* clear bss before set_intr_gate with early_idt_handler */ clear_bss(); - /* XXX - this is wrong... we need to build page tables from scratch */ - max_pfn_mapped = KERNEL_IMAGE_SIZE >> PAGE_SHIFT; - for (i = 0; i < NUM_EXCEPTION_VECTORS; i++) { #ifdef CONFIG_EARLY_PRINTK set_intr_gate(i, &early_idt_handlers[i]); diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index 81ea5a5..d321b9b 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c @@ -646,6 +646,23 @@ static int __init parse_reservelow(char *p) early_param("reservelow", parse_reservelow); +static __init void print_init_mem_mapped(void) +{ +#ifdef CONFIG_X86_32 + printk(KERN_DEBUG "initial memory mapped: [mem 0x00000000-%#010lx]\n", + (max_pfn_mapped<