X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=dump.c;h=c0d3da515b6c083b41819564d867c4bafb12dc24;hb=eeaa8d33e444ef6bbf2a10bde43aaf079db8d4df;hp=4ed1fa8622c2791ad34632022886c380d588c09b;hpb=a3161038a1fd17a638a0c606f71e1f799f65f41b;p=qemu.git diff --git a/dump.c b/dump.c index 4ed1fa862..c0d3da515 100644 --- a/dump.c +++ b/dump.c @@ -23,7 +23,6 @@ #include "sysemu/memory_mapping.h" #include "qapi/error.h" #include "qmp-commands.h" -#include "exec/gdbstub.h" static uint16_t cpu_convert_to_target16(uint16_t val, int endian) { @@ -268,15 +267,22 @@ static int write_elf64_note(DumpState *s) return 0; } +static inline int cpu_index(CPUState *cpu) +{ + return cpu->cpu_index + 1; +} + static int write_elf64_notes(DumpState *s) { CPUArchState *env; + CPUState *cpu; int ret; int id; for (env = first_cpu; env != NULL; env = env->next_cpu) { - id = cpu_index(env); - ret = cpu_write_elf64_note(fd_write_vmcore, env, id, s); + cpu = ENV_GET_CPU(env); + id = cpu_index(cpu); + ret = cpu_write_elf64_note(fd_write_vmcore, cpu, id, s); if (ret < 0) { dump_error(s, "dump: failed to write elf notes.\n"); return -1; @@ -284,7 +290,7 @@ static int write_elf64_notes(DumpState *s) } for (env = first_cpu; env != NULL; env = env->next_cpu) { - ret = cpu_write_elf64_qemunote(fd_write_vmcore, env, s); + ret = cpu_write_elf64_qemunote(fd_write_vmcore, cpu, s); if (ret < 0) { dump_error(s, "dump: failed to write CPU status.\n"); return -1; @@ -321,12 +327,14 @@ static int write_elf32_note(DumpState *s) static int write_elf32_notes(DumpState *s) { CPUArchState *env; + CPUState *cpu; int ret; int id; for (env = first_cpu; env != NULL; env = env->next_cpu) { - id = cpu_index(env); - ret = cpu_write_elf32_note(fd_write_vmcore, env, id, s); + cpu = ENV_GET_CPU(env); + id = cpu_index(cpu); + ret = cpu_write_elf32_note(fd_write_vmcore, cpu, id, s); if (ret < 0) { dump_error(s, "dump: failed to write elf notes.\n"); return -1; @@ -334,7 +342,7 @@ static int write_elf32_notes(DumpState *s) } for (env = first_cpu; env != NULL; env = env->next_cpu) { - ret = cpu_write_elf32_qemunote(fd_write_vmcore, env, s); + ret = cpu_write_elf32_qemunote(fd_write_vmcore, cpu, s); if (ret < 0) { dump_error(s, "dump: failed to write CPU status.\n"); return -1;