|
From: <sv...@va...> - 2009-08-02 14:35:59
|
Author: sewardj
Date: 2009-08-02 15:35:45 +0100 (Sun, 02 Aug 2009)
New Revision: 1913
Log:
Implement mfpvr (mfspr 287) (bug #201585).
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.
Modified:
trunk/priv/guest_ppc_defs.h
trunk/priv/guest_ppc_helpers.c
trunk/priv/guest_ppc_toIR.c
Modified: trunk/priv/guest_ppc_defs.h
===================================================================
--- trunk/priv/guest_ppc_defs.h 2009-07-22 11:06:17 UTC (rev 1912)
+++ trunk/priv/guest_ppc_defs.h 2009-08-02 14:35:45 UTC (rev 1913)
@@ -150,6 +150,8 @@
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 );
Modified: trunk/priv/guest_ppc_helpers.c
===================================================================
--- trunk/priv/guest_ppc_helpers.c 2009-07-22 11:06:17 UTC (rev 1912)
+++ trunk/priv/guest_ppc_helpers.c 2009-08-02 14:35:45 UTC (rev 1913)
@@ -118,6 +118,20 @@
/* 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,
UInt vD_off, UInt sh, UInt shift_right )
Modified: trunk/priv/guest_ppc_toIR.c
===================================================================
--- trunk/priv/guest_ppc_toIR.c 2009-07-22 11:06:17 UTC (rev 1912)
+++ trunk/priv/guest_ppc_toIR.c 2009-08-02 14:35:45 UTC (rev 1913)
@@ -5471,11 +5471,33 @@
);
/* 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;
+ }
+
default:
vex_printf("dis_proc_ctl(ppc)(mfspr,SPR)(0x%x)\n", SPR);
return False;
|