Skip to contentSkip to conversation

PATCH: Solaris softfloat

Qemu-devel Ben Taylor 1 participant 1 message Apr 28, 2006

lore
Share & tools
lore

Ben Taylor

author
#0 lore raw

This is an updated patch to modify configure and files in the fpu directory to allow qemu to compile on Solaris. This patch has been extensively tested with Solaris 10 on X86 and Solaris 9 on Sparc.

configure +1 -6
diff -ruN qemu/configure qemu-solaris/configure
@@ -148,9 +148,6 @@
     make="gmake"
     install="ginstall"
     solarisrev=`uname -r | cut -f2 -d.`
-    if test $solarisrev -lt 10 ; then
-      presolaris10="yes"
-    fi
 fi
 
 # find source path
@@ -640,9 +637,7 @@
 fi
 if test "$solaris" = "yes" ; then
   echo "CONFIG_SOLARIS=yes" >> $config_mak
-  if test "$presolaris10" = "yes" ; then
-    echo "#define _PRESOLARIS10 1" >> $config_h
-  fi
+  echo "#define SOLARISREV $solarisrev" >> $config_h
 fi
 if test "$gdbstub" = "yes" ; then
   echo "CONFIG_GDBSTUB=yes" >> $config_mak
fpu/softfloat-native.c +9 -4
diff -ruN qemu/fpu/softfloat-native.c qemu-solaris/fpu/softfloat-native.c
@@ -6,7 +6,7 @@
 void set_float_rounding_mode(int val STATUS_PARAM)
 {
     STATUS(float_rounding_mode) = val;
-#if defined(_BSD) && !defined(__APPLE__)
+#if defined(_BSD) && !defined(__APPLE__) || defined(SOLARISREV) && SOLARISREV < 10
     fpsetround(val);
 #elif defined(__arm__)
     /* nothing to do */
@@ -22,9 +22,14 @@
 }
 #endif
 
-#if defined(_BSD)
-#define lrint(d)		((long)rint(d))
-#define llrint(d)		((long long)rint(d))
+#if defined(_BSD) || defined(SOLARISREV) && SOLARISREV < 10
+#define lrint(d)		((int32_t)rint(d))
+#define llrint(d)		((int64_t)rint(d))
+#define lrintf(f)		((int32_t)rint(f))
+#define llrintf(f)		((int64_t)rint(f))
+#define sqrtf(f)		((float)sqrt(f))
+#define remainderf(fa, fb)	((float)remainder(fa, fb))
+#define rintf(f)		((float)rint(f))
 #endif
 
 #if defined(__powerpc__)
fpu/softfloat-native.h +55 -2

68 lines not on this page · raw message

fpu/softfloat-specialize.h +1 -1
diff -ruN qemu/fpu/softfloat-specialize.h qemu-solaris/fpu/softfloat-specialize.h
@@ -43,7 +43,7 @@
 | should be simply `float_exception_flags |= flags;'.
 *----------------------------------------------------------------------------*/
 
-void float_raise( int8 flags STATUS_PARAM )
+void float_raise( signed char flags STATUS_PARAM )
 {
 
     STATUS(float_exception_flags) |= flags;
fpu/softfloat.h +6 -2
diff -ruN qemu/fpu/softfloat.h qemu-solaris/fpu/softfloat.h
@@ -84,9 +84,13 @@
 #define FLOAT128
 #else
 /* native float support */
-#if (defined(__i386__) || defined(__x86_64__)) && !defined(_BSD)
+#if defined(__i386__) || defined(__x86_64__)
+#if defined(_BSD) || (defined(SOLARISREV) && SOLARISREV < 10)
+/* BSD & old SunOS releases have incomplete native long double support */
+#else
 #define FLOATX80
 #endif
+#endif /* __i386__ || __x86_64__ */
 #endif /* !CONFIG_SOFTFLOAT */
 
 #define STATUS_PARAM , float_status *status
@@ -177,7 +181,7 @@
 | Routine to raise any or all of the software IEC/IEEE floating-point
 | exception flags.
 *----------------------------------------------------------------------------*/
-void float_raise( int8 flags STATUS_PARAM);
+void float_raise( signed char flags STATUS_PARAM);
 
 /*----------------------------------------------------------------------------
 | Software IEC/IEEE integer-to-floating-point conversion routines.