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 8f6e269a-dfd6-0310-a8e1-e2731360e62c
diff --git a/priv/guest_amd64_defs.h b/priv/guest_amd64_defs.h
index a295648..8ccce6f 100644
--- a/priv/guest_amd64_defs.h
+++ b/priv/guest_amd64_defs.h
@@ -159,9 +159,9 @@
/* --- 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/priv/guest_amd64_helpers.c b/priv/guest_amd64_helpers.c
index 15dc8bc..779f75b 100644
--- a/priv/guest_amd64_helpers.c
+++ b/priv/guest_amd64_helpers.c
@@ -2051,18 +2051,18 @@
/* 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/priv/guest_generic_bb_to_IR.c b/priv/guest_generic_bb_to_IR.c
index f74c15c..4264346 100644
--- a/priv/guest_generic_bb_to_IR.c
+++ b/priv/guest_generic_bb_to_IR.c
@@ -514,7 +514,7 @@
that do.
*/
{
- Addr64 base2check;
+ Addr base2check;
UInt len2check;
HWord expectedhW;
IRTemp tistart_tmp, tilen_tmp;
diff --git a/priv/guest_x86_defs.h b/priv/guest_x86_defs.h
index 47ce896..3dc34c8 100644
--- a/priv/guest_x86_defs.h
+++ b/priv/guest_x86_defs.h
@@ -139,9 +139,9 @@
/* --- 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/priv/guest_x86_helpers.c b/priv/guest_x86_helpers.c
index 1272fce..ef5e09e 100644
--- a/priv/guest_x86_helpers.c
+++ b/priv/guest_x86_helpers.c
@@ -1437,18 +1437,18 @@
/* 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/pub/libvex.h b/pub/libvex.h
index bde9656..442ca8f 100644
--- a/pub/libvex.h
+++ b/pub/libvex.h
@@ -366,7 +366,7 @@
(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 @@
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/switchback/switchback.c b/switchback/switchback.c
index deecc54..f3603d1 100644
--- a/switchback/switchback.c
+++ b/switchback/switchback.c
@@ -414,8 +414,8 @@
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 @@
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 @@
#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 @@
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 @@
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 @@
__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 @@
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 @@
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__)