|
From: Stephen M.
|
>>>>> "NJN" == Nicholas Nethercote <nj...@cs...> writes:
NJN> So every register has a 32-bit shadow, regardless of its size?
NJN> In that case, specifying the absolute shadow guest state size
NJN> might be better than specifying a multiplier.
I've now put together a revised patch including the changes we
discussed. The tool interface now looks like:
/* How much space, in bytes, should be allocated for shadow data
describing the guest program's registers? */
extern void VG_(details_shadow_guest_sizeB)( Int size );
/* How much space, in bytes, does it take to store the registers of
the guest program's architecture? Often, the argument to
details_shadow_guest_sizeB is a multiple of this. */
extern Int VG_(get_guest_sizeB)(void);
The default is an empty shadow guest area, so the standard tools other
than Memcheck don't need to be changed at all. To get the same amount
of space it's used in the past, Memcheck does:
VG_(details_shadow_guest_sizeB)(VG_(get_guest_sizeB)());
Notes on the interface:
* I put the order of the ThreadArchState structure back to the way it
was, so that the shadow guest area still starts right after the
regular guest area. This means that the spill are is now no longer
at a fixed offset, and the size of the shadow area needs to get
passed to Vex.
* To implement get_guest_sizeB(), I added an interface to Vex to make
the GuestLayout available at any time, not just as a parameter to
the translate function.
* Since Valgrind delivers signals synchronously, I think it's safe to
call VG_(arena_malloc/free) in the signal frame setup code, so I
used that to allocate the saved shadow guest state.
This patch compiles and passes "make regtest" on the two platforms I
can test on here, Debian Etch/x86 and Debian Etch/amd64. I've also
made the corresponding changes to the PPC code, but can't test them.
Besides the standard tools, I've also tested the code with one of mine
that uses
VG_(details_shadow_guest_sizeB)(9 * VG_(get_guest_sizeB)());
and it also works as expected.
As before, I've split the patch into Valgrind-proper and Vex-specific
parts:
http://people.csail.mit.edu/smcc/valgrind-patches/guest-resize-try2-vg.patch
http://people.csail.mit.edu/smcc/valgrind-patches/guest-resize-try2-vex.patch
-- Stephen
|