Skip to contentSkip to conversation

Patch: java problems, llrint() macro truncates result to 32-bit [was: 0.60 Solaris 9 problems.]

Qemu-devel Juergen Keil 1 participant 1 message Sep 14, 2004

lore
Share & tools
lore
#0 lore raw
Quoted 8 lines
Quoted 5 lines

The java virtual machine included in Solaris x86
does not work
for me. When I start "java", I get:

Sounds like It'll be some time before I start worrying about a lack of JVM.

Reason for the java VM crash was a buggy llrint() macro in target-i386/exec.h, it was truncating the result to a 32-bit value, on "_BSD" platforms.

(I'm using the _BSD code on the Solaris platform)

The following patch fixes the problem:

Index: target-i386/exec.h
===================================================================
RCS file: /cvsroot/qemu/qemu/target-i386/exec.h,v
retrieving revision 1.14

exec.h 14 Sep 2004 13:38:34 -0000 renamed from exec.h 5 Jul 2004 21:25:17 -0000 1.14 +2 -2
diff -u -B -r1.14 exec.h
@@ -310,12 +314,12 @@
 #define rint rintl
 #endif
 
 #if !defined(_BSD)
 extern int lrint(CPU86_LDouble x);
 extern int64_t llrint(CPU86_LDouble x);
 #else
-#define lrint(d)               ((int)rint(d))
-#define llrint(d)              ((int)rint(d))
+#define lrint(d)               ((long)rint(d))
+#define llrint(d)              ((long long)rint(d))
 #endif
 extern CPU86_LDouble fabs(CPU86_LDouble x);
 extern CPU86_LDouble sin(CPU86_LDouble x);