Patchwork [RFC,15/20] target-arm: replace cpu_arm_init() with generic_cpu_init()

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

Comments

Eduardo Habkost - Dec. 18, 2012, 8:04 p.m.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 target-arm/cpu.h    |  6 ++++--
 target-arm/helper.c | 13 -------------
 2 files changed, 4 insertions(+), 15 deletions(-)

Patch

diff --git a/target-arm/cpu.h b/target-arm/cpu.h
index 718f1d9..bf50ea1 100644
--- a/target-arm/cpu.h
+++ b/target-arm/cpu.h
@@ -232,7 +232,6 @@  typedef struct CPUARMState {
 
 #include "cpu-qom.h"
 
-ARMCPU *cpu_arm_init(const char *cpu_model);
 void arm_translate_init(void);
 int cpu_arm_exec(CPUARMState *s);
 void do_interrupt(CPUARMState *);
@@ -625,7 +624,10 @@  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) CPU(cpu_arm_init(m))
+#define cpu_init(m) generic_cpu_init(TYPE_ARM_CPU, m)
+
+/* helper for existing code easily create an ARM CPU: */
+#define cpu_arm_init(m) ARM_CPU(cpu_init(m))
 
 #define cpu_exec cpu_arm_exec
 #define cpu_gen_code cpu_arm_gen_code
diff --git a/target-arm/helper.c b/target-arm/helper.c
index 2a62a7f..036c056 100644
--- a/target-arm/helper.c
+++ b/target-arm/helper.c
@@ -1204,19 +1204,6 @@  void register_cp_regs_for_features(ARMCPU *cpu)
     }
 }
 
-ARMCPU *cpu_arm_init(const char *cpu_model)
-{
-    ARMCPU *cpu;
-
-    if (!object_class_by_name(cpu_model)) {
-        return NULL;
-    }
-    cpu = ARM_CPU(object_new(cpu_model));
-    CPU(cpu)->cpu_model_str = cpu_model;
-    cpu_realize(CPU(cpu), NULL);
-    return cpu;
-}
-
 typedef struct ARMCPUListState {
     fprintf_function cpu_fprintf;
     FILE *file;