Calculate the size of vki_elf_gregset_t via operator sizeof on MIPS platforms.
authorpetarj <petarj@a5019735-40e9-0310-863c-91ae7b9d1cf9>
Wed, 27 Jun 2012 14:14:26 +0000 (14:14 +0000)
committerpetarj <petarj@a5019735-40e9-0310-863c-91ae7b9d1cf9>
Wed, 27 Jun 2012 14:14:26 +0000 (14:14 +0000)
The value VKI_ELF_NGREG is now defined with the the help of operator sizeof.
Incorrect size triggered an assertion in the file coredump-elf.c.
The issue was reported as coredump problem at:
https://bugs.kde.org/show_bug.cgi?id=270777

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12677 a5019735-40e9-0310-863c-91ae7b9d1cf9

include/vki/vki-mips32-linux.h

index fa042dd82e80fab4a82286fee31986bc53f16b93..255e0d6bfc935ba6b6fe228ae030b389957a7325 100644 (file)
@@ -660,22 +660,6 @@ struct vki_pollfd {
        short revents;
 };
 //----------------------------------------------------------------------
-// From linux-2.6.35.5/include/asm-mips/elf.h
-//----------------------------------------------------------------------
-
-#define VKI_ELF_NGREG                  45      /* includes nip, msr, lr, etc. */
-#define VKI_ELF_NFPREG                 33      /* includes fpscr */
-
-typedef unsigned long vki_elf_greg_t;
-typedef vki_elf_greg_t vki_elf_gregset_t[VKI_ELF_NGREG];
-
-typedef double vki_elf_fpreg_t;
-typedef vki_elf_fpreg_t vki_elf_fpregset_t[VKI_ELF_NFPREG];
-
-typedef struct vki_user_fxsr_struct vki_elf_fpxregset_t;
-
-#define VKI_AT_SYSINFO         32
-//----------------------------------------------------------------------
 // From linux-2.6.35.5/include/asm-mips/ucontext.h
 //----------------------------------------------------------------------
 
@@ -868,6 +852,22 @@ struct vki_pt_regs {
 #define VKI_PTRACE_GETFPREGS          14
 #define VKI_PTRACE_SETFPREGS          15
 //----------------------------------------------------------------------
+// From linux-2.6.35.5/include/asm-mips/elf.h
+//----------------------------------------------------------------------
+typedef unsigned long vki_elf_greg_t;
+
+#define VKI_ELF_NGREG (sizeof (struct vki_user_regs_struct) / sizeof(vki_elf_greg_t))
+#define VKI_ELF_NFPREG                 33      /* includes fpscr */
+
+typedef vki_elf_greg_t vki_elf_gregset_t[VKI_ELF_NGREG];
+
+typedef double vki_elf_fpreg_t;
+typedef vki_elf_fpreg_t vki_elf_fpregset_t[VKI_ELF_NFPREG];
+
+typedef struct vki_user_fxsr_struct vki_elf_fpxregset_t;
+
+#define VKI_AT_SYSINFO         32
+//----------------------------------------------------------------------
 // From linux-2.6.35.5/include/asm-generic/siginfo.h
 //----------------------------------------------------------------------
 #define HAVE_ARCH_SIGINFO_T