]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Changes to make function wrapping work better on ppc64-linux:
authorJulian Seward <jseward@acm.org>
Fri, 20 Jan 2006 14:31:57 +0000 (14:31 +0000)
committerJulian Seward <jseward@acm.org>
Fri, 20 Jan 2006 14:31:57 +0000 (14:31 +0000)
- when recording the non-redirected address in guest_NRADDR, also
  snapshot the current R2 value, as that will be needed to run the
  original safely

- As a consequence, the original-function information extracted by
  VALGRIND_GET_ORIG_FN is different on ppc64-linux (2 words) from
  all other platforms (1 word).  So change the type of it from
  void* to a new type OrigFn which can be defined differently for
  each platform.

- Change the CALL_FN_* macros for ppc64-linux to save/restore
  R2 values appropriately.

- ppc64-linux: detect overflow/underflow of the redirect stack
  and bring Valgrind to a halt if this happens

- Update VG_CLREQ_SZB for ppc32/64 (was out of date).

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5569

coregrind/m_scheduler/scheduler.c
coregrind/m_translate.c
include/pub_tool_machine.h
include/valgrind.h
memcheck/mc_main.c
memcheck/tests/wrap1.c
memcheck/tests/wrap2.c
memcheck/tests/wrap3.c
memcheck/tests/wrap4.c
memcheck/tests/wrap5.c
memcheck/tests/wrap6.c

index cb9adcb415136a1f0881883b11d47a8bfa728013..5ba430fe520ad617310c6e0ae7ca1a1bce3367b3 100644 (file)
@@ -923,7 +923,7 @@ VgSchedReturnCode VG_(scheduler) ( ThreadId tid )
          show = (ew < 0 || ew >= EmWarn_NUMBER)
                    ? True
                    : counts[ew]++ < 3;
-         if (show && VG_(clo_show_emwarns)) {
+         if (show && VG_(clo_show_emwarns) && !VG_(clo_xml)) {
             VG_(message)( Vg_UserMsg,
                           "Emulation warning: unsupported action:");
             VG_(message)( Vg_UserMsg, "  %s", what);
@@ -932,6 +932,24 @@ VgSchedReturnCode VG_(scheduler) ( ThreadId tid )
          break;
       }
 
+      case VEX_TRC_JMP_EMFAIL: {
+         VexEmWarn ew;
+         HChar*    what;
+         ew   = (VexEmWarn)VG_(threads)[tid].arch.vex.guest_EMWARN;
+         what = (ew < 0 || ew >= EmWarn_NUMBER)
+                   ? "unknown (?!)"
+                   : LibVEX_EmWarn_string(ew);
+         VG_(message)( Vg_UserMsg,
+                       "Emulation fatal error -- Valgrind cannot continue:");
+         VG_(message)( Vg_UserMsg, "  %s", what);
+         VG_(get_and_pp_StackTrace)( tid, VG_(clo_backtrace_size) );
+         VG_(message)(Vg_UserMsg, "");
+         VG_(message)(Vg_UserMsg, "Valgrind has to exit now.  Sorry.");
+         VG_(message)(Vg_UserMsg, "");
+         VG_(exit)(1);
+         break;
+      }
+
       case VEX_TRC_JMP_NODECODE:
 #define M(a) VG_(message)(Vg_UserMsg, a);
    M("Your program just tried to execute an instruction that Valgrind" );
index fabee9f8063bca147ef166714c8ad060df19c9ff..bf3a8c6b5fb22836f9a2af6e0bab7f317c7c6bdd 100644 (file)
@@ -569,16 +569,22 @@ static Bool chase_into_ok ( void* closureV, Addr64 addr64 )
 /* --------------- ppc64-linux specific helpers --------------- */
 
 #if defined(VGP_ppc64_linux)
-static IRExpr* mkU64 ( ULong n )
-{
+static IRExpr* mkU64 ( ULong n ) {
    return IRExpr_Const(IRConst_U64(n));
 }
+static IRExpr* mkU32 ( UInt n ) {
+   return IRExpr_Const(IRConst_U32(n));
+}
+static IRExpr* mkU8 ( UChar n ) {
+   return IRExpr_Const(IRConst_U8(n));
+}
 
 static void gen_PUSH ( IRBB* bb, IRExpr* e )
 {
    Int stack_size       = VEX_GUEST_PPC64_REDIR_STACK_SIZE;
    Int offB_REDIR_SP    = offsetof(VexGuestPPC64State,guest_REDIR_SP);
    Int offB_REDIR_STACK = offsetof(VexGuestPPC64State,guest_REDIR_STACK);
+   Int offB_EMWARN      = offsetof(VexGuestPPC64State,guest_EMWARN);
 
    IRArray* descr = mkIRArray( offB_REDIR_STACK, Ity_I64, stack_size );
    IRTemp   t1    = newIRTemp( bb->tyenv, Ity_I64 );
@@ -593,7 +599,31 @@ static void gen_PUSH ( IRBB* bb, IRExpr* e )
       )
    );
 
-   /* bomb out if t1 >= # elements in stack (16) */
+   /* Bomb out if t1 >=s stack_size, that is, (stack_size-1)-t1 <s 0.
+      The destination (0) is a bit bogus but it doesn't matter since
+      this is an unrecoverable error and will lead to Valgrind
+      shutting down.  _EMWARN is set regardless - that's harmless
+      since is only has a meaning if the exit is taken. */
+   addStmtToIRBB(
+      bb,
+      IRStmt_Put(offB_EMWARN, mkU32(EmWarn_PPC64_redir_overflow))
+   );
+   addStmtToIRBB(
+      bb,
+      IRStmt_Exit(
+         IRExpr_Binop(
+            Iop_CmpNE64,
+            IRExpr_Binop(
+               Iop_Sar64,
+               IRExpr_Binop(Iop_Sub64,mkU64(stack_size-1),IRExpr_Tmp(t1)),
+               mkU8(63)
+            ),
+            mkU64(0)
+         ),
+         Ijk_EmFail,
+         IRConst_U64(0)
+      )
+   );
 
    /* guest_REDIR_SP = t1 */
    addStmtToIRBB(bb, IRStmt_Put(offB_REDIR_SP, IRExpr_Tmp(t1)));
@@ -610,6 +640,7 @@ static IRTemp gen_POP ( IRBB* bb )
    Int stack_size       = VEX_GUEST_PPC64_REDIR_STACK_SIZE;
    Int offB_REDIR_SP    = offsetof(VexGuestPPC64State,guest_REDIR_SP);
    Int offB_REDIR_STACK = offsetof(VexGuestPPC64State,guest_REDIR_STACK);
+   Int offB_EMWARN      = offsetof(VexGuestPPC64State,guest_EMWARN);
 
    IRArray* descr = mkIRArray( offB_REDIR_STACK, Ity_I64, stack_size );
    IRTemp   t1    = newIRTemp( bb->tyenv, Ity_I64 );
@@ -622,7 +653,27 @@ static IRTemp gen_POP ( IRBB* bb )
       IRStmt_Tmp( t1, IRExpr_Get( offB_REDIR_SP, Ity_I64 ) )
    );
 
-   /* bomb out if t1 < 0 */
+   /* Bomb out if t1 < 0.  Same comments as gen_PUSH apply. */
+   addStmtToIRBB(
+      bb,
+      IRStmt_Put(offB_EMWARN, mkU32(EmWarn_PPC64_redir_underflow))
+   );
+   addStmtToIRBB(
+      bb,
+      IRStmt_Exit(
+         IRExpr_Binop(
+            Iop_CmpNE64,
+            IRExpr_Binop(
+               Iop_Sar64,
+               IRExpr_Tmp(t1),
+               mkU8(63)
+            ),
+            mkU64(0)
+         ),
+         Ijk_EmFail,
+         IRConst_U64(0)
+      )
+   );
 
    /* res = guest_REDIR_STACK[t1+0] */
    addStmtToIRBB(
@@ -743,6 +794,14 @@ Bool mk_preamble__set_NRADDR_to_nraddr ( void* closureV, IRBB* bb )
       )
    );
 #  if defined(VGP_ppc64_linux)
+   addStmtToIRBB( 
+      bb,
+      IRStmt_Put( 
+         offsetof(VexGuestArchState,guest_NRADDR_GPR2),
+         IRExpr_Get(offsetof(VexGuestArchState,guest_GPR2), 
+                    Ity_I64)
+      )
+   );
    gen_push_and_set_LR_R2 ( bb, VG_(get_tocptr)( closure->readdr ) );
 #  endif
    return False;
index 67c65f00306c481e58abb576e045843ee74c33a8..ff549974517c4fdcb40c4fdf643838e539b9b12c 100644 (file)
 #elif defined(VGA_ppc32)
 #  define VG_MIN_INSTR_SZB          4
 #  define VG_MAX_INSTR_SZB          4 
-#  define VG_CLREQ_SZB             24
+#  define VG_CLREQ_SZB             20
 #  define VG_STACK_REDZONE_SZB      0
 #elif defined(VGA_ppc64)
 #  define VG_MIN_INSTR_SZB          4
 #  define VG_MAX_INSTR_SZB          4 
-#  define VG_CLREQ_SZB             24
+#  define VG_CLREQ_SZB             20
 #  define VG_STACK_REDZONE_SZB    288  // number of addressable bytes below R1
                                        // from 64-bit PowerPC ELF ABI Supplement 1.7
 #else
index 21dee6c21d8c5c6b98449ffced2ef289f393c1eb..2ec274d58854059e8bc7cbdefaf766ef233ebb03 100644 (file)
       _zzq_arg1..4  request params
 
    The other two macros are used to support function wrapping, and are
-   a lot simpler.  VALGRIND_GET_NRADDR returns the value of the
-   guest's NRADDR pseudo-register.  VALGRIND_CALL_NOREDIR_* behaves
-   the same as the following on the guest, but guarantees that the
-   branch instruction will not be redirected: x86: call *%eax, amd64:
-   call *%rax, ppc32/ppc64: bctrl.  VALGRIND_CALL_NOREDIR is just
-   text, not a complete inline asm, since it needs to be combined with
-   more magic inline asm stuff to be useful.
+   a lot simpler.  VALGRIND_GET_NR_CONTEXT returns the value of the
+   guest's NRADDR pseudo-register and whatever other information is
+   needed to safely run the call original from the wrapper: on
+   ppc64-linux, the R2 value at the divert point is also needed.  This
+   information is abstracted into a user-visible type, OrigFn.
+
+   VALGRIND_CALL_NOREDIR_* behaves the same as the following on the
+   guest, but guarantees that the branch instruction will not be
+   redirected: x86: call *%eax, amd64: call *%rax, ppc32/ppc64:
+   branch-and-link-to-r11.  VALGRIND_CALL_NOREDIR is just text, not a
+   complete inline asm, since it needs to be combined with more magic
+   inline asm stuff to be useful.
 */
 
 /* ---------------------------- x86 ---------------------------- */
 /* --------------------------- ppc32 --------------------------- */
 
 #if defined(ARCH_ppc32)
+
+typedef
+   struct { 
+      unsigned long int nraddr; /* where's the code? */
+   }
+   OrigFn;
+
 #define __SPECIAL_INSTRUCTION_PREAMBLE                            \
                      "rlwinm 0,0,3,0,0  ; rlwinm 0,0,13,0,0\n\t"  \
                      "rlwinm 0,0,29,0,0 ; rlwinm 0,0,19,0,0\n\t"
     _zzq_rlval = _zzq_result;                                     \
   }
 
-#define VALGRIND_GET_NRADDR(_zzq_rlval)                           \
-  { register unsigned int __addr __asm__("r3");                   \
+#define VALGRIND_GET_NR_CONTEXT(_zzq_rlval)                       \
+  { volatile OrigFn* _zzq_orig = &(_zzq_rlval);                   \
+    register unsigned int __addr __asm__("r3");                   \
     __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE               \
                      /* %R3 = guest_NRADDR */                     \
                      "or 2,2,2"                                   \
                      :                                            \
                      : "cc", "memory"                             \
                     );                                            \
-    _zzq_rlval = (void*)__addr;                                   \
+    _zzq_orig->nraddr = __addr;                                   \
   }
 
 #define VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                   \
 /* --------------------------- ppc64 --------------------------- */
 
 #if defined(ARCH_ppc64)
+
+typedef
+   struct { 
+      unsigned long long int nraddr; /* where's the code? */
+      unsigned long long int r2;  /* what tocptr do we need? */
+   }
+   OrigFn;
+
 #define __SPECIAL_INSTRUCTION_PREAMBLE                            \
                      "rotldi 0,0,3  ; rotldi 0,0,13\n\t"          \
                      "rotldi 0,0,61 ; rotldi 0,0,51\n\t"
     _zzq_rlval = _zzq_result;                                     \
   }
 
-#define VALGRIND_GET_NRADDR(_zzq_rlval)                           \
-  { register unsigned long long int __addr __asm__("r3");         \
+#define VALGRIND_GET_NR_CONTEXT(_zzq_rlval)                       \
+  { volatile OrigFn* _zzq_orig = &(_zzq_rlval);                   \
+    register unsigned long long int __addr __asm__("r3");         \
     __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE               \
                      /* %R3 = guest_NRADDR */                     \
                      "or 2,2,2"                                   \
                      :                                            \
                      : "cc", "memory"                             \
                     );                                            \
-    _zzq_rlval = (void*)__addr;                                   \
+    _zzq_orig->nraddr = __addr;                                   \
+    __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE               \
+                     /* %R3 = guest_NRADDR_GPR2 */                \
+                     "or 4,4,4"                                   \
+                     : "=r" (__addr)                              \
+                     :                                            \
+                     : "cc", "memory"                             \
+                    );                                            \
+    _zzq_orig->r2 = __addr;                                       \
   }
 
 #define VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                   \
 #define I_WRAP_SONAME_FNNAME_ZZ(soname,fnname)                    \
    _vgwZZ_##soname##_##fnname
 
-/* Use this macro from within a wrapper function to get the address of
-   the original function.  Once you have that you can then use it in
-   one of the CALL_FN_ macros. */
-#define VALGRIND_GET_ORIG_FN(_lval)  VALGRIND_GET_NRADDR(_lval)
+/* Use this macro from within a wrapper function to collect the
+   context (address and possibly other info) of the original function.
+   Once you have that you can then use it in one of the CALL_FN_
+   macros.  The type of the argument _lval is OrigFn. */
+#define VALGRIND_GET_ORIG_FN(_lval)  VALGRIND_GET_NR_CONTEXT(_lval)
 
 /* Derivatives of the main macros below, for calling functions
    returning void. */
 
 #define CALL_FN_W_v(lval, fnptr)                                  \
    do {                                                           \
-      volatile void*         _fnptr = (fnptr);                    \
+      volatile OrigFn        _orig = (orig);                      \
       volatile unsigned long _argvec[1];                          \
       volatile unsigned long _res;                                \
-      _argvec[0] = (unsigned long)_fnptr;                         \
+      _argvec[0] = (unsigned long)_orig.nraddr;                   \
       __asm__ volatile(                                           \
          "mr 11,%1\n\t"                                           \
          "lwz 11,0(11)\n\t"  /* target->r11 */                    \
 /* These CALL_FN_ macros assume that on ppc64-linux, sizeof(unsigned
    long) == 8. */
 
-#define CALL_FN_W_v(lval, fnptr)                                  \
+#define CALL_FN_W_v(lval, orig)                                   \
    do {                                                           \
-      volatile void*         _fnptr = (fnptr);                    \
-      volatile unsigned long _argvec[1+1];                        \
+      volatile OrigFn        _orig = (orig);                      \
+      volatile unsigned long _argvec[3+0];                        \
       volatile unsigned long _res;                                \
-      _argvec[1+0] = (unsigned long)_fnptr;                       \
+      /* _argvec[0] holds current r2 across the call */           \
+      _argvec[1] = (unsigned long)_orig.r2;                       \
+      _argvec[2] = (unsigned long)_orig.nraddr;                   \
       __asm__ volatile(                                           \
          "mr 11,%1\n\t"                                           \
-         "std 2,-8(11)\n\t" /* save tocptr */                     \
-         "ld 11,0(11)\n\t"  /* target->r11 */                     \
+         "std 2,-16(11)\n\t"  /* save tocptr */                   \
+         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
+         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
          VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
          "mr 11,%1\n\t"                                           \
          "mr %0,3\n\t"                                            \
-         "ld 2,-8(11)" /* restore tocptr */                       \
+         "ld 2,-16(11)" /* restore tocptr */                      \
          : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[1+0])                          \
+         : /*in*/    "r" (&_argvec[2])                            \
          : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
       );                                                          \
       lval = (__typeof__(lval)) _res;                             \
    } while (0)
 
-#define CALL_FN_W_W(lval, fnptr, arg1)                            \
+#define CALL_FN_W_W(lval, orig, arg1)                             \
    do {                                                           \
-      volatile void*         _fnptr = (fnptr);                    \
-      volatile unsigned long _argvec[1+2];                        \
+      volatile OrigFn        _orig = (orig);                      \
+      volatile unsigned long _argvec[3+1];                        \
       volatile unsigned long _res;                                \
-      _argvec[1+0] = (unsigned long)_fnptr;                       \
-      _argvec[1+1] = (unsigned long)arg1;                         \
+      /* _argvec[0] holds current r2 across the call */           \
+      _argvec[1]   = (unsigned long)_orig.r2;                     \
+      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
+      _argvec[2+1] = (unsigned long)arg1;                         \
       __asm__ volatile(                                           \
          "mr 11,%1\n\t"                                           \
-         "std 2,-8(11)\n\t" /* save tocptr */                     \
-         "ld 3,8(11)\n\t"   /* arg1->r3 */                        \
-         "ld 11,0(11)\n\t"  /* target->r11 */                     \
+         "std 2,-16(11)\n\t"  /* save tocptr */                   \
+         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
+         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
+         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
          VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
          "mr 11,%1\n\t"                                           \
          "mr %0,3\n\t"                                            \
-         "ld 2,-8(11)" /* restore tocptr */                       \
+         "ld 2,-16(11)" /* restore tocptr */                      \
          : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[1+0])                          \
+         : /*in*/    "r" (&_argvec[2])                            \
          : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
       );                                                          \
       lval = (__typeof__(lval)) _res;                             \
    } while (0)
 
-#define CALL_FN_W_WW(lval, fnptr, arg1,arg2)                      \
+#define CALL_FN_W_WW(lval, orig, arg1,arg2)                       \
    do {                                                           \
-      volatile void*         _fnptr = (fnptr);                    \
-      volatile unsigned long _argvec[1+3];                        \
+      volatile OrigFn        _orig = (orig);                      \
+      volatile unsigned long _argvec[3+2];                        \
       volatile unsigned long _res;                                \
-      _argvec[1+0] = (unsigned long)_fnptr;                       \
-      _argvec[1+1] = (unsigned long)arg1;                         \
-      _argvec[1+2] = (unsigned long)arg1;                         \
+      /* _argvec[0] holds current r2 across the call */           \
+      _argvec[1]   = (unsigned long)_orig.r2;                     \
+      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
+      _argvec[2+1] = (unsigned long)arg1;                         \
+      _argvec[2+2] = (unsigned long)arg2;                         \
       __asm__ volatile(                                           \
          "mr 11,%1\n\t"                                           \
-         "std 2,-8(11)\n\t" /* save tocptr */                     \
-         "ld 3, 8(11)\n\t"   /* arg1->r3 */                       \
-         "ld 4,16(11)\n\t"                                        \
-         "ld 11,0(11)\n\t"  /* target->r11 */                     \
+         "std 2,-16(11)\n\t"  /* save tocptr */                   \
+         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
+         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
+         "ld   4, 16(11)\n\t" /* arg1->r4 */                      \
+         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
          VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
          "mr 11,%1\n\t"                                           \
          "mr %0,3\n\t"                                            \
-         "ld 2,-8(11)" /* restore tocptr */                       \
+         "ld 2,-16(11)" /* restore tocptr */                      \
          : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[1+0])                          \
+         : /*in*/    "r" (&_argvec[2])                            \
          : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
       );                                                          \
       lval = (__typeof__(lval)) _res;                             \
index c6df65ce3608c0607f117386e3ddfc2946f9a92e..99084955c28f7778c70ffe3a55906acb5b2c5bc5 100644 (file)
@@ -1370,7 +1370,7 @@ void mc_post_mem_write(CorePart part, ThreadId tid, Addr a, SizeT len)
 static void mc_post_reg_write ( CorePart part, ThreadId tid, 
                                 OffT offset, SizeT size)
 {
-#  define MAX_REG_WRITE_SIZE 1264
+#  define MAX_REG_WRITE_SIZE 1392
    UChar area[MAX_REG_WRITE_SIZE];
    tl_assert(size <= MAX_REG_WRITE_SIZE);
    VG_(memset)(area, VGM_BYTE_VALID, size);
index b4b977f7a7882296c4fb865ae76c62c46b09cafe..1401cee7ad1c56646178f3776b0e80c6a73c8220 100644 (file)
@@ -17,7 +17,7 @@ void actual ( void )
    as if its soname was "NONE". */
 void I_WRAP_SONAME_FNNAME_ZU(NONE,actual) ( void )
 {
-   void* orig;
+   OrigFn orig;
    VALGRIND_GET_ORIG_FN(orig);
    printf("wrapper-pre\n");
    CALL_FN_v_v(orig);
index d45cb780e0539ef4f150687888b5d62facbbb913..d5e79db04659801c707bc621a0e4ad0b7306e981 100644 (file)
@@ -15,8 +15,8 @@ int fact ( int n )
 
 int I_WRAP_SONAME_FNNAME_ZU(NONE,fact) ( int n )
 {
-   int r;
-   void* orig;
+   int    r;
+   OrigFn orig;
    VALGRIND_GET_ORIG_FN(orig);
    printf("in wrapper1-pre:  fact(%d)\n", n);
    CALL_FN_W_W(r, orig, n);
index d8ab313719b72072165eb5e2faa4075eeae9a28b..1510d1311ff1650d46c4efceea4d246c16147c71 100644 (file)
@@ -24,8 +24,8 @@ int fact2 ( int n )
 
 int I_WRAP_SONAME_FNNAME_ZU(NONE,fact1) ( int n )
 {
-   int   r;
-   void* fn;
+   int    r;
+   OrigFn fn;
    VALGRIND_GET_ORIG_FN(fn);
    printf("in wrapper1-pre:  fact(%d)\n", n);
    CALL_FN_W_W(r,fn,n);
@@ -35,8 +35,8 @@ int I_WRAP_SONAME_FNNAME_ZU(NONE,fact1) ( int n )
 
 int I_WRAP_SONAME_FNNAME_ZU(NONE,fact2) ( int n )
 {
-   int   r;
-   void* fn;
+   int    r;
+   OrigFn fn;
    VALGRIND_GET_ORIG_FN(fn);
    printf("in wrapper2-pre:  fact(%d)\n", n);
    CALL_FN_W_W(r,fn,n);
index e704c4630ed986f5f6ddf94ad406364ba634ae5d..bdc6a3b9c981460a4672117543a93aa04a186632 100644 (file)
@@ -28,8 +28,8 @@ int fact2 ( int n )
 
 int I_WRAP_SONAME_FNNAME_ZU(NONE,fact1) ( int n )
 {
-   int r;
-   void* fn;
+   int    r;
+   OrigFn fn;
    VALGRIND_GET_ORIG_FN(fn);
    printf("in wrapper1-pre:  fact(%d)\n", n);
    CALL_FN_W_W(r, fn, n);
@@ -40,8 +40,8 @@ int I_WRAP_SONAME_FNNAME_ZU(NONE,fact1) ( int n )
 
 int I_WRAP_SONAME_FNNAME_ZU(NONE,fact2) ( int n )
 {
-   int r;
-   void* fn;
+   int    r;
+   OrigFn fn;
    VALGRIND_GET_ORIG_FN(fn);
    printf("in wrapper2-pre:  fact(%d)\n", n);
    CALL_FN_W_W(r, fn, n);
index ca1be3c70215afde34a8d22c7325621260a7d690..7f35e4726d288d133ef2353f1566ed163e387744 100644 (file)
@@ -50,8 +50,8 @@ int fact2 ( int n )
 
 int I_WRAP_SONAME_FNNAME_ZU(NONE,fact1) ( int n )
 {
-   int   r;
-   void* fn;
+   int    r;
+   OrigFn fn;
    VALGRIND_GET_ORIG_FN(fn);
    printf("in wrapper1-pre:  fact(%d)\n", n);
    addMoreLard();
@@ -64,8 +64,8 @@ int I_WRAP_SONAME_FNNAME_ZU(NONE,fact1) ( int n )
 
 int I_WRAP_SONAME_FNNAME_ZU(NONE,fact2) ( int n )
 {
-   int   r;
-   void* fn;
+   int    r;
+   OrigFn fn;
    VALGRIND_GET_ORIG_FN(fn);
    printf("in wrapper2-pre:  fact(%d)\n", n);
    addMoreLard();
index 82ce2ab079b354a48a043a01f938e28eebe4782d..85994fff5b4e3bfdfae2021d4b4ff45719173400 100644 (file)
@@ -70,8 +70,8 @@ UInt fn_0 ( void )
 
 UInt I_WRAP_SONAME_FNNAME_ZU(NONE,fn_0) ( UInt a1 )
 {
-   UInt r;
-   void* fn;
+   UInt   r;
+   OrigFn fn;
    VALGRIND_GET_ORIG_FN(fn);
    printf("fn_0  wrapper pre ()\n");
    CALL_FN_W_v(r, fn);
@@ -85,7 +85,7 @@ UInt I_WRAP_SONAME_FNNAME_ZU(NONE,fn_0) ( UInt a1 )
 
 UInt fn_1 ( UInt a1 )
 {
-   UInt r;
+   UInt  r;
    UInt* words = calloc(200, sizeof(UInt));
    words[1-1] = a1;
    TRASH_IREGS(r, words);
@@ -95,8 +95,8 @@ UInt fn_1 ( UInt a1 )
 
 UInt I_WRAP_SONAME_FNNAME_ZU(NONE,fn_1) ( UInt a1 )
 {
-   UInt r;
-   void* fn;
+   UInt   r;
+   OrigFn fn;
    VALGRIND_GET_ORIG_FN(fn);
    printf("fn_1  wrapper pre ( %d )\n", (int)a1);
    CALL_FN_W_W(r, fn, a1);
@@ -121,8 +121,8 @@ UInt fn_2 ( UInt a1, UInt a2 )
 
 UInt I_WRAP_SONAME_FNNAME_ZU(NONE,fn_2) ( UInt a1, UInt a2 )
 {
-   UInt r;
-   void* fn;
+   UInt   r;
+   OrigFn fn;
    VALGRIND_GET_ORIG_FN(fn);
    printf("fn_2  wrapper pre ( %d, %d )\n", (int)a1, (int)a2);
    CALL_FN_W_WW(r, fn, a1, a2);