mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 16:23:55 -06:00
target-arm: Detect attempt to instantiate non-CPU type in cpu_init()
Consolidate model checking into a new arm_cpu_class_by_name(). If the name matches an existing type, also check whether that type is actually (a sub-type of) TYPE_ARM_CPU. This fixes, e.g., -cpu tmp105 asserting. Cc: qemu-stable <qemu-stable@nongnu.org> Acked-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Andreas Färber <afaerber@suse.de>
This commit is contained in:
parent
2b8c275499
commit
5900d6b2d5
2 changed files with 21 additions and 2 deletions
|
@ -1262,12 +1262,14 @@ ARMCPU *cpu_arm_init(const char *cpu_model)
|
|||
{
|
||||
ARMCPU *cpu;
|
||||
CPUARMState *env;
|
||||
ObjectClass *oc;
|
||||
static int inited = 0;
|
||||
|
||||
if (!object_class_by_name(cpu_model)) {
|
||||
oc = cpu_class_by_name(TYPE_ARM_CPU, cpu_model);
|
||||
if (!oc) {
|
||||
return NULL;
|
||||
}
|
||||
cpu = ARM_CPU(object_new(cpu_model));
|
||||
cpu = ARM_CPU(object_new(object_class_get_name(oc)));
|
||||
env = &cpu->env;
|
||||
env->cpu_model_str = cpu_model;
|
||||
arm_cpu_realize(cpu);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue