From cf2ae7e3a0e8731270f6cb97fd7fcf8b1b23dca6 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Fri, 14 Dec 2007 20:07:59 +0000 Subject: [PATCH] FP registers are now saved and restored by the kernel, remove the save/restore code entirely. --- lib/libc_r/uthread/pthread_private.h | 18 +----------------- lib/libc_r/uthread/uthread_kern.c | 8 +++----- 2 files changed, 4 insertions(+), 22 deletions(-) diff --git a/lib/libc_r/uthread/pthread_private.h b/lib/libc_r/uthread/pthread_private.h index 9c386a08e1..b4ef11554f 100644 --- a/lib/libc_r/uthread/pthread_private.h +++ b/lib/libc_r/uthread/pthread_private.h @@ -32,7 +32,7 @@ * Private thread definitions for the uthread kernel. * * $FreeBSD: src/lib/libc_r/uthread/pthread_private.h,v 1.36.2.21 2002/10/22 14:44:02 fjoe Exp $ - * $DragonFly: src/lib/libc_r/uthread/pthread_private.h,v 1.14 2007/12/14 19:54:36 dillon Exp $ + * $DragonFly: src/lib/libc_r/uthread/pthread_private.h,v 1.15 2007/12/14 20:07:59 dillon Exp $ */ #ifndef _PTHREAD_PRIVATE_H @@ -77,22 +77,6 @@ #define SET_STACK_JB(jb, stk) (jb)[0]._jb[2] = (int)(stk) #define SET_STACK_SJB(sjb, stk) (sjb)[0]._sjb[2] = (int)(stk) #define SET_STACK_UC(ucp, stk) (ucp)->uc_mcontext.mc_esp = (int)(stk) -#define FP_SAVE_UC(ucp) do { \ - char *fdata; \ - fdata = (char *) (ucp)->uc_mcontext.mc_fpregs; \ - if ((ucp)->uc_mcontext.mc_fpformat == _MC_FPFMT_XMM) \ - __asm__("fxsave %0": :"m"(*fdata)); \ - else if ((ucp)->uc_mcontext.mc_fpformat == _MC_FPFMT_387) \ - __asm__("fnsave %0": :"m"(*fdata)); \ -} while (0) -#define FP_RESTORE_UC(ucp) do { \ - char *fdata; \ - fdata = (char *) (ucp)->uc_mcontext.mc_fpregs; \ - if ((ucp)->uc_mcontext.mc_fpformat == _MC_FPFMT_XMM) \ - __asm__("fxrstor %0": :"m"(*fdata)); \ - else if ((ucp)->uc_mcontext.mc_fpformat == _MC_FPFMT_387) \ - __asm__("frstor %0": :"m"(*fdata)); \ -} while (0) #define SET_RETURN_ADDR_JB(jb, ra) (jb)[0]._jb[0] = (int)(ra) #elif defined(__amd64__) #define GET_STACK_JB(jb) ((unsigned long)((jb)[0]._jb[2])) diff --git a/lib/libc_r/uthread/uthread_kern.c b/lib/libc_r/uthread/uthread_kern.c index 5d602589c7..ff59dabb97 100644 --- a/lib/libc_r/uthread/uthread_kern.c +++ b/lib/libc_r/uthread/uthread_kern.c @@ -30,7 +30,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/lib/libc_r/uthread/uthread_kern.c,v 1.28.2.13 2002/10/22 14:44:03 fjoe Exp $ - * $DragonFly: src/lib/libc_r/uthread/uthread_kern.c,v 1.6 2007/01/08 21:41:53 dillon Exp $ + * $DragonFly: src/lib/libc_r/uthread/uthread_kern.c,v 1.7 2007/12/14 20:07:59 dillon Exp $ * */ #include @@ -114,8 +114,7 @@ _thread_kern_sched(ucontext_t *ucp) /* Check if this function was called from the signal handler: */ if (ucp != NULL) { - /* XXX - Save FP registers? */ - FP_SAVE_UC(ucp); + /* FP registers now saved and restored by kernel */ called_from_handler = 1; DBG_MSG("Entering scheduler due to signal\n"); } @@ -157,8 +156,7 @@ _thread_kern_sched(ucontext_t *ucp) if (ucp == NULL) return; else { - /* XXX - Restore FP registers? */ - FP_RESTORE_UC(ucp); + /* NOTE: FP registers now saved and restored by kernel*/ /* * Set the process signal mask in the context; it -- 2.41.0