aboutsummaryrefslogtreecommitdiff
path: root/target-arm/helper.c
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/helper.c
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/helper.c')
-rw-r--r--target-arm/helper.c29
1 files changed, 28 insertions, 1 deletions
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: