From a9aa079113436a751fa9f848f7174c719e6921a3 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Sun, 4 Jan 2015 17:20:45 +0000 Subject: [PATCH] Change most remaining use of Addr64 in coregrind and the tools to Addr. Tracking VEX r3056. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14846 --- cachegrind/cg_main.c | 8 +-- callgrind/main.c | 12 ++--- coregrind/m_redir.c | 22 ++++---- coregrind/m_sbprofile.c | 6 +-- coregrind/m_scheduler/scheduler.c | 2 +- coregrind/m_sigframe/sigframe-ppc32-linux.c | 2 +- coregrind/m_sigframe/sigframe-ppc64-linux.c | 2 +- coregrind/m_stacktrace.c | 2 +- coregrind/m_syswrap/syswrap-arm-linux.c | 2 +- coregrind/m_syswrap/syswrap-arm64-linux.c | 2 +- coregrind/m_syswrap/syswrap-generic.c | 12 ++--- coregrind/m_syswrap/syswrap-linux.c | 2 +- coregrind/m_syswrap/syswrap-mips32-linux.c | 4 +- coregrind/m_syswrap/syswrap-mips64-linux.c | 2 +- coregrind/m_tooliface.c | 2 +- coregrind/m_translate.c | 35 ++++++------ coregrind/m_transtab.c | 60 ++++++++++----------- coregrind/pub_core_tooliface.h | 2 +- coregrind/pub_core_translate.h | 2 +- coregrind/pub_core_transtab.h | 12 ++--- include/pub_tool_tooliface.h | 6 +-- 21 files changed, 97 insertions(+), 102 deletions(-) diff --git a/cachegrind/cg_main.c b/cachegrind/cg_main.c index ec9c6e9d88..7f2c7e555b 100644 --- a/cachegrind/cg_main.c +++ b/cachegrind/cg_main.c @@ -1715,17 +1715,17 @@ static void cg_fini(Int exitcode) // any reason at all: to free up space, because the guest code was // unmapped or modified, or for any arbitrary reason. static -void cg_discard_superblock_info ( Addr64 orig_addr64, VexGuestExtents vge ) +void cg_discard_superblock_info ( Addr orig_addr64, VexGuestExtents vge ) { SB_info* sbInfo; - Addr orig_addr = (Addr)vge.base[0]; + Addr orig_addr = vge.base[0]; tl_assert(vge.n_used > 0); if (DEBUG_CG) VG_(printf)( "discard_basic_block_info: %p, %p, %llu\n", - (void*)(Addr)orig_addr, - (void*)(Addr)vge.base[0], (ULong)vge.len[0]); + (void*)orig_addr, + (void*)vge.base[0], (ULong)vge.len[0]); // Get BB info, remove from table, free BB info. Simple! Note that we // use orig_addr, not the first instruction address in vge. diff --git a/callgrind/main.c b/callgrind/main.c index 05df95d35c..5d10b40d4d 100644 --- a/callgrind/main.c +++ b/callgrind/main.c @@ -1368,16 +1368,14 @@ IRSB* CLG_(instrument)( VgCallbackClosure* closure, // any reason at all: to free up space, because the guest code was // unmapped or modified, or for any arbitrary reason. static -void clg_discard_superblock_info ( Addr64 orig_addr64, VexGuestExtents vge ) +void clg_discard_superblock_info ( Addr orig_addr, VexGuestExtents vge ) { - Addr orig_addr = (Addr)orig_addr64; - tl_assert(vge.n_used > 0); if (0) VG_(printf)( "discard_superblock_info: %p, %p, %llu\n", - (void*)(Addr)orig_addr, - (void*)(Addr)vge.base[0], (ULong)vge.len[0]); + (void*)orig_addr, + (void*)vge.base[0], (ULong)vge.len[0]); // Get BB info, remove from table, free BB info. Simple! Note that we // use orig_addr, not the first instruction address in vge. @@ -1450,7 +1448,7 @@ void zero_state_cost(thread_info* t) /* Ups, this can go very wrong... FIXME: We should export this function or provide other means to get a handle */ -extern void VG_(discard_translations) ( Addr64 start, ULong range, const HChar* who ); +extern void VG_(discard_translations) ( Addr start, ULong range, const HChar* who ); void CLG_(set_instrument_state)(const HChar* reason, Bool state) { @@ -1463,7 +1461,7 @@ void CLG_(set_instrument_state)(const HChar* reason, Bool state) CLG_DEBUG(2, "%s: Switching instrumentation %s ...\n", reason, state ? "ON" : "OFF"); - VG_(discard_translations)( (Addr64)0x1000, (ULong) ~0xfffl, "callgrind"); + VG_(discard_translations)( (Addr)0x1000, (ULong) ~0xfffl, "callgrind"); /* reset internal state: call stacks, simulator */ CLG_(forall_threads)(unwind_thread); diff --git a/coregrind/m_redir.c b/coregrind/m_redir.c index 5075b061d2..d87110b9ac 100644 --- a/coregrind/m_redir.c +++ b/coregrind/m_redir.c @@ -733,8 +733,8 @@ void VG_(redir_add_ifunc_target)( Addr old_from, Addr new_from ) if (VG_(clo_trace_redir)) { VG_(message)( Vg_DebugMsg, "Adding redirect for indirect function " - "0x%llx from 0x%llx -> 0x%llx\n", - (ULong)old_from, (ULong)new_from, (ULong)new.to_addr ); + "0x%lx from 0x%lx -> 0x%lx\n", + old_from, new_from, new.to_addr ); } } @@ -988,9 +988,9 @@ static void maybe_add_active ( Active act ) they get redirected to 'to'. So discard them. Just for paranoia (but, I believe, unnecessarily), discard 'to' as well. */ - VG_(discard_translations)( (Addr64)act.from_addr, 1, + VG_(discard_translations)( act.from_addr, 1, "redir_new_DebugInfo(from_addr)"); - VG_(discard_translations)( (Addr64)act.to_addr, 1, + VG_(discard_translations)( act.to_addr, 1, "redir_new_DebugInfo(to_addr)"); if (VG_(clo_verbosity) > 2) { VG_(message)(Vg_UserMsg, "Adding active redirection:\n"); @@ -1074,9 +1074,9 @@ void VG_(redir_notify_delete_DebugInfo)( const DebugInfo* delsi ) VG_(OSetWord_Insert)( tmpSet, act->from_addr ); /* While we have our hands on both the 'from' and 'to' of this Active, do paranoid stuff with tt/tc. */ - VG_(discard_translations)( (Addr64)act->from_addr, 1, + VG_(discard_translations)( act->from_addr, 1, "redir_del_DebugInfo(from_addr)"); - VG_(discard_translations)( (Addr64)act->to_addr, 1, + VG_(discard_translations)( act->to_addr, 1, "redir_del_DebugInfo(to_addr)"); } } @@ -1698,12 +1698,12 @@ static void handle_require_text_symbols ( const DebugInfo* di ) static void show_spec ( const HChar* left, const Spec* spec ) { VG_(message)( Vg_DebugMsg, - "%s%-25s %-30s %s-> (%04d.%d) 0x%08llx\n", + "%s%-25s %-30s %s-> (%04d.%d) 0x%08lx\n", left, spec->from_sopatt, spec->from_fnpatt, spec->isWrap ? "W" : "R", spec->becTag, spec->becPrio, - (ULong)spec->to_addr ); + spec->to_addr ); } static void show_active ( const HChar* left, const Active* act ) @@ -1721,12 +1721,12 @@ static void show_active ( const HChar* left, const Active* act ) ok = VG_(get_fnname_w_offset)(act->to_addr, &name2); if (!ok) name2 = "???"; - VG_(message)(Vg_DebugMsg, "%s0x%08llx (%-20s) %s-> (%04d.%d) 0x%08llx %s\n", + VG_(message)(Vg_DebugMsg, "%s0x%08lx (%-20s) %s-> (%04d.%d) 0x%08lx %s\n", left, - (ULong)act->from_addr, name1, + act->from_addr, name1, act->isWrap ? "W" : "R", act->becTag, act->becPrio, - (ULong)act->to_addr, name2 ); + act->to_addr, name2 ); } static void show_redir_state ( const HChar* who ) diff --git a/coregrind/m_sbprofile.c b/coregrind/m_sbprofile.c index 4befbc8932..f64260fc22 100644 --- a/coregrind/m_sbprofile.c +++ b/coregrind/m_sbprofile.c @@ -96,7 +96,7 @@ void show_SB_profile ( const SBProfEntry tops[], UInt n_tops, Double percent_here = score_total == 0 ? 100.0 : score_here * 100.0 / score_total; - VG_(printf)("%3d: (%9lld %5.2f%%) %9lld %5.2f%% 0x%llx %s\n", + VG_(printf)("%3d: (%9lld %5.2f%%) %9lld %5.2f%% 0x%lx %s\n", r, score_cumul, percent_cumul, score_here, percent_here, tops[r].addr, name); @@ -138,7 +138,7 @@ void show_SB_profile ( const SBProfEntry tops[], UInt n_tops, VG_(printf)("\n"); VG_(printf)("=-=-=-=-=-=-=-=-=-=-=-=-=-= begin SB rank %d " "=-=-=-=-=-=-=-=-=-=-=-=-=-=\n\n", r); - VG_(printf)("%3d: (%9lld %5.2f%%) %9lld %5.2f%% 0x%llx %s\n", + VG_(printf)("%3d: (%9lld %5.2f%%) %9lld %5.2f%% 0x%lx %s\n", r, score_cumul, percent_cumul, score_here, percent_here, tops[r].addr, name ); @@ -170,7 +170,7 @@ void show_SB_profile ( const SBProfEntry tops[], UInt n_tops, Double percent_here = score_total == 0 ? 100.0 : score_here * 100.0 / score_total; - VG_(printf)("%3d: (%9lld %5.2f%%) %9lld %5.2f%% 0x%llx %s\n", + VG_(printf)("%3d: (%9lld %5.2f%%) %9lld %5.2f%% 0x%lx %s\n", r, score_cumul, percent_cumul, score_here, percent_here, tops[r].addr, name ); diff --git a/coregrind/m_scheduler/scheduler.c b/coregrind/m_scheduler/scheduler.c index a424be61f5..33642d728f 100644 --- a/coregrind/m_scheduler/scheduler.c +++ b/coregrind/m_scheduler/scheduler.c @@ -1555,7 +1555,7 @@ VgSchedReturnCode VG_(scheduler) ( ThreadId tid ) case VEX_TRC_JMP_INVALICACHE: VG_(discard_translations)( - (Addr64)VG_(threads)[tid].arch.vex.guest_CMSTART, + (Addr)VG_(threads)[tid].arch.vex.guest_CMSTART, VG_(threads)[tid].arch.vex.guest_CMLEN, "scheduler(VEX_TRC_JMP_INVALICACHE)" ); diff --git a/coregrind/m_sigframe/sigframe-ppc32-linux.c b/coregrind/m_sigframe/sigframe-ppc32-linux.c index aae1d2f779..7f35ac08b5 100644 --- a/coregrind/m_sigframe/sigframe-ppc32-linux.c +++ b/coregrind/m_sigframe/sigframe-ppc32-linux.c @@ -183,7 +183,7 @@ void stack_mcontext ( struct vki_mcontext *mc, VG_TRACK( post_mem_write, Vg_CoreSignal, tst->tid, (Addr)&mc->mc_pad, sizeof(mc->mc_pad) ); /* invalidate any translation of this area */ - VG_(discard_translations)( (Addr64)(Addr)&mc->mc_pad, + VG_(discard_translations)( (Addr)&mc->mc_pad, sizeof(mc->mc_pad), "stack_mcontext" ); /* set the signal handler to return to the trampoline */ diff --git a/coregrind/m_sigframe/sigframe-ppc64-linux.c b/coregrind/m_sigframe/sigframe-ppc64-linux.c index 459d6b1c0c..ce3224a4eb 100644 --- a/coregrind/m_sigframe/sigframe-ppc64-linux.c +++ b/coregrind/m_sigframe/sigframe-ppc64-linux.c @@ -287,7 +287,7 @@ void VG_(sigframe_create)( ThreadId tid, (Addr)&frame->tramp, sizeof(frame->tramp)); /* invalidate any translation of this area */ - VG_(discard_translations)( (Addr64)&frame->tramp[0], + VG_(discard_translations)( (Addr)&frame->tramp[0], sizeof(frame->tramp), "stack_mcontext" ); /* set the signal handler to return to the trampoline */ diff --git a/coregrind/m_stacktrace.c b/coregrind/m_stacktrace.c index c38a4a821b..45594ae94b 100644 --- a/coregrind/m_stacktrace.c +++ b/coregrind/m_stacktrace.c @@ -696,7 +696,7 @@ UInt VG_(get_StackTrace_wrk) ( ThreadId tid_if_known, /* Deal with bogus LR values caused by function interception/wrapping on ppc-TOC platforms; see comment on similar code a few lines further down. */ - if (ULong_to_Ptr(lr) == (void*)&VG_(ppctoc_magic_redirect_return_stub) + if (lr == (Addr)&VG_(ppctoc_magic_redirect_return_stub) && VG_(is_valid_tid)(tid_if_known)) { Word hsp = VG_(threads)[tid_if_known].arch.vex.guest_REDIR_SP; redirs_used++; diff --git a/coregrind/m_syswrap/syswrap-arm-linux.c b/coregrind/m_syswrap/syswrap-arm-linux.c index 955e033495..4293800602 100644 --- a/coregrind/m_syswrap/syswrap-arm-linux.c +++ b/coregrind/m_syswrap/syswrap-arm-linux.c @@ -599,7 +599,7 @@ PRE(sys_cacheflush) { PRINT("cacheflush (%lx, %#lx, %#lx)",ARG1,ARG2,ARG3); PRE_REG_READ3(long, "cacheflush", void*, addrlow,void*, addrhigh,int, flags); - VG_(discard_translations)( (Addr64)ARG1, + VG_(discard_translations)( (Addr)ARG1, ((ULong)ARG2) - ((ULong)ARG1) + 1ULL/*paranoia*/, "PRE(sys_cacheflush)" ); SET_STATUS_Success(0); diff --git a/coregrind/m_syswrap/syswrap-arm64-linux.c b/coregrind/m_syswrap/syswrap-arm64-linux.c index 2c7b4596a8..56fafac4c3 100644 --- a/coregrind/m_syswrap/syswrap-arm64-linux.c +++ b/coregrind/m_syswrap/syswrap-arm64-linux.c @@ -703,7 +703,7 @@ PRE(sys_rt_sigreturn) //ZZ { //ZZ PRINT("cacheflush (%lx, %#lx, %#lx)",ARG1,ARG2,ARG3); //ZZ PRE_REG_READ3(long, "cacheflush", void*, addrlow,void*, addrhigh,int, flags); -//ZZ VG_(discard_translations)( (Addr64)ARG1, +//ZZ VG_(discard_translations)( (Addr)ARG1, //ZZ ((ULong)ARG2) - ((ULong)ARG1) + 1ULL/*paranoia*/, //ZZ "PRE(sys_cacheflush)" ); //ZZ SET_STATUS_Success(0); diff --git a/coregrind/m_syswrap/syswrap-generic.c b/coregrind/m_syswrap/syswrap-generic.c index 057052bce5..42d134c0c5 100644 --- a/coregrind/m_syswrap/syswrap-generic.c +++ b/coregrind/m_syswrap/syswrap-generic.c @@ -185,7 +185,7 @@ static void notify_core_of_mmap(Addr a, SizeT len, UInt prot, d = VG_(am_notify_client_mmap)( a, len, prot, flags, fd, offset ); if (d) - VG_(discard_translations)( (Addr64)a, (ULong)len, + VG_(discard_translations)( a, (ULong)len, "notify_core_of_mmap" ); } @@ -243,7 +243,7 @@ ML_(notify_core_and_tool_of_munmap) ( Addr a, SizeT len ) VG_TRACK( die_mem_munmap, a, len ); VG_(di_notify_munmap)( a, len ); if (d) - VG_(discard_translations)( (Addr64)a, (ULong)len, + VG_(discard_translations)( a, (ULong)len, "ML_(notify_core_and_tool_of_munmap)" ); } @@ -260,7 +260,7 @@ ML_(notify_core_and_tool_of_mprotect) ( Addr a, SizeT len, Int prot ) VG_TRACK( change_mem_mprotect, a, len, rr, ww, xx ); VG_(di_notify_mprotect)( a, len, prot ); if (d) - VG_(discard_translations)( (Addr64)a, (ULong)len, + VG_(discard_translations)( a, (ULong)len, "ML_(notify_core_and_tool_of_mprotect)" ); } @@ -1945,7 +1945,7 @@ ML_(generic_POST_sys_shmat) ( ThreadId tid, VG_TRACK( new_mem_mmap, res, segmentSize, True, True, False, 0/*di_handle*/ ); if (d) - VG_(discard_translations)( (Addr64)res, + VG_(discard_translations)( (Addr)res, (ULong)VG_PGROUNDUP(segmentSize), "ML_(generic_POST_sys_shmat)" ); } @@ -1977,7 +1977,7 @@ ML_(generic_POST_sys_shmdt) ( ThreadId tid, UWord res, UWord arg0 ) s = NULL; /* s is now invalid */ VG_TRACK( die_mem_munmap, s_start, s_len ); if (d) - VG_(discard_translations)( (Addr64)s_start, + VG_(discard_translations)( s_start, (ULong)s_len, "ML_(generic_POST_sys_shmdt)" ); } @@ -3757,7 +3757,7 @@ POST(sys_munmap) Addr a = ARG1; SizeT len = ARG2; - ML_(notify_core_and_tool_of_munmap)( (Addr64)a, (ULong)len ); + ML_(notify_core_and_tool_of_munmap)( a, len ); } PRE(sys_mincore) diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index bc86eadbc7..f0bd3cbbea 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -1710,7 +1710,7 @@ PRE(sys_io_destroy) Bool d = VG_(am_notify_munmap)( ARG1, size ); VG_TRACK( die_mem_munmap, ARG1, size ); if (d) - VG_(discard_translations)( (Addr64)ARG1, (ULong)size, + VG_(discard_translations)( (Addr)ARG1, (ULong)size, "PRE(sys_io_destroy)" ); } } diff --git a/coregrind/m_syswrap/syswrap-mips32-linux.c b/coregrind/m_syswrap/syswrap-mips32-linux.c index 0f5359c204..bddadd0168 100644 --- a/coregrind/m_syswrap/syswrap-mips32-linux.c +++ b/coregrind/m_syswrap/syswrap-mips32-linux.c @@ -365,7 +365,7 @@ static void notify_core_of_mmap(Addr a, SizeT len, UInt prot, d = VG_(am_notify_client_mmap)( a, len, prot, flags, fd, offset ); if (d) - VG_(discard_translations)( (Addr64)a, (ULong)len, + VG_(discard_translations)( a, (ULong)len, "notify_core_of_mmap" ); } @@ -752,7 +752,7 @@ PRE (sys_cacheflush) PRINT ("cacheflush (%lx, %lx, %lx)", ARG1, ARG2, ARG3); PRE_REG_READ3(long, "cacheflush", unsigned long, addr, int, nbytes, int, cache); - VG_ (discard_translations) ((Addr64) ARG1, ((ULong) ARG2), + VG_ (discard_translations) ((Addr)ARG1, (ULong) ARG2, "PRE(sys_cacheflush)"); SET_STATUS_Success (0); } diff --git a/coregrind/m_syswrap/syswrap-mips64-linux.c b/coregrind/m_syswrap/syswrap-mips64-linux.c index 34ea581fbe..c51ab6fb21 100644 --- a/coregrind/m_syswrap/syswrap-mips64-linux.c +++ b/coregrind/m_syswrap/syswrap-mips64-linux.c @@ -387,7 +387,7 @@ PRE(sys_cacheflush) PRINT("cacheflush (%lx, %lx, %lx)", ARG1, ARG2, ARG3); PRE_REG_READ3(long, "cacheflush", unsigned long, addr, int, nbytes, int, cache); - VG_ (discard_translations) ((Addr64) ARG1, ((ULong) ARG2), + VG_ (discard_translations) ((Addr)ARG1, (ULong) ARG2, "PRE(sys_cacheflush)"); SET_STATUS_Success(0); } diff --git a/coregrind/m_tooliface.c b/coregrind/m_tooliface.c index 3fd8f821d5..00006f2fca 100644 --- a/coregrind/m_tooliface.c +++ b/coregrind/m_tooliface.c @@ -219,7 +219,7 @@ NEEDS(core_errors) NEEDS(var_info) void VG_(needs_superblock_discards)( - void (*discard)(Addr64, VexGuestExtents) + void (*discard)(Addr, VexGuestExtents) ) { VG_(needs).superblock_discards = True; diff --git a/coregrind/m_translate.c b/coregrind/m_translate.c index 6c3c899529..8a8f5aa244 100644 --- a/coregrind/m_translate.c +++ b/coregrind/m_translate.c @@ -789,8 +789,8 @@ static UInt needs_self_check ( void* closureV, for (i = 0; i < vge->n_used; i++) { Bool check = False; - Addr addr = (Addr)vge->base[i]; - SizeT len = (SizeT)vge->len[i]; + Addr addr = vge->base[i]; + SizeT len = vge->len[i]; NSegment const* segA = NULL; # if defined(VGO_darwin) @@ -1128,10 +1128,10 @@ static IRTemp gen_POP ( IRSB* bb ) intercept the return and restore R2 and L2 to the values saved here. */ -static void gen_push_and_set_LR_R2 ( IRSB* bb, Addr64 new_R2_value ) +static void gen_push_and_set_LR_R2 ( IRSB* bb, Addr new_R2_value ) { # if defined(VGP_ppc64be_linux) - Addr64 bogus_RA = (Addr64)&VG_(ppctoc_magic_redirect_return_stub); + Addr bogus_RA = (Addr)&VG_(ppctoc_magic_redirect_return_stub); Int offB_GPR2 = offsetof(VexGuestPPC64State,guest_GPR2); Int offB_LR = offsetof(VexGuestPPC64State,guest_LR); gen_PUSH( bb, IRExpr_Get(offB_LR, Ity_I64) ); @@ -1211,7 +1211,7 @@ Bool mk_preamble__ppctoc_magic_return_stub ( void* closureV, IRSB* bb ) static void gen_push_R2_and_set_LR ( IRSB* bb ) { - Addr64 bogus_RA = (Addr64)&VG_(ppctoc_magic_redirect_return_stub); + Addr bogus_RA = (Addr)&VG_(ppctoc_magic_redirect_return_stub); Int offB_GPR2 = offsetof(VexGuestPPC64State,guest_GPR2); Int offB_LR = offsetof(VexGuestPPC64State,guest_LR); gen_PUSH( bb, IRExpr_Get(offB_LR, Ity_I64) ); @@ -1356,7 +1356,7 @@ Bool mk_preamble__set_NRADDR_to_nraddr ( void* closureV, IRSB* bb ) /* --- Helpers to do with PPC related stack redzones. --- */ __attribute__((unused)) -static Bool const_True ( Addr64 guest_addr ) +static Bool const_True ( Addr guest_addr ) { return True; } @@ -1392,13 +1392,13 @@ typedef */ Bool VG_(translate) ( ThreadId tid, - Addr64 nraddr, + Addr nraddr, Bool debugging_translation, Int debugging_verbosity, ULong bbs_done, Bool allow_redirection ) { - Addr64 addr; + Addr addr; T_Kind kind; Int tmpbuf_used, verbosity, i; Bool (*preamble_fn)(void*,IRSB*); @@ -1425,7 +1425,7 @@ Bool VG_(translate) ( ThreadId tid, start from. Sets (addr,kind). */ if (allow_redirection) { Bool isWrap; - Addr64 tmp = VG_(redir_do_lookup)( nraddr, &isWrap ); + Addr tmp = VG_(redir_do_lookup)( nraddr, &isWrap ); if (tmp == nraddr) { /* no redirection found */ addr = nraddr; @@ -1470,7 +1470,7 @@ Bool VG_(translate) ( ThreadId tid, if (!ok) name2 = "???"; VG_(message)(Vg_DebugMsg, - "REDIR: 0x%llx (%s:%s) redirected to 0x%llx (%s)\n", + "REDIR: 0x%lx (%s:%s) redirected to 0x%lx (%s)\n", nraddr, nraddr_soname, name1, addr, name2 ); } @@ -1494,7 +1494,7 @@ Bool VG_(translate) ( ThreadId tid, Bool ok = VG_(get_fnname_w_offset)(addr, &fnname); if (!ok) fnname = "UNKNOWN_FUNCTION"; VG_(printf)( - "==== SB %d (evchecks %lld) [tid %d] 0x%llx %s %s+0x%llx\n", + "==== SB %d (evchecks %lld) [tid %d] 0x%lx %s %s+0x%llx\n", VG_(get_bbs_translated)(), bbs_done, (Int)tid, addr, fnname, objname, (ULong)objoff ); @@ -1508,7 +1508,7 @@ Bool VG_(translate) ( ThreadId tid, if ( (!translations_allowable_from_seg(seg, addr)) || addr == TRANSTAB_BOGUS_GUEST_ADDR ) { if (VG_(clo_trace_signals)) - VG_(message)(Vg_DebugMsg, "translations not allowed here (0x%llx)" + VG_(message)(Vg_DebugMsg, "translations not allowed here (0x%lx)" " - throwing SEGV\n", addr); /* U R busted, sonny. Place your hands on your head and step away from the orig_addr. */ @@ -1518,7 +1518,7 @@ Bool VG_(translate) ( ThreadId tid, aren't allowed to execute code here. */ if (debugging_translation) VG_(printf)("translations not allowed here (segment not executable)" - "(0x%llx)\n", addr); + "(0x%lx)\n", addr); else VG_(synth_fault_perms)(tid, addr); } else { @@ -1526,7 +1526,7 @@ Bool VG_(translate) ( ThreadId tid, the middle of nowhere. */ if (debugging_translation) VG_(printf)("translations not allowed here (no segment)" - "(0x%llx)\n", addr); + "(0x%lx)\n", addr); else VG_(synth_fault_mapping)(tid, addr); } @@ -1555,8 +1555,7 @@ Bool VG_(translate) ( ThreadId tid, /* LE we setup the LR */ # if defined(VG_PLAT_USES_PPCTOC) || defined(VGP_ppc64le_linux) - if (ULong_to_Ptr(nraddr) - == (void*)&VG_(ppctoc_magic_redirect_return_stub)) { + if (nraddr == (Addr)&VG_(ppctoc_magic_redirect_return_stub)) { /* If entering the special return stub, this means a wrapped or redirected function is returning. Make this translation one which restores R2 and LR from the thread's hidden redir @@ -1615,7 +1614,7 @@ Bool VG_(translate) ( ThreadId tid, vta.archinfo_host = vex_archinfo; vta.abiinfo_both = vex_abiinfo; vta.callback_opaque = (void*)&closure; - vta.guest_bytes = (UChar*)ULong_to_Ptr(addr); + vta.guest_bytes = (UChar*)addr; vta.guest_bytes_addr = addr; vta.chase_into_ok = chase_into_ok; vta.guest_extents = &vge; @@ -1692,7 +1691,7 @@ Bool VG_(translate) ( ThreadId tid, from them. Optimisation: don't re-look up vge.base[0] since seg should already point to it. */ - vg_assert( vge.base[0] == (Addr64)addr ); + vg_assert( vge.base[0] == addr ); /* set 'translations taken from this segment' flag */ VG_(am_set_segment_hasT_if_SkFileC_or_SkAnonC)( seg ); } /* END new scope specially for 'seg' */ diff --git a/coregrind/m_transtab.c b/coregrind/m_transtab.c index 8477b48eba..d5622e1a47 100644 --- a/coregrind/m_transtab.c +++ b/coregrind/m_transtab.c @@ -161,7 +161,7 @@ typedef from which this translation was made. However, .entry may or may not be a lie, depending on whether or not we're doing redirection. */ - Addr64 entry; + Addr entry; /* This structure describes precisely what ranges of guest code the translation covers, so we can decide whether or not to @@ -642,7 +642,7 @@ Bool HostExtent__is_dead (const HostExtent* hx, const Sector* sec) #define LDEBUG(m) if (DEBUG_TRANSTAB) \ VG_(printf) (m \ " start 0x%p len %u sector %d ttslot %u" \ - " tt.entry 0x%llu tt.tcptr 0x%p\n", \ + " tt.entry 0x%lu tt.tcptr 0x%p\n", \ hx->start, hx->len, (int)(sec - sectors), \ hx->tteNo, \ sec->tt[tteNo].entry, sec->tt[tteNo].tcptr) @@ -882,7 +882,7 @@ void unchain_in_preparation_for_deletion ( VexArch arch_host, Int evCheckSzB = LibVEX_evCheckSzB(arch_host, endness_host); TTEntry* here_tte = index_tte(here_sNo, here_tteNo); if (DEBUG_TRANSTAB) - VG_(printf)("... QQQ tt.entry 0x%llu tt.tcptr 0x%p\n", + VG_(printf)("... QQQ tt.entry 0x%lu tt.tcptr 0x%p\n", here_tte->entry, here_tte->tcptr); vg_assert(here_tte->status == InUse); @@ -939,7 +939,7 @@ void unchain_in_preparation_for_deletion ( VexArch arch_host, /* Return equivalence class number for a range. */ -static Int range_to_eclass ( Addr64 start, UInt len ) +static Int range_to_eclass ( Addr start, UInt len ) { UInt mask = (1 << ECLASS_WIDTH) - 1; UInt lo = (UInt)start; @@ -975,7 +975,7 @@ Int vexGuestExtents_to_eclasses ( /*OUT*/Int* eclasses, n_ec = 0; for (i = 0; i < vge->n_used; i++) { - r = range_to_eclass( vge->base[i], (UInt)vge->len[i] ); + r = range_to_eclass( vge->base[i], vge->len[i] ); if (r == ECLASS_MISC) goto bad; /* only add if we haven't already seen it */ @@ -1201,8 +1201,7 @@ static Bool sanity_check_eclasses_in_sector ( const Sector* sec ) } if (tte->status != Empty) { for (k = 0; k < tte->vge.n_used; k++) - VG_(printf)("0x%llx %d\n", tte->vge.base[k], - (Int)tte->vge.len[k]); + VG_(printf)("0x%lx %u\n", tte->vge.base[k], (UInt)tte->vge.len[k]); } # endif @@ -1312,9 +1311,9 @@ static Bool isValidSector ( Int sector ) return True; } -static inline UInt HASH_TT ( Addr64 key ) +static inline UInt HASH_TT ( Addr key ) { - UInt kHi = (UInt)(key >> 32); + UInt kHi = sizeof(Addr) == 4 ? 0 : (key >> 32); UInt kLo = (UInt)key; UInt k32 = kHi ^ kLo; UInt ror = 7; @@ -1323,10 +1322,10 @@ static inline UInt HASH_TT ( Addr64 key ) return k32 % N_TTES_PER_SECTOR; } -static void setFastCacheEntry ( Addr64 key, ULong* tcptr ) +static void setFastCacheEntry ( Addr key, ULong* tcptr ) { UInt cno = (UInt)VG_TT_FAST_HASH(key); - VG_(tt_fast)[cno].guest = (Addr)key; + VG_(tt_fast)[cno].guest = key; VG_(tt_fast)[cno].host = (Addr)tcptr; n_fast_updates++; /* This shouldn't fail. It should be assured by m_translate @@ -1513,7 +1512,7 @@ static void initialiseSector ( Int sno ) sector. */ void VG_(add_to_transtab)( const VexGuestExtents* vge, - Addr64 entry, + Addr entry, Addr code, UInt code_len, Bool is_self_checking, @@ -1535,7 +1534,7 @@ void VG_(add_to_transtab)( const VexGuestExtents* vge, vg_assert(n_guest_instrs < 200); /* it can be zero, tho */ if (DEBUG_TRANSTAB) - VG_(printf)("add_to_transtab(entry = 0x%llx, len = %d) ...\n", + VG_(printf)("add_to_transtab(entry = 0x%lx, len = %u) ...\n", entry, code_len); n_in_count++; @@ -1685,7 +1684,7 @@ void VG_(add_to_transtab)( const VexGuestExtents* vge, Bool VG_(search_transtab) ( /*OUT*/Addr* res_hcode, /*OUT*/UInt* res_sNo, /*OUT*/UInt* res_tteNo, - Addr64 guest_addr, + Addr guest_addr, Bool upd_cache ) { Int i, j, k, kstart, sno; @@ -1753,34 +1752,34 @@ Bool VG_(search_transtab) ( /*OUT*/Addr* res_hcode, /*-------------------------------------------------------------*/ /* forward */ -static void unredir_discard_translations( Addr64, ULong ); +static void unredir_discard_translations( Addr, ULong ); /* Stuff for deleting translations which intersect with a given address range. Unfortunately, to make this run at a reasonable speed, it is complex. */ static inline -Bool overlap1 ( Addr64 s1, ULong r1, Addr64 s2, ULong r2 ) +Bool overlap1 ( Addr s1, ULong r1, Addr s2, ULong r2 ) { - Addr64 e1 = s1 + r1 - 1ULL; - Addr64 e2 = s2 + r2 - 1ULL; + Addr e1 = s1 + r1 - 1; + Addr e2 = s2 + r2 - 1; if (e1 < s2 || e2 < s1) return False; return True; } static inline -Bool overlaps ( Addr64 start, ULong range, const VexGuestExtents* vge ) +Bool overlaps ( Addr start, ULong range, const VexGuestExtents* vge ) { - if (overlap1(start, range, vge->base[0], (UInt)vge->len[0])) + if (overlap1(start, range, vge->base[0], vge->len[0])) return True; if (vge->n_used < 2) return False; - if (overlap1(start, range, vge->base[1], (UInt)vge->len[1])) + if (overlap1(start, range, vge->base[1], vge->len[1])) return True; if (vge->n_used < 3) return False; - if (overlap1(start, range, vge->base[2], (UInt)vge->len[2])) + if (overlap1(start, range, vge->base[2], vge->len[2])) return True; return False; } @@ -1841,7 +1840,7 @@ static void delete_tte ( /*MOD*/Sector* sec, UInt secNo, Int tteno, static Bool delete_translations_in_sector_eclass ( /*MOD*/Sector* sec, UInt secNo, - Addr64 guest_start, ULong range, + Addr guest_start, ULong range, Int ec, VexArch arch_host, VexEndness endness_host ) @@ -1882,7 +1881,7 @@ Bool delete_translations_in_sector_eclass ( /*MOD*/Sector* sec, UInt secNo, static Bool delete_translations_in_sector ( /*MOD*/Sector* sec, UInt secNo, - Addr64 guest_start, ULong range, + Addr guest_start, ULong range, VexArch arch_host, VexEndness endness_host ) { @@ -1901,7 +1900,7 @@ Bool delete_translations_in_sector ( /*MOD*/Sector* sec, UInt secNo, } -void VG_(discard_translations) ( Addr64 guest_start, ULong range, +void VG_(discard_translations) ( Addr guest_start, ULong range, const HChar* who ) { Sector* sec; @@ -1911,7 +1910,7 @@ void VG_(discard_translations) ( Addr64 guest_start, ULong range, vg_assert(init_done); VG_(debugLog)(2, "transtab", - "discard_translations(0x%llx, %lld) req by %s\n", + "discard_translations(0x%lx, %llu) req by %s\n", guest_start, range, who ); /* Pre-deletion sanity check */ @@ -2106,7 +2105,7 @@ static Bool sanity_check_redir_tt_tc ( void ) is temporarily in code[0 .. code_len-1]. */ void VG_(add_to_unredir_transtab)( const VexGuestExtents* vge, - Addr64 entry, + Addr entry, Addr code, UInt code_len ) { @@ -2161,21 +2160,21 @@ void VG_(add_to_unredir_transtab)( const VexGuestExtents* vge, } Bool VG_(search_unredir_transtab) ( /*OUT*/Addr* result, - Addr64 guest_addr ) + Addr guest_addr ) { Int i; for (i = 0; i < N_UNREDIR_TT; i++) { if (!unredir_tt[i].inUse) continue; if (unredir_tt[i].vge.base[0] == guest_addr) { - *result = (Addr)unredir_tt[i].hcode; + *result = unredir_tt[i].hcode; return True; } } return False; } -static void unredir_discard_translations( Addr64 guest_start, ULong range ) +static void unredir_discard_translations( Addr guest_start, ULong range ) { Int i; @@ -2202,7 +2201,6 @@ void VG_(init_tt_tc) ( void ) /* Otherwise lots of things go wrong... */ vg_assert(sizeof(ULong) == 8); - vg_assert(sizeof(Addr64) == 8); /* check fast cache entries really are 2 words long */ vg_assert(sizeof(Addr) == sizeof(void*)); vg_assert(sizeof(FastCacheEntry) == 2 * sizeof(Addr)); diff --git a/coregrind/pub_core_tooliface.h b/coregrind/pub_core_tooliface.h index 9b7df351e4..6968a18eec 100644 --- a/coregrind/pub_core_tooliface.h +++ b/coregrind/pub_core_tooliface.h @@ -133,7 +133,7 @@ typedef struct { void (*tool_update_extra_suppression_use) (const Error*, const Supp*); // VG_(needs).superblock_discards - void (*tool_discard_superblock_info)(Addr64, VexGuestExtents); + void (*tool_discard_superblock_info)(Addr, VexGuestExtents); // VG_(needs).command_line_options Bool (*tool_process_cmd_line_option)(const HChar*); diff --git a/coregrind/pub_core_translate.h b/coregrind/pub_core_translate.h index 81e547c1d0..486662986a 100644 --- a/coregrind/pub_core_translate.h +++ b/coregrind/pub_core_translate.h @@ -40,7 +40,7 @@ extern Bool VG_(translate) ( ThreadId tid, - Addr64 orig_addr, + Addr orig_addr, Bool debugging_translation, Int debugging_verbosity, ULong bbs_done, diff --git a/coregrind/pub_core_transtab.h b/coregrind/pub_core_transtab.h index d079881125..892a0b1e6e 100644 --- a/coregrind/pub_core_transtab.h +++ b/coregrind/pub_core_transtab.h @@ -82,7 +82,7 @@ extern void VG_(init_tt_tc) ( void ); extern void VG_(add_to_transtab)( const VexGuestExtents* vge, - Addr64 entry, + Addr entry, Addr code, UInt code_len, Bool is_self_checking, @@ -98,10 +98,10 @@ void VG_(tt_tc_do_chaining) ( void* from__patch_addr, extern Bool VG_(search_transtab) ( /*OUT*/Addr* res_hcode, /*OUT*/UInt* res_sNo, /*OUT*/UInt* res_tteNo, - Addr64 guest_addr, + Addr guest_addr, Bool upd_cache ); -extern void VG_(discard_translations) ( Addr64 start, ULong range, +extern void VG_(discard_translations) ( Addr start, ULong range, const HChar* who ); extern void VG_(print_tt_tc_stats) ( void ); @@ -113,17 +113,17 @@ extern UInt VG_(get_bbs_translated) ( void ); extern void VG_(add_to_unredir_transtab)( const VexGuestExtents* vge, - Addr64 entry, + Addr entry, Addr code, UInt code_len ); extern Bool VG_(search_unredir_transtab) ( /*OUT*/Addr* result, - Addr64 guest_addr ); + Addr guest_addr ); // SB profiling stuff typedef struct _SBProfEntry { - Addr64 addr; + Addr addr; ULong score; } SBProfEntry; diff --git a/include/pub_tool_tooliface.h b/include/pub_tool_tooliface.h index 6f84ca4e78..3952f29406 100644 --- a/include/pub_tool_tooliface.h +++ b/include/pub_tool_tooliface.h @@ -64,8 +64,8 @@ extern void (*VG_(tl_pre_clo_init)) ( void ); */ typedef struct { - Addr64 nraddr; /* non-redirected guest address */ - Addr64 readdr; /* redirected guest address */ + Addr nraddr; /* non-redirected guest address */ + Addr readdr; /* redirected guest address */ ThreadId tid; /* tid requesting translation */ } VgCallbackClosure; @@ -381,7 +381,7 @@ extern void VG_(needs_superblock_discards) ( // translation, and so could be covered by the "extents" of more than // one call to this function. // Doing it the first way (as eg. Cachegrind does) is probably easier. - void (*discard_superblock_info)(Addr64 orig_addr, VexGuestExtents extents) + void (*discard_superblock_info)(Addr orig_addr, VexGuestExtents extents) ); /* Tool defines its own command line options? */ -- 2.47.3