|
From: Jeremy F. <je...@go...> - 2005-02-17 01:50:31
|
CVS commit by fitzhardinge:
Convert the "before" wrapper function to use a va_list for getting the
wrapped function's arguments.
M +1 -6 core.h 1.82
M +4 -2 vg_redir.c 1.4
M +3 -0 x86/core_arch.h 1.23
--- valgrind/coregrind/core.h #1.81:1.82
@@ -508,9 +508,4 @@ extern Bool VG_(is_empty_arena) ( Arena
#define VG_USERREQ__LIBC_FREERES_DONE 0x3029
-/*
-In core_asm.h:
-#define VG_USERREQ__SIGNAL_RETURNS 0x4001
-*/
-
#define VG_INTERCEPT_PREFIX "_vgi__"
#define VG_INTERCEPT_PREFIX_LEN 6
@@ -1108,5 +1103,5 @@ enum return_type {
typedef struct _FuncWrapper FuncWrapper;
struct _FuncWrapper {
- void *(*before)(ThreadState *tst);
+ void *(*before)(va_list args);
void (*after) (void *nonce, enum return_type, Word retval);
};
--- valgrind/coregrind/vg_redir.c #1.3:1.4
@@ -500,6 +500,8 @@ void VG_(wrap_before)(ThreadState *tst,
void *nonce = NULL;
- if (wrapper->before)
- nonce = (*wrapper->before)(tst);
+ if (wrapper->before) {
+ va_list args = ARCH_VA_LIST(tst->arch);
+ nonce = (*wrapper->before)(args);
+ }
if (wrapper->after) {
--- valgrind/coregrind/x86/core_arch.h #1.22:1.23
@@ -58,4 +58,7 @@
#define ARCH_RETVAL(regs) ((regs).m_eax)
+/* va_list on x86 is just a pointer to the first arg */
+#define ARCH_VA_LIST(regs) ((va_list)(ARCH_STACK_PTR(regs)+sizeof(Addr)))
+
#define ARCH_CLREQ_ARGS(regs) ((regs).m_eax)
#define ARCH_PTHREQ_RET(regs) ((regs).m_edx)
|