From: twisti Date: Tue, 31 Jan 2006 15:35:22 +0000 (+0000) Subject: Fixes Debian bug #350729 X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=commitdiff_plain;h=18153e3207bc92d216b640f053645bf7d29e0658;p=cacao.git Fixes Debian bug #350729 * src/vm/jit/i386/asmpart.S (asm_md_init): Added, puts the FPU to 64-bit precision mode. * src/vm/jit/i386/md.c (md_init): Call asm_md_init. * src/vm/jit/asmpart.h (asm_md_init): Added. (has_no_x_instr_set): Removed. * src/vm/options.c, src/vm/options.h (has_ext_instr_set): Removed. * src/vm/jit/jit.c (jit_init): Removed has_no_x_instr_set call. * src/vm/jit/alpha/asmpart.S (has_no_x_instr_set): Renamed to asm_md_init. * src/vm/jit/alpha/md.c (has_ext_instr_set): Added. (md_init): Call asm_md_init. * src/vm/jit/alpha/md.h (has_ext_instr_set): Added. --- diff --git a/src/vm/jit/alpha/asmpart.S b/src/vm/jit/alpha/asmpart.S index 9255cc8b0..6689f6896 100644 --- a/src/vm/jit/alpha/asmpart.S +++ b/src/vm/jit/alpha/asmpart.S @@ -30,7 +30,7 @@ Changes: Joseph Wenninger Christian Thalinger - $Id: asmpart.S 4357 2006-01-22 23:33:38Z twisti $ + $Id: asmpart.S 4392 2006-01-31 15:35:22Z twisti $ */ @@ -52,8 +52,9 @@ /********************* exported functions and variables ***********************/ + .globl asm_md_init + .globl asm_sync_instruction_cache - .globl has_no_x_instr_set .globl asm_calljavafunction .globl asm_calljavafunction_int @@ -91,20 +92,24 @@ asm_sync_instruction_cache: .end asm_sync_instruction_cache -/*********************** function has_no_x_instr_set *************************** -* * -* determines if the byte support instruction set (21164a and higher) * -* is available. * -* * + +/* asm_md_init ***************************************************************** + + Initialize machine dependent stuff. + + Determines if the byte support instruction set (21164a and higher) + is available. + *******************************************************************************/ - .ent has_no_x_instr_set -has_no_x_instr_set: + .ent asm_md_init + +asm_md_init: - .long 0x47e03c20 /* amask 1,v0 */ - jmp zero,(ra) /* return */ + .long 0x47e03c20 /* amask 1,v0 */ + jmp zero,(ra) /* return */ - .end has_no_x_instr_set + .end asm_md_init /********************* function asm_calljavafunction *************************** diff --git a/src/vm/jit/alpha/md.c b/src/vm/jit/alpha/md.c index dce3afd55..cdd5fea5b 100644 --- a/src/vm/jit/alpha/md.c +++ b/src/vm/jit/alpha/md.c @@ -30,7 +30,7 @@ Changes: Joseph Wenninger Christian Thalinger - $Id: md.c 4357 2006-01-22 23:33:38Z twisti $ + $Id: md.c 4392 2006-01-31 15:35:22Z twisti $ */ @@ -57,6 +57,11 @@ extern void ieee_set_fp_control(unsigned long fp_control); #include "vm/jit/stacktrace.h" +/* global variables ***********************************************************/ + +bool has_ext_instr_set = false; /* has instruction set extensions */ + + /* md_init ********************************************************************* Do some machine dependent initialization. @@ -65,7 +70,9 @@ extern void ieee_set_fp_control(unsigned long fp_control); void md_init(void) { - /* XXX TWISTI: do we really need this? fptest's seem to work fine */ + /* check for extended instruction set */ + + has_ext_instr_set = !asm_md_init(); #if defined(__LINUX__) /* Linux on Digital Alpha needs an initialisation of the ieee diff --git a/src/vm/jit/alpha/md.h b/src/vm/jit/alpha/md.h index 804cf3ecf..80200715f 100644 --- a/src/vm/jit/alpha/md.h +++ b/src/vm/jit/alpha/md.h @@ -28,7 +28,7 @@ Changes: - $Id: md.h 4357 2006-01-22 23:33:38Z twisti $ + $Id: md.h 4392 2006-01-31 15:35:22Z twisti $ */ @@ -36,6 +36,14 @@ #ifndef _MD_H #define _MD_H +#include "config.h" +#include "vm/global.h" + + +/* global variables ***********************************************************/ + +extern bool has_ext_instr_set; + /* function prototypes ********************************************************/ #endif /* _MD_H_ */ diff --git a/src/vm/jit/asmpart.h b/src/vm/jit/asmpart.h index 23936504c..97172917e 100644 --- a/src/vm/jit/asmpart.h +++ b/src/vm/jit/asmpart.h @@ -29,7 +29,7 @@ Changes: Christian Thalinger - $Id: asmpart.h 4357 2006-01-22 23:33:38Z twisti $ + $Id: asmpart.h 4392 2006-01-31 15:35:22Z twisti $ */ @@ -224,14 +224,12 @@ struct castinfo { }; -#if defined(__ALPHA__) -/* - determines if the byte support instruction set (21164a and higher) - is available. -*/ -int has_no_x_instr_set(void); +/* function prototypes ********************************************************/ + +/* machine dependent initialization */ +s4 asm_md_init(void); + void asm_sync_instruction_cache(void); -#endif /* diff --git a/src/vm/jit/i386/asmpart.S b/src/vm/jit/i386/asmpart.S index f90743898..63c23d53a 100644 --- a/src/vm/jit/i386/asmpart.S +++ b/src/vm/jit/i386/asmpart.S @@ -30,7 +30,7 @@ Changes: Joseph Wenninger - $Id: asmpart.S 4357 2006-01-22 23:33:38Z twisti $ + $Id: asmpart.S 4392 2006-01-31 15:35:22Z twisti $ */ @@ -50,6 +50,8 @@ /* exported functions and variables *******************************************/ + .globl asm_md_init + .globl asm_calljavafunction .globl asm_calljavafunction_int @@ -77,6 +79,33 @@ .globl asm_getclassvalues_atomic +/* asm_md_init ***************************************************************** + + Initialize machine dependent stuff. + + See: http://www.srware.com/linux_numerics.txt + + This puts the X86 FPU in 64-bit precision mode. The default under + Linux is to use 80-bit mode, which produces subtle differences from + FreeBSD and other systems, eg, (int)(1000*atof("0.3")) is 300 in + 64-bit mode, 299 in 80-bit mode. + + Fixes: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=350729 + +*******************************************************************************/ + +asm_md_init: + sub $4,sp /* allocate space for the FPU state */ + fnstcw (sp) /* get the FPU state */ + mov (sp),%eax + and $0xfcff,%ax /* remove the extended mode flag */ + or $0x0200,%ax /* put the double mode flag */ + mov %eax,(sp) /* store new FPU state */ + fldcw (sp) /* setup new FPU state */ + add $4,sp + ret + + /********************* function asm_calljavafunction *************************** * * * This function calls a Java-method (which possibly needs compilation) * diff --git a/src/vm/jit/i386/md.c b/src/vm/jit/i386/md.c index cd50dbd61..a9fcf7c54 100644 --- a/src/vm/jit/i386/md.c +++ b/src/vm/jit/i386/md.c @@ -28,7 +28,7 @@ Changes: - $Id: md.c 4357 2006-01-22 23:33:38Z twisti $ + $Id: md.c 4392 2006-01-31 15:35:22Z twisti $ */ @@ -37,6 +37,7 @@ #include "vm/types.h" #include "vm/global.h" +#include "vm/jit/asmpart.h" #include "vm/jit/codegen-common.h" @@ -48,7 +49,7 @@ void md_init(void) { - /* nothing to do */ + (void) asm_md_init(); } diff --git a/src/vm/jit/jit.c b/src/vm/jit/jit.c index 0b145d6c3..2f6ae6364 100644 --- a/src/vm/jit/jit.c +++ b/src/vm/jit/jit.c @@ -31,7 +31,7 @@ Christian Thalinger Christian Ullrich - $Id: jit.c 4381 2006-01-28 14:18:06Z twisti $ + $Id: jit.c 4392 2006-01-31 15:35:22Z twisti $ */ @@ -1203,10 +1203,6 @@ void jit_init(void) { s4 i; -#if defined(__ALPHA__) - has_ext_instr_set = ! has_no_x_instr_set(); -#endif - for (i = 0; i < 256; i++) stackreq[i] = 1; diff --git a/src/vm/options.c b/src/vm/options.c index c56d464af..90b602dc0 100644 --- a/src/vm/options.c +++ b/src/vm/options.c @@ -28,7 +28,7 @@ Changes: - $Id: options.c 4388 2006-01-30 15:44:52Z twisti $ + $Id: options.c 4392 2006-01-31 15:35:22Z twisti $ */ @@ -104,8 +104,6 @@ bool makeinitializations = true; bool getloadingtime = false; /* to measure the runtime */ bool getcompilingtime = false; /* compute compile time */ -int has_ext_instr_set = 0; /* has instruction set extensions */ - bool opt_stat = false; bool opt_verify = true; /* true if classfiles should be verified */ bool opt_eager = false; diff --git a/src/vm/options.h b/src/vm/options.h index 75cbd09d1..e6a2605fd 100644 --- a/src/vm/options.h +++ b/src/vm/options.h @@ -28,7 +28,7 @@ Changes: - $Id: options.h 4388 2006-01-30 15:44:52Z twisti $ + $Id: options.h 4392 2006-01-31 15:35:22Z twisti $ */ @@ -118,8 +118,6 @@ extern bool makeinitializations; extern bool getloadingtime; extern bool getcompilingtime; -extern int has_ext_instr_set; - extern bool opt_stat; extern bool opt_verify; extern bool opt_eager;