From 151d1322a3a0c865089c09aeb50f18215121921a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Fri, 15 Feb 2013 15:41:49 +0100 Subject: cpus: Replace open-coded CPU loop in qmp_memsave() with qemu_get_cpu() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: Luiz Capitulino Signed-off-by: Andreas Färber --- cpus.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'cpus.c') 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) { -- cgit v1.2.1