From: Matt Birkholz Date: Tue, 5 Jan 2016 23:07:22 +0000 (-0700) Subject: Do not initialize the floating-point environment in x86-64 assembly. X-Git-Tag: mit-scheme-pucked-9.2.12~376^2~3 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=5d11e546936e36ce016960eda750ed569829cb88;p=mit-scheme.git Do not initialize the floating-point environment in x86-64 assembly. The floating-point environment is managed (and needs to be initialized) by libc. --- diff --git a/src/microcode/cmpauxmd/x86-64.m4 b/src/microcode/cmpauxmd/x86-64.m4 index 4d58c5e25..fb2929452 100644 --- a/src/microcode/cmpauxmd/x86-64.m4 +++ b/src/microcode/cmpauxmd/x86-64.m4 @@ -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 diff --git a/src/microcode/cmpintmd/x86-64.c b/src/microcode/cmpintmd/x86-64.c index 03e39fe1e..364167946 100644 --- a/src/microcode/cmpintmd/x86-64.c +++ b/src/microcode/cmpintmd/x86-64.c @@ -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 */ diff --git a/src/microcode/cmpintmd/x86-64.h b/src/microcode/cmpintmd/x86-64.h index 46bde9d2b..f0faf23e3 100644 --- a/src/microcode/cmpintmd/x86-64.h +++ b/src/microcode/cmpintmd/x86-64.h @@ -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);