tags:

views:

46

answers:

0

I'm writing a Valgrind tool and in the instrumented code I need to pass the guest's stack pointer to a dirty function. What I'm currently doing to get the stack pointer is this:

IRTemp temp = newIRTemp (sbOut->tyenv, gWordTy);
addStmtToIRSB (sbOut,
               IRStmt_WrTmp (temp,
                             IRExpr_Get (offsetof (VexGuestAMD64State,
                                                   guest_RSP),
                                         gWordTy)));

This will obviously only work on AMD64. Is there a way to do this portably?