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
This commit is contained in:
Florian Krohm 2015-01-04 17:20:19 +00:00
parent eeed23ac5a
commit 70ce1338ee
7 changed files with 29 additions and 28 deletions

View File

@ -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 );

View File

@ -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 );
}

View File

@ -514,7 +514,7 @@ IRSB* bb_to_IR (
that do.
*/
{
Addr64 base2check;
Addr base2check;
UInt len2check;
HWord expectedhW;
IRTemp tistart_tmp, tilen_tmp;

View File

@ -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* );

View File

@ -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 );
}

View File

@ -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;
}

View File

@ -414,8 +414,8 @@ void switchback ( void )
UInt* p = (UInt*)(&copy[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__)