[Crash-utility] Implement end_pfn -> max_pfn change for Xen dumps

Bernhard Walle bwalle at suse.de
Wed Nov 26 20:24:11 UTC 2008


This patch reflects the change from end_pfn to max_pfn in x86_64
mainline between 2.6.26 and 2.6.27 that already has been partitially
implemented in x86_64_init(PRE_GDB):

 ...

        if (kernel_symbol_exists("end_pfn"))
                /* 2.6.11 layout */
                machdep->machspec->page_offset = PAGE_OFFSET_2_6_11;
        else
                /* 2.6.27 layout */
                machdep->machspec->page_offset = PAGE_OFFSET_2_6_27;
 ...

also for Xen Dom0 dumps (not in HV mode).


Signed-off-by: Bernhard Walle <bwalle at suse.de>

---
 kernel.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

--- a/kernel.c
+++ b/kernel.c
@@ -102,8 +102,14 @@ kernel_init()
 		}
 		if (machine_type("X86"))
                 	get_symbol_data("max_pfn", sizeof(ulong), &kt->p2m_table_size);
-		if (machine_type("X86_64"))
-                	get_symbol_data("end_pfn", sizeof(ulong), &kt->p2m_table_size);
+		if (machine_type("X86_64")) {
+			/*
+			 * kernel version <  2.6.27 => end_pfn
+			 * kernel version >= 2.6.27 => max_pfn
+			 */
+			if (!try_get_symbol_data("end_pfn", sizeof(ulong), &kt->p2m_table_size))
+				get_symbol_data("max_pfn", sizeof(ulong), &kt->p2m_table_size);
+		}
                 if ((kt->m2p_page = (char *)malloc(PAGESIZE())) == NULL)
                        	error(FATAL, "cannot malloc m2p page.");
 	}




More information about the Crash-utility mailing list