Kexec Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Taras Kondratyuk <taras.kondratiuk@linaro.org>
To: Simon Horman <horms@verge.net.au>
Cc: Taras Kondratiuk <taras.kondratiuk@linaro.org>,
	kexec@lists.infradead.org, patches@linaro.org
Subject: [RESEND PATCH] kexec: arm: Fix endianness in crashdump header
Date: Mon, 13 Jan 2014 12:47:25 +0200	[thread overview]
Message-ID: <1389610045-5372-1-git-send-email-kondratyuk.taras@gmail.com> (raw)

From: Taras Kondratiuk <taras.kondratiuk@linaro.org>

Currently little-endian ELFDATA is hard-coded in crashdump header.
This lead to a wrong header format if crashdump is generated on BE system.

Set native endianness into ELFDATA field.

Signed-off-by: Taras Kondratiuk <taras.kondratiuk@linaro.org>
---
Based on commit 027413d "kexec: Add m68k support"

 kexec/arch/arm/crashdump-arm.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/kexec/arch/arm/crashdump-arm.c b/kexec/arch/arm/crashdump-arm.c
index 01973b1..0cd6935 100644
--- a/kexec/arch/arm/crashdump-arm.c
+++ b/kexec/arch/arm/crashdump-arm.c
@@ -31,6 +31,13 @@
 #include "../../crashdump.h"
 #include "crashdump-arm.h"
 
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+#define ELFDATANATIVE ELFDATA2LSB
+#elif __BYTE_ORDER == __BIG_ENDIAN
+#define ELFDATANATIVE ELFDATA2MSB
+#else
+#error "Unknown machine endian"
+#endif
 
 /*
  * Used to save various memory ranges/regions needed for the captured
@@ -47,7 +54,7 @@ static struct memory_range crash_reserved_mem;
 
 static struct crash_elf_info elf_info = {
 	.class		= ELFCLASS32,
-	.data		= ELFDATA2LSB,
+	.data		= ELFDATANATIVE,
 	.machine	= EM_ARM,
 	.page_offset	= PAGE_OFFSET,
 };
-- 
1.7.9.5


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

             reply	other threads:[~2014-01-13 10:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-13 10:47 Taras Kondratyuk [this message]
2014-01-14  0:26 ` [RESEND PATCH] kexec: arm: Fix endianness in crashdump header 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=1389610045-5372-1-git-send-email-kondratyuk.taras@gmail.com \
    --to=taras.kondratiuk@linaro.org \
    --cc=horms@verge.net.au \
    --cc=kexec@lists.infradead.org \
    --cc=patches@linaro.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