]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
ppc64-linux: set R2 before running __libc_freeres
authorJulian Seward <jseward@acm.org>
Tue, 17 Jan 2006 02:22:21 +0000 (02:22 +0000)
committerJulian Seward <jseward@acm.org>
Tue, 17 Jan 2006 02:22:21 +0000 (02:22 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5537

coregrind/m_main.c

index 8cd1e944f87074a22ad854b2114b7ed9037e0d58..dcd9b694078e4490c57f5245d5a708c3cc3cdaff 100644 (file)
@@ -2683,6 +2683,9 @@ void shutdown_actions_NORETURN( ThreadId tid,
 */
 static void final_tidyup(ThreadId tid)
 {
+#  if defined(VGP_ppc64_linux)
+   Addr r2;
+#  endif
    Addr __libc_freeres_wrapper = VG_(client___libc_freeres_wrapper);
 
    vg_assert(VG_(is_running_thread)(tid));
@@ -2692,6 +2695,17 @@ static void final_tidyup(ThreadId tid)
         0 == __libc_freeres_wrapper )
       return;                  /* can't/won't do it */
 
+#  if defined(VGP_ppc64_linux)
+   r2 = VG_(get_tocptr)( __libc_freeres_wrapper );
+   if (r2 == 0) {
+      VG_(message)(Vg_UserMsg, 
+                   "Caught __NR_exit, but can't run __libc_freeres()");
+      VG_(message)(Vg_UserMsg, 
+                   "   since cannot establish TOC pointer for it.");
+      return;
+   }
+#  endif
+
    if (VG_(clo_verbosity) > 2  ||
        VG_(clo_trace_syscalls) ||
        VG_(clo_trace_sched))
@@ -2704,6 +2718,9 @@ static void final_tidyup(ThreadId tid)
       directly.  However, we need to set R2 (the toc pointer)
       appropriately. */
    VG_(set_IP)(tid, __libc_freeres_wrapper);
+#  if defined(VGP_ppc64_linux)
+   VG_(threads)[tid].arch.vex.guest_GPR2 = r2;
+#  endif
 
    /* Block all blockable signals by copying the real block state into
       the thread's block state*/