|
From: <sv...@va...> - 2006-12-27 18:39:47
|
Author: sewardj
Date: 2006-12-27 18:39:46 +0000 (Wed, 27 Dec 2006)
New Revision: 1705
Log:
Implement mfspr 268 and 269. Fixes #139050.
Modified:
trunk/priv/guest-ppc/gdefs.h
trunk/priv/guest-ppc/ghelpers.c
trunk/priv/guest-ppc/toIR.c
Modified: trunk/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
--- trunk/priv/guest-ppc/gdefs.h 2006-12-27 04:52:17 UTC (rev 1704)
+++ trunk/priv/guest-ppc/gdefs.h 2006-12-27 18:39:46 UTC (rev 1705)
@@ -148,6 +148,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: trunk/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
--- trunk/priv/guest-ppc/ghelpers.c 2006-12-27 04:52:17 UTC (rev 1704)
+++ trunk/priv/guest-ppc/ghelpers.c 2006-12-27 18:39:46 UTC (rev 1705)
@@ -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: trunk/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
--- trunk/priv/guest-ppc/toIR.c 2006-12-27 04:52:17 UTC (rev 1704)
+++ trunk/priv/guest-ppc/toIR.c 2006-12-27 18:39:46 UTC (rev 1705)
@@ -5347,6 +5347,28 @@
putIReg( rD_addr, getGST( PPC_GST_SPRG3_RO ) );
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
+ (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;
|