aboutsummaryrefslogtreecommitdiff
path: root/target-arm
diff options
context:
space:
mode:
authorpbrook <pbrook@c046a42c-6fe2-441c-8c8c-71466251a162>2007-03-08 03:04:12 +0000
committerpbrook <pbrook@c046a42c-6fe2-441c-8c8c-71466251a162>2007-03-08 03:04:12 +0000
commit3371d27293dc40159069d6593da22ba77ac8513c (patch)
tree1ea59000c4beb850f0b1e36aaa66f839d226efcf /target-arm
parent76a66253e5e48f1744f689041c1c21cedcaff630 (diff)
Implement --cpu for ARM.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2474 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'target-arm')
-rw-r--r--target-arm/cpu.h2
-rw-r--r--target-arm/helper.c29
2 files changed, 29 insertions, 2 deletions
diff --git a/target-arm/cpu.h b/target-arm/cpu.h
index 3208c138b5..b3b37ebbe5 100644
--- a/target-arm/cpu.h
+++ b/target-arm/cpu.h
@@ -209,7 +209,7 @@ static inline int arm_feature(CPUARMState *env, int feature)
return (env->features & (1u << feature)) != 0;
}
-void cpu_arm_set_model(CPUARMState *env, uint32_t id);
+void cpu_arm_set_model(CPUARMState *env, const char *name);
#define ARM_CPUID_ARM1026 0x4106a262
#define ARM_CPUID_ARM926 0x41069265
diff --git a/target-arm/helper.c b/target-arm/helper.c
index 5b4cd13933..093acc9af4 100644
--- a/target-arm/helper.c
+++ b/target-arm/helper.c
@@ -36,8 +36,35 @@ static inline void set_feature(CPUARMState *env, int feature)
env->features |= 1u << feature;
}
-void cpu_arm_set_model(CPUARMState *env, uint32_t id)
+struct arm_cpu_t {
+ uint32_t id;
+ const char *name;
+};
+
+static const struct arm_cpu_t arm_cpu_names[] = {
+ { ARM_CPUID_ARM926, "arm926"},
+ { ARM_CPUID_ARM1026, "arm1026"},
+ { 0, NULL}
+};
+
+void cpu_arm_set_model(CPUARMState *env, const char *name)
{
+ int i;
+ uint32_t id;
+
+ id = 0;
+ i = 0;
+ for (i = 0; arm_cpu_names[i].name; i++) {
+ if (strcmp(name, arm_cpu_names[i].name) == 0) {
+ id = arm_cpu_names[i].id;
+ break;
+ }
+ }
+ if (!id) {
+ cpu_abort(env, "Unknown CPU '%s'", name);
+ return;
+ }
+
env->cp15.c0_cpuid = id;
switch (id) {
case ARM_CPUID_ARM926: