From 796cf99d71875c740f1d36046f8dff2aab5cbc3d Mon Sep 17 00:00:00 2001 From: Taylor R Campbell Date: Tue, 2 Nov 2010 01:41:18 +0000 Subject: [PATCH] Replace FPE_RESET_TRAPS by generic clear_float_exceptions. --- src/microcode/cmpauxmd/x86-64.m4 | 2 +- src/microcode/cmpintmd/i386.h | 1 - src/microcode/cmpintmd/x86-64.c | 2 +- src/microcode/cmpintmd/x86-64.h | 3 +-- src/microcode/floenv.c | 8 ++++++++ src/microcode/uxsig.c | 8 +++----- 6 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/microcode/cmpauxmd/x86-64.m4 b/src/microcode/cmpauxmd/x86-64.m4 index 8555d6a69..a943c0cbd 100644 --- a/src/microcode/cmpauxmd/x86-64.m4 +++ b/src/microcode/cmpauxmd/x86-64.m4 @@ -356,7 +356,7 @@ define_double(flonum_one,1.0) DECLARE_CODE_SEGMENT() declare_alignment(2) -define_c_label(x86_64_fpe_reset_traps) +define_c_label(x86_64_interface_initialize) OP(push,q) REG(rbp) OP(mov,q) TW(REG(rsp),REG(rbp)) OP(sub,q) TW(IMM(8),REG(rsp)) diff --git a/src/microcode/cmpintmd/i386.h b/src/microcode/cmpintmd/i386.h index f7ab66826..054cb0438 100644 --- a/src/microcode/cmpintmd/i386.h +++ b/src/microcode/cmpintmd/i386.h @@ -182,7 +182,6 @@ magic = ([TC_COMPILED_ENTRY | 0] - (offset + length_of_CALL_instruction)) */ #define ASM_RESET_HOOK i386_reset_hook -#define FPE_RESET_TRAPS i386_interface_initialize #define CMPINT_USE_STRUCS 1 diff --git a/src/microcode/cmpintmd/x86-64.c b/src/microcode/cmpintmd/x86-64.c index 8d5c3967a..02d541409 100644 --- a/src/microcode/cmpintmd/x86-64.c +++ b/src/microcode/cmpintmd/x86-64.c @@ -223,7 +223,7 @@ x86_64_reset_hook (void) int offset = (COMPILER_REGBLOCK_N_FIXED * (sizeof (SCHEME_OBJECT))); unsigned char * rsi_value = ((unsigned char *) Registers); - x86_64_fpe_reset_traps (); + x86_64_interface_initialize (); /* These must match machines/x86-64/lapgen.scm */ diff --git a/src/microcode/cmpintmd/x86-64.h b/src/microcode/cmpintmd/x86-64.h index 91c815f5a..787df1a33 100644 --- a/src/microcode/cmpintmd/x86-64.h +++ b/src/microcode/cmpintmd/x86-64.h @@ -117,7 +117,6 @@ entry 0 MOV AL,code 0xB0, code-byte */ #define ASM_RESET_HOOK x86_64_reset_hook -#define FPE_RESET_TRAPS x86_64_fpe_reset_traps #define CMPINT_USE_STRUCS 1 @@ -174,7 +173,7 @@ typedef byte_t insn_t; # define ASM_ENTRY_POINT(name) name #endif -extern void ASM_ENTRY_POINT (x86_64_fpe_reset_traps) (void); +extern void ASM_ENTRY_POINT (x86_64_interface_initialize) (void); extern void ASM_ENTRY_POINT (within_c_stack) (void (*) (void *), void *); extern void asm_assignment_trap (void); diff --git a/src/microcode/floenv.c b/src/microcode/floenv.c index 9d3978f55..ed08a506e 100644 --- a/src/microcode/floenv.c +++ b/src/microcode/floenv.c @@ -77,6 +77,14 @@ fixup_float_environment (void) #endif } +void +clear_float_exceptions (void) +{ +#ifdef HAVE_FECLEAREXCEPT + (void) feclearexcept (FE_ALL_EXCEPT); +#endif +} + /* FIXME: Alignment? */ static SCHEME_OBJECT diff --git a/src/microcode/uxsig.c b/src/microcode/uxsig.c index 743d2f765..b1fa4129f 100644 --- a/src/microcode/uxsig.c +++ b/src/microcode/uxsig.c @@ -541,15 +541,13 @@ DEFUN_STD_HANDLER (sighnd_terminate, ? (find_signal_name (signo)) : 0))) -#ifndef FPE_RESET_TRAPS -# define FPE_RESET_TRAPS() -#endif - #ifdef HAVE_SIGFPE +extern void clear_float_exceptions (void); + static DEFUN_STD_HANDLER (sighnd_fpe, { - FPE_RESET_TRAPS (); + clear_float_exceptions (); trap_handler ("floating-point exception", signo, info, scp); }) #endif -- 2.25.1