Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FZRnu-0003oN-My for qemu-devel@nongnu.org; Fri, 28 Apr 2006 08:10:35 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FZRns-0003nB-NA for Qemu-devel@nongnu.org; Fri, 28 Apr 2006 08:10:33 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FZRns-0003n7-6C for Qemu-devel@nongnu.org; Fri, 28 Apr 2006 08:10:32 -0400 Received: from [68.230.240.38] (helo=eastrmmtao01.cox.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FZRqz-0004mY-2x for Qemu-devel@nongnu.org; Fri, 28 Apr 2006 08:13:45 -0400 Received: from eastrmwml05.mgt.cox.net ([172.18.52.68]) by eastrmmtao01.cox.net (InterMail vM.6.01.06.01 201-2131-130-101-20060113) with ESMTP id <20060428121029.CVSG17255.eastrmmtao01.cox.net@eastrmwml05.mgt.cox.net> for ; Fri, 28 Apr 2006 08:10:29 -0400 Message-ID: <26475224.1146226229682.JavaMail.root@eastrmwml05.mgt.cox.net> Date: Fri, 28 Apr 2006 8:10:29 -0400 From: Ben Taylor MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_7029_7715880.1146226229650" Subject: [Qemu-devel] PATCH: Solaris softfloat Reply-To: sol10x86@cox.net, qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Qemu-devel@nongnu.org ------=_Part_7029_7715880.1146226229650 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit 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. ------=_Part_7029_7715880.1146226229650 Content-Type: text/x-patch; name=softfloat-solaris.diff Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=softfloat-solaris.diff diff -ruN qemu/configure qemu-solaris/configure --- qemu/configure 2006-04-27 17:05:14.000000000 -0400 +++ qemu-solaris/configure 2006-04-28 07:52:21.895715000 -0400 @@ -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 diff -ruN qemu/fpu/softfloat-native.c qemu-solaris/fpu/softfloat-native.c --- qemu/fpu/softfloat-native.c 2006-04-23 18:59:41.000000000 -0400 +++ qemu-solaris/fpu/softfloat-native.c 2006-04-27 21:18:27.310303000 -0400 @@ -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__) diff -ruN qemu/fpu/softfloat-native.h qemu-solaris/fpu/softfloat-native.h --- qemu/fpu/softfloat-native.h 2006-04-26 11:55:55.000000000 -0400 +++ qemu-solaris/fpu/softfloat-native.h 2006-04-27 20:43:17.851525000 -0400 @@ -1,13 +1,66 @@ /* Native implementation of soft float functions */ #include -#if defined(_BSD) && !defined(__APPLE__) + +/* + * include if __sun__ or ( *BSD and not APPLE) + */ +#if defined(__sun__) || ( defined(_BSD) && !defined(__APPLE__)) #include +#endif + +/* + * include if ( APPLE and not *BSD ), including + * Solaris systems OS greater than 9 + */ +#if !defined(_BSD) || defined(__APPLE__) +/* + * define some things needed to compile qemu on Solaris 8/9 + * since is not available those versions of Solaris. + */ +#if defined(SOLARISREV) && SOLARISREV < 10 +#define FE_TONEAREST 0 +#define FE_DOWNWARD 1 +#define FE_UPWARD 2 +#define FE_TOWARDZERO 3 +#define fabsf(f)((float)fabs(f)) +/* + * Rounding modes + */ +#define fesetround fpsetround +#define fegetround fpgetround #else -#if !defined(_PRESOLARIS10) #include #endif #endif + +#if defined(__sun__) +/* + * Define some C99-7.12.3 classification macros and + * some C99-.12.4 for Solaris systems OS less than 10, + * or Solaris 10 systems running GCC 3.x or less. + * Solaris 10 with GCC4 does not need these macros as they + * are defined in with a compiler directive + */ +#if ( SOLARISREV <= 9 ) || ( ( SOLARISREV >= 10 ) && (__GNUC__ <= 4) ) +/* + * C99 7.12.3 classification macros + * and + * C99 7.12.14 comparison macros + * + * ... do not work on Solaris 10 using GNU CC 3.4.x. + * Try to workaround the missing / broken C99 math macros. + */ + +#define isnormal(x) (fpclass(x) >= FP_NZERO) +#define isgreater(x, y) ((!unordered(x, y)) && ((x) > (y))) +#define isgreaterequal(x, y) ((!unordered(x, y)) && ((x) >= (y))) +#define isless(x, y) ((!unordered(x, y)) && ((x) < (y))) +#define islessequal(x, y) ((!unordered(x, y)) && ((x) <= (y))) +#define isunordered(x,y) unordered(x, y) +#endif +#endif + typedef float float32; typedef double float64; #ifdef FLOATX80 diff -ruN qemu/fpu/softfloat-specialize.h qemu-solaris/fpu/softfloat-specialize.h --- qemu/fpu/softfloat-specialize.h 2005-03-13 11:54:06.000000000 -0500 +++ qemu-solaris/fpu/softfloat-specialize.h 2006-04-27 21:19:06.064954000 -0400 @@ -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; diff -ruN qemu/fpu/softfloat.h qemu-solaris/fpu/softfloat.h --- qemu/fpu/softfloat.h 2006-04-25 18:36:06.000000000 -0400 +++ qemu-solaris/fpu/softfloat.h 2006-04-28 01:45:49.042857000 -0400 @@ -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. ------=_Part_7029_7715880.1146226229650--