[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 03/17] cpus: Replace open-coded CPU loop in qmp_mems
From: |
Andreas Färber |
Subject: |
[Qemu-devel] [PATCH 03/17] cpus: Replace open-coded CPU loop in qmp_memsave() with qemu_get_cpu() |
Date: |
Tue, 12 Mar 2013 10:49:04 +0100 |
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 <address@hidden>
Signed-off-by: Andreas Färber <address@hidden>
---
cpus.c | 11 +++--------
1 Datei geändert, 3 Zeilen hinzugefügt(+), 8 Zeilen entfernt(-)
diff --git a/cpus.c b/cpus.c
index c4b021d..46355c1 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) {
--
1.7.10.4
- [Qemu-devel] [PULL 00/17] QOM CPUState patch queue 2013-03-12, Andreas Färber, 2013/03/12
- [Qemu-devel] [PATCH 01/17] cpu: Fix qemu_get_cpu() to return NULL if CPU not found, Andreas Färber, 2013/03/12
- [Qemu-devel] [PATCH 03/17] cpus: Replace open-coded CPU loop in qmp_memsave() with qemu_get_cpu(),
Andreas Färber <=
- [Qemu-devel] [PATCH 10/17] target-i386: Update VMStateDescription to X86CPU, Andreas Färber, 2013/03/12
- [Qemu-devel] [PATCH 06/17] vmstate: Make vmstate_register() static inline, Andreas Färber, 2013/03/12
- [Qemu-devel] [PATCH 08/17] cpu: Register VMStateDescription through CPUState, Andreas Färber, 2013/03/12
- [Qemu-devel] [PATCH 11/17] target-cris/helper.c: Update Coding Style, Andreas Färber, 2013/03/12
- [Qemu-devel] [PATCH 04/17] target-sh4: Introduce SuperHCPU subclasses, Andreas Färber, 2013/03/12
- [Qemu-devel] [PATCH 07/17] stubs: Add a vmstate_dummy struct for CONFIG_USER_ONLY, Andreas Färber, 2013/03/12
- [Qemu-devel] [PATCH 17/17] target-lm32: Update VMStateDescription to LM32CPU, Andreas Färber, 2013/03/12
- [Qemu-devel] [PATCH 05/17] target-sh4: Move PVR/PRR/CVR into SuperHCPUClass, Andreas Färber, 2013/03/12
- [Qemu-devel] [PATCH 09/17] cpu: Introduce cpu_class_set_vmsd(), Andreas Färber, 2013/03/12
- [Qemu-devel] [PATCH 02/17] monitor: Use qemu_get_cpu() in monitor_set_cpu(), Andreas Färber, 2013/03/12