]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
mips: add definitions of expected ISA levels
authorPetar Jovanovic <mips32r2@gmail.com>
Thu, 26 Nov 2015 18:17:33 +0000 (18:17 +0000)
committerPetar Jovanovic <mips32r2@gmail.com>
Thu, 26 Nov 2015 18:17:33 +0000 (18:17 +0000)
Add values of supported isa level for MIPS CPU models. This extended
information will be packed in 31:24 bits in hwcaps.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3205

VEX/priv/guest_mips_toIR.c
VEX/priv/host_mips_isel.c
VEX/priv/main_main.c
VEX/pub/libvex.h

index b72d314c97cfcefdae3f1145eb1074c0af7c5154..e16e2754e220b6f95de21152c3a312513c01e1df 100644 (file)
@@ -17290,7 +17290,7 @@ DisResult disInstr_MIPS( IRSB*        irsb_IN,
 
    mode64 = guest_arch != VexArchMIPS32;
 #if (__mips_fpr==64)
-   fp_mode64 = ((VEX_MIPS_REV(archinfo->hwcaps) == VEX_PRID_CPU_32FPR)
+   fp_mode64 = (VEX_MIPS_HAS_32_64BIT_FPRS(archinfo->hwcaps)
                 || guest_arch == VexArchMIPS64);
 #endif
 
index 0cde325560a501a8cfdf3ab01856642b1487f873..1cccaa87a44190755ec7f9bda97839ff6541bf9e 100644 (file)
@@ -4184,7 +4184,7 @@ HInstrArray *iselSB_MIPS ( const IRSB* bb,
 
    mode64 = arch_host != VexArchMIPS32;
 #if (__mips_fpr==64)
-   fp_mode64 = ((VEX_MIPS_REV(hwcaps_host) == VEX_PRID_CPU_32FPR)
+   fp_mode64 = (VEX_MIPS_HAS_32_64BIT_FPRS(hwcaps_host)
                 || arch_host == VexArchMIPS64);
 #endif
 
index 119d70120fc91c31b40d9e0b706c73a33a2066c0..88f21a29467eb5ca89f27e64af7b9d424f4d30c3 100644 (file)
@@ -1738,7 +1738,12 @@ static const HChar* show_hwcaps_mips64 ( UInt hwcaps )
       return "Loongson-baseline";
    }
 
-   return "mips64-baseline";
+   /* MIPS64 baseline. */
+   if (VEX_MIPS_COMP_ID(hwcaps) == VEX_PRID_COMP_MIPS) {
+      return "mips64-baseline";
+   }
+
+   return "Unsupported baseline";
 }
 
 static const HChar* show_hwcaps_tilegx ( UInt hwcaps )
index 0388acc72e76332281aa9da753f91890443d33be..b2bd476bdcca422c5f6b3e28357da1d16bce501c 100644 (file)
@@ -222,15 +222,32 @@ typedef
 #define VEX_PRID_IMP_34K                0x9500
 #define VEX_PRID_IMP_74K                0x9700
 
+/*
+ * Instead of Company Options values, bits 31:24 will be packed with
+ * additional information, such as isa level and presence of FPU unit
+ * with 32 64-bit registers.
+ */
+#define VEX_MIPS_CPU_ISA_M32R1      0x01000000
+#define VEX_MIPS_CPU_ISA_M32R2      0x02000000
+#define VEX_MIPS_CPU_ISA_M64R1      0x04000000
+#define VEX_MIPS_CPU_ISA_M64R2      0x08000000
+#define VEX_MIPS_CPU_ISA_M32R6      0x10000000
+#define VEX_MIPS_CPU_ISA_M64R6      0x20000000
 /* CPU has FPU and 32 dbl. prec. FP registers */
-#define VEX_PRID_CPU_32FPR      0x00000040
-
+#define VEX_MIPS_CPU_32FPR          0x40000000
+/* Get MIPS Extended Information */
+#define VEX_MIPS_EX_INFO(x) ((x) & 0xFF000000)
 /* Get MIPS Company ID from HWCAPS */
 #define VEX_MIPS_COMP_ID(x) ((x) & 0x00FF0000)
 /* Get MIPS Processor ID from HWCAPS */
 #define VEX_MIPS_PROC_ID(x) ((x) & 0x0000FF00)
 /* Get MIPS Revision from HWCAPS */
 #define VEX_MIPS_REV(x) ((x) & 0x000000FF)
+/* Check if the processor has 32 64-bit FP registers */
+#define VEX_MIPS_HAS_32_64BIT_FPRS(x) (VEX_MIPS_EX_INFO(x) | VEX_MIPS_CPU_32FPR)
+/* Check if the processor supports MIPS32R2. */
+#define VEX_MIPS_CPU_HAS_MIPS32R2(x) (VEX_MIPS_EX_INFO(x) | \
+                                      VEX_MIPS_CPU_ISA_M32R2)
 /* Check if the processor supports DSP ASE Rev 2. */
 #define VEX_MIPS_PROC_DSP2(x) ((VEX_MIPS_COMP_ID(x) == VEX_PRID_COMP_MIPS) && \
                                (VEX_MIPS_PROC_ID(x) == VEX_PRID_IMP_74K))