summaryrefslogtreecommitdiff
path: root/kexec/arch/mips/crashdump-mips.c
diff options
context:
space:
mode:
authorMaxim Uvarov <muvarov@gmail.com>2010-11-13 13:23:20 +0300
committerSimon Horman <horms@verge.net.au>2010-11-18 21:59:19 +0900
commitcca4fa3921d549df984ee429756c4d6e882e5a74 (patch)
treef84047110f23ed22aeaf16333580e297ccb34599 /kexec/arch/mips/crashdump-mips.c
parent841c02cfbfb54a5460b3507c497c07bc869a6fe8 (diff)
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@gmail.com> Signed-off-by: Simon Horman <horms@verge.net.au>
Diffstat (limited to 'kexec/arch/mips/crashdump-mips.c')
-rw-r--r--kexec/arch/mips/crashdump-mips.c49
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;