Received: from eggs.gnu.org ([208.118.235.92]:36650) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SbiVN-0003Uu-Ek for qemu-devel@nongnu.org; Mon, 04 Jun 2012 21:24:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SbiVL-0008OC-Jw for qemu-devel@nongnu.org; Mon, 04 Jun 2012 21:24:16 -0400 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Tue, 5 Jun 2012 03:22:18 +0200 Message-Id: <1338859366-20689-47-git-send-email-afaerber@suse.de> In-Reply-To: <1338859366-20689-1-git-send-email-afaerber@suse.de> References: <1338859366-20689-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH 46/74] target-ppc: Let cpu_ppc_init() return PowerPCCPU List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: "open list:PowerPC" , =?UTF-8?q?Andreas=20F=C3=A4rber?= , Alexander Graf Adapt e500 mpc8544ds machine accordingly. Turn cpu_init() into a static inline function returning CPUPPCState for backwards compatibility. Signed-off-by: Andreas F=C3=A4rber Acked-by: Alexander Graf --- 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 =3D g_malloc0(smp_cpus * sizeof(qemu_irq *)); irqs[0] =3D g_malloc0(smp_cpus * sizeof(qemu_irq) * OPENPIC_OUTPUT_N= B); for (i =3D 0; i < smp_cpus; i++) { + PowerPCCPU *cpu; qemu_irq *input; - env =3D cpu_ppc_init(cpu_model); - if (!env) { + + cpu =3D cpu_ppc_init(cpu_model); + if (cpu =3D=3D NULL) { fprintf(stderr, "Unable to initialize CPU!\n"); exit(1); } + env =3D &cpu->env; =20 if (!firstenv) { firstenv =3D 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" =20 /***********************************************************************= ******/ -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 *e= nv, 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); =20 -#define cpu_init cpu_ppc_init +static inline CPUPPCState *cpu_init(const char *cpu_model) +{ + PowerPCCPU *cpu =3D cpu_ppc_init(cpu_model); + if (cpu =3D=3D 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)); } =20 -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) =20 qemu_init_vcpu(env); =20 - return env; + return cpu; } --=20 1.7.7