From: Julian Seward Date: Tue, 17 Jan 2006 02:22:21 +0000 (+0000) Subject: ppc64-linux: set R2 before running __libc_freeres X-Git-Tag: svn/VALGRIND_3_2_0~374 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2f93c4272765f632969cadd0e9ee2cea8c2c3aca;p=thirdparty%2Fvalgrind.git ppc64-linux: set R2 before running __libc_freeres git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5537 --- diff --git a/coregrind/m_main.c b/coregrind/m_main.c index 8cd1e944f8..dcd9b69407 100644 --- a/coregrind/m_main.c +++ b/coregrind/m_main.c @@ -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*/