ARM: 6485/5: proc/vmcore - allow archs to override vmcore_elf_check_arch()
authorMika Westerberg <mika.westerberg@iki.fi>
Fri, 19 Nov 2010 08:29:24 +0000 (09:29 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Tue, 30 Nov 2010 13:39:55 +0000 (13:39 +0000)
Allow architectures to redefine this macro if needed. This is useful for
example in architectures where 64-bit ELF vmcores are not supported.
Specifying zero vmcore_elf64_check_arch() allows compiler to optimize
away unnecessary parts of parse_crash_elf64_headers().

We also rename the macro to vmcore_elf64_check_arch() to reflect that it
is used for 64-bit vmcores only.

Signed-off-by: Mika Westerberg <mika.westerberg@iki.fi>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
fs/proc/vmcore.c
include/linux/crash_dump.h

index 2367fb3f70bc6ba468ab0ccb628b5b88fabac955..74802bc5ded95e09d510bcadfba94167e1390bc2 100644 (file)
@@ -499,7 +499,7 @@ static int __init parse_crash_elf64_headers(void)
        /* Do some basic Verification. */
        if (memcmp(ehdr.e_ident, ELFMAG, SELFMAG) != 0 ||
                (ehdr.e_type != ET_CORE) ||
-               !vmcore_elf_check_arch(&ehdr) ||
+               !vmcore_elf64_check_arch(&ehdr) ||
                ehdr.e_ident[EI_CLASS] != ELFCLASS64 ||
                ehdr.e_ident[EI_VERSION] != EV_CURRENT ||
                ehdr.e_version != EV_CURRENT ||
index 0026f267da20d6e9f1a0dc5343b978c1e5f0b6f1..088cd4ace4ef756c542cffc66e9b8a42f5ad1b38 100644 (file)
@@ -20,7 +20,14 @@ extern ssize_t copy_oldmem_page(unsigned long, char *, size_t,
 #define vmcore_elf_check_arch_cross(x) 0
 #endif
 
-#define vmcore_elf_check_arch(x) (elf_check_arch(x) || vmcore_elf_check_arch_cross(x))
+/*
+ * Architecture code can redefine this if there are any special checks
+ * needed for 64-bit ELF vmcores. In case of 32-bit only architecture,
+ * this can be set to zero.
+ */
+#ifndef vmcore_elf64_check_arch
+#define vmcore_elf64_check_arch(x) (elf_check_arch(x) || vmcore_elf_check_arch_cross(x))
+#endif
 
 /*
  * is_kdump_kernel() checks whether this kernel is booting after a panic of