Skip to contentSkip to conversation

ARM: enable XScale/iWMMXT in linux-user mode

PATCH In review Peter Maydell 1 participant 2 messages Nov 19, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: enable XScale/iWMMXT in linux-user mode

In linux-user mode, the XScale/iWMMXT coprocessors must be enabled at reset so that we can run code that uses these instructions.

---
 target-arm/helper.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
target-arm/helper.c +6 -0
index 996d40d..94aef39 100644
@@ -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;
Signature · 1 line
1.6.3.3
#1 lore raw
Quoted 4 lines · Peter Maydell

In linux-user mode, the XScale/iWMMXT coprocessors must be enabled at reset so that we can run code that uses these instructions.

This patch fixes the same issue as this patch submitted by Lars Munch back in May: http://patchwork.ozlabs.org/patch/51970/
but I preferred to put the enabling of the XScale coprocessors in the same part of the code as the existing enabling of the VFP for linux-user mode.

-- PMM