]> Git Repo - qemu.git/commitdiff
m68k: replace cpu_m68k_init() with cpu_generic_init()
authorIgor Mammedov <[email protected]>
Thu, 24 Aug 2017 16:31:34 +0000 (18:31 +0200)
committerEduardo Habkost <[email protected]>
Fri, 1 Sep 2017 14:54:24 +0000 (11:54 -0300)
call register_m68k_insns() at realize time which makes
cpu_m68k_init() typical object creation function.
As result we can replace it with cpu_generic_init()
which does the same job, reducing code duplication a bit.

Signed-off-by: Igor Mammedov <[email protected]>
Tested-by: Thomas Huth <[email protected]>
Acked-by: Laurent Vivier <[email protected]>
Message-Id: <1503592308[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
hw/m68k/an5206.c
hw/m68k/mcf5208.c
target/m68k/cpu.c
target/m68k/cpu.h
target/m68k/helper.c

index c76244176f590c0f96ddb8d00fdbacfcb79c74a6..7b9b15d6c497713e3aaf06cf895e2bae8bed623a 100644 (file)
@@ -42,7 +42,7 @@ static void an5206_init(MachineState *machine)
     if (!cpu_model) {
         cpu_model = "m5206";
     }
-    cpu = cpu_m68k_init(cpu_model);
+    cpu = M68K_CPU(cpu_generic_init(TYPE_M68K_CPU, cpu_model));
     if (!cpu) {
         error_report("Unable to find m68k CPU definition");
         exit(1);
index f4b1387c0d3bf916295a8db28a7102424a442eda..1a0f18073a01b370e6803619d22605d906fba65a 100644 (file)
@@ -232,7 +232,7 @@ static void mcf5208evb_init(MachineState *machine)
     if (!cpu_model) {
         cpu_model = "m5208";
     }
-    cpu = cpu_m68k_init(cpu_model);
+    cpu = M68K_CPU(cpu_generic_init(TYPE_M68K_CPU, cpu_model));
     if (!cpu) {
         fprintf(stderr, "Unable to find m68k CPU definition\n");
         exit(1);
index a14b6dda7f6bc1f39b3f0bea66f9d8687c558611..55bf24bae62116f2bffce220c6ddfa08b5fa18b8 100644 (file)
@@ -230,6 +230,8 @@ static void m68k_cpu_realizefn(DeviceState *dev, Error **errp)
     M68kCPUClass *mcc = M68K_CPU_GET_CLASS(dev);
     Error *local_err = NULL;
 
+    register_m68k_insns(&cpu->env);
+
     cpu_exec_realizefn(cs, &local_err);
     if (local_err != NULL) {
         error_propagate(errp, local_err);
index 38a7e11b92c84571ff2f7cca6ffc10c1be056265..d9365476e5de75802b8f8b369ad70c3bb9b47305 100644 (file)
@@ -163,7 +163,6 @@ int m68k_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
 
 void m68k_tcg_init(void);
 void m68k_cpu_init_gdb(M68kCPU *cpu);
-M68kCPU *cpu_m68k_init(const char *cpu_model);
 /* you can call this signal handler from your SIGBUS and SIGSEGV
    signal handlers to inform the virtual CPU of exceptions. non zero
    is returned if the signal was handled by the virtual CPU.  */
@@ -322,7 +321,7 @@ void register_m68k_insns (CPUM68KState *env);
 #define TARGET_PHYS_ADDR_SPACE_BITS 32
 #define TARGET_VIRT_ADDR_SPACE_BITS 32
 
-#define cpu_init(cpu_model) CPU(cpu_m68k_init(cpu_model))
+#define cpu_init(cpu_model) cpu_generic_init(TYPE_M68K_CPU, cpu_model)
 
 #define cpu_signal_handler cpu_m68k_signal_handler
 #define cpu_list m68k_cpu_list
index caae29100cabad31e60c9ca0bed143386e1b1259..7e50ff587145bd68dc9bac5fe717fd266aed3b01 100644 (file)
@@ -156,26 +156,6 @@ static int m68k_fpu_gdb_set_reg(CPUM68KState *env, uint8_t *mem_buf, int n)
     return 0;
 }
 
-M68kCPU *cpu_m68k_init(const char *cpu_model)
-{
-    M68kCPU *cpu;
-    CPUM68KState *env;
-    ObjectClass *oc;
-
-    oc = cpu_class_by_name(TYPE_M68K_CPU, cpu_model);
-    if (oc == NULL) {
-        return NULL;
-    }
-    cpu = M68K_CPU(object_new(object_class_get_name(oc)));
-    env = &cpu->env;
-
-    register_m68k_insns(env);
-
-    object_property_set_bool(OBJECT(cpu), true, "realized", NULL);
-
-    return cpu;
-}
-
 void m68k_cpu_init_gdb(M68kCPU *cpu)
 {
     CPUState *cs = CPU(cpu);
This page took 0.034804 seconds and 4 git commands to generate.