[PATCH] Add kernel data section to final vmcore
Maxim Uvarov
muvarov at gmail.com
Sat Nov 13 05:25:19 EST 2010
From: Maxim Uvarov <muvarov at gmail.com>
Patch adds kernel data section to final vmcore. This forces gdb read kernel
static data from dump instead of not initialized values from vmlinux.
Signed-off-by: Maxim Uvarov <muvarov at gmail.com>
---
kexec/arch/mips/crashdump-mips.c | 49 ++++++++++++++++++++++++++++++++++++++
1 files changed, 49 insertions(+), 0 deletions(-)
diff --git a/kexec/arch/mips/crashdump-mips.c b/kexec/arch/mips/crashdump-mips.c
index 17cf52d..5ea4f4f 100644
--- a/kexec/arch/mips/crashdump-mips.c
+++ b/kexec/arch/mips/crashdump-mips.c
@@ -49,6 +49,49 @@ static struct memory_range crash_reserved_mem;
*/
unsigned long long saved_max_mem;
+/* Read kernel physical load addr from the file returned by proc_iomem()
+ * (Kernel Code) and store in kexec_info */
+static int get_kernel_paddr(struct kexec_info *info)
+{
+ uint64_t start;
+
+ if (xen_present()) /* Kernel not entity mapped under Xen */
+ return 0;
+
+ if (parse_iomem_single("Kernel code\n", &start, NULL) == 0) {
+ info->kern_paddr_start = start;
+#ifdef DEBUG
+ printf("kernel load physical addr start = 0x%lx\n", start);
+#endif
+ return 0;
+ }
+
+ fprintf(stderr, "Cannot determine kernel physical load addr\n");
+ return -1;
+}
+
+static int get_kernel_vaddr_and_size(struct kexec_info *info)
+{
+ uint64_t end;
+
+ if (!info->kern_paddr_start)
+ return -1;
+
+ info->kern_vaddr_start = info->kern_paddr_start | 0xffffffff80000000UL;
+ if (parse_iomem_single("Kernel data\n", NULL, &end) == 0) {
+ info->kern_size = end - info->kern_paddr_start;
+#ifdef DEBUG
+ printf("kernel_vaddr= 0x%llx paddr %llx\n",
+ info->kern_vaddr_start,
+ info->kern_paddr_start);
+ printf("kernel size = 0x%llx\n", info->kern_size);
+#endif
+ return 0;
+ }
+ fprintf(stderr, "Cannot determine kernel virtual load addr and size\n");
+ return -1;
+}
+
/* Removes crash reserve region from list of memory chunks for whom elf program
* headers have to be created. Assuming crash reserve region to be a single
* continuous area fully contained inside one of the memory chunks */
@@ -313,6 +356,12 @@ int load_crashdump_segments(struct kexec_info *info, char* mod_cmdline,
int nr_ranges, align = 1024;
struct memory_range *mem_range;
+ if (get_kernel_paddr(info))
+ return -1;
+
+ if (get_kernel_vaddr_and_size(info))
+ return -1;
+
if (get_crash_memory_ranges(&mem_range, &nr_ranges) < 0)
return -1;
Best regards,
Maxim Uvarov.
More information about the kexec
mailing list