From patchwork Tue Dec 18 20:03:57 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 207210 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 32D492C0085 for ; Wed, 19 Dec 2012 08:13:56 +1100 (EST) Received: from localhost ([::1]:60975 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tl3ON-0007T7-3U for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2012 15:03:55 -0500 Received: from eggs.gnu.org ([208.118.235.92]:34126) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tl3NL-0005HJ-BP for qemu-devel@nongnu.org; Tue, 18 Dec 2012 15:02:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tl3NG-0000bs-8m for qemu-devel@nongnu.org; Tue, 18 Dec 2012 15:02:51 -0500 Received: from mx1.redhat.com ([209.132.183.28]:58884) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tl3NG-0000bJ-1h for qemu-devel@nongnu.org; Tue, 18 Dec 2012 15:02:46 -0500 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id qBIK2jeH010583 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 18 Dec 2012 15:02:45 -0500 Received: from blackpad.lan.raisama.net (vpn1-6-125.gru2.redhat.com [10.97.6.125]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id qBIK2iVf024292 for ; Tue, 18 Dec 2012 15:02:45 -0500 Received: by blackpad.lan.raisama.net (Postfix, from userid 500) id 3BD942036F2; Tue, 18 Dec 2012 18:04:18 -0200 (BRST) From: Eduardo Habkost To: qemu-devel@nongnu.org Date: Tue, 18 Dec 2012 18:03:57 -0200 Message-Id: <1355861053-11460-5-git-send-email-ehabkost@redhat.com> In-Reply-To: <1355861053-11460-1-git-send-email-ehabkost@redhat.com> References: <1355861053-11460-1-git-send-email-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [RFC 04/20] cpu: replace trivial old_cpu_init functions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Most of the existing old_cpu_init functions were just wrappers around QOM-ready cpu_*_init() functions, so just define cpu_init as a call to those functions (wrapped inside CPU macro). Signed-off-by: Eduardo Habkost --- target-arm/cpu.h | 10 +--------- target-cris/cpu.h | 10 +--------- target-i386/cpu.h | 10 +--------- target-lm32/cpu.h | 10 +--------- target-microblaze/cpu.h | 10 +--------- target-mips/cpu.h | 10 +--------- target-openrisc/cpu.h | 10 +--------- target-ppc/cpu.h | 10 +--------- target-s390x/cpu.h | 3 +-- target-sh4/cpu.h | 10 +--------- target-sparc/cpu.h | 10 +--------- target-xtensa/cpu.h | 10 +--------- 12 files changed, 12 insertions(+), 101 deletions(-) diff --git a/target-arm/cpu.h b/target-arm/cpu.h index 8b14bfc..718f1d9 100644 --- a/target-arm/cpu.h +++ b/target-arm/cpu.h @@ -625,15 +625,7 @@ static inline bool cp_access_ok(CPUARMState *env, #define TARGET_PHYS_ADDR_SPACE_BITS 40 #define TARGET_VIRT_ADDR_SPACE_BITS 32 -#define cpu_init(m) ENV_GET_CPU(old_cpu_init(m)) -static inline CPUARMState *old_cpu_init(const char *cpu_model) -{ - ARMCPU *cpu = cpu_arm_init(cpu_model); - if (cpu) { - return &cpu->env; - } - return NULL; -} +#define cpu_init(m) CPU(cpu_arm_init(m)) #define cpu_exec cpu_arm_exec #define cpu_gen_code cpu_arm_gen_code diff --git a/target-cris/cpu.h b/target-cris/cpu.h index e992f06..e1af636 100644 --- a/target-cris/cpu.h +++ b/target-cris/cpu.h @@ -218,15 +218,7 @@ enum { #define TARGET_PHYS_ADDR_SPACE_BITS 32 #define TARGET_VIRT_ADDR_SPACE_BITS 32 -#define cpu_init(m) ENV_GET_CPU(old_cpu_init(m)) -static inline CPUCRISState *old_cpu_init(const char *cpu_model) -{ - CRISCPU *cpu = cpu_cris_init(cpu_model); - if (cpu == NULL) { - return NULL; - } - return &cpu->env; -} +#define cpu_init(m) CPU(cpu_cris_init(m)) #define cpu_exec cpu_cris_exec #define cpu_gen_code cpu_cris_gen_code diff --git a/target-i386/cpu.h b/target-i386/cpu.h index c381b03..8fa183b 100644 --- a/target-i386/cpu.h +++ b/target-i386/cpu.h @@ -1034,15 +1034,7 @@ uint64_t cpu_get_tsc(CPUX86State *env); #define TARGET_VIRT_ADDR_SPACE_BITS 32 #endif -#define cpu_init(m) ENV_GET_CPU(old_cpu_init(m)) -static inline CPUX86State *old_cpu_init(const char *cpu_model) -{ - X86CPU *cpu = cpu_x86_init(cpu_model); - if (cpu == NULL) { - return NULL; - } - return &cpu->env; -} +#define cpu_init(m) CPU(cpu_x86_init(m)) #define cpu_exec cpu_x86_exec #define cpu_gen_code cpu_x86_gen_code diff --git a/target-lm32/cpu.h b/target-lm32/cpu.h index 9cfa7b1..1cf58c9 100644 --- a/target-lm32/cpu.h +++ b/target-lm32/cpu.h @@ -199,15 +199,7 @@ int cpu_lm32_signal_handler(int host_signum, void *pinfo, void lm32_translate_init(void); void cpu_lm32_set_phys_msb_ignore(CPULM32State *env, int value); -#define cpu_init(m) ENV_GET_CPU(old_cpu_init(m)) -static inline CPULM32State *old_cpu_init(const char *cpu_model) -{ - LM32CPU *cpu = cpu_lm32_init(cpu_model); - if (cpu == NULL) { - return NULL; - } - return &cpu->env; -} +#define cpu_init(m) CPU(cpu_lm32_init(m)) #define cpu_list cpu_lm32_list #define cpu_exec cpu_lm32_exec diff --git a/target-microblaze/cpu.h b/target-microblaze/cpu.h index c41354e..7bbf01c 100644 --- a/target-microblaze/cpu.h +++ b/target-microblaze/cpu.h @@ -295,15 +295,7 @@ enum { #define TARGET_PHYS_ADDR_SPACE_BITS 32 #define TARGET_VIRT_ADDR_SPACE_BITS 32 -#define cpu_init(m) ENV_GET_CPU(old_cpu_init(m)) -static inline CPUMBState *old_cpu_init(const char *cpu_model) -{ - MicroBlazeCPU *cpu = cpu_mb_init(cpu_model); - if (cpu == NULL) { - return NULL; - } - return &cpu->env; -} +#define cpu_init(m) CPU(cpu_mb_init(m)) #define cpu_exec cpu_mb_exec #define cpu_gen_code cpu_mb_gen_code diff --git a/target-mips/cpu.h b/target-mips/cpu.h index 9162ced..b01f3da 100644 --- a/target-mips/cpu.h +++ b/target-mips/cpu.h @@ -632,15 +632,7 @@ int cpu_mips_exec(CPUMIPSState *s); MIPSCPU *cpu_mips_init(const char *cpu_model); int cpu_mips_signal_handler(int host_signum, void *pinfo, void *puc); -#define cpu_init(m) ENV_GET_CPU(old_cpu_init(m)) -static inline CPUMIPSState *old_cpu_init(const char *cpu_model) -{ - MIPSCPU *cpu = cpu_mips_init(cpu_model); - if (cpu == NULL) { - return NULL; - } - return &cpu->env; -} +#define cpu_init(m) CPU(cpu_mips_init(m)) /* TODO QOM'ify CPU reset and remove */ void cpu_state_reset(CPUMIPSState *s); diff --git a/target-openrisc/cpu.h b/target-openrisc/cpu.h index 13220a5..d7470a9 100644 --- a/target-openrisc/cpu.h +++ b/target-openrisc/cpu.h @@ -386,15 +386,7 @@ int cpu_openrisc_get_phys_data(OpenRISCCPU *cpu, int *prot, target_ulong address, int rw); #endif -#define cpu_init(m) ENV_GET_CPU(old_cpu_init(m)) -static inline CPUOpenRISCState *old_cpu_init(const char *cpu_model) -{ - OpenRISCCPU *cpu = cpu_openrisc_init(cpu_model); - if (cpu) { - return &cpu->env; - } - return NULL; -} +#define cpu_init(m) CPU(cpu_openrisc_init(m)) #if defined(CONFIG_USER_ONLY) static inline void cpu_clone_regs(CPUOpenRISCState *env, target_ulong newsp) diff --git a/target-ppc/cpu.h b/target-ppc/cpu.h index 58404b8..ec626fd 100644 --- a/target-ppc/cpu.h +++ b/target-ppc/cpu.h @@ -1216,15 +1216,7 @@ 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(m) ENV_GET_CPU(old_cpu_init(m)) -static inline CPUPPCState *old_cpu_init(const char *cpu_model) -{ - PowerPCCPU *cpu = cpu_ppc_init(cpu_model); - if (cpu == NULL) { - return NULL; - } - return &cpu->env; -} +#define cpu_init(m) CPU(cpu_ppc_init(m)) #define cpu_exec cpu_ppc_exec #define cpu_gen_code cpu_ppc_gen_code diff --git a/target-s390x/cpu.h b/target-s390x/cpu.h index 2edebf1..6d7b936 100644 --- a/target-s390x/cpu.h +++ b/target-s390x/cpu.h @@ -345,8 +345,7 @@ static inline void cpu_set_tls(CPUS390XState *env, target_ulong newtls) env->aregs[1] = newtls & 0xffffffffULL; } -#define cpu_init(m) ENV_GET_CPU(old_cpu_init(m)) -#define old_cpu_init(model) (&cpu_s390x_init(model)->env) +#define cpu_init(m) CPU(cpu_s390x_init(m)) #define cpu_exec cpu_s390x_exec #define cpu_gen_code cpu_s390x_gen_code #define cpu_signal_handler cpu_s390x_signal_handler diff --git a/target-sh4/cpu.h b/target-sh4/cpu.h index f6ba00e..1445533 100644 --- a/target-sh4/cpu.h +++ b/target-sh4/cpu.h @@ -232,15 +232,7 @@ void cpu_load_tlb(CPUSH4State * env); #include "softfloat.h" -#define cpu_init(m) ENV_GET_CPU(old_cpu_init(m)) -static inline CPUSH4State *old_cpu_init(const char *cpu_model) -{ - SuperHCPU *cpu = cpu_sh4_init(cpu_model); - if (cpu == NULL) { - return NULL; - } - return &cpu->env; -} +#define cpu_init(m) CPU(cpu_sh4_init(m)) #define cpu_exec cpu_sh4_exec #define cpu_gen_code cpu_sh4_gen_code diff --git a/target-sparc/cpu.h b/target-sparc/cpu.h index ca2bdb1..4db26a6 100644 --- a/target-sparc/cpu.h +++ b/target-sparc/cpu.h @@ -592,15 +592,7 @@ hwaddr cpu_get_phys_page_nofault(CPUSPARCState *env, target_ulong addr, int cpu_sparc_signal_handler(int host_signum, void *pinfo, void *puc); #ifndef NO_CPU_IO_DEFS -#define cpu_init(m) ENV_GET_CPU(old_cpu_init(m)) -static inline CPUSPARCState *old_cpu_init(const char *cpu_model) -{ - SPARCCPU *cpu = cpu_sparc_init(cpu_model); - if (cpu == NULL) { - return NULL; - } - return &cpu->env; -} +#define cpu_init(m) CPU(cpu_sparc_init(m)) #endif #define cpu_exec cpu_sparc_exec diff --git a/target-xtensa/cpu.h b/target-xtensa/cpu.h index 65f2af3..52d775d 100644 --- a/target-xtensa/cpu.h +++ b/target-xtensa/cpu.h @@ -375,15 +375,7 @@ typedef struct CPUXtensaState { XtensaCPU *cpu_xtensa_init(const char *cpu_model); -#define cpu_init(m) ENV_GET_CPU(old_cpu_init(m)) -static inline CPUXtensaState *old_cpu_init(const char *cpu_model) -{ - XtensaCPU *cpu = cpu_xtensa_init(cpu_model); - if (cpu == NULL) { - return NULL; - } - return &cpu->env; -} +#define cpu_init(m) CPU(cpu_xtensa_init(m)) void xtensa_translate_init(void); int cpu_xtensa_exec(CPUXtensaState *s);