From: Florian Krohm Date: Sun, 4 Jan 2015 17:20:19 +0000 (+0000) Subject: Change remaining use of Addr64 in the VEX API to Addr. The reduces X-Git-Tag: svn/VALGRIND_3_11_0^2~118 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=70ce1338ee6cdacb66659f5a44bb83b9bfdf29d7;p=thirdparty%2Fvalgrind.git Change remaining use of Addr64 in the VEX API to Addr. The reduces the size of VexGuestExtent to 20 bytes on a 32-bit platform. Change prototypes of x86g_dirtyhelper_loadF80le and x86g_dirtyhelper_storeF80le to give the address in the parameter list type Addr. Likewise for amd64g_dirtyhelper_loadF80le and amd64g_dirtyhelper_storeF80le. Update switchback.c - but not tested. git-svn-id: svn://svn.valgrind.org/vex/trunk@3056 --- diff --git a/VEX/priv/guest_amd64_defs.h b/VEX/priv/guest_amd64_defs.h index a2956484fa..8ccce6f75e 100644 --- a/VEX/priv/guest_amd64_defs.h +++ b/VEX/priv/guest_amd64_defs.h @@ -159,9 +159,9 @@ extern ULong amd64g_calculate_pdep ( ULong, ULong ); /* --- DIRTY HELPERS --- */ -extern ULong amd64g_dirtyhelper_loadF80le ( ULong/*addr*/ ); +extern ULong amd64g_dirtyhelper_loadF80le ( Addr/*addr*/ ); -extern void amd64g_dirtyhelper_storeF80le ( ULong/*addr*/, ULong/*data*/ ); +extern void amd64g_dirtyhelper_storeF80le ( Addr/*addr*/, ULong/*data*/ ); extern void amd64g_dirtyhelper_CPUID_baseline ( VexGuestAMD64State* st ); extern void amd64g_dirtyhelper_CPUID_sse3_and_cx16 ( VexGuestAMD64State* st ); diff --git a/VEX/priv/guest_amd64_helpers.c b/VEX/priv/guest_amd64_helpers.c index 15dc8bcb11..779f75b326 100644 --- a/VEX/priv/guest_amd64_helpers.c +++ b/VEX/priv/guest_amd64_helpers.c @@ -2051,18 +2051,18 @@ void amd64g_dirtyhelper_FINIT ( VexGuestAMD64State* gst ) /* CALLED FROM GENERATED CODE */ /* DIRTY HELPER (reads guest memory) */ -ULong amd64g_dirtyhelper_loadF80le ( ULong addrU ) +ULong amd64g_dirtyhelper_loadF80le ( Addr addrU ) { ULong f64; - convert_f80le_to_f64le ( (UChar*)ULong_to_Ptr(addrU), (UChar*)&f64 ); + convert_f80le_to_f64le ( (UChar*)addrU, (UChar*)&f64 ); return f64; } /* CALLED FROM GENERATED CODE */ /* DIRTY HELPER (writes guest memory) */ -void amd64g_dirtyhelper_storeF80le ( ULong addrU, ULong f64 ) +void amd64g_dirtyhelper_storeF80le ( Addr addrU, ULong f64 ) { - convert_f64le_to_f80le( (UChar*)&f64, (UChar*)ULong_to_Ptr(addrU) ); + convert_f64le_to_f80le( (UChar*)&f64, (UChar*)addrU ); } diff --git a/VEX/priv/guest_generic_bb_to_IR.c b/VEX/priv/guest_generic_bb_to_IR.c index f74c15ca08..4264346423 100644 --- a/VEX/priv/guest_generic_bb_to_IR.c +++ b/VEX/priv/guest_generic_bb_to_IR.c @@ -514,7 +514,7 @@ IRSB* bb_to_IR ( that do. */ { - Addr64 base2check; + Addr base2check; UInt len2check; HWord expectedhW; IRTemp tistart_tmp, tilen_tmp; diff --git a/VEX/priv/guest_x86_defs.h b/VEX/priv/guest_x86_defs.h index 47ce896c57..3dc34c8bc3 100644 --- a/VEX/priv/guest_x86_defs.h +++ b/VEX/priv/guest_x86_defs.h @@ -139,9 +139,9 @@ extern ULong x86g_calculate_mmx_psadbw ( ULong, ULong ); /* --- DIRTY HELPERS --- */ -extern ULong x86g_dirtyhelper_loadF80le ( UInt ); +extern ULong x86g_dirtyhelper_loadF80le ( Addr ); -extern void x86g_dirtyhelper_storeF80le ( UInt, ULong ); +extern void x86g_dirtyhelper_storeF80le ( Addr, ULong ); extern void x86g_dirtyhelper_CPUID_sse0 ( VexGuestX86State* ); extern void x86g_dirtyhelper_CPUID_mmxext ( VexGuestX86State* ); diff --git a/VEX/priv/guest_x86_helpers.c b/VEX/priv/guest_x86_helpers.c index 1272fcec2e..ef5e09e720 100644 --- a/VEX/priv/guest_x86_helpers.c +++ b/VEX/priv/guest_x86_helpers.c @@ -1437,18 +1437,18 @@ UInt x86g_calculate_FXAM ( UInt tag, ULong dbl ) /* CALLED FROM GENERATED CODE */ /* DIRTY HELPER (reads guest memory) */ -ULong x86g_dirtyhelper_loadF80le ( UInt addrU ) +ULong x86g_dirtyhelper_loadF80le ( Addr addrU ) { ULong f64; - convert_f80le_to_f64le ( (UChar*)ULong_to_Ptr(addrU), (UChar*)&f64 ); + convert_f80le_to_f64le ( (UChar*)addrU, (UChar*)&f64 ); return f64; } /* CALLED FROM GENERATED CODE */ /* DIRTY HELPER (writes guest memory) */ -void x86g_dirtyhelper_storeF80le ( UInt addrU, ULong f64 ) +void x86g_dirtyhelper_storeF80le ( Addr addrU, ULong f64 ) { - convert_f64le_to_f80le( (UChar*)&f64, (UChar*)ULong_to_Ptr(addrU) ); + convert_f64le_to_f80le( (UChar*)&f64, (UChar*)addrU ); } diff --git a/VEX/pub/libvex.h b/VEX/pub/libvex.h index bde9656821..442ca8fb0d 100644 --- a/VEX/pub/libvex.h +++ b/VEX/pub/libvex.h @@ -366,7 +366,7 @@ typedef (function call) ? Is supplied with the guest address of the target of the call since that may be significant. If NULL, is assumed equivalent to a fn which always returns False. */ - Bool (*guest_ppc_zap_RZ_at_bl)(Addr64); + Bool (*guest_ppc_zap_RZ_at_bl)(Addr); /* PPC32/PPC64 HOSTS only: does '&f' give us a pointer to a function descriptor on the host, or to the function code @@ -569,12 +569,13 @@ typedef scheme of describing a chunk of guest code merely by its start address and length is inadequate. - Hopefully this struct is only 32 bytes long. Space is important as - clients will have to store one of these for each translation made. + This struct uses 20 bytes on a 32-bit archtecture and 32 bytes on a + 64-bit architecture. Space is important as clients will have to store + one of these for each translation made. */ typedef struct { - Addr64 base[3]; + Addr base[3]; UShort len[3]; UShort n_used; } diff --git a/VEX/switchback/switchback.c b/VEX/switchback/switchback.c index deecc54045..f3603d189a 100644 --- a/VEX/switchback/switchback.c +++ b/VEX/switchback/switchback.c @@ -414,8 +414,8 @@ void switchback ( void ) UInt* p = (UInt*)(©[off_nopstart]); - Addr64 addr_of_nop = (Addr64)p; - Addr64 where_to_go = gst.guest_PC; + Addr addr_of_nop = (Addr)p; + Addr where_to_go = gst.guest_PC; Long diff = ((Long)where_to_go) - ((Long)addr_of_nop); if (0) { @@ -519,12 +519,12 @@ HWord run_translation ( HWord translation ) return trc; } -HWord find_translation ( Addr64 guest_addr ) +HWord find_translation ( Addr guest_addr ) { Int i; HWord __res; if (0) - printf("find translation %p ... ", ULong_to_Ptr(guest_addr)); + printf("find translation %p ... ", (void *)(guest_addr)); for (i = 0; i < trans_table_used; i++) if (trans_table[i].base[0] == guest_addr) break; @@ -552,7 +552,7 @@ HWord find_translation ( Addr64 guest_addr ) #define N_TRANSBUF 5000 static UChar transbuf[N_TRANSBUF]; -void make_translation ( Addr64 guest_addr, Bool verbose ) +void make_translation ( Addr guest_addr, Bool verbose ) { VexTranslateArgs vta; VexTranslateResult tres; @@ -573,7 +573,7 @@ void make_translation ( Addr64 guest_addr, Bool verbose ) assert(trans_table_used < N_TRANS_TABLE); if (0) - printf("make translation %p\n", ULong_to_Ptr(guest_addr)); + printf("make translation %p\n", (void *)guest_addr); LibVEX_default_VexArchInfo(&vex_archinfo); //vex_archinfo.subarch = VexSubArch; @@ -584,7 +584,7 @@ void make_translation ( Addr64 guest_addr, Bool verbose ) vta.archinfo_guest = vex_archinfo; vta.arch_host = VexArch; vta.archinfo_host = vex_archinfo; - vta.guest_bytes = (UChar*)ULong_to_Ptr(guest_addr); + vta.guest_bytes = (UChar*)guest_addr; vta.guest_bytes_addr = guest_addr; vta.chase_into_ok = chase_into_ok; // vta.guest_extents = &vge; @@ -631,7 +631,7 @@ void make_translation ( Addr64 guest_addr, Bool verbose ) __attribute__((unused)) -static Bool overlap ( Addr64 start, UInt len, VexGuestExtents* vge ) +static Bool overlap ( Addr start, UInt len, VexGuestExtents* vge ) { Int i; for (i = 0; i < vge->n_used; i++) { @@ -670,8 +670,8 @@ void log_bytes ( HChar* bytes, Int nbytes ) serviceFn(0)). */ static void run_simulator ( void ) { - static Addr64 last_guest = 0; - Addr64 next_guest; + static Addr last_guest = 0; + Addr next_guest; HWord next_host; while (1) { next_guest = gst.GuestPC; @@ -679,7 +679,7 @@ static void run_simulator ( void ) if (0) printf("\nnext_guest: 0x%x\n", (UInt)next_guest); - if (next_guest == Ptr_to_ULong(&serviceFn)) { + if (next_guest == (Addr)&serviceFn) { /* "do" the function call to serviceFn */ # if defined(__i386__)