Kexec Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [RESEND PATCH] kexec: arm: Fix endianness in crashdump header
@ 2014-01-13 10:47 Taras Kondratyuk
  2014-01-14  0:26 ` Simon Horman
  0 siblings, 1 reply; 2+ messages in thread
From: Taras Kondratyuk @ 2014-01-13 10:47 UTC (permalink / raw)
  To: Simon Horman; +Cc: Taras Kondratiuk, kexec, patches

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [RESEND PATCH] kexec: arm: Fix endianness in crashdump header
  2014-01-13 10:47 [RESEND PATCH] kexec: arm: Fix endianness in crashdump header Taras Kondratyuk
@ 2014-01-14  0:26 ` Simon Horman
  0 siblings, 0 replies; 2+ messages in thread
From: Simon Horman @ 2014-01-14  0:26 UTC (permalink / raw)
  To: Taras Kondratyuk; +Cc: kexec, patches

On Mon, Jan 13, 2014 at 12:47:25PM +0200, Taras Kondratyuk wrote:
> 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>

Thanks, applied.

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-01-14  0:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-13 10:47 [RESEND PATCH] kexec: arm: Fix endianness in crashdump header Taras Kondratyuk
2014-01-14  0:26 ` Simon Horman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox