Do not initialize the floating-point environment in x86-64 assembly.
authorMatt Birkholz <puck@birchwood-abbey.net>
Tue, 5 Jan 2016 23:07:22 +0000 (16:07 -0700)
committerMatt Birkholz <puck@birchwood-abbey.net>
Tue, 5 Jan 2016 23:07:22 +0000 (16:07 -0700)
The floating-point environment is managed (and needs to be
initialized) by libc.

src/microcode/cmpauxmd/x86-64.m4
src/microcode/cmpintmd/x86-64.c
src/microcode/cmpintmd/x86-64.h

index 4d58c5e25990cd29d1b9ade42d46b1a97e2fa3cb..fb2929452f83e92a7c31d0745f380a1aeef418f1 100644 (file)
@@ -315,14 +315,6 @@ define(REGBLOCK_VAL,16)
 define(REGBLOCK_COMPILER_TEMP,32)
 define(REGBLOCK_DLINK,REGBLOCK_COMPILER_TEMP)
 
-# Define the floating-point processor control word.  Always set
-# round-to-even and double precision.  Under Win32, mask all
-# exceptions.  Under unix and OS/2, mask only the inexact result
-# exception.
-ifdef(`WIN32',
-      `define(FP_CONTROL_WORD,HEX(023f))',
-      `define(FP_CONTROL_WORD,HEX(0220))')
-
 define(regs,REG(rsi))
 define(rfree,REG(rdi))
 define(rmask,REG(rbp))
@@ -356,24 +348,6 @@ define_double(flonum_one,1.0)
 DECLARE_CODE_SEGMENT()
 declare_alignment(2)
 
-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))
-       stmxcsr         IND(REG(rsp))
-       # Clear 7 (invalid operation mask)
-       #       8 (denormalized operand mask)
-       #       9 (zero-divide exception mask)
-       #       10 (overflow exception mask)
-       #       11 (underflow exception mask)
-       #       15 (flush-to-zero (if set, gives non-IEEE semantics))
-       OP(and,l)       TW(IMM(HEX(ffff707f)),IND(REG(rsp)))
-       # Set   12 (precision exception mask)
-       OP(or,l)        TW(IMM(HEX(1000)),IND(REG(rsp)))
-       ldmxcsr         IND(REG(rsp))
-       leave
-       ret
-
 # Call a function (rdi) with an argument (rsi) and a stack pointer and
 # frame pointer from inside C.  When it returns, restore the original
 # stack pointer.  This kludge is necessary for operating system
@@ -1002,22 +976,22 @@ define_c_label(x87_trap_exceptions)
 
 define_c_label(x87_read_control_word)
        enter           IMM(4),IMM(0)
-       fnstcw          IND(REG(esp))
-       OP(mov,w)       TW(IND(REG(esp)),REG(ax))
+       fnstcw          IND(REG(rsp))
+       OP(mov,w)       TW(IND(REG(rsp)),REG(ax))
        leave
        ret
 
 define_c_label(x87_write_control_word)
        enter           IMM(4),IMM(0)
        OP(mov,w)       TW(REG(di),IND(REG(rsp)))
-       fldcw           IND(REG(esp))
+       fldcw           IND(REG(rsp))
        leave
        ret
 
 define_c_label(x87_read_status_word)
        enter           IMM(4),IMM(0)
-       fnstsw          IND(REG(esp))
-       OP(mov,w)       TW(IND(REG(esp)),REG(ax))
+       fnstsw          IND(REG(rsp))
+       OP(mov,w)       TW(IND(REG(rsp)),REG(ax))
        leave
        ret
 
index 03e39fe1ef1bc43bd287a21c90369be31568bf02..3641679465d593cb6d025d0af9b5509b4a7bb08b 100644 (file)
@@ -224,8 +224,6 @@ x86_64_reset_hook (void)
   int offset = (COMPILER_REGBLOCK_N_FIXED * (sizeof (SCHEME_OBJECT)));
   unsigned char * rsi_value = ((unsigned char *) Registers);
 
-  x86_64_interface_initialize ();
-
   /* These must match machines/x86-64/lapgen.scm */
 
   SETUP_REGISTER (asm_scheme_to_interface);            /* 0 */
index 46bde9d2bc5deb2574cc9b17b4150f5887641d87..f0faf23e31bb7153f750c83a9648bbfec22bb2fb 100644 (file)
@@ -174,7 +174,6 @@ typedef byte_t insn_t;
 #  define ASM_ENTRY_POINT(name) name
 #endif
 
-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);