ARM: enable XScale/iWMMXT in linux-user mode
authorPeter Maydell <peter.maydell@linaro.org>
Fri, 19 Nov 2010 15:36:47 +0000 (15:36 +0000)
committerRiku Voipio <riku.voipio@nokia.com>
Fri, 3 Dec 2010 13:09:39 +0000 (15:09 +0200)
In linux-user mode, the XScale/iWMMXT coprocessors must be enabled
at reset so that we can run code that uses these instructions.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
target-arm/helper.c

index 996d40d1858cc4478a9f784b4f8b7d005b21a1e9..94aef393e2c881455d8eab2fe9e260370799daa9 100644 (file)
@@ -203,7 +203,13 @@ void cpu_reset(CPUARMState *env)
         cpu_reset_model_id(env, id);
 #if defined (CONFIG_USER_ONLY)
     env->uncached_cpsr = ARM_CPU_MODE_USR;
+    /* For user mode we must enable access to coprocessors */
     env->vfp.xregs[ARM_VFP_FPEXC] = 1 << 30;
+    if (arm_feature(env, ARM_FEATURE_IWMMXT)) {
+        env->cp15.c15_cpar = 3;
+    } else if (arm_feature(env, ARM_FEATURE_XSCALE)) {
+        env->cp15.c15_cpar = 1;
+    }
 #else
     /* SVC mode with interrupts disabled.  */
     env->uncached_cpsr = ARM_CPU_MODE_SVC | CPSR_A | CPSR_F | CPSR_I;