Patchwork [RFC,04/20] cpu: replace trivial old_cpu_init functions

login
register
mail settings
Submitter Eduardo Habkost
Date Dec. 18, 2012, 8:03 p.m.
Message ID <1355861053-11460-5-git-send-email-ehabkost@redhat.com>
Download mbox | patch
Permalink /patch/207210/
State New
Headers show

Comments

Eduardo Habkost - Dec. 18, 2012, 8:03 p.m.
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 <ehabkost@redhat.com>
---
 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(-)

Patch

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);