[Crash-utility] [PATCH] Use dha_kernel_addr from LKCD header

Bernhard Walle bwalle at suse.de
Wed Jun 13 09:31:53 UTC 2007


Currently, ia64_calc_phys_start() in ia64.c silently assumes DEFAULT_PHYS_START
as start address with LKCD dumps.  There are machines where this is not true.

This patch implements querying from the dump header.


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

---
 ia64.c         |   11 ++++++++++-
 lkcd_common.c  |   18 ++++++++++++++++++
 lkcd_fix_mem.c |   10 ++++++++++
 3 files changed, 38 insertions(+), 1 deletion(-)

--- a/ia64.c
+++ b/ia64.c
@@ -3810,7 +3810,16 @@ ia64_calc_phys_start(void)
 					phys_start);
 		}
                 return;
-        }
+        } else if (LKCD_DUMPFILE()) {
+
+		if (lkcd_get_kernel_start(&phys_start)) {
+                        machdep->machspec->phys_start = phys_start;
+			if (CRASHDEBUG(1))
+				fprintf(fp,
+				    "LKCD dump: phys_start: %lx\n",
+					phys_start);
+		}
+	}
 
 	if ((vd = get_kdump_vmcore_data())) {
 		/*
--- a/lkcd_common.c
+++ b/lkcd_common.c
@@ -787,6 +787,24 @@ get_offset(uint64_t paddr)
 }
 
 
+int
+lkcd_get_kernel_start(ulong *addr)
+{
+	if (!addr)
+		return 0;
+
+	switch (lkcd->version)
+	{
+        case LKCD_DUMP_V8:
+        case LKCD_DUMP_V9:
+		return lkcd_get_kernel_start_v8(addr);
+
+	default:
+		return 0;
+	}
+}
+
+
 
 int
 lkcd_lseek(physaddr_t paddr)
--- a/lkcd_fix_mem.c
+++ b/lkcd_fix_mem.c
@@ -113,4 +113,14 @@ get_lkcd_switch_stack(ulong task)
 	return 0;
 }
 
+int lkcd_get_kernel_start_v8(ulong *addr)
+{
+	if (!addr)
+		return 0;
+
+	*addr = ((dump_header_asm_t *)lkcd->dump_header_asm)->dha_kernel_addr;
+
+	return 1;
+}
+
 #endif // IA64




More information about the Crash-utility mailing list