summaryrefslogtreecommitdiff
path: root/kexec/crashdump-elf.c
diff options
context:
space:
mode:
authorItsuro ODA <oda@valinux.co.jp>2008-03-31 13:26:04 +0900
committerSimon Horman <horms@verge.net.au>2008-04-02 16:34:15 +0900
commit1e1ee02f95e69890fb98d71cb512261ac9283623 (patch)
tree6fffe3dc10daa44ef08ef8224d884645ec010c8b /kexec/crashdump-elf.c
parent9e959db12a671a71934a765d15aaf082f0a4f886 (diff)
extract vmcoreinfo from /proc/vmcore for Xen
This patch is for kexec-tools-testing-20080324. Signed-off-by: Simon Horman <horms@verge.net.au>
Diffstat (limited to 'kexec/crashdump-elf.c')
-rw-r--r--kexec/crashdump-elf.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/kexec/crashdump-elf.c b/kexec/crashdump-elf.c
index b979c1c..7d2befe 100644
--- a/kexec/crashdump-elf.c
+++ b/kexec/crashdump-elf.c
@@ -36,6 +36,8 @@ int FUNC(struct kexec_info *info,
uint64_t notes_addr, notes_len;
uint64_t vmcoreinfo_addr, vmcoreinfo_len;
int has_vmcoreinfo = 0;
+ uint64_t vmcoreinfo_addr_xen, vmcoreinfo_len_xen;
+ int has_vmcoreinfo_xen = 0;
int (*get_note_info)(int cpu, uint64_t *addr, uint64_t *len);
if (xen_present())
@@ -51,7 +53,12 @@ int FUNC(struct kexec_info *info,
has_vmcoreinfo = 1;
}
- sz = sizeof(EHDR) + (nr_cpus + has_vmcoreinfo) * sizeof(PHDR) +
+ if (xen_present() &&
+ get_xen_vmcoreinfo(&vmcoreinfo_addr_xen, &vmcoreinfo_len_xen) == 0) {
+ has_vmcoreinfo_xen = 1;
+ }
+
+ sz = sizeof(EHDR) + (nr_cpus + has_vmcoreinfo + has_vmcoreinfo_xen) * sizeof(PHDR) +
ranges * sizeof(PHDR);
/*
@@ -168,6 +175,21 @@ int FUNC(struct kexec_info *info,
dbgprintf_phdr("vmcoreinfo header", phdr);
}
+ if (has_vmcoreinfo_xen) {
+ phdr = (PHDR *) bufp;
+ bufp += sizeof(PHDR);
+ phdr->p_type = PT_NOTE;
+ phdr->p_flags = 0;
+ phdr->p_offset = phdr->p_paddr = vmcoreinfo_addr_xen;
+ phdr->p_vaddr = 0;
+ phdr->p_filesz = phdr->p_memsz = vmcoreinfo_len_xen;
+ /* Do we need any alignment of segments? */
+ phdr->p_align = 0;
+
+ (elf->e_phnum)++;
+ dbgprintf_phdr("vmcoreinfo_xen header", phdr);
+ }
+
/* Setup an PT_LOAD type program header for the region where
* Kernel is mapped if info->kern_size is non-zero.
*/