[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 41/47] e500: Replace open-coded loop with qemu_get_c
From: |
Andreas Färber |
Subject: |
[Qemu-devel] [PATCH 41/47] e500: Replace open-coded loop with qemu_get_cpu() |
Date: |
Sat, 16 Feb 2013 16:45:36 +0100 |
Since we still need env for ppc-specific fields, obtain it via the new
env_ptr fields to avoid "cpu" name conflicts between CPUState and
PowerPCCPU for now.
This fixes a potential issue with env being NULL at the end of the loop
but cpu still being a valid pointer corresponding to a previous env.
Acked-by: Alexander Graf <address@hidden>
Signed-off-by: Andreas Färber <address@hidden>
---
hw/ppc/e500.c | 11 +++--------
1 Datei geändert, 3 Zeilen hinzugefügt(+), 8 Zeilen entfernt(-)
diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c
index b7474c0..451682c 100644
--- a/hw/ppc/e500.c
+++ b/hw/ppc/e500.c
@@ -240,20 +240,15 @@ static int ppce500_load_device_tree(CPUPPCState *env,
/* We need to generate the cpu nodes in reverse order, so Linux can pick
the first node as boot node and be happy */
for (i = smp_cpus - 1; i >= 0; i--) {
- CPUState *cpu = NULL;
+ CPUState *cpu;
char cpu_name[128];
uint64_t cpu_release_addr = MPC8544_SPIN_BASE + (i * 0x20);
- for (env = first_cpu; env != NULL; env = env->next_cpu) {
- cpu = ENV_GET_CPU(env);
- if (cpu->cpu_index == i) {
- break;
- }
- }
-
+ cpu = qemu_get_cpu(i);
if (cpu == NULL) {
continue;
}
+ env = cpu->env_ptr;
snprintf(cpu_name, sizeof(cpu_name), "/cpus/PowerPC,address@hidden",
cpu->cpu_index);
--
1.7.10.4
- [Qemu-devel] [PATCH 43/47] spapr_hcall: Replace open-coded CPU loop with qemu_get_cpu(), (continued)
- [Qemu-devel] [PATCH 43/47] spapr_hcall: Replace open-coded CPU loop with qemu_get_cpu(), Andreas Färber, 2013/02/16
- [Qemu-devel] [PATCH 36/47] cpu: Move running field to CPUState, Andreas Färber, 2013/02/16
- [Qemu-devel] [PATCH 29/47] ppc405_uc: Pass PowerPCCPU to ppc40x_{core, chip, system}_reset(), Andreas Färber, 2013/02/16
- [Qemu-devel] [PATCH 27/47] target-unicore32: Move TCG initialization to UniCore32CPU initfn, Andreas Färber, 2013/02/16
- [Qemu-devel] [PATCH 45/47] target-lm32: Drop unused cpu_lm32_close() prototype, Andreas Färber, 2013/02/16
- [Qemu-devel] [PATCH 30/47] target-m68k: Return M68kCPU from cpu_m68k_init(), Andreas Färber, 2013/02/16
- [Qemu-devel] [PATCH 47/47] target-i386: Split command line parsing out of cpu_x86_register(), Andreas Färber, 2013/02/16
- [Qemu-devel] [PATCH 31/47] mcf5206: Pass M68kCPU to mcf5206_init(), Andreas Färber, 2013/02/16
- [Qemu-devel] [PATCH 46/47] target-i386: Move cpu_x86_init(), Andreas Färber, 2013/02/16
- [Qemu-devel] [PATCH 33/47] target-m68k: Pass M68kCPU to m68k_set_irq_level(), Andreas Färber, 2013/02/16
- [Qemu-devel] [PATCH 41/47] e500: Replace open-coded loop with qemu_get_cpu(),
Andreas Färber <=
- [Qemu-devel] [PATCH 35/47] cpu: Move host_tid field to CPUState, Andreas Färber, 2013/02/16
- [Qemu-devel] [PATCH 39/47] cputlb: Pass CPUState to cpu_unlink_tb(), Andreas Färber, 2013/02/16
- [Qemu-devel] [PATCH 37/47] cpu: Move exit_request field to CPUState, Andreas Färber, 2013/02/16
- [Qemu-devel] [PATCH 44/47] target-s390x: Drop unused cpu_s390x_close() prototype, Andreas Färber, 2013/02/16
- [Qemu-devel] [PATCH 34/47] target-cris: Introduce CRISCPU subclasses, Andreas Färber, 2013/02/16
- [Qemu-devel] [PATCH 40/47] cpu: Add CPUArchState pointer to CPUState, Andreas Färber, 2013/02/16
- [Qemu-devel] [PATCH 38/47] cpu: Move current_tb field to CPUState, Andreas Färber, 2013/02/16
- [Qemu-devel] [PATCH 42/47] ppce500_spin: Replace open-coded CPU loop with qemu_get_cpu(), Andreas Färber, 2013/02/16
- [Qemu-devel] [PATCH 28/47] target-xtensa: Move TCG initialization to XtensaCPU initfn, Andreas Färber, 2013/02/16
- [Qemu-devel] [PATCH 32/47] mcf_intc: Pass M68kCPU to mcf_intc_init(), Andreas Färber, 2013/02/16