From 2d170746c771db2eaea7b26f037bd2a7e3ad66bb Mon Sep 17 00:00:00 2001 From: Daniel Eischen Date: Sat, 22 Dec 2001 06:11:06 +0000 Subject: [PATCH] Use the real function address (instead of function address + 8) for the return address when modifying a jmp_buf to create a new thread context. Also set t12 with the return address. This should fix libc_r on alpha. With much detective work by: Bernd Walter --- lib/libc_r/uthread/pthread_private.h | 4 ++-- lib/libkse/thread/thr_private.h | 4 ++-- lib/libpthread/thread/thr_private.h | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/libc_r/uthread/pthread_private.h b/lib/libc_r/uthread/pthread_private.h index b60d8b7aed9..65661f7c7ba 100644 --- a/lib/libc_r/uthread/pthread_private.h +++ b/lib/libc_r/uthread/pthread_private.h @@ -96,8 +96,8 @@ #define FP_SAVE_UC(ucp) #define FP_RESTORE_UC(ucp) #define SET_RETURN_ADDR_JB(jb, ra) do { \ - (jb)[0]._jb[2] = (unsigned long)(ra) + 8UL; \ - (jb)[0]._jb[R_RA + 4] = 0; \ + (jb)[0]._jb[2] = (long)(ra); \ + (jb)[0]._jb[R_RA + 4] = (long)(ra); \ (jb)[0]._jb[R_T12 + 4] = (long)(ra); \ } while (0) #else diff --git a/lib/libkse/thread/thr_private.h b/lib/libkse/thread/thr_private.h index b60d8b7aed9..65661f7c7ba 100644 --- a/lib/libkse/thread/thr_private.h +++ b/lib/libkse/thread/thr_private.h @@ -96,8 +96,8 @@ #define FP_SAVE_UC(ucp) #define FP_RESTORE_UC(ucp) #define SET_RETURN_ADDR_JB(jb, ra) do { \ - (jb)[0]._jb[2] = (unsigned long)(ra) + 8UL; \ - (jb)[0]._jb[R_RA + 4] = 0; \ + (jb)[0]._jb[2] = (long)(ra); \ + (jb)[0]._jb[R_RA + 4] = (long)(ra); \ (jb)[0]._jb[R_T12 + 4] = (long)(ra); \ } while (0) #else diff --git a/lib/libpthread/thread/thr_private.h b/lib/libpthread/thread/thr_private.h index b60d8b7aed9..65661f7c7ba 100644 --- a/lib/libpthread/thread/thr_private.h +++ b/lib/libpthread/thread/thr_private.h @@ -96,8 +96,8 @@ #define FP_SAVE_UC(ucp) #define FP_RESTORE_UC(ucp) #define SET_RETURN_ADDR_JB(jb, ra) do { \ - (jb)[0]._jb[2] = (unsigned long)(ra) + 8UL; \ - (jb)[0]._jb[R_RA + 4] = 0; \ + (jb)[0]._jb[2] = (long)(ra); \ + (jb)[0]._jb[R_RA + 4] = (long)(ra); \ (jb)[0]._jb[R_T12 + 4] = (long)(ra); \ } while (0) #else