public inbox for kexec@lists.infradead.org
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: Simon Horman <horms@verge.net.au>
Cc: Kexec Mailing List <kexec@lists.infradead.org>
Subject: [PATCH 3/3] x86: Fix biarch crashdump setup.
Date: Thu, 11 Mar 2010 00:22:07 -0800	[thread overview]
Message-ID: <m16353b74g.fsf@fess.ebiederm.org> (raw)
In-Reply-To: <m1k4tjb7d1.fsf@fess.ebiederm.org> (Eric W. Biederman's message of "Thu\, 11 Mar 2010 00\:16\:58 -0800")


Generate the correct crashdump header for x86_64 kernels
when a 32bit kernel is used.

Signed-off-by: Eric W. Biederman <ebiederm@aristanetworks.com>
---
 kexec/arch/i386/crashdump-x86.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/kexec/arch/i386/crashdump-x86.c b/kexec/arch/i386/crashdump-x86.c
index 804dadd..9d37442 100644
--- a/kexec/arch/i386/crashdump-x86.c
+++ b/kexec/arch/i386/crashdump-x86.c
@@ -509,7 +509,7 @@ static struct crash_elf_info elf_info32 =
 static enum coretype get_core_type(struct kexec_info *info,
 				   struct memory_range *range, int ranges)
 {
-	if (info->kexec_flags & KEXEC_ARCH_X86_64)
+	if ((info->kexec_flags & KEXEC_ARCH_MASK) == KEXEC_ARCH_X86_64)
 		return CORE_TYPE_ELF64;
 	else {
 		/* fall back to default */
@@ -534,6 +534,7 @@ int load_crashdump_segments(struct kexec_info *info, char* mod_cmdline,
 	unsigned long sz, elfcorehdr;
 	int nr_ranges, align = 1024;
 	struct memory_range *mem_range, *memmap_p;
+	unsigned machine;
 
 	if (get_crash_memory_ranges(&mem_range, &nr_ranges,
 				    info->kexec_flags) < 0)
@@ -548,6 +549,12 @@ int load_crashdump_segments(struct kexec_info *info, char* mod_cmdline,
 			get_core_type(info, mem_range, nr_ranges);
 	}
 
+        /* Get the elf architecture of the running kernel */
+	machine = EM_386;
+	if ((info->kexec_flags & KEXEC_ARCH_MASK) == KEXEC_ARCH_X86_64) {
+		machine = EM_X86_64;
+	}
+
 	/* Memory regions which panic kernel can safely use to boot into */
 	sz = (sizeof(struct memory_range) * (KEXEC_MAX_SEGMENTS + 1));
 	memmap_p = xmalloc(sz);
@@ -571,6 +578,7 @@ int load_crashdump_segments(struct kexec_info *info, char* mod_cmdline,
 
 	/* Create elf header segment and store crash image data. */
 	if (arch_options.core_header_type == CORE_TYPE_ELF64) {
+		elf_info64.machine = machine;
 		if (crash_create_elf64_headers(info, &elf_info64,
 					       crash_memory_range, nr_ranges,
 					       &tmp, &sz,
@@ -578,6 +586,7 @@ int load_crashdump_segments(struct kexec_info *info, char* mod_cmdline,
 			return -1;
 	}
 	else {
+		elf_info32.machine = machine;
 		if (crash_create_elf32_headers(info, &elf_info32,
 					       crash_memory_range, nr_ranges,
 					       &tmp, &sz,
-- 
1.6.6.1


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

  parent reply	other threads:[~2010-03-11  8:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-11  8:16 [PATCH 0/3] Getting biarch support Eric W. Biederman
2010-03-11  8:20 ` [PATCH 1/3] Refix concat_cmdline Eric W. Biederman
2010-03-11  8:20 ` [PATCH 0/3] Getting biarch support Simon Horman
2010-03-11  8:21 ` [PATCH 2/3] kexec: Figure out our native architecture before load Eric W. Biederman
2010-03-11  8:22 ` Eric W. Biederman [this message]
2010-03-11  8:22 ` [PATCH 0/3] Getting biarch support Bernhard Walle
2010-03-11  8:35   ` Eric W. Biederman
2010-03-11  8:48 ` Simon Horman

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=m16353b74g.fsf@fess.ebiederm.org \
    --to=ebiederm@xmission.com \
    --cc=horms@verge.net.au \
    --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