Bug 538339 In fpehandler() mask cw and back to the faulting x87 instruction on Solaris r=gal,bsmedberg

This commit is contained in:
Ginn Chen 2010-01-13 17:04:52 +08:00
Родитель b6988efcdf
Коммит bfd7862ee6
2 изменённых файлов: 28 добавлений и 1 удалений

Просмотреть файл

@ -64,6 +64,7 @@
#if defined(SOLARIS)
#include <sys/resource.h>
#include <ucontext.h>
#endif
#ifdef XP_BEOS
@ -259,6 +260,32 @@ static void fpehandler(int signum, siginfo_t *si, void *context)
*mxcsr &= ~SSE_STATUS_FLAGS; /* clear all pending SSE exceptions */
#endif
#endif
#ifdef SOLARIS
ucontext_t *uc = (ucontext_t *)context;
#if defined(__i386)
uint32_t *cw = &uc->uc_mcontext.fpregs.fp_reg_set.fpchip_state.state[0];
*cw |= FPU_EXCEPTION_MASK;
uint32_t *sw = &uc->uc_mcontext.fpregs.fp_reg_set.fpchip_state.state[1];
*sw &= ~FPU_STATUS_FLAGS;
/* address of the instruction that caused the exception */
uint32_t *ip = &uc->uc_mcontext.fpregs.fp_reg_set.fpchip_state.state[3];
uc->uc_mcontext.gregs[REG_PC] = *ip;
#endif
#if defined(__amd64__)
uint16_t *cw = &uc->uc_mcontext.fpregs.fp_reg_set.fpchip_state.cw;
*cw |= FPU_EXCEPTION_MASK;
uint16_t *sw = &uc->uc_mcontext.fpregs.fp_reg_set.fpchip_state.sw;
*sw &= ~FPU_STATUS_FLAGS;
uint32_t *mxcsr = &uc->uc_mcontext.fpregs.fp_reg_set.fpchip_state.mxcsr;
*mxcsr |= SSE_EXCEPTION_MASK; /* disable all SSE exceptions */
*mxcsr &= ~SSE_STATUS_FLAGS; /* clear all pending SSE exceptions */
#endif
#endif
}
void InstallSignalHandlers(const char *ProgramName)

Просмотреть файл

@ -36,7 +36,7 @@
*
* ***** END LICENSE BLOCK ***** */
#if defined(_M_IX86) || defined(__i386__) || defined(__amd64__)
#if defined(_M_IX86) || defined(__i386__) || defined(__i386) || defined(__amd64__)
/*
* x87 FPU Control Word: