Definitions relating to ptrace: replace bogus x86 versions with
arm specific versions.  Partial fix for #269079.
(Ulrich Weigand, uweigand@de.ibm.com)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11663 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/include/vki/vki-arm-linux.h b/include/vki/vki-arm-linux.h
index 678e268..21ed427 100644
--- a/include/vki/vki-arm-linux.h
+++ b/include/vki/vki-arm-linux.h
@@ -34,6 +34,10 @@
 // arm is little-endian.
 #define VKI_LITTLE_ENDIAN  1
 
+// The various comments below indicating i386-ness should be regarded
+// with great skepticism -- they are quite possibly wrong.  But see
+// also bug 269079 comment 0.
+
 //----------------------------------------------------------------------
 // From linux-2.6.8.1/include/asm-i386/types.h
 //----------------------------------------------------------------------
@@ -190,43 +194,6 @@
 // From linux-2.6.8.1/include/asm-i386/sigcontext.h
 //----------------------------------------------------------------------
 
-struct _vki_fpreg {
-	unsigned short significand[4];
-	unsigned short exponent;
-};
-
-struct _vki_fpxreg {
-	unsigned short significand[4];
-	unsigned short exponent;
-	unsigned short padding[3];
-};
-
-struct _vki_xmmreg {
-	unsigned long element[4];
-};
-
-struct _vki_fpstate {
-	/* Regular FPU environment */
-	unsigned long 	cw;
-	unsigned long	sw;
-	unsigned long	tag;
-	unsigned long	ipoff;
-	unsigned long	cssel;
-	unsigned long	dataoff;
-	unsigned long	datasel;
-	struct _vki_fpreg	_st[8];
-	unsigned short	status;
-	unsigned short	magic;		/* 0xffff = regular FPU data only */
-
-	/* FXSR FPU environment */
-	unsigned long	_fxsr_env[6];	/* FXSR FPU env is ignored */
-	unsigned long	mxcsr;
-	unsigned long	reserved;
-	struct _vki_fpxreg	_fxsr_st[8];	/* FXSR FPU reg data is ignored */
-	struct _vki_xmmreg	_xmm[8];
-	unsigned long	padding[56];
-};
-
 struct vki_sigcontext {
 		unsigned long trap_no;
 		unsigned long error_code;
@@ -546,33 +513,41 @@
 // From linux-2.6.8.1/include/asm-i386/user.h
 //----------------------------------------------------------------------
 
-struct vki_user_i387_struct {
-	long	cwd;
-	long	swd;
-	long	twd;
-	long	fip;
-	long	fcs;
-	long	foo;
-	long	fos;
-	long	st_space[20];	/* 8*10 bytes for each FP-reg = 80 bytes */
+struct vki_user_fp {
+	struct vki_fp_reg {
+		unsigned int sign1:1;
+		unsigned int unused:15;
+		unsigned int sign2:1;
+		unsigned int exponent:14;
+		unsigned int j:1;
+		unsigned int mantissa1:31;
+		unsigned int mantissa0:32;
+	} fpregs[8];
+	unsigned int fpsr:32;
+	unsigned int fpcr:32;
+	unsigned char ftype[8];
+	unsigned int init_flag;
 };
 
-struct vki_user_fxsr_struct {
-	unsigned short	cwd;
-	unsigned short	swd;
-	unsigned short	twd;
-	unsigned short	fop;
-	long	fip;
-	long	fcs;
-	long	foo;
-	long	fos;
-	long	mxcsr;
-	long	reserved;
-	long	st_space[32];	/* 8*16 bytes for each FP-reg = 128 bytes */
-	long	xmm_space[32];	/* 8*16 bytes for each XMM-reg = 128 bytes */
-	long	padding[56];
+struct vki_user_vfp {
+	unsigned long long fpregs[32];
+	unsigned long fpscr;
 };
 
+#define VKI_IWMMXT_SIZE 0x98
+
+struct vki_iwmmxt_struct {
+	unsigned int save[VKI_IWMMXT_SIZE / sizeof(unsigned int)];
+};
+
+struct vki_crunch_state {
+	unsigned int    mvdx[16][2];
+	unsigned int    mvax[4][3];
+	unsigned int    dspsc[2];
+};
+
+#define VKI_CRUNCH_SIZE sizeof(struct vki_crunch_state)
+
 struct vki_user_regs_struct {
     long uregs[18];
 };
@@ -603,8 +578,7 @@
 #define VKI_ELF_NGREG (sizeof (struct vki_user_regs_struct) / sizeof(vki_elf_greg_t))
 typedef vki_elf_greg_t vki_elf_gregset_t[VKI_ELF_NGREG];
 
-typedef struct vki_user_i387_struct vki_elf_fpregset_t;
-typedef struct vki_user_fxsr_struct vki_elf_fpxregset_t;
+typedef struct vki_user_fp vki_elf_fpregset_t;
 
 #define VKI_AT_SYSINFO		32
 
@@ -799,8 +773,16 @@
 #define VKI_PTRACE_SETREGS            13
 #define VKI_PTRACE_GETFPREGS          14
 #define VKI_PTRACE_SETFPREGS          15
-#define VKI_PTRACE_GETFPXREGS         18
-#define VKI_PTRACE_SETFPXREGS         19
+#define VKI_PTRACE_GETWMMXREGS        18
+#define VKI_PTRACE_SETWMMXREGS        19
+#define VKI_PTRACE_GET_THREAD_AREA    22
+#define VKI_PTRACE_SET_SYSCALL        23
+#define VKI_PTRACE_GETCRUNCHREGS      25
+#define VKI_PTRACE_SETCRUNCHREGS      26
+#define VKI_PTRACE_GETVFPREGS         27
+#define VKI_PTRACE_SETVFPREGS         28
+#define VKI_PTRACE_GETHBPREGS         29
+#define VKI_PTRACE_SETHBPREGS         30
 
 //----------------------------------------------------------------------
 // From linux-2.6.15.4/include/asm-i386/vm86.h