From: Maxim Uvarov <muvarov@gmail.com>
To: kexec@lists.infradead.org
Subject: [PATCH] Patch adds kernel data section to final vmcore. This forces gdb read kernel
Date: Sat, 13 Nov 2010 13:23:20 +0300 [thread overview]
Message-ID: <20101113102320.3273.3435.stgit@localhost.localdomain> (raw)
From: Maxim Uvarov <muvarov@gmail.com>
static data from dump instead of not initialized values from vmlinux.
Signed-off-by: Maxim Uvarov <muvarov@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.
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
reply other threads:[~2010-11-13 10:23 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20101113102320.3273.3435.stgit@localhost.localdomain \
--to=muvarov@gmail.com \
--cc=kexec@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox