From: Bart Van Assche Date: Sun, 15 Jan 2012 19:08:13 +0000 (+0000) Subject: drd: Refactor functions for starting / stopping to access stack memory X-Git-Tag: svn/VALGRIND_3_8_0~522 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d953fbfc3cb5bfc68694a764233f441ce207b9f5;p=thirdparty%2Fvalgrind.git drd: Refactor functions for starting / stopping to access stack memory git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12331 --- diff --git a/drd/drd_main.c b/drd/drd_main.c index 789d495ee0..5889f4ca89 100644 --- a/drd/drd_main.c +++ b/drd/drd_main.c @@ -454,29 +454,40 @@ void drd_start_using_mem_w_perms(const Addr a, const SizeT len, * Assumption: stacks grow downward. */ static __inline__ -void drd_start_using_mem_stack(const Addr a, const SizeT len) +void drd_start_using_mem_stack2(const DrdThreadId tid, 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, + 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_start_using_mem_stack2(DRD_(thread_get_running_tid)(), a, len); +} + /** * Called by the core when the stack of a thread shrinks, to indicate that * the addresses [ a, a + len [ are no longer accessible for the client. * 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) {