From 10bb7876f914a4b1ffcd360a91afc61967c2ce35 Mon Sep 17 00:00:00 2001 From: Julian Seward Date: Tue, 18 Oct 2005 12:01:48 +0000 Subject: [PATCH] API change: pass both the VexGuestExtents and the original pre-redirection guest address to instrumentation functions. git-svn-id: svn://svn.valgrind.org/vex/trunk@1420 --- VEX/priv/main/vex_main.c | 13 +++++++++++-- VEX/pub/libvex.h | 8 ++++++++ VEX/test_main.c | 3 ++- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/VEX/priv/main/vex_main.c b/VEX/priv/main/vex_main.c index f1589c39e9..7c97e76227 100644 --- a/VEX/priv/main/vex_main.c +++ b/VEX/priv/main/vex_main.c @@ -179,8 +179,13 @@ VexTranslateResult LibVEX_Translate ( VexArch arch_host, VexArchInfo* archinfo_host, /* IN: the block to translate, and its guest address. */ + /* where are the actual bytes in the host's address space? */ UChar* guest_bytes, + /* where do the bytes came from in the guest's aspace? */ Addr64 guest_bytes_addr, + /* what guest entry point address do they correspond to? */ + Addr64 guest_bytes_addr_noredir, + /* Is it OK to chase into this guest address? */ Bool (*chase_into_ok) ( Addr64 ), /* OUT: which bits of guest code actually got translated */ VexGuestExtents* guest_extents, @@ -191,8 +196,10 @@ VexTranslateResult LibVEX_Translate ( Int* host_bytes_used, /* IN: optionally, two instrumentation functions. */ IRBB* (*instrument1) ( IRBB*, VexGuestLayout*, + Addr64, VexGuestExtents*, IRType gWordTy, IRType hWordTy ), IRBB* (*instrument2) ( IRBB*, VexGuestLayout*, + Addr64, VexGuestExtents*, IRType gWordTy, IRType hWordTy ), Bool cleanup_after_instrumentation, /* IN: should this translation be self-checking? */ @@ -463,10 +470,12 @@ VexTranslateResult LibVEX_Translate ( /* Get the thing instrumented. */ if (instrument1) irbb = (*instrument1)(irbb, guest_layout, - guest_word_type, host_word_type); + guest_bytes_addr_noredir, guest_extents, + guest_word_type, host_word_type); if (instrument2) irbb = (*instrument2)(irbb, guest_layout, - guest_word_type, host_word_type); + guest_bytes_addr_noredir, guest_extents, + guest_word_type, host_word_type); if (vex_traceflags & VEX_TRACE_INST) { vex_printf("\n------------------------" diff --git a/VEX/pub/libvex.h b/VEX/pub/libvex.h index 8bf068e5ae..e482737bec 100644 --- a/VEX/pub/libvex.h +++ b/VEX/pub/libvex.h @@ -275,14 +275,20 @@ typedef extern VexTranslateResult LibVEX_Translate ( + /* The instruction sets we are translating from and to. */ VexArch arch_guest, VexArchInfo* archinfo_guest, VexArch arch_host, VexArchInfo* archinfo_host, /* IN: the block to translate, and its guest address. */ + /* where are the actual bytes in the host's address space? */ UChar* guest_bytes, + /* where do the bytes came from in the guest's aspace? */ Addr64 guest_bytes_addr, + /* what guest entry point address do they correspond to? */ + Addr64 guest_bytes_addr_noredir, + /* Is it OK to chase into this guest address? */ Bool (*chase_into_ok) ( Addr64 ), /* OUT: which bits of guest code actually got translated */ VexGuestExtents* guest_extents, @@ -293,8 +299,10 @@ VexTranslateResult LibVEX_Translate ( Int* host_bytes_used, /* IN: optionally, two instrumentation functions. */ IRBB* (*instrument1) ( IRBB*, VexGuestLayout*, + Addr64, VexGuestExtents*, IRType gWordTy, IRType hWordTy ), IRBB* (*instrument2) ( IRBB*, VexGuestLayout*, + Addr64, VexGuestExtents*, IRType gWordTy, IRType hWordTy ), Bool cleanup_after_instrumentation, /* IN: should this translation be self-checking? */ diff --git a/VEX/test_main.c b/VEX/test_main.c index 1fa937da11..0a9c067386 100644 --- a/VEX/test_main.c +++ b/VEX/test_main.c @@ -148,7 +148,8 @@ int main ( int argc, char** argv ) VexArchX86, &vai_x86, VexArchX86, &vai_x86, #endif - origbuf, (Addr64)orig_addr, chase_into_not_ok, + origbuf, (Addr64)orig_addr, (Addr64)orig_addr, + chase_into_not_ok, &vge, transbuf, N_TRANSBUF, &trans_used, #if 1 /* no instrumentation */ -- 2.47.3