From 7e32a18bc786322a2f3e87063d208469d3fa4d18 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Fri, 14 Dec 2007 19:54:36 +0000 Subject: [PATCH] Use the mc_fpformat field to determine the correct FP save/restore instructions to use. --- lib/libc_r/uthread/pthread_private.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/libc_r/uthread/pthread_private.h b/lib/libc_r/uthread/pthread_private.h index fc5ea9e035..9c386a08e1 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.13 2007/06/26 23:30:05 josepht Exp $ + * $DragonFly: src/lib/libc_r/uthread/pthread_private.h,v 1.14 2007/12/14 19:54:36 dillon Exp $ */ #ifndef _PTHREAD_PRIVATE_H @@ -80,12 +80,18 @@ #define FP_SAVE_UC(ucp) do { \ char *fdata; \ fdata = (char *) (ucp)->uc_mcontext.mc_fpregs; \ - __asm__("fnsave %0": :"m"(*fdata)); \ + 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; \ - __asm__("frstor %0": :"m"(*fdata)); \ + 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__) -- 2.41.0