Hi,

I think I have found a solution for this problem.

It seems that VEX have no implementation for this instruction, so I have
added this instruction now. And it seem to do the job.

I am not 100% sure that I have made the implementation correct, but at
least it works for me, and I can continue to use Valgrind. It has
already reported a bunch of memory leaks!

I can't make 3.4.1 or the latest SVN version work, due to some other
problem. (Writes a lot of strange errors and finally quits due to too
many errors). So I use version 3.3.1, which works fine for me.

The diff below is from VEX revision 1900
(svn://svn.valgrind.org/vex/trunk). 

I hope that someone can review the changes and commit them to the
repository if they are OK.

Kind regards
Mogens

m...@dhcppc6:~/TargetTools/valgrind/valgrind/VEX> svn diff
Index: priv/guest-ppc/ghelpers.c
===================================================================
--- priv/guest-ppc/ghelpers.c   (revision 1900)
+++ priv/guest-ppc/ghelpers.c   (working copy)
@@ -101,14 +101,23 @@

 /* CALLED FROM GENERATED CODE */
 /* DIRTY HELPER (non-referentially transparent) */
-UInt ppc32g_dirtyhelper_MFSPR_268_269 ( UInt r269 )
+UInt ppc32g_dirtyhelper_MFSPR ( UInt reg )
 {
 #  if defined(__powerpc__) || defined(_AIX)
-   UInt spr;
-   if (r269) {
-      __asm__ __volatile__("mfspr %0,269" : "=b"(spr));
-   } else {
-      __asm__ __volatile__("mfspr %0,268" : "=b"(spr));
+   UInt spr = 0;
+   switch(reg)
+   {
+     case 268:
+        __asm__ __volatile__("mfspr %0,268" : "=b"(spr));
+     break;
+     case 269:
+        __asm__ __volatile__("mfspr %0,269" : "=b"(spr));
+     break;
+     case 287:
+        __asm__ __volatile__("mfspr %0,287" : "=b"(spr));
+     break;
+     default:
+     break;
    }
    return spr;
 #  else
Index: priv/guest-ppc/gdefs.h
===================================================================
--- priv/guest-ppc/gdefs.h      (revision 1900)
+++ priv/guest-ppc/gdefs.h      (working copy)
@@ -148,7 +148,7 @@

 extern ULong ppcg_dirtyhelper_MFTB ( void );

-extern UInt ppc32g_dirtyhelper_MFSPR_268_269 ( UInt );
+extern UInt ppc32g_dirtyhelper_MFSPR ( UInt );

 extern void ppc32g_dirtyhelper_LVS ( VexGuestPPC32State* gst,
                                      UInt vD_idx, UInt sh,
Index: priv/guest-ppc/toIR.c
===================================================================
--- priv/guest-ppc/toIR.c       (revision 1900)
+++ priv/guest-ppc/toIR.c       (working copy)
@@ -5447,16 +5447,17 @@
       /* 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;
+      case 269 /* 0x10D */:
+      case 287 /* 0x11F: mfpvr rt / mfspr rt,287 */: {
+         UInt     arg  = SPR;
          IRTemp   val  = newTemp(Ity_I32);
          IRExpr** args = mkIRExprVec_1( mkU32(arg) );
          IRDirty* d    = unsafeIRDirty_1_N(
                             val,
                             0/*regparms*/,
-                            "ppc32g_dirtyhelper_MFSPR_268_269",
+                            "ppc32g_dirtyhelper_MFSPR",
                             fnptr_to_fnentry
-                               (vbi,
&ppc32g_dirtyhelper_MFSPR_268_269),
+                               (vbi, &ppc32g_dirtyhelper_MFSPR),
                             args
                          );
          /* execute the dirty call, dumping the result in val. */
m...@dhcppc6:~/TargetTools/valgrind/valgrind/VEX>



<P><p><font face="Arial, Helvetica, sans-serif" size="2" 
style="font-size:13.5px">_______________________________________________________________<BR>http://www.sol.dk/
 - Debat mail biler job rejser og meget mere</font>
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Valgrind-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to