Skip to contentSkip to conversation

iwMMXt instruction set for the PXA270.

PATCH In review andrzej zaborowski 3 participants 3 messages Mar 16, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iwMMXt instruction set for the PXA270.

A very primitive implementation of the iwMMXt instruction set. Test iwMMXt program is provided.

The iwMMXt has 16+ of its own registers, Does someone know if there's any standard way for gdb to read their values so they can be printed when you do "info registers"? It may be worth adding proper piece in gdbstub.c then.

Cheers,
Andrew

From 1c152f8e6d987b9e5c57e966407d27107baa6a75 Mon Sep 17 00:00:00 2001
From: Andrzej Zaborowski <[email protected]>
Date: Fri, 16 Mar 2007 16:32:08 +0100
Subject: [PATCH] iwMMXt instruction set for the PXA270.

---
 target-arm/cpu.h        |   19 +
 target-arm/exec.h       |    2 +
 target-arm/helper.c     |    2 +
 target-arm/op.c         |  690 ++++++++++++++++++++++++++++++++
 target-arm/op_mem.h     |   20 +
 target-arm/translate.c  | 1007 ++++++++++++++++++++++++++++++++++++++++++++++-
 tests/Makefile          |    3 +
 tests/test-arm-iwmmxt.s |   49 +++
 8 files changed, 1786 insertions(+), 6 deletions(-)
target-arm/cpu.h +19 -0
index 738bb3a..530acb2 100644
@@ -128,6 +128,14 @@ typedef struct CPUARMState {
         float_status fp_status;
     } vfp;
 
+    /* iwMMXt coprocessor state.  */
+    struct {
+        uint64_t regs[16];
+        uint64_t val;
+
+        uint32_t cregs[16];
+    } iwmmxt;
+
 #if defined(CONFIG_USER_ONLY)
     /* For usermode syscall translation.  */
     int eabi;
@@ -217,10 +225,21 @@ enum arm_cpu_mode {
 #define ARM_VFP_FPINST  9
 #define ARM_VFP_FPINST2 10
 
+/* iwMMXt coprocessor control registers.  */
+#define ARM_IWMMXT_wCID		0
+#define ARM_IWMMXT_wCon		1
+#define ARM_IWMMXT_wCSSF	2
+#define ARM_IWMMXT_wCASF	3
+#define ARM_IWMMXT_wCGR0	8
+#define ARM_IWMMXT_wCGR1	9
+#define ARM_IWMMXT_wCGR2	10
+#define ARM_IWMMXT_wCGR3	11
+
 enum arm_features {
     ARM_FEATURE_VFP,
     ARM_FEATURE_AUXCR,  /* ARM1026 Auxiliary control register.  */
     ARM_FEATURE_XSCALE, /* Intel XScale extensions.  */
+    ARM_FEATURE_IWMMXT  /* Intel iwMMXt extension.  */
 };
 
 static inline int arm_feature(CPUARMState *env, int feature)
target-arm/exec.h +2 -0
index af06f48..95b5154 100644
@@ -38,6 +38,8 @@ register uint32_t T2 asm(AREG3);
 #define FT0d env->vfp.tmp0d
 #define FT1d env->vfp.tmp1d
 
+#define M0   env->iwmmxt.val
+
 #include "cpu.h"
 #include "exec-all.h"
 
target-arm/helper.c +2 -0
index 50795d6..a05cd21 100644
@@ -42,6 +42,8 @@ static void cpu_reset_model_id(CPUARMState *env, uint32_t id)
     case ARM_CPUID_PXA270_C5:
         set_feature(env, ARM_FEATURE_XSCALE);
         /* JTAG_ID is ((id << 28) | 0x09265013) */
+        set_feature(env, ARM_FEATURE_IWMMXT);
+        env->iwmmxt.cregs[ARM_IWMMXT_wCID] = 0x69051000 | 'Q';
         env->cp15.c0_cachetype = 0xd172172;
         break;
     default:
target-arm/op.c +690 -0

699 lines not on this page · raw message

target-arm/op_mem.h +20 -0
index 29fd85b..6bccb06 100644
@@ -67,4 +67,24 @@ VFP_MEM_OP(d,q)
 
 #undef VFP_MEM_OP
 
+/* iwMMXt load/store.  Address is in T1 */
+#define MMX_MEM_OP(name, ldname) \
+void OPPROTO glue(op_iwmmxt_ld##name,MEMSUFFIX)(void) \
+{ \
+    M0 = glue(ld##ldname,MEMSUFFIX)(T1); \
+    FORCE_RET(); \
+} \
+void OPPROTO glue(op_iwmmxt_st##name,MEMSUFFIX)(void) \
+{ \
+    glue(st##name,MEMSUFFIX)(T1, M0); \
+    FORCE_RET(); \
+}
+
+MMX_MEM_OP(b, ub)
+MMX_MEM_OP(w, uw)
+MMX_MEM_OP(l, l)
+MMX_MEM_OP(q, q)
+
+#undef MMX_MEM_OP
+
 #undef MEMSUFFIX
target-arm/translate.c +1001 -6

1,061 lines not on this page · raw message

tests/Makefile +3 -0
index 79a3d55..49f1c3f 100644
@@ -82,6 +82,9 @@ hello-arm: hello-arm.o
 hello-arm.o: hello-arm.c
 	arm-linux-gcc -Wall -g -O2 -c -o $@ $<
 
+test-arm-iwmmxt: test-arm-iwmmxt.s
+	cpp < $< | arm-palmte-linux-gnu-gcc -Wall -static -march=iwmmxt -mabi=aapcs -x assembler - -o $@
+
 # MIPS test
 hello-mips: hello-mips.c
 	mips-linux-gnu-gcc -nostdlib -static -mno-abicalls -fno-PIC -mabi=32 -Wall -Wextra -g -O2 -o $@ $<
tests/test-arm-iwmmxt.s new file +49 -0

49 lines not on this page · raw message

Signature · 1 line
1.4.4.3
#1 lore raw
Quoted 4 lines

The iwMMXt has 16+ of its own registers, Does someone know if there's any standard way for gdb to read their values so they can be printed when you do "info registers"? It may be worth adding proper piece in gdbstub.c then.

Yes, recent gdb has remote protocol bits for this. The same mechanisms can be used to expose system registers.

http://sourceware.org/gdb/current/onlinedocs/gdb_35.html

Paul

#2 lore raw
In reply to andrzej zaborowski
Quoted 3 lines · andrzej zaborowski

The iwMMXt has 16+ of its own registers, Does someone know if there's any standard way for gdb to read their values so they can be printed when you do "info registers"?

You mean something like PTRACE_GETWMMXREGS ?