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 $
*/
/********************* 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
.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 ***************************
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 $
*/
#include "vm/jit/stacktrace.h"
+/* global variables ***********************************************************/
+
+bool has_ext_instr_set = false; /* has instruction set extensions */
+
+
/* md_init *********************************************************************
Do some machine dependent initialization.
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
Changes:
- $Id: md.h 4357 2006-01-22 23:33:38Z twisti $
+ $Id: md.h 4392 2006-01-31 15:35:22Z twisti $
*/
#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_ */
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 $
*/
};
-#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
/*
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 $
*/
/* exported functions and variables *******************************************/
+ .globl asm_md_init
+
.globl asm_calljavafunction
.globl asm_calljavafunction_int
.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) *
Changes:
- $Id: md.c 4357 2006-01-22 23:33:38Z twisti $
+ $Id: md.c 4392 2006-01-31 15:35:22Z twisti $
*/
#include "vm/types.h"
#include "vm/global.h"
+#include "vm/jit/asmpart.h"
#include "vm/jit/codegen-common.h"
void md_init(void)
{
- /* nothing to do */
+ (void) asm_md_init();
}
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 $
*/
{
s4 i;
-#if defined(__ALPHA__)
- has_ext_instr_set = ! has_no_x_instr_set();
-#endif
-
for (i = 0; i < 256; i++)
stackreq[i] = 1;
Changes:
- $Id: options.c 4388 2006-01-30 15:44:52Z twisti $
+ $Id: options.c 4392 2006-01-31 15:35:22Z twisti $
*/
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;
Changes:
- $Id: options.h 4388 2006-01-30 15:44:52Z twisti $
+ $Id: options.h 4392 2006-01-31 15:35:22Z twisti $
*/
extern bool getloadingtime;
extern bool getcompilingtime;
-extern int has_ext_instr_set;
-
extern bool opt_stat;
extern bool opt_verify;
extern bool opt_eager;