drd: Refactor functions for starting / stopping to access stack memory

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12331
This commit is contained in:
Bart Van Assche 2012-01-15 19:08:13 +00:00
parent f374300062
commit d953fbfc3c

View File

@ -453,14 +453,19 @@ void drd_start_using_mem_w_perms(const Addr a, const SizeT len,
* the addresses in range [ a, a + len [ may now be used by the client.
* Assumption: stacks grow downward.
*/
static __inline__
void drd_start_using_mem_stack2(const DrdThreadId tid, const Addr a,
const SizeT len)
{
DRD_(thread_set_stack_min)(tid, a - VG_STACK_REDZONE_SZB);
drd_start_using_mem(a - VG_STACK_REDZONE_SZB, len + VG_STACK_REDZONE_SZB,
True);
}
static __inline__
void drd_start_using_mem_stack(const Addr a, const SizeT len)
{
DRD_(thread_set_stack_min)(DRD_(thread_get_running_tid)(),
a - VG_STACK_REDZONE_SZB);
drd_start_using_mem(a - VG_STACK_REDZONE_SZB,
len + VG_STACK_REDZONE_SZB,
True);
drd_start_using_mem_stack2(DRD_(thread_get_running_tid)(), a, len);
}
/**
@ -469,14 +474,20 @@ void drd_start_using_mem_stack(const Addr a, const SizeT len)
* Assumption: stacks grow downward.
*/
static __inline__
void drd_stop_using_mem_stack(const Addr a, const SizeT len)
void drd_stop_using_mem_stack2(const DrdThreadId tid, const Addr a,
const SizeT len)
{
DRD_(thread_set_stack_min)(DRD_(thread_get_running_tid)(),
a + len - VG_STACK_REDZONE_SZB);
DRD_(thread_set_stack_min)(tid, a + len - VG_STACK_REDZONE_SZB);
drd_stop_using_mem(a - VG_STACK_REDZONE_SZB, len + VG_STACK_REDZONE_SZB,
True);
}
static __inline__
void drd_stop_using_mem_stack(const Addr a, const SizeT len)
{
drd_stop_using_mem_stack2(DRD_(thread_get_running_tid)(), a, len);
}
static
Bool on_alt_stack(const Addr a)
{