]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
drd: Refactor functions for starting / stopping to access stack memory
authorBart Van Assche <bvanassche@acm.org>
Sun, 15 Jan 2012 19:08:13 +0000 (19:08 +0000)
committerBart Van Assche <bvanassche@acm.org>
Sun, 15 Jan 2012 19:08:13 +0000 (19:08 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12331

drd/drd_main.c

index 789d495ee0788a1287fd62b41b2793870c13c2bf..5889f4ca8922e6d283dee19b9e9a86a8f44ec02e 100644 (file)
@@ -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)
 {