qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] Patch to compile qemu-cvs under Solaris
@ 2006-04-13 19:02 Ben Taylor
  0 siblings, 0 replies; 2+ messages in thread
From: Ben Taylor @ 2006-04-13 19:02 UTC (permalink / raw)
  To: Qemu-devel

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

I've been too busy the last 8 months or so to do much with
qemu, but I finally just went back to basics and re-ported
my 0.6.2/0.7.0 patches with the minimal amount of changes
to get it working under Solaris 10/Solaris express and
the latest qemu-cvs (last night).

Other than the change to configure to use /bin/bash instead
of /bin/sh (solaris's /bin/sh really is /bin/sh, not bash),
the included changes are able to boot my Win98SE image that
runs under the blastwave version of qemu (precompiled 
qemu for Solaris).

I've got some other changes, but I wanted to get these 
patches into the qemu before the next release.

Comments? 

Ben

[-- Attachment #2: qemu-snapshot-2006-04-12_23-solaris.patch --]
[-- Type: application/octet-stream, Size: 21475 bytes --]

diff -ruN qemu-snapshot-2006-04-12_23/Makefile qemu-snapshot-2006-04-12_23.solaris/Makefile
--- qemu-snapshot-2006-04-12_23/Makefile	2006-04-09 16:47:35.000000000 -0400
+++ qemu-snapshot-2006-04-12_23.solaris/Makefile	2006-04-13 13:26:46.000000000 -0400
@@ -4,6 +4,9 @@
 ifdef CONFIG_DARWIN
 CFLAGS+= -mdynamic-no-pic
 endif
+ifdef _PRESOLARIS10
+CFLAGS+= -D_PRESOLARIS10
+endif
 LDFLAGS=-g
 LIBS=
 DEFINES+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
@@ -45,20 +48,20 @@
 
 install: all 
 	mkdir -p "$(DESTDIR)$(bindir)"
-	install -m 755 -s $(TOOLS) "$(DESTDIR)$(bindir)"
+	$(INSTALL) -m 755 -s $(TOOLS) "$(DESTDIR)$(bindir)"
 	mkdir -p "$(DESTDIR)$(datadir)"
-	install -m 644 pc-bios/bios.bin pc-bios/vgabios.bin \
+	$(INSTALL) -m 644 pc-bios/bios.bin pc-bios/vgabios.bin \
                        pc-bios/vgabios-cirrus.bin \
                        pc-bios/ppc_rom.bin pc-bios/video.x \
                        pc-bios/proll.elf \
                        pc-bios/linux_boot.bin "$(DESTDIR)$(datadir)"
 	mkdir -p "$(DESTDIR)$(docdir)"
-	install -m 644 qemu-doc.html  qemu-tech.html "$(DESTDIR)$(docdir)"
+	$(INSTALL) -m 644 qemu-doc.html  qemu-tech.html "$(DESTDIR)$(docdir)"
 ifndef CONFIG_WIN32
 	mkdir -p "$(DESTDIR)$(mandir)/man1"
-	install qemu.1 qemu-img.1 "$(DESTDIR)$(mandir)/man1"
+	$(INSTALL) qemu.1 qemu-img.1 "$(DESTDIR)$(mandir)/man1"
 	mkdir -p "$(DESTDIR)$(datadir)/keymaps"
-	install -m 644 $(addprefix keymaps/,$(KEYMAPS)) "$(DESTDIR)$(datadir)/keymaps"
+	$(INSTALL) -m 644 $(addprefix keymaps/,$(KEYMAPS)) "$(DESTDIR)$(datadir)/keymaps"
 endif
 	for d in $(TARGET_DIRS); do \
 	$(MAKE) -C $$d $@ || exit 1 ; \
diff -ruN qemu-snapshot-2006-04-12_23/Makefile.target qemu-snapshot-2006-04-12_23.solaris/Makefile.target
--- qemu-snapshot-2006-04-12_23/Makefile.target	2006-04-09 16:47:35.000000000 -0400
+++ qemu-snapshot-2006-04-12_23.solaris/Makefile.target	2006-04-13 13:27:33.000000000 -0400
@@ -109,7 +109,11 @@
 ifeq ($(ARCH),sparc)
 CFLAGS+=-m32 -ffixed-g1 -ffixed-g2 -ffixed-g3 -ffixed-g6
 LDFLAGS+=-m32
+ifeq ($(HAVE_GCC3_OPTIONS),yes)
+OP_CFLAGS=$(CFLAGS) -fno-delayed-branch -ffixed-i0 -fno-omit-frame-pointer
+else
 OP_CFLAGS=$(CFLAGS) -fno-delayed-branch -ffixed-i0
+endif
 HELPER_CFLAGS=$(CFLAGS) -ffixed-i0 -mflat
 # -static is used to avoid g1/g3 usage by the dynamic linker
 LDFLAGS+=-Wl,-T,$(SRC_PATH)/sparc.ld -static
@@ -118,8 +122,12 @@
 ifeq ($(ARCH),sparc64)
 CFLAGS+=-m64 -ffixed-g1 -ffixed-g2 -ffixed-g3 -ffixed-g6
 LDFLAGS+=-m64
+ifeq ($(HAVE_GCC3_OPTIONS),yes)
+OP_CFLAGS=$(CFLAGS) -fno-delayed-branch -ffixed-i0 -fno-omit-frame-pointer
+else
 OP_CFLAGS=$(CFLAGS) -fno-delayed-branch -ffixed-i0
 endif
+endif
 
 ifeq ($(ARCH),alpha)
 # -msmall-data is not used because we want two-instruction relocations
@@ -166,6 +174,12 @@
 ifdef CONFIG_WIN32
 LIBS+=-lwinmm -lws2_32 -liphlpapi
 endif
+ifdef CONFIG_SOLARIS
+LIBS+=-lsocket -lnsl -lresolv
+ifdef _PRESOLARIS10
+CFLAGS+=-D_PRESOLARIS10
+endif
+endif
 
 # profiling code
 ifdef TARGET_GPROF
@@ -283,6 +297,11 @@
 endif
 ifdef CONFIG_OSS
 AUDIODRV += ossaudio.o
+ifdef CONFIG_SOLARIS
+ifdef CONFIG_OSS_INC
+audio.o ossaudio.o: DEFINES := -I$(CONFIG_OSS_INC) $(DEFINES)
+endif
+endif
 endif
 ifdef CONFIG_COREAUDIO
 AUDIODRV += coreaudio.o
@@ -373,9 +392,11 @@
 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
@@ -470,7 +491,7 @@
 
 install: all 
 ifneq ($(PROGS),)
-	install -m 755 -s $(PROGS) "$(DESTDIR)$(bindir)"
+	$(INSTALL) -m 755 -s $(PROGS) "$(DESTDIR)$(bindir)"
 endif
 
 ifneq ($(wildcard .depend),)
diff -ruN qemu-snapshot-2006-04-12_23/block.c qemu-snapshot-2006-04-12_23.solaris/block.c
--- qemu-snapshot-2006-04-12_23/block.c	2005-12-18 13:28:15.000000000 -0500
+++ qemu-snapshot-2006-04-12_23.solaris/block.c	2006-04-13 13:28:56.000000000 -0400
@@ -648,6 +648,33 @@
     }
 }
 
+#ifdef __sun__
+static int64_t
+raw_find_device_size(int fd)
+{
+    char buf[512];
+    uint64_t low, high, mid;
+
+    /* we already know that the real capacity is at least one sector */
+    low = high = 1;
+
+    /* find an upper limit for the device size */
+    while (pread(fd, buf, 512, high*512) == 512) {
+	low = high;
+	high <<= 1;
+    }
+
+    /* find the real device size using a binary search */
+    while (low < high) {
+	mid = (low + high) >> 1;
+	if (pread(fd, buf, 512, mid*512) == 512)
+	    low = mid + 1;
+	else
+	    high = mid;
+    }
+    return low*512;
+}
+#endif
 
 /**************************************************************/
 /* RAW block driver */
@@ -698,6 +725,29 @@
     if (size == -1)
         size = LONG_LONG_MAX;
 #endif
+
+#ifdef __sun__
+    /*
+     * the solaris 9 character device /vol/dev/aliases/cdrom0 refuses to 
+     * seek to the end of the device and stays at seek offset 0. So we 
+     * have to work a bit harder to find out the real device size in this
+     * special case.
+     */
+    {
+	char buf[512];
+	struct stat stb;
+
+	/*
+	 * is it a character device, and did lseek lie about the seek offset
+	 * for the end of file position?
+	 */
+	if (size == 0 && fstat(fd, &stb) == 0 && S_ISCHR(stb.st_mode)
+	    && read(fd, buf, sizeof(buf)) == sizeof(buf)) {
+	    size = raw_find_device_size(fd);
+	}
+    }
+
+#endif
     bs->total_sectors = size / 512;
     s->fd = fd;
     return 0;
diff -ruN qemu-snapshot-2006-04-12_23/bswap.h qemu-snapshot-2006-04-12_23.solaris/bswap.h
--- qemu-snapshot-2006-04-12_23/bswap.h	2004-10-10 11:44:19.000000000 -0400
+++ qemu-snapshot-2006-04-12_23.solaris/bswap.h	2006-04-13 13:29:19.000000000 -0400
@@ -27,6 +27,20 @@
 		(((uint32_t)(__x) & (uint32_t)0xff000000UL) >> 24) )); \
 })
 
+#ifdef __sun__
+
+#define	bswap_64(x) \
+({ \
+	uint64_t __x = (x); \
+	uint32_t __hi = __x >> 32; \
+	uint32_t __lo = __x; \
+	__hi = bswap_32(__hi); \
+	__lo = bswap_32(__lo); \
+	(uint64_t)__lo << 32 | __hi; \
+})
+
+#else
+
 #define bswap_64(x) \
 ({ \
 	uint64_t __x = (x); \
@@ -41,6 +55,8 @@
 		(uint64_t)(((uint64_t)(__x) & (uint64_t)0xff00000000000000ULL) >> 56) )); \
 })
 
+#endif
+
 #endif /* !HAVE_BYTESWAP_H */
 
 static inline uint16_t bswap16(uint16_t x)
diff -ruN qemu-snapshot-2006-04-12_23/configure qemu-snapshot-2006-04-12_23.solaris/configure
--- qemu-snapshot-2006-04-12_23/configure	2006-04-08 10:26:41.000000000 -0400
+++ qemu-snapshot-2006-04-12_23.solaris/configure	2006-04-13 13:30:00.000000000 -0400
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 #
 # qemu configure script (c) 2003 Fabrice Bellard
 #
@@ -25,6 +25,7 @@
 host_cc="gcc"
 ar="ar"
 make="make"
+install="install"
 strip="strip"
 cpu=`uname -m`
 target_list=""
@@ -50,7 +51,7 @@
   s390)
     cpu="s390"
   ;;
-  sparc)
+  sparc|sun4m|sun4u)
     cpu="sparc"
   ;;
   sparc64)
@@ -122,6 +123,9 @@
 bsd="yes"
 darwin="yes"
 ;;
+SunOS)
+solaris="yes"
+;;
 *)
 oss="yes"
 linux="yes"
@@ -133,11 +137,20 @@
 esac
 
 if [ "$bsd" = "yes" ] ; then
-  if [ ! "$darwin" = "yes" ] ; then
+  if [ "$darwin" != "yes" ] ; then
     make="gmake"
   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
 # XXX: we assume an absolute path is given when launching configure,
 # except in './configure' case.
@@ -167,6 +180,8 @@
   ;;
   --make=*) make=`echo $opt | cut -d '=' -f 2`
   ;;
+  --install=*) install=`echo $opt | cut -d '=' -f 2`
+  ;;
   --extra-cflags=*) CFLAGS="${opt#--extra-cflags=}"
   ;;
   --extra-ldflags=*) LDFLAGS="${opt#--extra-ldflags=}"
@@ -207,6 +222,21 @@
   ;;
   --enable-cocoa) cocoa="yes" ; coreaudio="yes" ; sdl="no"
   ;;
+  --with-oss=*) oss="${opt#--with-oss=}"
+    case $oss in
+      yes|y|YES|Y) oss="yes";;
+      *) oss="no";;
+    esac
+  ;;
+  --oss-inc=*) oss_inc=${opt#--oss-inc=}
+    if test ! -d "$oss_inc" || ! test -f "$oss_inc/sys/soundcard.h" ; then
+      oss_inc=""
+      echo "Could not find $oss_inc/sys/soundcard.h.  Disabling OSS"
+      if test "$solaris" = "yes" ; then
+          oss=no;
+      fi
+    fi
+  ;;
   --disable-gfx-check) check_gfx="no"
   ;;
   --disable-gcc-check) check_gcc="no"
@@ -284,6 +314,47 @@
     fi
 fi
 
+if test "$solaris" = "yes" ; then
+  #solaris gcc for solaris 10 in /usr/sfw/bin doesn't compile qemu correctly
+  if test -z "$presolaris10" ; then
+    solgcc=`which $cc`
+    if test "$solgcc" = "/usr/sfw/bin/gcc" ; then 
+      echo "Solaris 10 gcc in /usr/sfw/bin will not compiled qemu correctly."
+      echo "please get gcc-3.4.3 from www.blastwave.org using pkg-get -i gcc3"
+      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"
+    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
@@ -442,6 +513,7 @@
 echo "C compiler        $cc"
 echo "Host C compiler   $host_cc"
 echo "make              $make"
+echo "install           $install"
 echo "host CPU          $cpu"
 echo "host big endian   $bigendian"
 echo "target list       $target_list"
@@ -472,6 +544,11 @@
     echo -n " (lib='$fmod_lib' include='$fmod_inc')"
 fi
 echo ""
+echo -n "OSS support       $oss"
+if test "$oss" = "yes" && test -d "$oss_inc"; then
+    echo -n " (include='$oss_inc')"
+fi
+echo ""
 echo "kqemu support     $kqemu"
 
 if test $sdl_too_old = "yes"; then
@@ -497,6 +574,7 @@
 echo "docdir=$docdir" >> $config_mak
 echo "#define CONFIG_QEMU_SHAREDIR \"$datadir\"" >> $config_h
 echo "MAKE=$make" >> $config_mak
+echo "INSTALL=$install" >> $config_mak
 echo "CC=$cc" >> $config_mak
 if test "$have_gcc3_options" = "yes" ; then
   echo "HAVE_GCC3_OPTIONS=yes" >> $config_mak
@@ -562,6 +640,15 @@
   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
+  echo "#define CONFIG_SOLARIS 1" >> $config_h
+  echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
+  if test "$presolaris10" = "yes" ; then
+    echo "PRESOLARIS10=yes" >> $config_mak
+    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
@@ -586,8 +673,18 @@
   echo "#define CONFIG_ADLIB 1" >> $config_h
 fi
 if test "$oss" = "yes" ; then
-  echo "CONFIG_OSS=yes" >> $config_mak
-  echo "#define CONFIG_OSS 1" >> $config_h
+  if test "$solaris" = "yes" && test -n "$oss_inc" ; then
+    echo "CONFIG_OSS_INC=$oss_inc" >> $config_mak
+  elif test "$solaris" = "yes" && test -z "$oss_inc" ; then
+    # handle case where OSS include is in /usr/include (OSS 4.0)
+    if test -f "$oss_inc/sys/soundcard.h" ; then
+      no_oss_hfile="yes"
+    fi
+  fi
+  if test -z "$no_oss_hfile" ; then
+    echo "CONFIG_OSS=yes" >> $config_mak
+    echo "#define CONFIG_OSS 1" >> $config_h
+  fi
 fi
 if test "$coreaudio" = "yes" ; then
   echo "CONFIG_COREAUDIO=yes" >> $config_mak
@@ -665,7 +762,12 @@
   mkdir -p $target_dir/slirp
 fi
 
-ln -sf $source_path/Makefile.target $target_dir/Makefile
+if test "$solaris" = "yes" ; then
+  rm -f $target_dir/Makefile
+  ln -s $source_path/Makefile.target $target_dir/Makefile
+else
+  ln -sf $source_path/Makefile.target $target_dir/Makefile
+fi
 
 echo "# Automatically generated by configure - do not modify" > $config_mak
 echo "/* Automatically generated by configure - do not modify */" > $config_h
@@ -751,10 +853,11 @@
         echo "#define CONFIG_SDL 1" >> $config_h
         echo "CONFIG_SDL=yes" >> $config_mak
         if test "$target_softmmu" = "no" -o "$static" = "yes"; then
-            echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
+            echo -n "SDL_LIBS=$sdl_static_libs" >> $config_mak
         else
-            echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
+            echo -n "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
         fi
+        echo "" >> $config_mak
         echo -n "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
         if [ "${aa}" = "yes" ] ; then
             echo -n " `aalib-config --cflags`" >> $config_mak ;
@@ -778,7 +881,12 @@
             mkdir -p $dir
     done
     for f in $FILES ; do
-        ln -sf $source_path/$f $f
+        if test "solaris" = "yes" ; then
+            rm -f $f
+            ln -s $source_path/$f $f
+        else
+            ln -sf $source_path/$f $f
+        fi
     done
 fi
 
diff -ruN qemu-snapshot-2006-04-12_23/dyngen-exec.h qemu-snapshot-2006-04-12_23.solaris/dyngen-exec.h
--- qemu-snapshot-2006-04-12_23/dyngen-exec.h	2005-07-24 11:11:38.000000000 -0400
+++ qemu-snapshot-2006-04-12_23.solaris/dyngen-exec.h	2006-04-13 13:30:52.000000000 -0400
@@ -25,6 +25,11 @@
    host headers do not allow that. */
 #include <stddef.h>
 
+#ifdef __sun__
+#include <stdio.h>
+#include <sys/types.h>
+#else
+
 typedef unsigned char uint8_t;
 typedef unsigned short uint16_t;
 typedef unsigned int uint32_t;
@@ -63,6 +68,8 @@
 #undef NULL
 #define NULL 0
 
+#endif // __sun__
+
 #ifdef __i386__
 #define AREG0 "ebp"
 #define AREG1 "ebx"
@@ -231,6 +238,8 @@
 #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")
diff -ruN qemu-snapshot-2006-04-12_23/fpu/softfloat-native.h qemu-snapshot-2006-04-12_23.solaris/fpu/softfloat-native.h
--- qemu-snapshot-2006-04-12_23/fpu/softfloat-native.h	2005-03-20 05:33:58.000000000 -0500
+++ qemu-snapshot-2006-04-12_23.solaris/fpu/softfloat-native.h	2006-04-13 13:31:14.000000000 -0400
@@ -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;
diff -ruN qemu-snapshot-2006-04-12_23/fpu/softfloat.h qemu-snapshot-2006-04-12_23.solaris/fpu/softfloat.h
--- qemu-snapshot-2006-04-12_23/fpu/softfloat.h	2005-03-13 13:52:29.000000000 -0500
+++ qemu-snapshot-2006-04-12_23.solaris/fpu/softfloat.h	2006-04-13 13:31:41.000000000 -0400
@@ -177,7 +177,9 @@
 | Routine to raise any or all of the software IEC/IEEE floating-point
 | exception flags.
 *----------------------------------------------------------------------------*/
+#ifndef __sun__
 void float_raise( signed char STATUS_PARAM);
+#endif
 
 /*----------------------------------------------------------------------------
 | Software IEC/IEEE integer-to-floating-point conversion routines.
diff -ruN qemu-snapshot-2006-04-12_23/gnu-c99-math.h qemu-snapshot-2006-04-12_23.solaris/gnu-c99-math.h
--- qemu-snapshot-2006-04-12_23/gnu-c99-math.h	1969-12-31 19:00:00.000000000 -0500
+++ qemu-snapshot-2006-04-12_23.solaris/gnu-c99-math.h	2006-04-13 13:30:24.000000000 -0400
@@ -0,0 +1,22 @@
+#if defined(__sun__) && defined(__GNUC__)
+
+/*
+ * 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.
+ */
+#include <ieeefp.h>
+
+#define isnormal(x)             (fpclass(x) >= FP_NZERO)
+
+#define isgreater(x, y)         ((!unordered(x, y)) && ((x) > (y)))
+#define isgreaterequal(x, y)    ((x) >= (y))
+#define isless(x, y)            ((x) < (y))
+#define islessequal(x, y)       ((x) <= (y))
+
+#define isunordered(x,y)        unordered(x, y)
+
+#endif
diff -ruN qemu-snapshot-2006-04-12_23/linux-user/main.c qemu-snapshot-2006-04-12_23.solaris/linux-user/main.c
--- qemu-snapshot-2006-04-12_23/linux-user/main.c	2006-03-25 14:31:22.000000000 -0500
+++ qemu-snapshot-2006-04-12_23.solaris/linux-user/main.c	2006-04-13 13:31:58.000000000 -0400
@@ -33,6 +33,10 @@
 # define environ  (*_NSGetEnviron())
 #endif
 
+#if defined(unix) && !defined(linux)
+extern char **environ;
+#endif
+
 static const char *interp_prefix = CONFIG_QEMU_PREFIX;
 
 #if defined(__i386__) && !defined(CONFIG_STATIC)
diff -ruN qemu-snapshot-2006-04-12_23/linux-user/syscall.c qemu-snapshot-2006-04-12_23.solaris/linux-user/syscall.c
--- qemu-snapshot-2006-04-12_23/linux-user/syscall.c	2006-03-25 14:31:22.000000000 -0500
+++ qemu-snapshot-2006-04-12_23.solaris/linux-user/syscall.c	2006-04-13 13:45:02.000000000 -0400
@@ -22,7 +22,9 @@
 #include <stdarg.h>
 #include <string.h>
 #include <elf.h>
+#ifdef linux
 #include <endian.h>
+#endif
 #include <errno.h>
 #include <unistd.h>
 #include <fcntl.h>
@@ -56,6 +58,7 @@
 #define tchars host_tchars /* same as target */
 #define ltchars host_ltchars /* same as target */
 
+#ifdef linux
 #include <linux/termios.h>
 #include <linux/unistd.h>
 #include <linux/utsname.h>
@@ -64,6 +67,7 @@
 #include <linux/soundcard.h>
 #include <linux/dirent.h>
 #include <linux/kd.h>
+#endif
 
 #include "qemu.h"
 
@@ -203,6 +207,8 @@
 
 #define __NR_sys_uname __NR_uname
 #define __NR_sys_getcwd1 __NR_getcwd
+#define __NR_sys_statfs __NR_statfs
+#define __NR_sys_fstatfs __NR_fstatfs
 #define __NR_sys_getdents __NR_getdents
 #define __NR_sys_getdents64 __NR_getdents64
 #define __NR_sys_rt_sigqueueinfo __NR_rt_sigqueueinfo
@@ -224,6 +230,8 @@
 _syscall3(int, sys_getdents64, uint, fd, struct dirent64 *, dirp, uint, count);
 _syscall5(int, _llseek,  uint,  fd, ulong, hi, ulong, lo,
           loff_t *, res, uint, wh);
+_syscall2(int,sys_statfs,const char *,path,struct kernel_statfs *,buf)
+_syscall2(int,sys_fstatfs,int,fd,struct kernel_statfs *,buf)
 _syscall3(int,sys_rt_sigqueueinfo,int,pid,int,sig,siginfo_t *,uinfo)
 #ifdef __NR_exit_group
 _syscall1(int,exit_group,int,error_code)
diff -ruN qemu-snapshot-2006-04-12_23/slirp/slirp_config.h qemu-snapshot-2006-04-12_23.solaris/slirp/slirp_config.h
--- qemu-snapshot-2006-04-12_23/slirp/slirp_config.h	2005-06-05 13:11:42.000000000 -0400
+++ qemu-snapshot-2006-04-12_23.solaris/slirp/slirp_config.h	2006-04-13 13:33:28.000000000 -0400
@@ -138,6 +138,9 @@
 
 /* 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
diff -ruN qemu-snapshot-2006-04-12_23/slirp/socket.c qemu-snapshot-2006-04-12_23.solaris/slirp/socket.c
--- qemu-snapshot-2006-04-12_23/slirp/socket.c	2006-03-11 15:48:36.000000000 -0500
+++ qemu-snapshot-2006-04-12_23.solaris/slirp/socket.c	2006-04-13 13:33:43.000000000 -0400
@@ -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 -ruN qemu-snapshot-2006-04-12_23/target-i386/exec.h qemu-snapshot-2006-04-12_23.solaris/target-i386/exec.h
--- qemu-snapshot-2006-04-12_23/target-i386/exec.h	2005-10-30 13:16:26.000000000 -0500
+++ qemu-snapshot-2006-04-12_23.solaris/target-i386/exec.h	2006-04-13 13:45:25.000000000 -0400
@@ -20,6 +20,10 @@
 #include "config.h"
 #include "dyngen-exec.h"
 
+#ifdef __sun__
+#include <sys/types.h>
+#endif
+
 /* XXX: factorize this mess */
 #ifdef TARGET_X86_64
 #define TARGET_LONG_BITS 64
diff -ruN qemu-snapshot-2006-04-12_23/vl.c qemu-snapshot-2006-04-12_23.solaris/vl.c
--- qemu-snapshot-2006-04-12_23/vl.c	2006-04-12 16:21:17.000000000 -0400
+++ qemu-snapshot-2006-04-12_23.solaris/vl.c	2006-04-13 13:43:48.000000000 -0400
@@ -47,6 +47,22 @@
 #include <libutil.h>
 #endif
 #else
+#ifdef __sun__
+#include <sys/stat.h>
+#include <sys/ethernet.h>
+#include <sys/sockio.h>
+#include <arpa/inet.h>
+#include <netinet/arp.h>
+#include <netinet/in.h>
+#include <netinet/in_systm.h>
+#include <netinet/ip.h>
+#include <netinet/ip_icmp.h> // must come after ip.h
+#include <netinet/udp.h>
+#include <netinet/tcp.h>
+#include <net/if.h>
+#include <syslog.h>
+#include <stropts.h>
+#else
 #include <linux/if.h>
 #include <linux/if_tun.h>
 #include <pty.h>
@@ -55,6 +71,7 @@
 #include <linux/ppdev.h>
 #endif
 #endif
+#endif
 
 #if defined(CONFIG_SLIRP)
 #include "libslirp.h"
@@ -2553,6 +2570,12 @@
     fcntl(fd, F_SETFL, O_NONBLOCK);
     return fd;
 }
+#elif defined(__sun__)
+static int tap_open(char *ifname, int ifname_size)
+{
+    fprintf(stderr, "warning: tun_open not yet implemented\n");
+    return -1;
+}
 #else
 static int tap_open(char *ifname, int ifname_size)
 {

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] Patch to compile qemu-cvs under Solaris
       [not found] <20060413190201.EWCZ18886.eastrmmtao06.cox.net@172.18.52.8>
@ 2006-04-18 15:46 ` Dennis Clarke
  0 siblings, 0 replies; 2+ messages in thread
From: Dennis Clarke @ 2006-04-18 15:46 UTC (permalink / raw)
  To: sol10x86, qemu-devel

sorry for the top post ..

how has this QEMU process worked for you ?  Are they listening ?

Dennis


----------------------------

On 4/13/06, Ben Taylor <sol10x86@cox.net> wrote:
> I've been too busy the last 8 months or so to do much with
> qemu, but I finally just went back to basics and re-ported
> my 0.6.2/0.7.0 patches with the minimal amount of changes
> to get it working under Solaris 10/Solaris express and
> the latest qemu-cvs (last night).
>
> Other than the change to configure to use /bin/bash instead
> of /bin/sh (solaris's /bin/sh really is /bin/sh, not bash),
> the included changes are able to boot my Win98SE image that
> runs under the blastwave version of qemu (precompiled
> qemu for Solaris).
>
> I've got some other changes, but I wanted to get these
> patches into the qemu before the next release.
>
> Comments?
>
> Ben
>
>
> _______________________________________________
> Qemu-devel mailing list
> Qemu-devel@nongnu.org
> http://lists.nongnu.org/mailman/listinfo/qemu-devel
>
>
>
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-04-18 15:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20060413190201.EWCZ18886.eastrmmtao06.cox.net@172.18.52.8>
2006-04-18 15:46 ` [Qemu-devel] Patch to compile qemu-cvs under Solaris Dennis Clarke
2006-04-13 19:02 Ben Taylor

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).