aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cpus.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/cpus.c b/cpus.c
index c4b021dd2e..46355c1321 100644
--- a/cpus.c
+++ b/cpus.c
@@ -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) {