qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Ben Taylor <sol10x86@cox.net>
To: qemu-devel@nongnu.org
Cc: qemu-discuss@opensolaris.org
Subject: [Qemu-devel] PATCH: Solaris 9/x86 support
Date: Fri, 30 Mar 2007 16:03:25 -0400	[thread overview]
Message-ID: <9767711.1175285005315.JavaMail.root@eastrmwml05.mgt.cox.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 979 bytes --]


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

[-- Attachment #2: qemu-s9x86-diff --]
[-- Type: application/octet-stream, Size: 3069 bytes --]

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 <sunmath.h>
+#endif
+
 #include <inttypes.h>
 #include "config.h"
 

                 reply	other threads:[~2007-03-30 20:06 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9767711.1175285005315.JavaMail.root@eastrmwml05.mgt.cox.net \
    --to=sol10x86@cox.net \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-discuss@opensolaris.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).