mips32: Add support for mips32 DSP instruction set.

Add support for mips32 DSP and DSP revision 2 ASE.
More details about the mips32 DSP(r2) ASE:
http://www.mips.com/media/files/MD00566-2B-MIPSDSP-QRC-01.00.pdf
Applied patch provided by Maja Gagic <maja.gagic@rt-rk.com>



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13470 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/m_libcsetjmp.c b/coregrind/m_libcsetjmp.c
index 2b016a9..9d0d9ba 100644
--- a/coregrind/m_libcsetjmp.c
+++ b/coregrind/m_libcsetjmp.c
@@ -444,6 +444,58 @@
 
 #endif /* VGP_x86_linux || VGP_x86_darwin */
 
+#if defined(VGP_mips32_linux)
+
+__asm__(
+".text                          \n\t"
+".globl VG_MINIMAL_SETJMP;      \n\t"
+".align 2;                      \n\t"
+"VG_MINIMAL_SETJMP:             \n\t"  /* a0 = jmp_buf */
+"   sw   $s0,  0($a0)           \n\t"  /* Save registers s0-s7. */
+"   sw   $s1,  4($a0)           \n\t"
+"   sw   $s2,  8($a0)           \n\t"
+"   sw   $s3, 12($a0)           \n\t"
+"   sw   $s4, 16($a0)           \n\t"
+"   sw   $s5, 20($a0)           \n\t"
+"   sw   $s6, 24($a0)           \n\t"
+"   sw   $s7, 28($a0)           \n\t"
+"   sw   $s8, 32($a0)           \n\t"  /* Frame pointer. */
+"   sw   $ra, 36($a0)           \n\t"  /* Return address. */
+"   sw   $gp, 40($a0)           \n\t"  /* Global data pointer. */
+"   sw   $sp, 44($a0)           \n\t"  /* Stack pointer. */
+
+"   move $v0, $zero             \n\t"  /* Return zero. */
+"   j    $ra                    \n\t"
+"   nop                         \n\t"
+".end VG_MINIMAL_SETJMP;        \n\t"
+"                               \n\t"
+".globl VG_MINIMAL_LONGJMP;     \n\t"
+".align 2;                      \n\t"
+"VG_MINIMAL_LONGJMP:            \n\t"  /* a0 = jmp_buf */
+"   lw   $s0,  0($a0)           \n\t"  /* Restore registers s0-s7. */
+"   lw   $s1,  4($a0)           \n\t"
+"   lw   $s2,  8($a0)           \n\t"
+"   lw   $s3, 12($a0)           \n\t"
+"   lw   $s4, 16($a0)           \n\t"
+"   lw   $s5, 20($a0)           \n\t"
+"   lw   $s6, 24($a0)           \n\t"
+"   lw   $s7, 28($a0)           \n\t"
+"   lw   $s8, 32($a0)           \n\t"  /* Frame pointer. */
+"   lw   $ra, 36($a0)           \n\t"  /* Return address. */
+"   lw   $gp, 40($a0)           \n\t"  /* Global data pointer. */
+"   lw   $sp, 44($a0)           \n\t"  /* Stack pointer. */
+
+/* Checking whether second argument is zero. */
+"   bnez $a1, 1f                \n\t"
+"   nop                         \n\t"
+"   addi $a1, $a1, 1            \n\t"  /* We must return 1 if val=0. */
+"1:                             \n\t"
+"   move $v0, $a1               \n\t"  /* Return value of second argument. */
+"   j    $ra                    \n\t"
+".end VG_MINIMAL_SETJMP;        \n\t"
+);
+#endif  /* VGP_mips32_linux */
+
 /*--------------------------------------------------------------------*/
 /*--- end                                                          ---*/
 /*--------------------------------------------------------------------*/