[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC 04/20] cpu: replace trivial old_cpu_init functions
From: |
Eduardo Habkost |
Subject: |
[Qemu-devel] [RFC 04/20] cpu: replace trivial old_cpu_init functions |
Date: |
Tue, 18 Dec 2012 18:03:57 -0200 |
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 <address@hidden>
---
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);
--
1.7.11.7
- [Qemu-devel] [RFC 01/20] qemu-common.h: "use" env parameter in no-op version of qemu_init_vcpu(), (continued)
- [Qemu-devel] [RFC 01/20] qemu-common.h: "use" env parameter in no-op version of qemu_init_vcpu(), Eduardo Habkost, 2012/12/18
- [Qemu-devel] [RFC 07/20] target-unicore32: convert cpu_init to QOM, Eduardo Habkost, 2012/12/18
- [Qemu-devel] [RFC 02/20] cpu: introduce CPU_GET_ENV macros, Eduardo Habkost, 2012/12/18
- [Qemu-devel] [RFC 12/20] hw/openrisc_sim.c: coding style/indentation fix, Eduardo Habkost, 2012/12/18
- [Qemu-devel] [RFC 06/20] m68k: convert cpu_init to QOM, Eduardo Habkost, 2012/12/18
- [Qemu-devel] [RFC 11/20] target-openrisc: implement CPU realize() method, Eduardo Habkost, 2012/12/18
- [Qemu-devel] [RFC 09/20] cpu: introduce cpu_realize(), Eduardo Habkost, 2012/12/18
- [Qemu-devel] [RFC 15/20] target-arm: replace cpu_arm_init() with generic_cpu_init(), Eduardo Habkost, 2012/12/18
- [Qemu-devel] [RFC 17/20] target-m68k: replace cpu_m68k_init() with generic_cpu_init(), Eduardo Habkost, 2012/12/18
- [Qemu-devel] [RFC 05/20] alpha: convert cpu_init to QOM, Eduardo Habkost, 2012/12/18
- [Qemu-devel] [RFC 04/20] cpu: replace trivial old_cpu_init functions,
Eduardo Habkost <=
- [Qemu-devel] [RFC 13/20] target-openrisc: replace cpu_openrisc_init() with generic_cpu_init(), Eduardo Habkost, 2012/12/18
- [Qemu-devel] [RFC 16/20] target-m68k: move final steps of cpu_m68k_init() to realize function, Eduardo Habkost, 2012/12/18
- [Qemu-devel] [RFC 18/20] target-unicore32: move final steps of uc32_cpu_init() to realize function, Eduardo Habkost, 2012/12/18
- [Qemu-devel] [RFC 19/20] target-unicore32: replace uc32_cpu_init() with generic_cpu_init(), Eduardo Habkost, 2012/12/18
- [Qemu-devel] [RFC 14/20] target-arm: move final steps of cpu_arm_init() to realize function, Eduardo Habkost, 2012/12/18
- [Qemu-devel] [RFC 20/20] cpu: convert cpu_copy() to QOM, Eduardo Habkost, 2012/12/18
- [Qemu-devel] [RFC 08/20] cpu: move cpu_model_str to CPUState, Eduardo Habkost, 2012/12/18
- [Qemu-devel] [RFC 10/20] cpu: introduce generic_cpu_init() & generic_cpu_create() functions, Eduardo Habkost, 2012/12/18
- [Qemu-devel] [RFC 03/20] cpu: make cpu_init return CPUState QOM object, Eduardo Habkost, 2012/12/18
- Re: [Qemu-devel] [RFC 00/20] generic_cpu_init() and generic_cpu_create() functions, Andreas Färber, 2012/12/18