]> Git Repo - qemu.git/commitdiff
alpha: replace cpu_alpha_init() with cpu_generic_init()
authorIgor Mammedov <[email protected]>
Thu, 24 Aug 2017 16:31:32 +0000 (18:31 +0200)
committerEduardo Habkost <[email protected]>
Fri, 1 Sep 2017 14:54:24 +0000 (11:54 -0300)
cpu_alpha_init() used to provide default fallback if invalid
(i.e. non existent) cpu_model were provided.

dp264 machine provides its own default so sole user of fallback
is [bsd|linux]-user targets which specifies 'any' cpu model that
fallbacks to "ev67" in cpu_alpha_init(). Push fallback handling
into alpha_cpu_class_by_name() and replace cpu_alpha_init() with
cpu_generic_init().

Signed-off-by: Igor Mammedov <[email protected]>
Acked-by: Richard Henderson <[email protected]>
Message-Id: <1503592308[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
hw/alpha/dp264.c
target/alpha/cpu.c
target/alpha/cpu.h

index 3b307ad87314d24b8dcdd908c5f5e4d65501f954..1c5a177102946eb32aed0bbf5bd2ac4bcdb9cf21 100644 (file)
@@ -51,7 +51,7 @@ static int clipper_pci_map_irq(PCIDevice *d, int irq_num)
 static void clipper_init(MachineState *machine)
 {
     ram_addr_t ram_size = machine->ram_size;
-    const char *cpu_model = machine->cpu_model;
+    const char *cpu_model = machine->cpu_model ? machine->cpu_model : "ev67";
     const char *kernel_filename = machine->kernel_filename;
     const char *kernel_cmdline = machine->kernel_cmdline;
     const char *initrd_filename = machine->initrd_filename;
@@ -67,7 +67,11 @@ static void clipper_init(MachineState *machine)
     /* Create up to 4 cpus.  */
     memset(cpus, 0, sizeof(cpus));
     for (i = 0; i < smp_cpus; ++i) {
-        cpus[i] = cpu_alpha_init(cpu_model ? cpu_model : "ev67");
+        cpus[i] = ALPHA_CPU(cpu_generic_init(TYPE_ALPHA_CPU, cpu_model));
+        if (!cpus[i]) {
+            error_report("Unable to find CPU definition");
+            exit(1);
+        }
     }
 
     cpus[0]->env.trap_arg0 = ram_size;
index 76150f48d385a467aa6aa1213036dc457260fe7e..1ea597b9dd888b1e115d859b226a5b5969548eeb 100644 (file)
@@ -155,24 +155,14 @@ static ObjectClass *alpha_cpu_class_by_name(const char *cpu_model)
     if (oc != NULL && object_class_is_abstract(oc)) {
         oc = NULL;
     }
-    return oc;
-}
-
-AlphaCPU *cpu_alpha_init(const char *cpu_model)
-{
-    AlphaCPU *cpu;
-    ObjectClass *cpu_class;
 
-    cpu_class = alpha_cpu_class_by_name(cpu_model);
-    if (cpu_class == NULL) {
-        /* Default to ev67; no reason not to emulate insns by default.  */
-        cpu_class = object_class_by_name(TYPE("ev67"));
+    /* TODO: remove match everything nonsense */
+    /* Default to ev67; no reason not to emulate insns by default. */
+    if (!oc) {
+        oc = object_class_by_name(TYPE("ev67"));
     }
-    cpu = ALPHA_CPU(object_new(object_class_get_name(cpu_class)));
-
-    object_property_set_bool(OBJECT(cpu), true, "realized", NULL);
 
-    return cpu;
+    return oc;
 }
 
 static void ev4_cpu_initfn(Object *obj)
index e95be2b34b9529c899c3fcf9e483bab26c3eb55f..0738e97d6d60edf9c8e5b7e6143dfbfda7b26dc2 100644 (file)
@@ -468,9 +468,7 @@ enum {
 
 void alpha_translate_init(void);
 
-AlphaCPU *cpu_alpha_init(const char *cpu_model);
-
-#define cpu_init(cpu_model) CPU(cpu_alpha_init(cpu_model))
+#define cpu_init(cpu_model) cpu_generic_init(TYPE_ALPHA_CPU, cpu_model)
 
 void alpha_cpu_list(FILE *f, fprintf_function cpu_fprintf);
 /* you can call this signal handler from your SIGBUS and SIGSEGV
This page took 0.038278 seconds and 4 git commands to generate.