X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=dump.c;h=c0d3da515b6c083b41819564d867c4bafb12dc24;hb=ba2bc7a42e7c7b343f996967484ce3a1543cfebc;hp=e70e0f3b21500b9635aa66546b5dca39dc8487b5;hpb=022c62cbbcf1ff40b23c92874f8670cddfec2414;p=qemu.git diff --git a/dump.c b/dump.c index e70e0f3b2..c0d3da515 100644 --- a/dump.c +++ b/dump.c @@ -16,14 +16,13 @@ #include "cpu.h" #include "exec/cpu-all.h" #include "exec/hwaddr.h" -#include "monitor.h" -#include "kvm.h" -#include "dump.h" -#include "sysemu.h" -#include "memory_mapping.h" +#include "monitor/monitor.h" +#include "sysemu/kvm.h" +#include "sysemu/dump.h" +#include "sysemu/sysemu.h" +#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; @@ -427,7 +435,7 @@ static hwaddr get_offset(hwaddr phys_addr, } } - QLIST_FOREACH(block, &ram_list.blocks, next) { + QTAILQ_FOREACH(block, &ram_list.blocks, next) { if (s->has_filter) { if (block->offset >= s->begin + s->length || block->offset + block->length <= s->begin) { @@ -594,7 +602,7 @@ static int dump_completed(DumpState *s) static int get_next_block(DumpState *s, RAMBlock *block) { while (1) { - block = QLIST_NEXT(block, next); + block = QTAILQ_NEXT(block, next); if (!block) { /* no more block */ return 1; @@ -670,11 +678,11 @@ static ram_addr_t get_start_block(DumpState *s) RAMBlock *block; if (!s->has_filter) { - s->block = QLIST_FIRST(&ram_list.blocks); + s->block = QTAILQ_FIRST(&ram_list.blocks); return 0; } - QLIST_FOREACH(block, &ram_list.blocks, next) { + QTAILQ_FOREACH(block, &ram_list.blocks, next) { if (block->offset >= s->begin + s->length || block->offset + block->length <= s->begin) { /* This block is out of the range */