hw/tosa: Fix initialization of AArch32 CPUs

We have to ensure that we pass the proper formatted name into cpu_new()
This commit is contained in:
Lioncash 2018-09-02 16:02:17 -04:00
parent c870339a10
commit 0ad97c7ee3
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7

View file

@ -21,12 +21,7 @@
static int tosa_init(struct uc_struct *uc, MachineState *machine) static int tosa_init(struct uc_struct *uc, MachineState *machine)
{ {
if (uc->mode & UC_MODE_MCLASS) { uc->cpu = cpu_create(uc, machine->cpu_type);
uc->cpu = cpu_create(uc, "cortex-m3");
} else {
uc->cpu = cpu_create(uc, "cortex-a15");
}
return 0; return 0;
} }
@ -35,6 +30,12 @@ static void tosa_machine_init(struct uc_struct *uc, MachineClass *mc)
mc->init = tosa_init; mc->init = tosa_init;
mc->is_default = 1; mc->is_default = 1;
mc->arch = UC_ARCH_ARM; mc->arch = UC_ARCH_ARM;
if (uc->mode & UC_MODE_MCLASS) {
mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-m3");
} else {
mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a15");
}
} }
DEFINE_MACHINE("tosa", tosa_machine_init) DEFINE_MACHINE("tosa", tosa_machine_init)