[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] PATCH: update for Solaris patch to current CVS
From: |
Ben Taylor |
Subject: |
[Qemu-devel] PATCH: update for Solaris patch to current CVS |
Date: |
Fri, 21 Apr 2006 16:38:14 -0400 |
This is hopefully the final iteration of the Solaris patch.
The main difference between this patch and previous patches
was the cleanup of dyngen-exec.h. Previous patches #ifdef'd
out a bunch of linux code and irc discussions showed that
this was not a preferable solution. I reworked the patch
to isolate the specific problems for Solaris, and had to
reorder the includes in target-ppc/op_helper.c and target-mips/op_helper.c to
avoid a duplicate typedef
problem with one variable.
Please forward me any comments about the patch.
Fabrice/Paul - can we get this into the CVS tree?
Ben
diff -ruN qemu/Makefile.target qemu-solaris/Makefile.target
--- qemu/Makefile.target 2006-04-17 09:57:12.000000000 -0400
+++ qemu-solaris/Makefile.target 2006-04-21 16:05:02.000000000 -0400
@@ -166,6 +166,9 @@
ifdef CONFIG_WIN32
LIBS+=-lwinmm -lws2_32 -liphlpapi
endif
+ifdef CONFIG_SOLARIS
+LIBS+=-lsocket -lnsl -lresolv
+endif
# profiling code
ifdef TARGET_GPROF
@@ -283,6 +286,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 +381,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
diff -ruN qemu/block.c qemu-solaris/block.c
--- qemu/block.c 2005-12-18 13:28:15.000000000 -0500
+++ qemu-solaris/block.c 2006-04-21 16:05:36.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/configure qemu-solaris/configure
--- qemu/configure 2006-04-17 09:57:12.000000000 -0400
+++ qemu-solaris/configure 2006-04-21 16:07:06.000000000 -0400
@@ -51,7 +51,7 @@
s390)
cpu="s390"
;;
- sparc)
+ sparc|sun4m|sun4u)
cpu="sparc"
;;
sparc64)
@@ -124,6 +124,9 @@
bsd="yes"
darwin="yes"
;;
+SunOS)
+solaris="yes"
+;;
*)
oss="yes"
linux="yes"
@@ -140,6 +143,15 @@
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
@@ -215,6 +227,20 @@
;;
--enable-cocoa) cocoa="yes" ; coreaudio="yes" ; sdl="no"
;;
+ --oss-inc=*) oss_inc=$"optarg"
+ if test "$oss_inc" = "/usr/include"; then
+ oss_inc="";
+ fi
+ 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
+ else
+ oss=yes;
+ fi
+ ;;
--disable-gfx-check) check_gfx="no"
;;
--disable-gcc-check) check_gcc="no"
@@ -274,6 +300,7 @@
echo " --disable-user disable all linux usermode emulation targets"
echo " --fmod-lib path to FMOD library"
echo " --fmod-inc path to FMOD includes"
+echo " --oss-inc path to OSS includes (if not in /usr/include)"
echo ""
echo "NOTE: The object files are build at the place where configure is
launched"
exit 1
@@ -293,6 +320,57 @@
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
@@ -483,6 +561,11 @@
fmod_support=""
fi
echo "FMOD support $fmod $fmod_support"
+if test "$oss" = "yes" -a -z "$oss_inc" ; then
+ echo "OSS support $oss (include='$oss_inc')"
+else
+ echo "OSS support $oss"
+fi
echo "kqemu support $kqemu"
if test $sdl_too_old = "yes"; then
@@ -573,6 +656,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
@@ -597,6 +689,9 @@
echo "#define CONFIG_ADLIB 1" >> $config_h
fi
if test "$oss" = "yes" ; then
+ if test "$solaris" = "yes" && test -n "$oss_inc" ; then
+ echo "CONFIG_OSS_INC=$oss_inc" >> $config_mak
+ fi
echo "CONFIG_OSS=yes" >> $config_mak
echo "#define CONFIG_OSS 1" >> $config_h
fi
@@ -675,7 +770,12 @@
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
@@ -787,8 +887,10 @@
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
diff -ruN qemu/dyngen-exec.h qemu-solaris/dyngen-exec.h
--- qemu/dyngen-exec.h 2005-07-24 11:11:38.000000000 -0400
+++ qemu-solaris/dyngen-exec.h 2006-04-21 16:13:34.000000000 -0400
@@ -20,6 +20,13 @@
#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 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 @@
#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/fpu/softfloat-native.h qemu-solaris/fpu/softfloat-native.h
--- qemu/fpu/softfloat-native.h 2005-03-20 05:33:58.000000000 -0500
+++ qemu-solaris/fpu/softfloat-native.h 2006-04-21 16:08:09.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/fpu/softfloat.h qemu-solaris/fpu/softfloat.h
--- qemu/fpu/softfloat.h 2005-03-13 13:52:29.000000000 -0500
+++ qemu-solaris/fpu/softfloat.h 2006-04-21 16:09:16.000000000 -0400
@@ -177,7 +177,7 @@
| 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.
diff -ruN qemu/gnu-c99-math.h qemu-solaris/gnu-c99-math.h
--- qemu/gnu-c99-math.h 1969-12-31 19:00:00.000000000 -0500
+++ qemu-solaris/gnu-c99-math.h 2006-04-21 16:07:45.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) ((!unordered(x, y)) && ((x) >= (y)))
+#define isless(x, y) ((!unordered(x, y)) && ((x) < (y)))
+#define islessequal(x, y) ((!unordered(x, y)) && ((x) <= (y)))
+
+#define isunordered(x,y) unordered(x, y)
+
+#endif
diff -ruN qemu/slirp/slirp_config.h qemu-solaris/slirp/slirp_config.h
--- qemu/slirp/slirp_config.h 2005-06-05 13:11:42.000000000 -0400
+++ qemu-solaris/slirp/slirp_config.h 2006-04-21 16:09:54.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/slirp/socket.c qemu-solaris/slirp/socket.c
--- qemu/slirp/socket.c 2006-03-11 15:48:36.000000000 -0500
+++ qemu-solaris/slirp/socket.c 2006-04-21 16:10:08.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/target-mips/op_helper.c qemu-solaris/target-mips/op_helper.c
--- qemu/target-mips/op_helper.c 2006-03-11 11:39:23.000000000 -0500
+++ qemu-solaris/target-mips/op_helper.c 2006-04-21 16:14:11.000000000
-0400
@@ -17,8 +17,8 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include <math.h>
#include "exec.h"
+#include <math.h>
#define MIPS_DEBUG_DISAS
diff -ruN qemu/target-ppc/op_helper.c qemu-solaris/target-ppc/op_helper.c
--- qemu/target-ppc/op_helper.c 2005-07-04 18:17:05.000000000 -0400
+++ qemu-solaris/target-ppc/op_helper.c 2006-04-21 16:13:56.000000000 -0400
@@ -17,8 +17,8 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include <math.h>
#include "exec.h"
+#include <math.h>
#define MEMSUFFIX _raw
#include "op_helper_mem.h"
diff -ruN qemu/vl.c qemu-solaris/vl.c
--- qemu/vl.c 2006-04-16 07:06:58.000000000 -0400
+++ qemu-solaris/vl.c 2006-04-21 16:11:19.000000000 -0400
@@ -47,6 +47,21 @@
#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 <stropts.h>
+#else
#include <linux/if.h>
#include <linux/if_tun.h>
#include <pty.h>
@@ -55,6 +70,7 @@
#include <linux/ppdev.h>
#endif
#endif
+#endif
#if defined(CONFIG_SLIRP)
#include "libslirp.h"
@@ -2560,6 +2576,12 @@
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)
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qemu-devel] PATCH: update for Solaris patch to current CVS,
Ben Taylor <=