|
From: <sv...@va...> - 2006-12-27 19:04:47
|
Author: sewardj
Date: 2006-12-27 19:04:45 +0000 (Wed, 27 Dec 2006)
New Revision: 1706
Log:
Merge r1705 (Implement mfspr 268 and 269. Fixes #139050.)
Modified:
branches/VEX_3_2_BRANCH/priv/guest-ppc/gdefs.h
branches/VEX_3_2_BRANCH/priv/guest-ppc/ghelpers.c
branches/VEX_3_2_BRANCH/priv/guest-ppc/toIR.c
Modified: branches/VEX_3_2_BRANCH/priv/guest-ppc/gdefs.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/VEX_3_2_BRANCH/priv/guest-ppc/gdefs.h 2006-12-27 18:39:46 UT=
C (rev 1705)
+++ branches/VEX_3_2_BRANCH/priv/guest-ppc/gdefs.h 2006-12-27 19:04:45 UT=
C (rev 1706)
@@ -147,6 +147,8 @@
=20
extern ULong ppcg_dirtyhelper_MFTB ( void );
=20
+extern UInt ppc32g_dirtyhelper_MFSPR_268_269 ( UInt );
+
extern void ppc32g_dirtyhelper_LVS ( VexGuestPPC32State* gst,
UInt vD_idx, UInt sh,
UInt shift_right );
Modified: branches/VEX_3_2_BRANCH/priv/guest-ppc/ghelpers.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/VEX_3_2_BRANCH/priv/guest-ppc/ghelpers.c 2006-12-27 18:39:46=
UTC (rev 1705)
+++ branches/VEX_3_2_BRANCH/priv/guest-ppc/ghelpers.c 2006-12-27 19:04:45=
UTC (rev 1706)
@@ -100,6 +100,24 @@
=20
=20
/* 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" : "=3Db"(spr));
+ } else {
+ __asm__ __volatile__("mfspr %0,268" : "=3Db"(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,
UInt vD_off, UInt sh, UInt shift_right )
Modified: branches/VEX_3_2_BRANCH/priv/guest-ppc/toIR.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/VEX_3_2_BRANCH/priv/guest-ppc/toIR.c 2006-12-27 18:39:46 UTC=
(rev 1705)
+++ branches/VEX_3_2_BRANCH/priv/guest-ppc/toIR.c 2006-12-27 19:04:45 UTC=
(rev 1706)
@@ -5307,6 +5307,28 @@
/* Signed */False) );
break;
=20
+ /* 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 =3D SPR=3D=3D268 ? 0 : 1;
+ IRTemp val =3D newTemp(Ity_I32);
+ IRExpr** args =3D mkIRExprVec_1( mkU32(arg) );
+ IRDirty* d =3D unsafeIRDirty_1_N(
+ val,
+ 0/*regparms*/,
+ "ppc32g_dirtyhelper_MFSPR_268_269",
+ fnptr_to_fnentry
+ (&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;
|