]> git.proxmox.com Git - mirror_qemu.git/commitdiff
Solaris port (Ben Taylor)
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>
Tue, 25 Apr 2006 22:36:06 +0000 (22:36 +0000)
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>
Tue, 25 Apr 2006 22:36:06 +0000 (22:36 +0000)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1855 c046a42c-6fe2-441c-8c8c-71466251a162

Makefile.target
block.c
configure
dyngen-exec.h
fpu/softfloat-native.h
fpu/softfloat.h
slirp/slirp_config.h
slirp/socket.c
vl.c

index bbb755d2d61e0d75ecb53c71732b9b85e0fbdac0..031515346a38cdd28eb7b8af143e939b04483e75 100644 (file)
@@ -166,6 +166,9 @@ endif
 ifdef CONFIG_WIN32
 LIBS+=-lwinmm -lws2_32 -liphlpapi
 endif
+ifdef CONFIG_SOLARIS
+LIBS+=-lsocket -lnsl -lresolv
+endif
 
 # profiling code
 ifdef TARGET_GPROF
@@ -369,9 +372,11 @@ VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/i386-vl.ld
 endif
 ifndef CONFIG_DARWIN
 ifndef CONFIG_WIN32
+ifndef CONFIG_SOLARIS
 VL_LIBS=-lutil
 endif
 endif
+endif
 ifdef TARGET_GPROF
 vl.o: CFLAGS+=-p
 VL_LDFLAGS+=-p
diff --git a/block.c b/block.c
index 6924cee67d65f9c9006871664c232d869d16dadd..b9081671862f580ec245cf202fbf8040565ead8e 100644 (file)
--- a/block.c
+++ b/block.c
 #include <CoreFoundation/CoreFoundation.h>
 #endif
 
+#ifdef __sun__
+#include <sys/dkio.h>
+#endif
+
 static BlockDriverState *bdrv_first;
 static BlockDriver *first_drv;
 
@@ -648,7 +652,6 @@ void bdrv_info(void)
     }
 }
 
-
 /**************************************************************/
 /* RAW block driver */
 
@@ -669,6 +672,10 @@ static int raw_open(BlockDriverState *bs, const char *filename)
 #ifdef _BSD
     struct stat sb;
 #endif
+#ifdef __sun__
+    struct dk_minfo minfo;
+    int rv;
+#endif
 
     fd = open(filename, O_RDWR | O_BINARY | O_LARGEFILE);
     if (fd < 0) {
@@ -688,6 +695,17 @@ static int raw_open(BlockDriverState *bs, const char *filename)
         size = lseek(fd, 0LL, SEEK_END);
 #endif
     } else
+#endif
+#ifdef __sun__
+    /*
+     * use the DKIOCGMEDIAINFO ioctl to read the size.
+     */
+    rv = ioctl ( fd, DKIOCGMEDIAINFO, &minfo );
+    if ( rv != -1 ) {
+        size = minfo.dki_lbsize * minfo.dki_capacity;
+    } else /* there are reports that lseek on some devices
+              fails, but irc discussion said that contingency
+              on contingency was overkill */
 #endif
     {
         size = lseek(fd, 0, SEEK_END);
index 120e03d7b80c19ba8387ff2809b6276c47835df3..cae6f6ea9864479f64ebfbe22f7b7fd9f544eae9 100755 (executable)
--- a/configure
+++ b/configure
@@ -125,6 +125,9 @@ Darwin)
 bsd="yes"
 darwin="yes"
 ;;
+SunOS)
+solaris="yes"
+;;
 *)
 oss="yes"
 linux="yes"
@@ -141,6 +144,15 @@ if [ "$bsd" = "yes" ] ; then
   fi
 fi
 
+if [ "$solaris" = "yes" ] ; then
+    make="gmake"
+    install="ginstall"
+    solarisrev=`uname -r | cut -f2 -d.`
+    if test $solarisrev -lt 10 ; then
+      presolaris10="yes"
+    fi
+fi
+
 # find source path
 source_path=`dirname "$0"`
 if [ -z "$source_path" ]; then
@@ -299,6 +311,57 @@ if test "$mingw32" = "yes" ; then
     fi
 fi
 
+#
+# Solaris specific configure tool chain decisions
+#
+if test "$solaris" = "yes" ; then
+  #
+  # gcc for solaris 10/fcs in /usr/sfw/bin doesn't compile qemu correctly
+  # override the check with --disable-gcc-check
+  # 
+  if test "$solarisrev" -eq 10 -a "$check_gcc" = "yes" ; then
+    solgcc=`which $cc`
+    if test "$solgcc" = "/usr/sfw/bin/gcc" ; then
+      echo "Solaris 10/FCS gcc in /usr/sfw/bin will not compiled qemu correctly."
+      echo "please get gcc-3.4.3 or later, from www.blastwave.org using pkg-get -i gcc3"
+      echo "or get the latest patch from SunSolve for gcc"
+      exit 1
+    fi
+  fi
+  solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
+  if test -z "$solinst" ; then
+    echo "Solaris install program not found. Use --install=/usr/ucb/install or"
+    echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
+    echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
+    exit 1
+  fi
+  if test "$solinst" = "/usr/sbin/install" ; then
+    echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
+    echo "try ginstall from the GNU fileutils available from www.blastwave.org"
+    echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
+    exit 1
+  fi
+  soltexi2html=`which texi2html 2> /dev/null | /usr/bin/grep -v "no texi2html in"`
+  if test -z "$soltexi2html" ; then
+    echo "Error: No path includes texi2html."
+    if test -f /usr/sfw/bin/texi2html ; then
+      echo "Add /usr/sfw/bin to your path and rerun configure"
+    else
+      echo "Add the directory holding the texi2html to your path and rerun configure"
+    fi
+    exit 1
+  fi
+  sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
+  if test -z "$sol_ar" ; then
+    echo "Error: No path includes ar"
+    if test -f /usr/ccs/bin/ar ; then
+      echo "Add /usr/ccs/bin to your path and rerun configure"
+    fi
+    exit 1
+  fi
+fi 
+
+
 if test -z "$target_list" ; then
 # these targets are portable
     if [ "$softmmu" = "yes" ] ; then
@@ -585,6 +648,12 @@ if test "$darwin" = "yes" ; then
   echo "CONFIG_DARWIN=yes" >> $config_mak
   echo "#define CONFIG_DARWIN 1" >> $config_h
 fi
+if test "$solaris" = "yes" ; then
+  echo "CONFIG_SOLARIS=yes" >> $config_mak
+  if test "$presolaris10" = "yes" ; then
+    echo "#define _PRESOLARIS10 1" >> $config_h
+  fi
+fi
 if test "$gdbstub" = "yes" ; then
   echo "CONFIG_GDBSTUB=yes" >> $config_mak
   echo "#define CONFIG_GDBSTUB 1" >> $config_h
@@ -690,7 +759,12 @@ if test "$target_user_only" = "no" ; then
   mkdir -p $target_dir/slirp
 fi
 
-ln -sf $source_path/Makefile.target $target_dir/Makefile
+#
+# don't use ln -sf as not all "ln -sf" over write the file/link
+#
+rm -f $target_dir/Makefile
+ln -s $source_path/Makefile.target $target_dir/Makefile
+
 
 echo "# Automatically generated by configure - do not modify" > $config_mak
 echo "/* Automatically generated by configure - do not modify */" > $config_h
@@ -802,8 +876,10 @@ if test "$source_path_used" = "yes" ; then
     for dir in $DIRS ; do
             mkdir -p $dir
     done
+    # remove the link and recreate it, as not all "ln -sf" overwrite the link
     for f in $FILES ; do
-        ln -sf $source_path/$f $f
+        rm -f $f
+        ln -s $source_path/$f $f
     done
 fi
 
index 946347d6c70e1c7ffdac23b6027dadcb0bcbe57c..6952c3a2c8a3f4f414c97df3af62adb84ba7bbc5 100644 (file)
 #if !defined(__DYNGEN_EXEC_H__)
 #define __DYNGEN_EXEC_H__
 
+/* prevent Solaris from trying to typedef FILE in gcc's
+   include/floatingpoint.h which will conflict with the
+   definition down below */
+#ifdef __sun__
+#define _FILEDEFED
+#endif
+
 /* NOTE: standard headers should be used with special care at this
    point because host CPU registers are used as global variables. Some
    host headers do not allow that. */
@@ -35,7 +42,12 @@ typedef unsigned long uint64_t;
 typedef unsigned long long uint64_t;
 #endif
 
+/* if Solaris/__sun__, don't typedef int8_t, as it will be typedef'd
+   prior to this and will cause an error in compliation, conflicting
+   with /usr/include/sys/int_types.h, line 75 */
+#ifndef __sun__
 typedef signed char int8_t;
+#endif
 typedef signed short int16_t;
 typedef signed int int32_t;
 #if defined (__x86_64__) || defined(__ia64)
@@ -231,6 +243,8 @@ extern int __op_jmp0, __op_jmp1, __op_jmp2, __op_jmp3;
 #ifdef __sparc__
 #define EXIT_TB() asm volatile ("jmpl %i0 + 8, %g0\n" \
                                 "nop")
+#define        GOTO_LABEL_PARAM(n) asm volatile ( \
+               "set " ASM_NAME(__op_gen_label) #n ", %g1; jmp %g1; nop")
 #endif
 #ifdef __arm__
 #define EXIT_TB() asm volatile ("b exec_loop")
index 9017ea582fbabefd0fbbb8fcfac70bd751f6979d..6f3b6a98a1e64f8603100c8ee06e35ec04780943 100644 (file)
@@ -3,8 +3,11 @@
 #if defined(_BSD) && !defined(__APPLE__)
 #include <ieeefp.h>
 #else
+#if !defined(_PRESOLARIS10)
 #include <fenv.h>
 #endif
+#endif
+#include "gnu-c99-math.h"
 
 typedef float float32;
 typedef double float64;
index 666d6a017fd62cdb89139d252bdfa7c5992d039b..fdc80f32dbd79e2d0ba31d5120ea3141d9c01c35 100644 (file)
@@ -177,7 +177,7 @@ void set_floatx80_rounding_precision(int val STATUS_PARAM);
 | Routine to raise any or all of the software IEC/IEEE floating-point
 | exception flags.
 *----------------------------------------------------------------------------*/
-void float_raise( signed char STATUS_PARAM);
+void float_raise( int8 flags STATUS_PARAM);
 
 /*----------------------------------------------------------------------------
 | Software IEC/IEEE integer-to-floating-point conversion routines.
index a0795ef6b5ac7923d2f2f0555c3c6125e4b679cb..e7e95dd5a0119c20c05f8f46442aa3064496e8c3 100644 (file)
 
 /* Define if you don't have u_int32_t etc. typedef'd */
 #undef NEED_TYPEDEFS
+#ifdef __sun__
+#define NEED_TYPEDEFS
+#endif
 
 /* Define to sizeof(char) */
 #define SIZEOF_CHAR 1
index fbd9e960d7d0d7304ebde7e88aecb45f39c8c6fc..ce6528fc45822d43fb95ab9a874b7747d44f679d 100644 (file)
@@ -9,6 +9,9 @@
 #include <slirp.h>
 #include "ip_icmp.h"
 #include "main.h"
+#ifdef __sun__
+#include <sys/filio.h>
+#endif
 
 void
 so_init()
diff --git a/vl.c b/vl.c
index 3b83ed2f2d51a9002b22100659d2718b7ecead52..8b6b33ce95683a8e033e7576d8c276e650322e21 100644 (file)
--- a/vl.c
+++ b/vl.c
@@ -47,6 +47,7 @@
 #include <libutil.h>
 #endif
 #else
+#ifndef __sun__
 #include <linux/if.h>
 #include <linux/if_tun.h>
 #include <pty.h>
@@ -55,6 +56,7 @@
 #include <linux/ppdev.h>
 #endif
 #endif
+#endif
 
 #if defined(CONFIG_SLIRP)
 #include "libslirp.h"
@@ -2531,6 +2533,12 @@ static int tap_open(char *ifname, int ifname_size)
     fcntl(fd, F_SETFL, O_NONBLOCK);
     return fd;
 }
+#elif defined(__sun__)
+static int tap_open(char *ifname, int ifname_size)
+{
+    fprintf(stderr, "warning: tap_open not yet implemented\n");
+    return -1;
+}
 #else
 static int tap_open(char *ifname, int ifname_size)
 {