[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PATCH next v2 15/74] target-ppc: Let cpu_ppc_init() return P
From: |
Andreas Färber |
Subject: |
[Qemu-ppc] [PATCH next v2 15/74] target-ppc: Let cpu_ppc_init() return PowerPCCPU |
Date: |
Thu, 10 May 2012 02:13:53 +0200 |
Adapt e500 mpc8544ds machine accordingly.
Turn cpu_init() into a static inline function returning CPUPPCState for
backwards compatibility.
Signed-off-by: Andreas Färber <address@hidden>
---
hw/ppce500_mpc8544ds.c | 7 +++++--
target-ppc/cpu.h | 12 ++++++++++--
target-ppc/helper.c | 4 ++--
3 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/hw/ppce500_mpc8544ds.c b/hw/ppce500_mpc8544ds.c
index f1dfbe1..88a2767 100644
--- a/hw/ppce500_mpc8544ds.c
+++ b/hw/ppce500_mpc8544ds.c
@@ -254,12 +254,15 @@ static void mpc8544ds_init(ram_addr_t ram_size,
irqs = g_malloc0(smp_cpus * sizeof(qemu_irq *));
irqs[0] = g_malloc0(smp_cpus * sizeof(qemu_irq) * OPENPIC_OUTPUT_NB);
for (i = 0; i < smp_cpus; i++) {
+ PowerPCCPU *cpu;
qemu_irq *input;
- env = cpu_ppc_init(cpu_model);
- if (!env) {
+
+ cpu = cpu_ppc_init(cpu_model);
+ if (cpu == NULL) {
fprintf(stderr, "Unable to initialize CPU!\n");
exit(1);
}
+ env = &cpu->env;
if (!firstenv) {
firstenv = env;
diff --git a/target-ppc/cpu.h b/target-ppc/cpu.h
index 84c9674..77a2858 100644
--- a/target-ppc/cpu.h
+++ b/target-ppc/cpu.h
@@ -1099,7 +1099,7 @@ struct mmu_ctx_t {
#include "cpu-qom.h"
/*****************************************************************************/
-CPUPPCState *cpu_ppc_init (const char *cpu_model);
+PowerPCCPU *cpu_ppc_init(const char *cpu_model);
void ppc_translate_init(void);
int cpu_ppc_exec (CPUPPCState *s);
/* you can call this signal handler from your SIGBUS and SIGSEGV
@@ -1214,7 +1214,15 @@ static inline uint64_t ppc_dump_gpr(CPUPPCState *env,
int gprn)
int ppc_dcr_read (ppc_dcr_t *dcr_env, int dcrn, uint32_t *valp);
int ppc_dcr_write (ppc_dcr_t *dcr_env, int dcrn, uint32_t val);
-#define cpu_init cpu_ppc_init
+static inline CPUPPCState *cpu_init(const char *cpu_model)
+{
+ PowerPCCPU *cpu = cpu_ppc_init(cpu_model);
+ if (cpu == NULL) {
+ return NULL;
+ }
+ return &cpu->env;
+}
+
#define cpu_exec cpu_ppc_exec
#define cpu_gen_code cpu_ppc_gen_code
#define cpu_signal_handler cpu_ppc_signal_handler
diff --git a/target-ppc/helper.c b/target-ppc/helper.c
index e97e496..42f66e8 100644
--- a/target-ppc/helper.c
+++ b/target-ppc/helper.c
@@ -3191,7 +3191,7 @@ void cpu_state_reset(CPUPPCState *env)
cpu_reset(ENV_GET_CPU(env));
}
-CPUPPCState *cpu_ppc_init (const char *cpu_model)
+PowerPCCPU *cpu_ppc_init(const char *cpu_model)
{
PowerPCCPU *cpu;
CPUPPCState *env;
@@ -3213,5 +3213,5 @@ CPUPPCState *cpu_ppc_init (const char *cpu_model)
qemu_init_vcpu(env);
- return env;
+ return cpu;
}
--
1.7.7
- [Qemu-ppc] [PATCH next v2 00/74] QOM CPUState, part 3: CPU reset, Andreas Färber, 2012/05/10
- [Qemu-ppc] [PATCH next v2 24/74] ppc_newworld: Pass PowerPCCPU to ppc_core99_reset(), Andreas Färber, 2012/05/09
- [Qemu-ppc] [PATCH next v2 26/74] ppc_oldworld: Pass PowerPCCPU to ppc_heathrow_reset(), Andreas Färber, 2012/05/09
- [Qemu-ppc] [PATCH next v2 15/74] target-ppc: Let cpu_ppc_init() return PowerPCCPU,
Andreas Färber <=
- [Qemu-ppc] [PATCH next v2 27/74] ppc_prep: Use cpu_ppc_init() to obtain PowerPCCPU, Andreas Färber, 2012/05/09
- [Qemu-ppc] [PATCH next v2 25/74] ppc_oldworld: Use cpu_ppc_init() to obtain PowerPCCPU, Andreas Färber, 2012/05/09
- [Qemu-ppc] [PATCH next v2 23/74] ppc_newworld: Use cpu_ppc_init() to obtain PowerPCCPU, Andreas Färber, 2012/05/09
- [Qemu-ppc] [PATCH next v2 32/74] cpu-exec: Use cpu_reset() in cpu_exec() for TARGET_PPC, Andreas Färber, 2012/05/09
- [Qemu-ppc] [PATCH next v2 28/74] ppc_prep: Pass PowerPCCPU to ppc_prep_reset(), Andreas Färber, 2012/05/09
- [Qemu-ppc] [PATCH next v2 74/74] Kill off cpu_state_reset(), Andreas Färber, 2012/05/10
- Message not available