diff options
author | Magnus Damm <magnus@valinux.co.jp> | 2006-11-22 00:01:47 +0900 |
---|---|---|
committer | Simon Horman <horms@verge.net.au> | 2006-11-27 12:25:12 +0900 |
commit | c80198e78ce26783e092645b9ac8587e1374f22f (patch) | |
tree | 5ca85a6bb221c09d6855eb4a6ad4fb04c5e0cc01 /kexec/crashdump.c | |
parent | f8b0123231e9ca2cb124aa290b9df7785ff135e0 (diff) |
kexec-tools: Introduce crashdump-elf.c and crash_create_elf32/64_headers() V2
kexec-tools: Introduce crashdump-elf.c and crash_create_elf32/64_headers() V2
This patch adds the new file crashdump-elf.c that implements a single generic
function which is used to create elf headers. The file gets included twice by
crash.c to create two functions from the same source. These two functions are
named crash_create_elf32_headers() and crash_create_elf64_headers().
The new code differs from prepare_crash_memory_elf32/64_headers() in the sense
that both allocation and setup now are done in the same function.
This patch only adds the new code, following patches make sure the different
architecture-specific files make use of the new code.
This version contains a new comment as suggested by Vivek, together with
that the alignment now is fixed at 1024 regardless of architecture. The cpu
elf note callback code has been slightly reworked to become cleaner. Also,
FUNCTION has been renamed to FUNC.
Signed-off-by: Magnus Damm <magnus@valinux.co.jp>
Removed trainling whitespace
Signed-off-by: Simon Horman <horms@verge.net.au>
Diffstat (limited to 'kexec/crashdump.c')
-rw-r--r-- | kexec/crashdump.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/kexec/crashdump.c b/kexec/crashdump.c index 0c10cf8..1cb8123 100644 --- a/kexec/crashdump.c +++ b/kexec/crashdump.c @@ -25,9 +25,28 @@ #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> +#include <elf.h> #include "kexec.h" #include "crashdump.h" +/* include "crashdump-elf.c" twice to create two functions from one */ + +#define FUNC crash_create_elf64_headers +#define EHDR Elf64_Ehdr +#define PHDR Elf64_Phdr +#include "crashdump-elf.c" +#undef PHDR +#undef EHDR +#undef FUNC + +#define FUNC crash_create_elf32_headers +#define EHDR Elf32_Ehdr +#define PHDR Elf32_Phdr +#include "crashdump-elf.c" +#undef PHDR +#undef EHDR +#undef FUNC + /* Returns the physical address of start of crash notes buffer for a cpu. */ int get_crash_notes_per_cpu(int cpu, uint64_t *addr, uint64_t *len) { |