]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Implement mfspr 268 and 269. Fixes #139050.
authorJulian Seward <jseward@acm.org>
Wed, 27 Dec 2006 18:39:46 +0000 (18:39 +0000)
committerJulian Seward <jseward@acm.org>
Wed, 27 Dec 2006 18:39:46 +0000 (18:39 +0000)
git-svn-id: svn://svn.valgrind.org/vex/trunk@1705

VEX/priv/guest-ppc/gdefs.h
VEX/priv/guest-ppc/ghelpers.c
VEX/priv/guest-ppc/toIR.c

index 1fc1681a25b5a825472f9783bbd5bf699e8d6c60..68b478d2738e80abdd33c2939b3a4c70cb7fcc31 100644 (file)
@@ -148,6 +148,8 @@ enum {
 
 extern ULong ppcg_dirtyhelper_MFTB ( void );
 
+extern UInt ppc32g_dirtyhelper_MFSPR_268_269 ( UInt );
+
 extern void ppc32g_dirtyhelper_LVS ( VexGuestPPC32State* gst,
                                      UInt vD_idx, UInt sh,
                                      UInt shift_right );
index 8eb35b244b9a52599ec5b3e094b349030fbdf2e6..ff1a5994a46d2cc81368ba5bb355eb3fc09b2db2 100644 (file)
@@ -99,6 +99,24 @@ ULong ppcg_dirtyhelper_MFTB ( void )
 }
 
 
+/* CALLED FROM GENERATED CODE */
+/* DIRTY HELPER (non-referentially transparent) */
+UInt ppc32g_dirtyhelper_MFSPR_268_269 ( UInt r269 )
+{
+#  if defined(__powerpc__) || defined(_AIX)
+   UInt spr;
+   if (r269) {
+      __asm__ __volatile__("mfspr %0,269" : "=b"(spr));
+   } else {
+      __asm__ __volatile__("mfspr %0,268" : "=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 eb1eba5de15fc598ebf18049b3c210f3642614d8..f01426461840c06a44a3a5915b13b745be553c56 100644 (file)
@@ -5347,6 +5347,28 @@ static Bool dis_proc_ctl ( VexAbiInfo* vbi, UInt theInstr )
          putIReg( rD_addr, getGST( PPC_GST_SPRG3_RO ) );
          break;
 
+      /* Even a lowly PPC7400 can run the associated helper, so no
+         obvious need for feature testing at this point. */
+      case 268 /* 0x10C */:
+      case 269 /* 0x10D */: {
+         UInt     arg  = SPR==268 ? 0 : 1;
+         IRTemp   val  = newTemp(Ity_I32);
+         IRExpr** args = mkIRExprVec_1( mkU32(arg) );
+         IRDirty* d    = unsafeIRDirty_1_N(
+                            val,
+                            0/*regparms*/,
+                            "ppc32g_dirtyhelper_MFSPR_268_269",
+                            fnptr_to_fnentry
+                               (vbi, &ppc32g_dirtyhelper_MFSPR_268_269),
+                            args
+                         );
+         /* execute the dirty call, dumping the result in val. */
+         stmt( IRStmt_Dirty(d) );
+         putIReg( rD_addr, mkexpr(val) );
+         DIP("mfspr r%u,%u", rD_addr, (UInt)SPR);
+         break;
+      }
+
       default:
          vex_printf("dis_proc_ctl(ppc)(mfspr,SPR)(0x%x)\n", SPR);
          return False;