From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HXNMY-0004a2-V4 for qemu-devel@nongnu.org; Fri, 30 Mar 2007 16:06:18 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HXNMW-0004Zq-O3 for qemu-devel@nongnu.org; Fri, 30 Mar 2007 16:06:17 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HXNMW-0004Zn-HS for qemu-devel@nongnu.org; Fri, 30 Mar 2007 15:06:16 -0500 Received: from eastrmmtao101.cox.net ([68.230.240.7]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1HXNJm-00044y-Ro for qemu-devel@nongnu.org; Fri, 30 Mar 2007 16:03:27 -0400 Message-ID: <9767711.1175285005315.JavaMail.root@eastrmwml05.mgt.cox.net> Date: Fri, 30 Mar 2007 16:03:25 -0400 From: Ben Taylor MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_5792_6746605.1175285005289" Subject: [Qemu-devel] PATCH: Solaris 9/x86 support 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 Cc: qemu-discuss@opensolaris.org ------=_Part_5792_6746605.1175285005289 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit This patch helps solaris 9/x86 (and likely Solaris 8/x86, but I don't have a machine or cycles to test this, and would only require a small configure fix) compile and run qemu. The basic difference required for Solaris 9/x86 vs Solaris 9/Sparc is that the libm in Solaris sparc is already mostly C99 feature rich or supports compatible calls. More than likely, the "delay" of Solaris 9/x86 in 2002 probably contributed to the pretty large disparity between Solaris 9/Sparc and Solaris 9/x86's libm. Using the libsunmath library from the free Sun Studio 11 download, qemu now runs on Solaris 9/x86. Not only that, it also will run with kqemu thanks again to Juergen Keil. (Juergen also has patches in the kqemu code for solaris 8/x86 as well, and has tested them. As above, I have not tested Solaris 8/x86) The kqemu source tree will be posted to the qemu project on www.opensolaris.org, until the patches can be added to wherever CVS or Subversion home kqemu finds. Ben ------=_Part_5792_6746605.1175285005289 Content-Type: application/octet-stream; name=qemu-s9x86-diff Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=qemu-s9x86-diff diff -ruN qemu.ORIG/Makefile.target qemu/Makefile.target --- qemu.ORIG/Makefile.target 2007-03-20 11:45:27.000000000 -0500 +++ qemu/Makefile.target 2007-03-30 13:52:20.002413000 -0500 @@ -197,6 +197,12 @@ endif ifdef CONFIG_SOLARIS LIBS+=-lsocket -lnsl -lresolv +ifdef NEEDS_LIBSUNMATH +LIBS+=-lsunmath +LDFLAGS+=-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib +OP_CFLAGS+=-I/opt/SUNWspro/prod/include/cc +BASE_CFLAGS+=-I/opt/SUNWspro/prod/include/cc +endif endif # profiling code diff -ruN qemu.ORIG/configure qemu/configure --- qemu.ORIG/configure 2007-03-25 15:55:00.000000000 -0500 +++ qemu/configure 2007-03-30 15:05:30.735581000 -0500 @@ -136,9 +136,21 @@ solaris="yes" make="gmake" install="ginstall" + needs_libsunmath="no" solarisrev=`uname -r | cut -f2 -d.` if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then - if test "$solarisrev" -ge 10 ; then + if test "$solarisrev" -le 9 ; then + if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then + needs_libsunmath="yes" + else + echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without" + echo "libsunmath from the Sun Studio compilers tools, due to a lack of" + echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86" + echo "Studio 11 can be downloaded from www.sun.com." + exit 1 + fi + fi + if test "$solarisrev" -ge 9 ; then kqemu="yes" fi fi @@ -721,6 +733,10 @@ if test "$solaris" = "yes" ; then echo "CONFIG_SOLARIS=yes" >> $config_mak echo "#define HOST_SOLARIS $solarisrev" >> $config_h + if test "$needs_libsunmath" = "yes" ; then + echo "NEEDS_LIBSUNMATH=yes" >> $config_mak + echo "#define NEEDS_LIBSUNMATH 1" >> $config_h + fi fi if test "$gdbstub" = "yes" ; then echo "CONFIG_GDBSTUB=yes" >> $config_mak diff -ruN qemu.ORIG/fpu/softfloat-native.c qemu/fpu/softfloat-native.c --- qemu.ORIG/fpu/softfloat-native.c 2007-03-20 17:10:42.000000000 -0500 +++ qemu/fpu/softfloat-native.c 2007-03-30 00:15:22.010808000 -0500 @@ -30,6 +30,25 @@ #define sqrtf(f) ((float)sqrt(f)) #define remainderf(fa, fb) ((float)remainder(fa, fb)) #define rintf(f) ((float)rint(f)) +#if !defined(__sparc__) && HOST_SOLARIS < 10 +extern long double rintl(long double); +extern long double scalbnl(long double, int); + +long long +llrintl(long double x) { + return ((long long) rintl(x)); +} + +long +lrintl(long double x) { + return ((long) rintl(x)); +} + +long double +ldexpl(long double x, int n) { + return (scalbnl(x, n)); +} +#endif #endif #if defined(__powerpc__) diff -ruN qemu.ORIG/fpu/softfloat.h qemu/fpu/softfloat.h --- qemu.ORIG/fpu/softfloat.h 2007-03-20 17:10:42.000000000 -0500 +++ qemu/fpu/softfloat.h 2007-03-30 13:24:32.259027000 -0500 @@ -32,6 +32,10 @@ #ifndef SOFTFLOAT_H #define SOFTFLOAT_H +#if defined(HOST_SOLARIS) && defined(NEEDS_LIBSUNMATH) +#include +#endif + #include #include "config.h" ------=_Part_5792_6746605.1175285005289--