qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] qemu-0.7.0 Solaris Host patch (Real)
@ 2005-04-28 14:24 Ben Taylor
  2005-04-30  9:40 ` Alex Beregszaszi
  2005-05-02 10:12 ` Nardmann, Heiko
  0 siblings, 2 replies; 7+ messages in thread
From: Ben Taylor @ 2005-04-28 14:24 UTC (permalink / raw)
  To: qemu-devel

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

Please ignore the first post. A webmail annomally sent
the message before it was cooked. :-)

This patch is mostly a collation of several sets of Solaris
host patches that have been around.  Thanks to Juergen
and a few others for actually having done the hard work
of debugging and making things work.

What the patch does:

1) deal with the fact that bash is not /bin/sh in Solaris
2) Add defaults for Solaris in configure, and deal with
   specific behaviors that Solaris doesn't support 
   (like ln -sf not overwriting the target)
3) add --install= option to configure.  Solaris's 
   /usr/bin/install is not what qemu expects to see. 
   Default is ginstall, but you can also use the full path
   to /usr/ucb/install if you don't have Gnu Fileutils
   installed. However, it's not a good ideas to put
   /usr/ucb in front of /usr/bin:/usr/sbin.  Modified
   the Makefiles to use $(INSTALL)
4) Added --with-oss= and --oss-inc= to allow the use of the
   OSS audio driver in Solaris. It had been previosly
   disabled.  (SDL audio tends to stutter on Solaris)
5) Add snippets of code in various place to make qemu
   compile cleanly under Solaris.

Two enhancements: 
1) ability to run with user-net if you don't have
   a DNS server on the host
2) some extra Samba features in vl.c, though I admit
   to just importing them since I don't run Samba.

On solaris, from above the qemu-0.7.0 directory, type

gpatch -p0 < qemu-0.7.0-solaris-patch

Notes: all of the work has been done on Solaris 10 or
Solaris express, using the blastwave gcc-3.4.3 compiler
and libSDL-1.2.8 from blastwave.  I have seen reports
that gcc-3.4.3 in /usr/sfw/bin is broken for qemu
building. 

Ben


[-- Attachment #2: qemu-0.7.0-solaris-patch --]
[-- Type: application/octet-stream, Size: 19855 bytes --]

diff -ruN qemu-0.7.0/Makefile qemu-0.7.0-sol/Makefile
--- qemu-0.7.0/Makefile	2005-04-27 16:52:05.000000000 -0400
+++ qemu-0.7.0-sol/Makefile	2005-04-27 18:50:14.000000000 -0400
@@ -55,20 +55,20 @@
 
 install: all 
 	mkdir -p "$(bindir)"
-	install -m 755 -s $(TOOLS) "$(bindir)"
+	$(INSTALL) -m 755 -s $(TOOLS) "$(bindir)"
 	mkdir -p "$(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/proll.elf \
                        pc-bios/linux_boot.bin "$(datadir)"
 	mkdir -p "$(docdir)"
-	install -m 644 qemu-doc.html  qemu-tech.html "$(docdir)"
+	$(INSTALL) -m 644 qemu-doc.html  qemu-tech.html "$(docdir)"
 ifndef CONFIG_WIN32
 	mkdir -p "$(mandir)/man1"
-	install qemu.1 qemu-img.1 "$(mandir)/man1"
+	$(INSTALL) qemu.1 qemu-img.1 "$(mandir)/man1"
 	mkdir -p "$(datadir)/keymaps"
-	install -m 644 $(addprefix keymaps/,$(KEYMAPS)) "$(datadir)/keymaps"
+	$(INSTALL) -m 644 $(addprefix keymaps/,$(KEYMAPS)) "$(datadir)/keymaps"
 endif
 	for d in $(TARGET_DIRS); do \
 	$(MAKE) -C $$d $@ || exit 1 ; \
diff -ruN qemu-0.7.0/Makefile.target qemu-0.7.0-sol/Makefile.target
--- qemu-0.7.0/Makefile.target	2005-04-27 16:52:05.000000000 -0400
+++ qemu-0.7.0-sol/Makefile.target	2005-04-28 01:46:34.000000000 -0400
@@ -219,6 +219,9 @@
 ifdef CONFIG_WIN32
 LIBS+=-lwinmm -lws2_32 -liphlpapi
 endif
+ifdef CONFIG_SOLARIS
+LIBS+=-lsocket -lnsl -lresolv
+endif
 
 # profiling code
 ifdef TARGET_GPROF
@@ -323,6 +326,9 @@
 endif
 ifdef CONFIG_OSS
 AUDIODRV += ossaudio.o
+ifdef CONFIG_SOLARIS
+audio.o ossaudio.o: DEFINES := -I$(CONFIG_OSS_INC) $(DEFINES)
+endif
 endif
 
 pc.o: DEFINES := -DUSE_SB16 $(DEFINES)
@@ -379,9 +385,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
@@ -463,7 +471,7 @@
 
 install: all 
 ifneq ($(PROGS),)
-	install -m 755 -s $(PROGS) "$(bindir)"
+	$(INSTALL) -m 755 -s $(PROGS) "$(bindir)"
 endif
 
 ifneq ($(wildcard .depend),)
diff -ruN qemu-0.7.0/block.c qemu-0.7.0-sol/block.c
--- qemu-0.7.0/block.c	2005-04-27 16:52:05.000000000 -0400
+++ qemu-0.7.0-sol/block.c	2005-04-27 20:30:20.000000000 -0400
@@ -530,6 +530,34 @@
     }
 }
 
+#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 */
@@ -570,12 +598,36 @@
     {
         size = lseek(fd, 0, SEEK_END);
     }
+
 #ifdef _WIN32
     /* On Windows hosts it can happen that we're unable to get file size
        for CD-ROM raw device (it's inherent limitation of the CDFS driver). */
     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;
@@ -588,7 +640,11 @@
     int ret;
     
     lseek(s->fd, sector_num * 512, SEEK_SET);
+#if __sun__
+    ret = pread(s->fd, buf, nb_sectors * 512, sector_num * 512);
+#else
     ret = read(s->fd, buf, nb_sectors * 512);
+#endif
     if (ret != nb_sectors * 512) 
         return -1;
     return 0;
@@ -601,7 +657,11 @@
     int ret;
     
     lseek(s->fd, sector_num * 512, SEEK_SET);
+#if __sun__
+    ret = pwrite(s->fd, buf, nb_sectors * 512, sector_num * 512);
+#else
     ret = write(s->fd, buf, nb_sectors * 512);
+#endif
     if (ret != nb_sectors * 512) 
         return -1;
     return 0;
diff -ruN qemu-0.7.0/bswap.h qemu-0.7.0-sol/bswap.h
--- qemu-0.7.0/bswap.h	2005-04-27 16:52:05.000000000 -0400
+++ qemu-0.7.0-sol/bswap.h	2005-04-27 19:03:15.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-0.7.0/configure qemu-0.7.0-sol/configure
--- qemu-0.7.0/configure	2005-04-27 16:52:05.000000000 -0400
+++ qemu-0.7.0-sol/configure	2005-04-28 09:21:16.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)
@@ -114,6 +115,9 @@
 bsd="yes"
 darwin="yes"
 ;;
+SunOS)
+solaris="yes"
+;;
 *) 
 oss="yes"
 linux="yes"
@@ -124,11 +128,15 @@
 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"
+fi
 # find source path
 # XXX: we assume an absolute path is given when launching configure, 
 # except in './configure' case.
@@ -154,6 +162,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=}"
@@ -186,6 +196,20 @@
   ;; 
   --enable-cocoa) cocoa="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" ; then
+      oss_inc=""
+      if test "$solaris" = "yes" ; then
+          oss=no;
+      fi
+    fi
+  ;;
   esac
 done
 
@@ -329,11 +353,14 @@
 echo "  --cross-prefix=PREFIX    use PREFIX for compile tools [$cross_prefix]"
 echo "  --cc=CC                  use C compiler CC [$cc]"
 echo "  --make=MAKE              use specified make [$make]"
+echo "  --install=INSTALL        use specified install [$install]"
 echo "  --static                 enable static build [$static]"
 echo "  --enable-mingw32         enable Win32 cross compilation with mingw32"
 echo "  --enable-fmod            enable FMOD audio output driver"
 echo "  --fmod-lib               path to FMOD library"
 echo "  --fmod-inc               path to FMOD includes"
+echo "  --with-oss               define OSS audio output driver (Solaris)"
+echo "  --oss-inc                path to OSS includes"
 echo ""
 echo "NOTE: The object files are build at the place where configure is launched"
 exit 1
@@ -409,6 +436,7 @@
 echo "Source path       $source_path"
 echo "C compiler        $cc"
 echo "make              $make"
+echo "install           $install"
 echo "host CPU          $cpu"
 echo "host big endian   $bigendian"
 echo "target list       $target_list"
@@ -428,6 +456,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 $kqemu = "yes" -a $linux = "yes" ; then
 echo ""
@@ -463,6 +496,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
@@ -527,6 +561,11 @@
   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
+fi
 if test "$gdbstub" = "yes" ; then
   echo "CONFIG_GDBSTUB=yes" >> $config_mak
   echo "#define CONFIG_GDBSTUB 1" >> $config_h
@@ -550,6 +589,9 @@
 if test "$oss" = "yes" ; then
   echo "CONFIG_OSS=yes" >> $config_mak
   echo "#define CONFIG_OSS 1" >> $config_h
+  if test "$solaris" = "yes" ; then
+    echo "CONFIG_OSS_INC=$oss_inc" >> $config_mak
+  fi
 fi
 if test "$fmod" = "yes" ; then
   echo "CONFIG_FMOD=yes" >> $config_mak
@@ -614,7 +656,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
@@ -691,10 +738,17 @@
         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
+            # sdl_static_libs is already generated, but dynamic
+            # sdl_libs is not, so we need to make sure that the
+            # aalib libs config is added if configured for sdl_libs
+            if [ "${aa}" = "yes" ] ; then
+                echo -n " `aalib-config --libs`" >> $config_mak ;
+            fi
         fi
+        echo "" >> $config_mak
         echo -n "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
         if [ "${aa}" = "yes" ] ; then
             echo -n " `aalib-config --cflags`" >> $config_mak ;
@@ -718,7 +772,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-0.7.0/dyngen-exec.h qemu-0.7.0-sol/dyngen-exec.h
--- qemu-0.7.0/dyngen-exec.h	2005-04-27 16:52:05.000000000 -0400
+++ qemu-0.7.0-sol/dyngen-exec.h	2005-04-27 19:29:27.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"
diff -ruN qemu-0.7.0/fpu/softfloat-native.c qemu-0.7.0-sol/fpu/softfloat-native.c
--- qemu-0.7.0/fpu/softfloat-native.c	2005-04-27 16:52:05.000000000 -0400
+++ qemu-0.7.0-sol/fpu/softfloat-native.c	2005-04-27 19:46:48.000000000 -0400
@@ -1,6 +1,7 @@
 /* Native implementation of soft float functions. Only a single status
    context is supported */
 #include "softfloat.h"
+#include "gnu-c99-math.h"
 #include <math.h>
 
 void set_float_rounding_mode(int val STATUS_PARAM)
diff -ruN qemu-0.7.0/fpu/softfloat-native.h qemu-0.7.0-sol/fpu/softfloat-native.h
--- qemu-0.7.0/fpu/softfloat-native.h	2005-04-27 16:52:05.000000000 -0400
+++ qemu-0.7.0-sol/fpu/softfloat-native.h	2005-04-28 09:10:21.000000000 -0400
@@ -1,5 +1,6 @@
 /* Native implementation of soft float functions */
 #include <math.h>
+#include "gnu-c99-math.h"
 #if defined(_BSD) && !defined(__APPLE__)
 #include <ieeefp.h>
 #else
diff -ruN qemu-0.7.0/gnu-c99-math.h qemu-0.7.0-sol/gnu-c99-math.h
--- qemu-0.7.0/gnu-c99-math.h	1969-12-31 19:00:00.000000000 -0500
+++ qemu-0.7.0-sol/gnu-c99-math.h	2005-04-28 09:53:37.261904000 -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)		((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-0.7.0/linux-user/main.c qemu-0.7.0-sol/linux-user/main.c
--- qemu-0.7.0/linux-user/main.c	2005-04-27 16:52:05.000000000 -0400
+++ qemu-0.7.0-sol/linux-user/main.c	2005-04-27 19:45:42.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-0.7.0/linux-user/syscall.c qemu-0.7.0-sol/linux-user/syscall.c
--- qemu-0.7.0/linux-user/syscall.c	2005-04-27 16:52:05.000000000 -0400
+++ qemu-0.7.0-sol/linux-user/syscall.c	2005-04-27 20:09:08.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>
@@ -55,6 +57,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>
@@ -63,6 +66,7 @@
 #include <linux/soundcard.h>
 #include <linux/dirent.h>
 #include <linux/kd.h>
+#endif
 
 #include "qemu.h"
 
diff -ruN qemu-0.7.0/sdl_keysym.h qemu-0.7.0-sol/sdl_keysym.h
--- qemu-0.7.0/sdl_keysym.h	2005-04-27 16:52:05.000000000 -0400
+++ qemu-0.7.0-sol/sdl_keysym.h	2005-04-27 18:58:32.000000000 -0400
@@ -231,6 +231,7 @@
 {"Home", SDLK_HOME},
 {"End", SDLK_END},
 {"Scroll_Lock", SDLK_SCROLLOCK},
+{"Escape", SDLK_ESCAPE},
 {"F1", SDLK_F1},
 {"F2", SDLK_F2},
 {"F3", SDLK_F3},
diff -ruN qemu-0.7.0/slirp/slirp.c qemu-0.7.0-sol/slirp/slirp.c
--- qemu-0.7.0/slirp/slirp.c	2005-04-27 16:52:05.000000000 -0400
+++ qemu-0.7.0-sol/slirp/slirp.c	2005-04-27 19:53:47.000000000 -0400
@@ -148,8 +148,12 @@
     inet_aton("127.0.0.1", &loopback_addr);
 
     if (get_dns_addr(&dns_addr) < 0) {
+#ifdef __sun__
+        inet_aton("127.0.0.1", &dns_addr);        
+#else
         fprintf(stderr, "Could not get DNS address\n");
         exit(1);
+#endif
     }
 
     inet_aton(CTL_SPECIAL, &special_addr);
diff -ruN qemu-0.7.0/slirp/slirp_config.h qemu-0.7.0-sol/slirp/slirp_config.h
--- qemu-0.7.0/slirp/slirp_config.h	2005-04-27 16:52:05.000000000 -0400
+++ qemu-0.7.0-sol/slirp/slirp_config.h	2005-04-28 00:56:10.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-0.7.0/slirp/socket.c qemu-0.7.0-sol/slirp/socket.c
--- qemu-0.7.0/slirp/socket.c	2005-04-27 16:52:05.000000000 -0400
+++ qemu-0.7.0-sol/slirp/socket.c	2005-04-27 19:51:03.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-0.7.0/target-i386/exec.h qemu-0.7.0-sol/target-i386/exec.h
--- qemu-0.7.0/target-i386/exec.h	2005-04-27 16:52:05.000000000 -0400
+++ qemu-0.7.0-sol/target-i386/exec.h	2005-04-27 20:07:02.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-0.7.0/target-ppc/exec.h qemu-0.7.0-sol/target-ppc/exec.h
--- qemu-0.7.0/target-ppc/exec.h	2005-04-27 16:52:05.000000000 -0400
+++ qemu-0.7.0-sol/target-ppc/exec.h	2005-04-27 20:01:09.000000000 -0400
@@ -22,6 +22,10 @@
 
 #include "dyngen-exec.h"
 
+#ifdef __sun__
+#include <sys/types.h>
+#endif
+
 register struct CPUPPCState *env asm(AREG0);
 register uint32_t T0 asm(AREG1);
 register uint32_t T1 asm(AREG2);
diff -ruN qemu-0.7.0/target-ppc/op_helper.c qemu-0.7.0-sol/target-ppc/op_helper.c
--- qemu-0.7.0/target-ppc/op_helper.c	2005-04-27 16:52:05.000000000 -0400
+++ qemu-0.7.0-sol/target-ppc/op_helper.c	2005-04-28 02:07:56.000000000 -0400
@@ -18,6 +18,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 #include <math.h>
+#include "gnu-c99-math.h"
 #include "exec.h"
 
 #define MEMSUFFIX _raw
diff -ruN qemu-0.7.0/vl.c qemu-0.7.0-sol/vl.c
--- qemu-0.7.0/vl.c	2005-04-27 16:52:05.000000000 -0400
+++ qemu-0.7.0-sol/vl.c	2005-04-28 09:09:46.000000000 -0400
@@ -46,6 +46,9 @@
 #include <libutil.h>
 #endif
 #else
+#ifdef __sun__
+#include <sys/stat.h>
+#else
 #include <linux/if.h>
 #include <linux/if_tun.h>
 #include <pty.h>
@@ -53,6 +56,7 @@
 #include <linux/rtc.h>
 #endif
 #endif
+#endif
 
 #if defined(CONFIG_SLIRP)
 #include "libslirp.h"
@@ -501,9 +505,13 @@
 
 int64_t cpu_get_real_ticks(void)
 {
+#ifdef __sun__
+    return gethrtime();
+#else
     int64_t val;
     asm volatile ("rdtsc" : "=A" (val));
     return val;
+#endif
 }
 
 #elif defined(__x86_64__)
@@ -528,6 +536,13 @@
 	return val;
 }
 
+#elif defined(__sparc__) && defined(__sun__)
+
+int64_t cpu_get_real_ticks(void)
+{
+        return gethrtime();
+}
+
 #else
 #error unsupported CPU
 #endif
@@ -1565,10 +1580,23 @@
             "log file=%s/log.smbd\n"
             "smb passwd file=%s/smbpasswd\n"
             "security = share\n"
+#ifdef __sun__
+            "load printers=yes\n"
+            "netbios aliases=SMBSERVER\n"
+#endif
             "[qemu]\n"
             "path=%s\n"
             "read only=no\n"
-            "guest ok=yes\n",
+            "guest ok=yes\n"
+#ifdef __sun__
+            "[printers]\n"
+            "path=/tmp\n"
+            "browseable=no\n"
+            "writeable=no\n"
+            "printable=yes\n"
+            "guest ok=yes\n"
+#endif // __sun__
+            ,
             smb_dir,
             smb_dir,
             smb_dir,
@@ -1579,8 +1607,13 @@
     fclose(f);
     atexit(smb_exit);
 
+#ifdef __sun__
+    snprintf(smb_cmdline, sizeof(smb_cmdline), "/bin/env LC_ALL=C /usr/sfw/sbin/smbd -s %s",
+             smb_conf);
+#else
     snprintf(smb_cmdline, sizeof(smb_cmdline), "/usr/sbin/smbd -s %s",
              smb_conf);
+#endif
     
     slirp_add_exec(0, smb_cmdline, 4, 139);
 }
@@ -1610,6 +1643,12 @@
     fcntl(fd, F_SETFL, O_NONBLOCK);
     return fd;
 }
+#elif defined(__sun__)
+static int tun_open(char *ifname, int ifname_size)
+{
+    fprintf(stderr, "warning, tun_open not yet implemented\n");
+    return -1;
+}
 #else
 static int tun_open(char *ifname, int ifname_size)
 {

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

* Re: [Qemu-devel] [PATCH] qemu-0.7.0 Solaris Host patch (Real)
  2005-04-28 14:24 Ben Taylor
@ 2005-04-30  9:40 ` Alex Beregszaszi
  2005-05-02 10:12 ` Nardmann, Heiko
  1 sibling, 0 replies; 7+ messages in thread
From: Alex Beregszaszi @ 2005-04-30  9:40 UTC (permalink / raw)
  To: sol10x86, qemu-devel

Hi,

> Please ignore the first post. A webmail annomally sent
> the message before it was cooked. :-)
> 
> This patch is mostly a collation of several sets of Solaris
> host patches that have been around.  Thanks to Juergen
> and a few others for actually having done the hard work
> of debugging and making things work.

I just noticed in the block.c code that it uses pread and pwrite all
around the code, which, at least the man page states, reads from an
offset specified. While it does that, you still left the lseek there. Is
that for a reason? And why are you using pread instead the good old
read?

Imho if pread is faster, there should be an USE_PREAD macro, which would
be set true on Solaris, while making the use of it for other systems
possible.

-- 
Alex Beregszaszi 			e-mail: alex@fsn.hu
Free Software Network			cell: +36 70 3144424

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

* Re: [Qemu-devel] [PATCH] qemu-0.7.0 Solaris Host patch (Real)
  2005-04-28 14:24 Ben Taylor
  2005-04-30  9:40 ` Alex Beregszaszi
@ 2005-05-02 10:12 ` Nardmann, Heiko
  2005-05-02 10:51   ` Nardmann, Heiko
  1 sibling, 1 reply; 7+ messages in thread
From: Nardmann, Heiko @ 2005-05-02 10:12 UTC (permalink / raw)
  To: qemu-devel, sol10x86

I get the following error after running

./configure --prefix=$HOME/qemu-0.7.0.install

Install prefix    /home/nardmann/qemu-0.7.0.install
BIOS directory    /home/nardmann/qemu-0.7.0.install/share/qemu
binary directory  /home/nardmann/qemu-0.7.0.install/bin
Manual directory  /home/nardmann/qemu-0.7.0.install/share/man
ELF interp prefix /usr/gnemul/qemu-%M
Source path       /home/nardmann/qemu-0.7.0
C compiler        gcc
make              gmake
install           ginstall
host CPU          sparc
host big endian   yes
target list       i386-softmmu ppc-softmmu sparc-softmmu x86_64-softmmu
gprof enabled     no
static build      no
SDL support       yes
SDL static link   yes
mingw32 support   no
Adlib support     no
FMOD support      no
OSS support       no
kqemu support     no



Then running make:

for d in i386-softmmu ppc-softmmu sparc-softmmu x86_64-softmmu; do \
gmake -C $d all || exit 1 ; \
        done
gmake[1]: Entering directory `/home/nardmann/qemu-0.7.0/i386-softmmu'
gcc -Wall -O2 -g -fno-strict-aliasing -m32 -ffixed-g1 -ffixed-g2 -ffixed-g3 
-ffixed-g6 -I. -I/home/nardmann/qemu-0.7.0/target-i386 
-I/home/nardmann/qemu-0.7.0 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 
-D_LARGEFILE_SOURCE -I/home/nardmann/qemu-0.7.0/fpu 
-I/home/nardmann/qemu-0.7.0/slirp -c -o vl.o /home/nardmann/qemu-0.7.0/vl.c
In file included from /home/nardmann/qemu-0.7.0/fpu/softfloat.h:394,
                 from /home/nardmann/qemu-0.7.0/target-i386/cpu.h:41,
                 from /home/nardmann/qemu-0.7.0/vl.h:73,
                 from /home/nardmann/qemu-0.7.0/vl.c:24:
/home/nardmann/qemu-0.7.0/fpu/softfloat-native.h:7:18: fenv.h: No such file or 
directory
In file included from /home/nardmann/qemu-0.7.0/fpu/softfloat.h:394,
                 from /home/nardmann/qemu-0.7.0/target-i386/cpu.h:41,
                 from /home/nardmann/qemu-0.7.0/vl.h:73,
                 from /home/nardmann/qemu-0.7.0/vl.c:24:
/home/nardmann/qemu-0.7.0/fpu/softfloat-native.h:53: `FE_TONEAREST' undeclared 
here (not in a function)
/home/nardmann/qemu-0.7.0/fpu/softfloat-native.h:53: enumerator value for 
`float_round_nearest_even' not integer constant
/home/nardmann/qemu-0.7.0/fpu/softfloat-native.h:54: `FE_DOWNWARD' undeclared 
here (not in a function)
/home/nardmann/qemu-0.7.0/fpu/softfloat-native.h:54: enumerator value for 
`float_round_down' not integer constant
/home/nardmann/qemu-0.7.0/fpu/softfloat-native.h:55: `FE_UPWARD' undeclared 
here (not in a function)
/home/nardmann/qemu-0.7.0/fpu/softfloat-native.h:55: enumerator value for 
`float_round_up' not integer constant
/home/nardmann/qemu-0.7.0/fpu/softfloat-native.h:57: `FE_TOWARDZERO' 
undeclared here (not in a function)
/home/nardmann/qemu-0.7.0/fpu/softfloat-native.h:57: enumerator value for 
`float_round_to_zero' not integer constant
/home/nardmann/qemu-0.7.0/fpu/softfloat-native.h: In function `float32_abs':
/home/nardmann/qemu-0.7.0/fpu/softfloat-native.h:164: warning: implicit 
declaration of function `fabsf'
/home/nardmann/qemu-0.7.0/vl.c: In function `init_timers':
/home/nardmann/qemu-0.7.0/vl.c:986: warning: label `use_itimer' defined but 
not used
/home/nardmann/qemu-0.7.0/vl.c: In function `net_slirp_smb':
/home/nardmann/qemu-0.7.0/vl.c:1561: warning: int format, pid_t arg (arg 4)
/home/nardmann/qemu-0.7.0/vl.c: In function `create_pidfile':
/home/nardmann/qemu-0.7.0/vl.c:1759: warning: int format, pid_t arg (arg 3)
/home/nardmann/qemu-0.7.0/vl.c: At top level:
/home/nardmann/qemu-0.7.0/vl.c:914: warning: `start_rtc_timer' defined but not 
used
gmake[1]: *** [vl.o] Error 1
gmake[1]: Leaving directory `/home/nardmann/qemu-0.7.0/i386-softmmu'
make: *** [all] Error 1

Anyone with the same problem and already having a solution for it?

On Donnerstag 28 April 2005 16:24, Ben Taylor wrote:
> Please ignore the first post. A webmail annomally sent
> the message before it was cooked. :-)
>
> This patch is mostly a collation of several sets of Solaris
> host patches that have been around.  Thanks to Juergen
> and a few others for actually having done the hard work
> of debugging and making things work.
>
> What the patch does:
>
> 1) deal with the fact that bash is not /bin/sh in Solaris
> 2) Add defaults for Solaris in configure, and deal with
>    specific behaviors that Solaris doesn't support
>    (like ln -sf not overwriting the target)
> 3) add --install= option to configure.  Solaris's
>    /usr/bin/install is not what qemu expects to see.
>    Default is ginstall, but you can also use the full path
>    to /usr/ucb/install if you don't have Gnu Fileutils
>    installed. However, it's not a good ideas to put
>    /usr/ucb in front of /usr/bin:/usr/sbin.  Modified
>    the Makefiles to use $(INSTALL)
> 4) Added --with-oss= and --oss-inc= to allow the use of the
>    OSS audio driver in Solaris. It had been previosly
>    disabled.  (SDL audio tends to stutter on Solaris)
> 5) Add snippets of code in various place to make qemu
>    compile cleanly under Solaris.
>
> Two enhancements:
> 1) ability to run with user-net if you don't have
>    a DNS server on the host
> 2) some extra Samba features in vl.c, though I admit
>    to just importing them since I don't run Samba.
>
> On solaris, from above the qemu-0.7.0 directory, type
>
> gpatch -p0 < qemu-0.7.0-solaris-patch
>
> Notes: all of the work has been done on Solaris 10 or
> Solaris express, using the blastwave gcc-3.4.3 compiler
> and libSDL-1.2.8 from blastwave.  I have seen reports
> that gcc-3.4.3 in /usr/sfw/bin is broken for qemu
> building.
>
> Ben

-- 
Heiko Nardmann (Dipl.-Ing. Technische Informatik)
secunet Security Networks AG - Sicherheit in Netzwerken (www.secunet.de),
Weidenauer Str. 223-225, D-57076 Siegen
Tel. : +49 271 48950-13, Fax  : +49 271 48950-50

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

* Re: [Qemu-devel] [PATCH] qemu-0.7.0 Solaris Host patch (Real)
  2005-05-02 10:12 ` Nardmann, Heiko
@ 2005-05-02 10:51   ` Nardmann, Heiko
  0 siblings, 0 replies; 7+ messages in thread
From: Nardmann, Heiko @ 2005-05-02 10:51 UTC (permalink / raw)
  To: qemu-devel

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

So ... I now get over this first point of trouble. The reason for not finding 
fenv.h ist that I can only find this file 
as /opt/SUNWspro/prod/include/cc/fenv.h.

Adding this path to DEFINES solved this one.

Now another thing:



gcc-3.4.2 -Wall -O2 -g -fno-strict-aliasing -m32 -ffixed-g1 -ffixed-g2 
- -ffixed-g3 -ffixed-g6 -fno-delayed-branch -ffixed-i0 -fno-reorder-blocks 
- -fno-optimize-sibling-calls -I. -I/home/nardmann/qemu-0.7.0/target-i386 
- -I/home/nardmann/qemu-0.7.0 -I/opt/SUNWspro/prod/include/cc -D_GNU_SOURCE 
- -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -I/home/nardmann/qemu-0.7.0/fpu 
- -I/home/nardmann/qemu-0.7.0/slirp -c -o 
op.o /home/nardmann/qemu-0.7.0/target-i386/op.c
In file included from /home/nardmann/qemu-0.7.0/fpu/softfloat-native.h:7,
                 from /home/nardmann/qemu-0.7.0/fpu/softfloat.h:394,
                 from /home/nardmann/qemu-0.7.0/target-i386/cpu.h:41,
                 from /home/nardmann/qemu-0.7.0/target-i386/exec.h:143,
                 from /home/nardmann/qemu-0.7.0/target-i386/op.c:22:
/opt/SUNWspro/prod/include/cc/fenv.h:8: warning: ignoring #pragma ident
In file included from /home/nardmann/qemu-0.7.0/fpu/softfloat.h:394,
                 from /home/nardmann/qemu-0.7.0/target-i386/cpu.h:41,
                 from /home/nardmann/qemu-0.7.0/target-i386/exec.h:143,
                 from /home/nardmann/qemu-0.7.0/target-i386/op.c:22:
/home/nardmann/qemu-0.7.0/fpu/softfloat-native.h: In function `float32_abs':
/home/nardmann/qemu-0.7.0/fpu/softfloat-native.h:164: warning: implicit 
declaration of function `fabsf'
In file included from /home/nardmann/qemu-0.7.0/target-i386/op.c:724:
/home/nardmann/qemu-0.7.0/target-i386/ops_template.h: In function 
`op_jb_subb':
/home/nardmann/qemu-0.7.0/target-i386/ops_template.h:278: warning: implicit 
declaration of function `GOTO_LABEL_PARAM'
../dyngen -o op.h op.o
dyngen: Found bogus save at the start of op_pavgw_xmm



I found that GOTO_LABEL_PARAM ist not defined for sparc in dyngen-exec.h; any 
reason for this?

On Montag 02 Mai 2005 12:12, Nardmann, Heiko wrote:
> I get the following error after running
>
> ./configure --prefix=$HOME/qemu-0.7.0.install
>
> Install prefix    /home/nardmann/qemu-0.7.0.install
> BIOS directory    /home/nardmann/qemu-0.7.0.install/share/qemu
> binary directory  /home/nardmann/qemu-0.7.0.install/bin
> Manual directory  /home/nardmann/qemu-0.7.0.install/share/man
> ELF interp prefix /usr/gnemul/qemu-%M
> Source path       /home/nardmann/qemu-0.7.0
> C compiler        gcc
> make              gmake
> install           ginstall
> host CPU          sparc
> host big endian   yes
> target list       i386-softmmu ppc-softmmu sparc-softmmu x86_64-softmmu
> gprof enabled     no
> static build      no
> SDL support       yes
> SDL static link   yes
> mingw32 support   no
> Adlib support     no
> FMOD support      no
> OSS support       no
> kqemu support     no
>
>
>
> Then running make:
>
> for d in i386-softmmu ppc-softmmu sparc-softmmu x86_64-softmmu; do \
> gmake -C $d all || exit 1 ; \
>         done
> gmake[1]: Entering directory `/home/nardmann/qemu-0.7.0/i386-softmmu'
> gcc -Wall -O2 -g -fno-strict-aliasing -m32 -ffixed-g1 -ffixed-g2 -ffixed-g3
> -ffixed-g6 -I. -I/home/nardmann/qemu-0.7.0/target-i386
> -I/home/nardmann/qemu-0.7.0 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64
> -D_LARGEFILE_SOURCE -I/home/nardmann/qemu-0.7.0/fpu
> -I/home/nardmann/qemu-0.7.0/slirp -c -o vl.o /home/nardmann/qemu-0.7.0/vl.c
> In file included from /home/nardmann/qemu-0.7.0/fpu/softfloat.h:394,
>                  from /home/nardmann/qemu-0.7.0/target-i386/cpu.h:41,
>                  from /home/nardmann/qemu-0.7.0/vl.h:73,
>                  from /home/nardmann/qemu-0.7.0/vl.c:24:
> /home/nardmann/qemu-0.7.0/fpu/softfloat-native.h:7:18: fenv.h: No such file
> or directory
> In file included from /home/nardmann/qemu-0.7.0/fpu/softfloat.h:394,
>                  from /home/nardmann/qemu-0.7.0/target-i386/cpu.h:41,
>                  from /home/nardmann/qemu-0.7.0/vl.h:73,
>                  from /home/nardmann/qemu-0.7.0/vl.c:24:
> /home/nardmann/qemu-0.7.0/fpu/softfloat-native.h:53: `FE_TONEAREST'
> undeclared here (not in a function)
> /home/nardmann/qemu-0.7.0/fpu/softfloat-native.h:53: enumerator value for
> `float_round_nearest_even' not integer constant
> /home/nardmann/qemu-0.7.0/fpu/softfloat-native.h:54: `FE_DOWNWARD'
> undeclared here (not in a function)
> /home/nardmann/qemu-0.7.0/fpu/softfloat-native.h:54: enumerator value for
> `float_round_down' not integer constant
> /home/nardmann/qemu-0.7.0/fpu/softfloat-native.h:55: `FE_UPWARD' undeclared
> here (not in a function)
> /home/nardmann/qemu-0.7.0/fpu/softfloat-native.h:55: enumerator value for
> `float_round_up' not integer constant
> /home/nardmann/qemu-0.7.0/fpu/softfloat-native.h:57: `FE_TOWARDZERO'
> undeclared here (not in a function)
> /home/nardmann/qemu-0.7.0/fpu/softfloat-native.h:57: enumerator value for
> `float_round_to_zero' not integer constant
> /home/nardmann/qemu-0.7.0/fpu/softfloat-native.h: In function
> `float32_abs': /home/nardmann/qemu-0.7.0/fpu/softfloat-native.h:164:
> warning: implicit declaration of function `fabsf'
> /home/nardmann/qemu-0.7.0/vl.c: In function `init_timers':
> /home/nardmann/qemu-0.7.0/vl.c:986: warning: label `use_itimer' defined but
> not used
> /home/nardmann/qemu-0.7.0/vl.c: In function `net_slirp_smb':
> /home/nardmann/qemu-0.7.0/vl.c:1561: warning: int format, pid_t arg (arg 4)
> /home/nardmann/qemu-0.7.0/vl.c: In function `create_pidfile':
> /home/nardmann/qemu-0.7.0/vl.c:1759: warning: int format, pid_t arg (arg 3)
> /home/nardmann/qemu-0.7.0/vl.c: At top level:
> /home/nardmann/qemu-0.7.0/vl.c:914: warning: `start_rtc_timer' defined but
> not used
> gmake[1]: *** [vl.o] Error 1
> gmake[1]: Leaving directory `/home/nardmann/qemu-0.7.0/i386-softmmu'
> make: *** [all] Error 1
>
> Anyone with the same problem and already having a solution for it?
>
> On Donnerstag 28 April 2005 16:24, Ben Taylor wrote:
> > Please ignore the first post. A webmail annomally sent
> > the message before it was cooked. :-)
> >
> > This patch is mostly a collation of several sets of Solaris
> > host patches that have been around.  Thanks to Juergen
> > and a few others for actually having done the hard work
> > of debugging and making things work.
> >
> > What the patch does:
> >
> > 1) deal with the fact that bash is not /bin/sh in Solaris
> > 2) Add defaults for Solaris in configure, and deal with
> >    specific behaviors that Solaris doesn't support
> >    (like ln -sf not overwriting the target)
> > 3) add --install= option to configure.  Solaris's
> >    /usr/bin/install is not what qemu expects to see.
> >    Default is ginstall, but you can also use the full path
> >    to /usr/ucb/install if you don't have Gnu Fileutils
> >    installed. However, it's not a good ideas to put
> >    /usr/ucb in front of /usr/bin:/usr/sbin.  Modified
> >    the Makefiles to use $(INSTALL)
> > 4) Added --with-oss= and --oss-inc= to allow the use of the
> >    OSS audio driver in Solaris. It had been previosly
> >    disabled.  (SDL audio tends to stutter on Solaris)
> > 5) Add snippets of code in various place to make qemu
> >    compile cleanly under Solaris.
> >
> > Two enhancements:
> > 1) ability to run with user-net if you don't have
> >    a DNS server on the host
> > 2) some extra Samba features in vl.c, though I admit
> >    to just importing them since I don't run Samba.
> >
> > On solaris, from above the qemu-0.7.0 directory, type
> >
> > gpatch -p0 < qemu-0.7.0-solaris-patch
> >
> > Notes: all of the work has been done on Solaris 10 or
> > Solaris express, using the blastwave gcc-3.4.3 compiler
> > and libSDL-1.2.8 from blastwave.  I have seen reports
> > that gcc-3.4.3 in /usr/sfw/bin is broken for qemu
> > building.
> >
> > Ben

- -- 
Heiko Nardmann (Dipl.-Ing. Technische Informatik)
secunet Security Networks AG - Sicherheit in Netzwerken (www.secunet.de),
Weidenauer Str. 223-225, D-57076 Siegen
Tel. : +49 271 48950-13, Fax  : +49 271 48950-50
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)

iD8DBQFCdgYfpm53PRScYygRAmxoAJ4nagjAY7m1BoLHcmpW1bcobfO+LgCgz2ym
NZDbtb8oqNGoTV73ccYH3WY=
=Y0z1
-----END PGP SIGNATURE-----

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

* Re: [Qemu-devel] [PATCH] qemu-0.7.0 Solaris Host patch (Real)
@ 2005-05-02 18:35 Juergen Keil
  2005-05-03 13:10 ` Nardmann, Heiko
  0 siblings, 1 reply; 7+ messages in thread
From: Juergen Keil @ 2005-05-02 18:35 UTC (permalink / raw)
  To: Heiko.Nardmann, qemu-devel



> gcc-3.4.2 -Wall -O2 -g -fno-strict-aliasing -m32 -ffixed-g1 -ffixed-g2 
> - -ffixed-g3 -ffixed-g6 -fno-delayed-branch -ffixed-i0 -fno-reorder-blocks 
> - -fno-optimize-sibling-calls -I. -I/home/nardmann/qemu-0.7.0/target-i386 
> - -I/home/nardmann/qemu-0.7.0 -I/opt/SUNWspro/prod/include/cc -D_GNU_SOURCE 
> - -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -I/home/nardmann/qemu-0.7.0/fpu 
> - -I/home/nardmann/qemu-0.7.0/slirp -c -o 
> op.o /home/nardmann/qemu-0.7.0/target-i386/op.c
> In file included from /home/nardmann/qemu-0.7.0/fpu/softfloat-native.h:7,
>                  from /home/nardmann/qemu-0.7.0/fpu/softfloat.h:394,
>                  from /home/nardmann/qemu-0.7.0/target-i386/cpu.h:41,
>                  from /home/nardmann/qemu-0.7.0/target-i386/exec.h:143,
>                  from /home/nardmann/qemu-0.7.0/target-i386/op.c:22:
> /opt/SUNWspro/prod/include/cc/fenv.h:8: warning: ignoring #pragma ident
> In file included from /home/nardmann/qemu-0.7.0/fpu/softfloat.h:394,
>                  from /home/nardmann/qemu-0.7.0/target-i386/cpu.h:41,
>                  from /home/nardmann/qemu-0.7.0/target-i386/exec.h:143,
>                  from /home/nardmann/qemu-0.7.0/target-i386/op.c:22:
> /home/nardmann/qemu-0.7.0/fpu/softfloat-native.h: In function `float32_abs':
> /home/nardmann/qemu-0.7.0/fpu/softfloat-native.h:164: warning: implicit 
> declaration of function `fabsf'
> In file included from /home/nardmann/qemu-0.7.0/target-i386/op.c:724:
> /home/nardmann/qemu-0.7.0/target-i386/ops_template.h: In function 
> `op_jb_subb':
> /home/nardmann/qemu-0.7.0/target-i386/ops_template.h:278: warning: implicit 
> declaration of function `GOTO_LABEL_PARAM'
> ../dyngen -o op.h op.o
> dyngen: Found bogus save at the start of op_pavgw_xmm
> 
> 
> 
> I found that GOTO_LABEL_PARAM ist not defined for sparc in dyngen-exec.h; any 
> reason for this?


I've fixed the 'bogus save' issue (and another sparc problem with 
incorrect C syntax generated by dyngen) with this patch:

Index: dyngen.c
===================================================================
RCS file: /cvsroot/qemu/qemu/dyngen.c,v
retrieving revision 1.40
diff -u -B -r1.40 dyngen.c
--- dyngen.c    27 Apr 2005 19:55:58 -0000      1.40
+++ dyngen.c    2 May 2005 18:29:08 -0000
@@ -1196,7 +1196,7 @@
     } else {
 #ifdef HOST_SPARC
         if (sym_name[0] == '.')
-            snprintf(name, sizeof(name),
+            snprintf(name, name_size,
                      "(long)(&__dot_%s)",
                      sym_name + 1);
         else
@@ -1451,7 +1451,9 @@
         if ((start_insn & ~0x1fff) == 0x9de3a000) {
             p_start += 0x4;
             start_offset += 0x4;
-            if ((int)(start_insn | ~0x1fff) < -128)
+            // if ((int)(start_insn | ~0x1fff) < -128)
+           // Why -128?  op_pavgb_xmm adjusts the stack by -0x110 == -272
+            if ((int)(start_insn | ~0x1fff) < -272)
                 error("Found bogus save at the start of %s", name);
             if (end_insn1 != 0x81c7e008 || end_insn2 != 0x81e80000)
                 error("ret; restore; not found at end of %s", name);



The missing GOTO_LABEL_PARAM macro needs a patch like this:

Index: dyngen-exec.h
===================================================================
RCS file: /cvsroot/qemu/qemu/dyngen-exec.h,v
retrieving revision 1.25
diff -u -B -r1.25 dyngen-exec.h
--- dyngen-exec.h       24 Apr 2005 18:01:56 -0000      1.25
+++ dyngen-exec.h       2 May 2005 18:29:07 -0000
@@ -230,6 +237,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")

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

* Re: [Qemu-devel] [PATCH] qemu-0.7.0 Solaris Host patch (Real)
  2005-05-02 18:35 Juergen Keil
@ 2005-05-03 13:10 ` Nardmann, Heiko
  0 siblings, 0 replies; 7+ messages in thread
From: Nardmann, Heiko @ 2005-05-03 13:10 UTC (permalink / raw)
  To: qemu-devel, Juergen Keil

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Okay, I now have applied all given patches to the source tree. But I still 
have problems linking qemu. Here is the linker error message:

gcc  -o qemu vl.o osdep.o block.o readline.o monitor.o pci.o console.o 
block-cow.o block-qcow.o aes.o block-vmdk.o block-cloop.o block-dmg.o 
block-bochs.o block-vpc.o ide.o ne2000.o pckbd.o vga.o sb16.o dma.o audio.o 
noaudio.o wavaudio.o sdlaudio.o fdc.o mc146818rtc.o serial.o i8259.o i8254.o 
pc.o cirrus_vga.omixeng.o apic.o parallel.o gdbstub.o sdl.o slirp/cksum.o 
slirp/if.o slirp/ip_icmp.o slirp/ip_input.o slirp/ip_output.o slirp/slirp.o 
slirp/mbuf.o slirp/misc.o slirp/sbuf.o slirp/socket.o slirp/tcp_input.o 
slirp/tcp_output.o slirp/tcp_subr.o slirp/tcp_timer.o slirp/udp.o 
slirp/bootp.o slirp/debug.o slirp/tftp.olibqemu.a  -lm -lz -lsocket -lnsl 
- -lresolv  -L/opt/sfw/lib -R/opt/sfw/lib -lSDL -lpthread -lposix4
Undefined                       first referenced
 symbol                             in file
fesetround                          libqemu.a(softfloat-native.o)
lrintf                              libqemu.a(softfloat-native.o)
llrint                              libqemu.a(softfloat-native.o)
rintf                               libqemu.a(softfloat-native.o)
lrint                               libqemu.a(softfloat-native.o)
remainderf                          libqemu.a(softfloat-native.o)
sqrtf                               libqemu.a(softfloat-native.o)
llrintf                             libqemu.a(softfloat-native.o)
ld: fatal: Symbol referencing errors. No output written to qemu
collect2: ld returned 1 exit status
gmake[1]: *** [qemu] Error 1

Okay, fesetround can be resolved by adding '-L/opt/SUNWspro/lib -lm9x' but 
what about the other symbols?

Another thing:
during compilation I get a lot of warnings about fabs which is declared 
inside /opt/SUNWspro/prod/cc/include/sunmath.h:

/home/nardmann/qemu-0.7.0/fpu/softfloat-native.h:171: warning: implicit 
declaration of function `fabsf'

BTW: yes, I am using Solaris 9.

On Montag 02 Mai 2005 20:35, Juergen Keil wrote:
> > gcc-3.4.2 -Wall -O2 -g -fno-strict-aliasing -m32 -ffixed-g1 -ffixed-g2
> > - -ffixed-g3 -ffixed-g6 -fno-delayed-branch -ffixed-i0
> > -fno-reorder-blocks - -fno-optimize-sibling-calls -I.
> > -I/home/nardmann/qemu-0.7.0/target-i386 - -I/home/nardmann/qemu-0.7.0
> > -I/opt/SUNWspro/prod/include/cc -D_GNU_SOURCE - -D_FILE_OFFSET_BITS=64
> > -D_LARGEFILE_SOURCE -I/home/nardmann/qemu-0.7.0/fpu -
> > -I/home/nardmann/qemu-0.7.0/slirp -c -o
> > op.o /home/nardmann/qemu-0.7.0/target-i386/op.c
> > In file included from /home/nardmann/qemu-0.7.0/fpu/softfloat-native.h:7,
> >                  from /home/nardmann/qemu-0.7.0/fpu/softfloat.h:394,
> >                  from /home/nardmann/qemu-0.7.0/target-i386/cpu.h:41,
> >                  from /home/nardmann/qemu-0.7.0/target-i386/exec.h:143,
> >                  from /home/nardmann/qemu-0.7.0/target-i386/op.c:22:
> > /opt/SUNWspro/prod/include/cc/fenv.h:8: warning: ignoring #pragma ident
> > In file included from /home/nardmann/qemu-0.7.0/fpu/softfloat.h:394,
> >                  from /home/nardmann/qemu-0.7.0/target-i386/cpu.h:41,
> >                  from /home/nardmann/qemu-0.7.0/target-i386/exec.h:143,
> >                  from /home/nardmann/qemu-0.7.0/target-i386/op.c:22:
> > /home/nardmann/qemu-0.7.0/fpu/softfloat-native.h: In function
> > `float32_abs': /home/nardmann/qemu-0.7.0/fpu/softfloat-native.h:164:
> > warning: implicit declaration of function `fabsf'
> > In file included from /home/nardmann/qemu-0.7.0/target-i386/op.c:724:
> > /home/nardmann/qemu-0.7.0/target-i386/ops_template.h: In function
> > `op_jb_subb':
> > /home/nardmann/qemu-0.7.0/target-i386/ops_template.h:278: warning:
> > implicit declaration of function `GOTO_LABEL_PARAM'
> > ../dyngen -o op.h op.o
> > dyngen: Found bogus save at the start of op_pavgw_xmm
> >
> >
> >
> > I found that GOTO_LABEL_PARAM ist not defined for sparc in dyngen-exec.h;
> > any reason for this?
>
> I've fixed the 'bogus save' issue (and another sparc problem with
> incorrect C syntax generated by dyngen) with this patch:
>
> Index: dyngen.c
> ===================================================================
> RCS file: /cvsroot/qemu/qemu/dyngen.c,v
> retrieving revision 1.40
> diff -u -B -r1.40 dyngen.c
> --- dyngen.c    27 Apr 2005 19:55:58 -0000      1.40
> +++ dyngen.c    2 May 2005 18:29:08 -0000
> @@ -1196,7 +1196,7 @@
>      } else {
>  #ifdef HOST_SPARC
>          if (sym_name[0] == '.')
> -            snprintf(name, sizeof(name),
> +            snprintf(name, name_size,
>                       "(long)(&__dot_%s)",
>                       sym_name + 1);
>          else
> @@ -1451,7 +1451,9 @@
>          if ((start_insn & ~0x1fff) == 0x9de3a000) {
>              p_start += 0x4;
>              start_offset += 0x4;
> -            if ((int)(start_insn | ~0x1fff) < -128)
> +            // if ((int)(start_insn | ~0x1fff) < -128)
> +           // Why -128?  op_pavgb_xmm adjusts the stack by -0x110 == -272
> +            if ((int)(start_insn | ~0x1fff) < -272)
>                  error("Found bogus save at the start of %s", name);
>              if (end_insn1 != 0x81c7e008 || end_insn2 != 0x81e80000)
>                  error("ret; restore; not found at end of %s", name);
>
>
>
> The missing GOTO_LABEL_PARAM macro needs a patch like this:
>
> Index: dyngen-exec.h
> ===================================================================
> RCS file: /cvsroot/qemu/qemu/dyngen-exec.h,v
> retrieving revision 1.25
> diff -u -B -r1.25 dyngen-exec.h
> --- dyngen-exec.h       24 Apr 2005 18:01:56 -0000      1.25
> +++ dyngen-exec.h       2 May 2005 18:29:07 -0000
> @@ -230,6 +237,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")
>
>
>
> _______________________________________________
> Qemu-devel mailing list
> Qemu-devel@nongnu.org
> http://lists.nongnu.org/mailman/listinfo/qemu-devel

- -- 
Heiko Nardmann (Dipl.-Ing. Technische Informatik)
secunet Security Networks AG - Sicherheit in Netzwerken (www.secunet.de),
Weidenauer Str. 223-225, D-57076 Siegen
Tel. : +49 271 48950-13, Fax  : +49 271 48950-50
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)

iD8DBQFCd3hXpm53PRScYygRAlJ2AKDOBYPKSzCtSsMFZRdFly6xOqG/qQCeKXV1
H7woQPoygPfc/m5buJyvBiM=
=E9ls
-----END PGP SIGNATURE-----

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

* Re: [Qemu-devel] [PATCH] qemu-0.7.0 Solaris Host patch (Real)
@ 2005-05-03 17:24 Juergen Keil
  0 siblings, 0 replies; 7+ messages in thread
From: Juergen Keil @ 2005-05-03 17:24 UTC (permalink / raw)
  To: qemu-devel



> Undefined                       first referenced
>  symbol                             in file
> fesetround                          libqemu.a(softfloat-native.o)
> lrintf                              libqemu.a(softfloat-native.o)
> llrint                              libqemu.a(softfloat-native.o)
> rintf                               libqemu.a(softfloat-native.o)
> lrint                               libqemu.a(softfloat-native.o)
> remainderf                          libqemu.a(softfloat-native.o)
> sqrtf                               libqemu.a(softfloat-native.o)
> llrintf                             libqemu.a(softfloat-native.o)
> ld: fatal: Symbol referencing errors. No output written to qemu
> collect2: ld returned 1 exit status
> gmake[1]: *** [qemu] Error 1
> 
> Okay, fesetround can be resolved by adding '-L/opt/SUNWspro/lib -lm9x' but 
> what about the other symbols?

Hmm, Solaris 10 has all of these functions in libm.so, but apparently
they are missing in the Solaris 8 or Solaris 9 math library -lm.


For the BSDs, this problem has already be solved for lrint() and llrint():

    long lrint(double x);
    long long llrint(double x);
    

See the file fpu/softfloat-native.c,  you'll find:

#if defined(_BSD)
#define lrint(d)                ((int32_t)rint(d))
#define llrint(d)               ((int64_t)rint(d))
#endif


Both macros should be enabled for Solaris 8 & 9, too.


lrintf() and llrintf() is the same, but with a float argument instead of
double.  The following macros should work:

#define lrintf(f)               ((int32_t)rint(f))
#define llrintf(f)              ((int64_t)rint(f))


sqrtf(), remainderf() and rintf() is similar to sqrt(), remainder() and
rint() but uses float arguments and result values.

#define sqrtf(f)		((float)sqrt(f))
#define remainderf(fa, fb)	((float)remainder(fa, fb))
#define rintf(f)		((float)rint(f))


(All of this is untested, but should work)

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

end of thread, other threads:[~2005-05-07  8:34 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-03 17:24 [Qemu-devel] [PATCH] qemu-0.7.0 Solaris Host patch (Real) Juergen Keil
  -- strict thread matches above, loose matches on Subject: below --
2005-05-02 18:35 Juergen Keil
2005-05-03 13:10 ` Nardmann, Heiko
2005-04-28 14:24 Ben Taylor
2005-04-30  9:40 ` Alex Beregszaszi
2005-05-02 10:12 ` Nardmann, Heiko
2005-05-02 10:51   ` Nardmann, Heiko

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