]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Implement mfpvr (mfspr 287) (bug #201585).
authorJulian Seward <jseward@acm.org>
Sun, 2 Aug 2009 14:35:45 +0000 (14:35 +0000)
committerJulian Seward <jseward@acm.org>
Sun, 2 Aug 2009 14:35:45 +0000 (14:35 +0000)
Also, fix a type mismatch in the generated IR for mfspr 268/269 which
would have caused an IR checker assertion failure when handling those
insns on ppc64.

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

VEX/priv/guest_ppc_defs.h
VEX/priv/guest_ppc_helpers.c
VEX/priv/guest_ppc_toIR.c

index 25fdaed41c7d98c4dcb47d0a6857b8096c09fecd..73b7f6acde4b7e05f0730be30ed43d0c3a7df8c8 100644 (file)
@@ -150,6 +150,8 @@ extern ULong ppcg_dirtyhelper_MFTB ( void );
 
 extern UInt ppc32g_dirtyhelper_MFSPR_268_269 ( UInt );
 
+extern UInt ppc32g_dirtyhelper_MFSPR_287 ( void );
+
 extern void ppc32g_dirtyhelper_LVS ( VexGuestPPC32State* gst,
                                      UInt vD_idx, UInt sh,
                                      UInt shift_right );
index 8c3cc40068b7b0c86746acb58aa23c61b6c02d41..b9d1052fc139286f54326cb2df599bb3ce382e77 100644 (file)
@@ -117,6 +117,20 @@ UInt ppc32g_dirtyhelper_MFSPR_268_269 ( UInt r269 )
 }
 
 
+/* CALLED FROM GENERATED CODE */
+/* DIRTY HELPER (I'm not really sure what the side effects are) */
+UInt ppc32g_dirtyhelper_MFSPR_287 ( void )
+{
+#  if defined(__powerpc__) || defined(_AIX)
+   UInt spr;
+   __asm__ __volatile__("mfspr %0,287" : "=b"(spr));
+   return spr;
+#  else
+   return 0;
+#  endif
+}
+
+
 /* CALLED FROM GENERATED CODE */
 /* DIRTY HELPER (reads guest state, writes guest mem) */
 void ppc32g_dirtyhelper_LVS ( VexGuestPPC32State* gst,
index 25e06bf47661ac75b781c7db18b2ac204011e0a5..92cc7d0ddec53d142b5531dabf365687654dbb41 100644 (file)
@@ -5471,7 +5471,29 @@ static Bool dis_proc_ctl ( VexAbiInfo* vbi, UInt theInstr )
                          );
          /* execute the dirty call, dumping the result in val. */
          stmt( IRStmt_Dirty(d) );
-         putIReg( rD_addr, mkexpr(val) );
+         putIReg( rD_addr,
+                  mkWidenFrom32(ty, mkexpr(val), False/*unsigned*/) );
+         DIP("mfspr r%u,%u", rD_addr, (UInt)SPR);
+         break;
+      }
+
+      /* Again, runs natively on PPC7400 (7447, really).  Not
+         bothering with a feature test. */
+      case 287: /* 0x11F */ {
+         IRTemp   val  = newTemp(Ity_I32);
+         IRExpr** args = mkIRExprVec_0();
+         IRDirty* d    = unsafeIRDirty_1_N(
+                            val,
+                            0/*regparms*/,
+                            "ppc32g_dirtyhelper_MFSPR_287",
+                            fnptr_to_fnentry
+                               (vbi, &ppc32g_dirtyhelper_MFSPR_287),
+                            args
+                         );
+         /* execute the dirty call, dumping the result in val. */
+         stmt( IRStmt_Dirty(d) );
+         putIReg( rD_addr,
+                  mkWidenFrom32(ty, mkexpr(val), False/*unsigned*/) );
          DIP("mfspr r%u,%u", rD_addr, (UInt)SPR);
          break;
       }