aboutsummaryrefslogtreecommitdiff
path: root/target-arm
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2013-01-28 14:48:03 -0600
committerAnthony Liguori <aliguori@us.ibm.com>2013-01-28 14:48:03 -0600
commitec9466ff2e50213c8318ffdd7003f345278ab795 (patch)
tree5c0b3431f709e8958858385e5aacd7cf28858250 /target-arm
parent503cb22e055dcf477f9147fa1a3b8ae17c86c9b0 (diff)
parent290adf38967787bd985a5ec67dc4717e83c29eaa (diff)
Merge remote-tracking branch 'afaerber/qom-cpu' into staging
* afaerber/qom-cpu: (37 commits) kvm: Pass CPUState to kvm_on_sigbus_vcpu() cpu: Unconditionalize CPUState fields target-m68k: Use type_register() instead of type_register_static() target-unicore32: Use type_register() instead of type_register_static() target-openrisc: Use type_register() instead of type_register_static() target-unicore32: Catch attempt to instantiate abstract type in cpu_init() target-openrisc: Catch attempt to instantiate abstract type in cpu_init() target-m68k: Catch attempt to instantiate abstract type in cpu_init() target-arm: Catch attempt to instantiate abstract type in cpu_init() target-alpha: Catch attempt to instantiate abstract type in cpu_init() qom: Introduce object_class_is_abstract() target-unicore32: Detect attempt to instantiate non-CPU type in cpu_init() target-openrisc: Detect attempt to instantiate non-CPU type in cpu_init() target-m68k: Detect attempt to instantiate non-CPU type in cpu_init() target-alpha: Detect attempt to instantiate non-CPU type in cpu_init() target-arm: Detect attempt to instantiate non-CPU type in cpu_init() cpu: Add model resolution support to CPUClass target-i386: Remove setting tsc-frequency from x86_def_t target-i386: Set custom features/properties without intermediate x86_def_t target-i386: Remove vendor_override field from CPUX86State ... Conflicts: tests/Makefile Resolved simple conflict caused by lack of context in Makefile Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'target-arm')
-rw-r--r--target-arm/cpu.c18
-rw-r--r--target-arm/helper.c6
2 files changed, 22 insertions, 2 deletions
diff --git a/target-arm/cpu.c b/target-arm/cpu.c
index 07588a13b2..d1a4c82680 100644
--- a/target-arm/cpu.c
+++ b/target-arm/cpu.c
@@ -201,6 +201,22 @@ void arm_cpu_realize(ARMCPU *cpu)
/* CPU models */
+static ObjectClass *arm_cpu_class_by_name(const char *cpu_model)
+{
+ ObjectClass *oc;
+
+ if (!cpu_model) {
+ return NULL;
+ }
+
+ oc = object_class_by_name(cpu_model);
+ if (!oc || !object_class_dynamic_cast(oc, TYPE_ARM_CPU) ||
+ object_class_is_abstract(oc)) {
+ return NULL;
+ }
+ return oc;
+}
+
static void arm926_initfn(Object *obj)
{
ARMCPU *cpu = ARM_CPU(obj);
@@ -766,6 +782,8 @@ static void arm_cpu_class_init(ObjectClass *oc, void *data)
acc->parent_reset = cc->reset;
cc->reset = arm_cpu_reset;
+
+ cc->class_by_name = arm_cpu_class_by_name;
}
static void cpu_register(const ARMCPUInfo *info)
diff --git a/target-arm/helper.c b/target-arm/helper.c
index 37c34a11c4..7a10fddf25 100644
--- a/target-arm/helper.c
+++ b/target-arm/helper.c
@@ -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);