Skip to content
Snippets Groups Projects
Commit 151d1322 authored by Andreas Färber's avatar Andreas Färber
Browse files

cpus: Replace open-coded CPU loop in qmp_memsave() with qemu_get_cpu()


No functional change, just less usages of first_cpu and next_cpu fields.

env is passed to cpu_memory_rw_debug(), which in turn passes it to
target-specific cpu_get_phys_page_debug(). Changing both would be a
larger refactoring, so defer that by using env_ptr for now.

Reviewed-by: default avatarLuiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: default avatarAndreas Färber <afaerber@suse.de>
parent 1c8bb3cc
No related branches found
No related tags found
No related merge requests found
......@@ -1241,18 +1241,13 @@ void qmp_memsave(int64_t addr, int64_t size, const char *filename,
cpu_index = 0;
}
for (env = first_cpu; env; env = env->next_cpu) {
cpu = ENV_GET_CPU(env);
if (cpu_index == cpu->cpu_index) {
break;
}
}
if (env == NULL) {
cpu = qemu_get_cpu(cpu_index);
if (cpu == NULL) {
error_set(errp, QERR_INVALID_PARAMETER_VALUE, "cpu-index",
"a CPU number");
return;
}
env = cpu->env_ptr;
f = fopen(filename, "wb");
if (!f) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment