summaryrefslogtreecommitdiff
path: root/kexec/crashdump-elf.c
diff options
context:
space:
mode:
authorMagnus Damm <magnus@valinux.co.jp>2007-02-15 18:57:06 +0900
committerSimon Horman <horms@verge.net.au>2007-02-16 17:54:02 +0900
commitf09cb6fb977e58e77054107e1df908bb18b92e86 (patch)
treee774a82b49a5b50b3f5b4bde964ce2c22d1202dc /kexec/crashdump-elf.c
parent40f4b56e54c3e42ef32189682a85bcdc1bf240f1 (diff)
Keep alignment comment in elf code and use ELF_CORE_HEADER_ALIGN
Keep alignment comment in elf code and use ELF_CORE_HEADER_ALIGN This patch puts back and extends the alignment comment in crashdump-elf.c and adds a small check to make sure the arch-specific code aligns properly. Instead of hardcoding 1024 we introduce ELF_CORE_HEADER_ALIGN. The idea behind the alignment requirement is explained here: http://lists.osdl.org/mailman/htdig/fastboot/2006-November/005147.html Signed-off-by: Magnus Damm <magnus@valinux.co.jp> Acked-by: Vivek Goyal <vgoyal@in.ibm.com> Removed trainling whitespace after "kilobytes," Signed-off-by: Simon Horman <horms@verge.net.au>
Diffstat (limited to 'kexec/crashdump-elf.c')
-rw-r--r--kexec/crashdump-elf.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/kexec/crashdump-elf.c b/kexec/crashdump-elf.c
index 850087e..dd89180 100644
--- a/kexec/crashdump-elf.c
+++ b/kexec/crashdump-elf.c
@@ -73,6 +73,17 @@ int FUNC(struct kexec_info *info,
sz += sizeof(PHDR);
}
+ /*
+ * Make sure the ELF core header is aligned to at least 1024.
+ * We do this because the secondary kernel gets the ELF core
+ * header address on the kernel command line through the memmap=
+ * option, and this option requires 1k granularity.
+ */
+
+ if (align % ELF_CORE_HEADER_ALIGN) {
+ return -1;
+ }
+
sz += align - 1;
sz &= ~(align - 1);