ARM XScale extension
Hi,
the attached file includes preliminary support for the Intel XScale CPU. I have also written code which emulates a Gumstix [1] system in QEMU - based on this processor - and got a Linux kernel up and running.
Could you please apply this patch to CVS?
Comments?
I will send further patches if this is all right so far...
--
Thorsten
target-arm/cpu.h +13 -1
@@ -47,6 +47,8 @@ typedef struct CPUARMState { /* Regs for current mode. */ uint32_t regs[16]; + /* Accumulator for XScale, by now only ACC0 supported */ + uint64_t acc[8]; /* Frequently accessed CPSR bits are stored separately for efficiently. This contains all the other bits. Use cpsr_{read,write} to accless the whole CPSR. */
@@ -69,6 +71,14 @@uint32_t QF ;/* 0 or 1 */ int thumb;/* 0 = arm mode, 1 = thumb mode */ + +/* System control coprocessor (cp14) */ +struct { +uint32_t pmnc;/* Performance Monitor Control Register */ +uint32_t ccnt;/* Clock Counter Register */ +uint32_t pmn0;/* Performance Count Register 0 */ +uint32_t pmn1;/* Performance Count Register 1 */ + } cp14;/* System control coprocessor (cp15) */ struct {
@@ -200,7 +210,8 @@enum arm_features {ARM_FEATURE_VFP , -ARM_FEATURE_AUXCR /* ARM1026 Auxiliary control register. */ +ARM_FEATURE_AUXCR ,/* ARM1026 Auxiliary control register. */ +ARM_FEATURE_XSCALE /* Intel XScale extensions */ };static inline int arm_feature (CPUARMState *env,int feature)
@@ -212,6 +223,7 @@#define ARM_CPUID_ARM1026 0x4106a262#define ARM_CPUID_ARM926 0x41069265 +#define ARM_CPUID_PXA255 0x69052d00#if defined(CONFIG_USER_ONLY )#define TARGET_PAGE_BITS 12
target-arm/exec.h +2 -0
@@ -53,6 +53,8 @@void cpu_lock (void );void cpu_unlock (void ); +void helper_set_cp14 (CPUState *,uint32_t ,uint32_t ); +uint32_t helper_get_cp14 (CPUState *,uint32_t );void helper_set_cp15 (CPUState *,uint32_t ,uint32_t );uint32_t helper_get_cp15 (CPUState *,uint32_t );
target-arm/helper.c +69 -6
94 lines not on this page · raw message
target-arm/op.c +28 -0
@@ -85,6 +85,21 @@#define SET_REG (x) REG = x & ~(uint32_t)1#include "op_template.h" +void OPPROTO op_acc0_T0_T1(void) +{ +uint64_t res; + res = ((uint64_t )T0 <<32 ) |T1 ; + env->acc[0 ] = res; +} + +void OPPROTO op_T0_T1_acc0(void) +{ +uint64_t res; + res = env->acc[0 ]; +T0 = res >>32 ; +T1 = res &0xffffffff ; +} + void OPPROTO op_bx_T0(void) { env->regs[15 ] =T0 & ~(uint32_t )1 ;
@@ -1148,6 +1163,19 @@T1 = (int32_t )T0 >>31 ; } +void OPPROTO op_movl_cp14_T0(void) +{ +helper_set_cp14 (env,PARAM1 ,T0 ); +FORCE_RET (); +} + +void OPPROTO op_movl_T0_cp14(void) +{ +T0 =helper_get_cp14 (env,PARAM1 ); +FORCE_RET (); +} + + void OPPROTO op_movl_cp15_T0(void) {helper_set_cp15 (env,PARAM1 ,T0 );
target-arm/translate.c +65 -0
82 lines not on this page · raw message
Quoted 3 lines · Thorsten Zitterell
the attached file includes preliminary support for the Intel XScale CPU. I have also written code which emulates a Gumstix [1] system in QEMU - based on this processor - and got a Linux kernel up and running.
You don't seem to truncate acc0 to 40 bits? The DSP coprocessor in non-iWMMXt xscale cores does truncate, and some future version of Linux (2.6.20?) might use this as a test to determine whether the CPU we're running on is iWMMXt-capable or not:
http://www.arm.linux.org.uk/developer/patches/viewpatch.php?id=3881/2
So, are you trying to emulate the DSP coprocessor, or the (mutually exclusive, since it uses the same instruction space) iWMMXt coprocessor? :)
cheers,
Lennert
Hi,
Quoted 8 lines · Lennert Buytenhek
Quoted 1 line · Thorsten Zitterell
the attached file includes preliminary support for the Intel XScale CPU.
You don't seem to truncate acc0 to 40 bits? The DSP coprocessor in non-iWMMXt xscale cores does truncate, and some future version of Linux (2.6.20?) might use this as a test to determine whether the CPU we're running on is iWMMXt-capable or not:
I want to emulate the PXA255. Probably the best way to differentiate between both cases is to have a new feature like "ARM_FEATURE_IWMMXT" depending on the cpu id.
-- Thorsten