summaryrefslogtreecommitdiff
path: root/kexec/crashdump-elf.c
diff options
context:
space:
mode:
authorMagnus Damm <magnus@valinux.co.jp>2006-11-22 00:02:47 +0900
committerSimon Horman <horms@verge.net.au>2006-11-27 12:25:13 +0900
commitf7d547f412f0f0b363240c2261ed3ec89b828689 (patch)
tree814175da6d5e4332f772b11d8fb42b711ac0a785 /kexec/crashdump-elf.c
parent5ce4f874087d0981479e841e9c366cf55e67d985 (diff)
kexec-tools: Introduce crashdump-xen.c and Xen support V2
kexec-tools: Introduce crashdump-xen.c and Xen support V2 This patch adds the new file crashdump-xen.c that implements Xen support. The Xen support is not complete yet in the sense that a special program header for the hypervisor isn't created. Crash notes for physical cpus are created so basic support is at least provided by this patch. Version 2 of this patch includes a cleaner implementation for crashdump-elf.c together with a bugfix for xen_get_nr_phys_cpus(). Signed-off-by: Magnus Damm <magnus@valinux.co.jp> Removed trailing whitespace Signed-off-by: Simon Horman <horms@verge.net.au>
Diffstat (limited to 'kexec/crashdump-elf.c')
-rw-r--r--kexec/crashdump-elf.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/kexec/crashdump-elf.c b/kexec/crashdump-elf.c
index 9e3121f..4c55baf 100644
--- a/kexec/crashdump-elf.c
+++ b/kexec/crashdump-elf.c
@@ -18,7 +18,11 @@ int FUNC(struct kexec_info *info,
uint64_t notes_addr, notes_len;
int (*get_note_info)(int cpu, uint64_t *addr, uint64_t *len);
- nr_cpus = sysconf(_SC_NPROCESSORS_CONF);
+ if (xen_present())
+ nr_cpus = xen_get_nr_phys_cpus();
+ else
+ nr_cpus = sysconf(_SC_NPROCESSORS_CONF);
+
if (nr_cpus < 0) {
return -1;
}
@@ -45,7 +49,7 @@ int FUNC(struct kexec_info *info,
* PT_LOAD program header and in the physical RAM program headers.
*/
- if (info->kern_size) {
+ if (info->kern_size && !xen_present()) {
sz += sizeof(PHDR);
}
@@ -87,6 +91,9 @@ int FUNC(struct kexec_info *info,
if (!get_note_info)
get_note_info = get_crash_notes_per_cpu;
+ if (xen_present())
+ get_note_info = xen_get_note;
+
/* PT_NOTE program headers. One per cpu */
for (i = 0; i < nr_cpus; i++) {
@@ -118,7 +125,7 @@ int FUNC(struct kexec_info *info,
* Kernel is mapped if info->kern_size is non-zero.
*/
- if (info->kern_size) {
+ if (info->kern_size && !xen_present()) {
phdr = (PHDR *) bufp;
bufp += sizeof(PHDR);
phdr->p_type = PT_LOAD;