提交 ec530c81 编写于 作者: B bellard

Solaris port (Ben Taylor)


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1855 c046a42c-6fe2-441c-8c8c-71466251a162
上级 96b74a02
...@@ -166,6 +166,9 @@ endif ...@@ -166,6 +166,9 @@ endif
ifdef CONFIG_WIN32 ifdef CONFIG_WIN32
LIBS+=-lwinmm -lws2_32 -liphlpapi LIBS+=-lwinmm -lws2_32 -liphlpapi
endif endif
ifdef CONFIG_SOLARIS
LIBS+=-lsocket -lnsl -lresolv
endif
# profiling code # profiling code
ifdef TARGET_GPROF ifdef TARGET_GPROF
...@@ -369,9 +372,11 @@ VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/i386-vl.ld ...@@ -369,9 +372,11 @@ VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/i386-vl.ld
endif endif
ifndef CONFIG_DARWIN ifndef CONFIG_DARWIN
ifndef CONFIG_WIN32 ifndef CONFIG_WIN32
ifndef CONFIG_SOLARIS
VL_LIBS=-lutil VL_LIBS=-lutil
endif endif
endif endif
endif
ifdef TARGET_GPROF ifdef TARGET_GPROF
vl.o: CFLAGS+=-p vl.o: CFLAGS+=-p
VL_LDFLAGS+=-p VL_LDFLAGS+=-p
......
...@@ -44,6 +44,10 @@ ...@@ -44,6 +44,10 @@
#include <CoreFoundation/CoreFoundation.h> #include <CoreFoundation/CoreFoundation.h>
#endif #endif
#ifdef __sun__
#include <sys/dkio.h>
#endif
static BlockDriverState *bdrv_first; static BlockDriverState *bdrv_first;
static BlockDriver *first_drv; static BlockDriver *first_drv;
...@@ -648,7 +652,6 @@ void bdrv_info(void) ...@@ -648,7 +652,6 @@ void bdrv_info(void)
} }
} }
/**************************************************************/ /**************************************************************/
/* RAW block driver */ /* RAW block driver */
...@@ -669,6 +672,10 @@ static int raw_open(BlockDriverState *bs, const char *filename) ...@@ -669,6 +672,10 @@ static int raw_open(BlockDriverState *bs, const char *filename)
#ifdef _BSD #ifdef _BSD
struct stat sb; struct stat sb;
#endif #endif
#ifdef __sun__
struct dk_minfo minfo;
int rv;
#endif
fd = open(filename, O_RDWR | O_BINARY | O_LARGEFILE); fd = open(filename, O_RDWR | O_BINARY | O_LARGEFILE);
if (fd < 0) { if (fd < 0) {
...@@ -688,6 +695,17 @@ static int raw_open(BlockDriverState *bs, const char *filename) ...@@ -688,6 +695,17 @@ static int raw_open(BlockDriverState *bs, const char *filename)
size = lseek(fd, 0LL, SEEK_END); size = lseek(fd, 0LL, SEEK_END);
#endif #endif
} else } 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 #endif
{ {
size = lseek(fd, 0, SEEK_END); size = lseek(fd, 0, SEEK_END);
......
...@@ -125,6 +125,9 @@ Darwin) ...@@ -125,6 +125,9 @@ Darwin)
bsd="yes" bsd="yes"
darwin="yes" darwin="yes"
;; ;;
SunOS)
solaris="yes"
;;
*) *)
oss="yes" oss="yes"
linux="yes" linux="yes"
...@@ -141,6 +144,15 @@ if [ "$bsd" = "yes" ] ; then ...@@ -141,6 +144,15 @@ if [ "$bsd" = "yes" ] ; then
fi fi
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 # find source path
source_path=`dirname "$0"` source_path=`dirname "$0"`
if [ -z "$source_path" ]; then if [ -z "$source_path" ]; then
...@@ -299,6 +311,57 @@ if test "$mingw32" = "yes" ; then ...@@ -299,6 +311,57 @@ if test "$mingw32" = "yes" ; then
fi fi
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 if test -z "$target_list" ; then
# these targets are portable # these targets are portable
if [ "$softmmu" = "yes" ] ; then if [ "$softmmu" = "yes" ] ; then
...@@ -585,6 +648,12 @@ if test "$darwin" = "yes" ; then ...@@ -585,6 +648,12 @@ if test "$darwin" = "yes" ; then
echo "CONFIG_DARWIN=yes" >> $config_mak echo "CONFIG_DARWIN=yes" >> $config_mak
echo "#define CONFIG_DARWIN 1" >> $config_h echo "#define CONFIG_DARWIN 1" >> $config_h
fi 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 if test "$gdbstub" = "yes" ; then
echo "CONFIG_GDBSTUB=yes" >> $config_mak echo "CONFIG_GDBSTUB=yes" >> $config_mak
echo "#define CONFIG_GDBSTUB 1" >> $config_h echo "#define CONFIG_GDBSTUB 1" >> $config_h
...@@ -690,7 +759,12 @@ if test "$target_user_only" = "no" ; then ...@@ -690,7 +759,12 @@ if test "$target_user_only" = "no" ; then
mkdir -p $target_dir/slirp mkdir -p $target_dir/slirp
fi 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_mak
echo "/* Automatically generated by configure - do not modify */" > $config_h echo "/* Automatically generated by configure - do not modify */" > $config_h
...@@ -802,8 +876,10 @@ if test "$source_path_used" = "yes" ; then ...@@ -802,8 +876,10 @@ if test "$source_path_used" = "yes" ; then
for dir in $DIRS ; do for dir in $DIRS ; do
mkdir -p $dir mkdir -p $dir
done done
# remove the link and recreate it, as not all "ln -sf" overwrite the link
for f in $FILES ; do for f in $FILES ; do
ln -sf $source_path/$f $f rm -f $f
ln -s $source_path/$f $f
done done
fi fi
......
...@@ -20,6 +20,13 @@ ...@@ -20,6 +20,13 @@
#if !defined(__DYNGEN_EXEC_H__) #if !defined(__DYNGEN_EXEC_H__)
#define __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 /* NOTE: standard headers should be used with special care at this
point because host CPU registers are used as global variables. Some point because host CPU registers are used as global variables. Some
host headers do not allow that. */ host headers do not allow that. */
...@@ -35,7 +42,12 @@ typedef unsigned long uint64_t; ...@@ -35,7 +42,12 @@ typedef unsigned long uint64_t;
typedef unsigned long long uint64_t; typedef unsigned long long uint64_t;
#endif #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; typedef signed char int8_t;
#endif
typedef signed short int16_t; typedef signed short int16_t;
typedef signed int int32_t; typedef signed int int32_t;
#if defined (__x86_64__) || defined(__ia64) #if defined (__x86_64__) || defined(__ia64)
...@@ -231,6 +243,8 @@ extern int __op_jmp0, __op_jmp1, __op_jmp2, __op_jmp3; ...@@ -231,6 +243,8 @@ extern int __op_jmp0, __op_jmp1, __op_jmp2, __op_jmp3;
#ifdef __sparc__ #ifdef __sparc__
#define EXIT_TB() asm volatile ("jmpl %i0 + 8, %g0\n" \ #define EXIT_TB() asm volatile ("jmpl %i0 + 8, %g0\n" \
"nop") "nop")
#define GOTO_LABEL_PARAM(n) asm volatile ( \
"set " ASM_NAME(__op_gen_label) #n ", %g1; jmp %g1; nop")
#endif #endif
#ifdef __arm__ #ifdef __arm__
#define EXIT_TB() asm volatile ("b exec_loop") #define EXIT_TB() asm volatile ("b exec_loop")
......
...@@ -3,8 +3,11 @@ ...@@ -3,8 +3,11 @@
#if defined(_BSD) && !defined(__APPLE__) #if defined(_BSD) && !defined(__APPLE__)
#include <ieeefp.h> #include <ieeefp.h>
#else #else
#if !defined(_PRESOLARIS10)
#include <fenv.h> #include <fenv.h>
#endif #endif
#endif
#include "gnu-c99-math.h"
typedef float float32; typedef float float32;
typedef double float64; typedef double float64;
......
...@@ -177,7 +177,7 @@ void set_floatx80_rounding_precision(int val STATUS_PARAM); ...@@ -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 | Routine to raise any or all of the software IEC/IEEE floating-point
| exception flags. | 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. | Software IEC/IEEE integer-to-floating-point conversion routines.
......
...@@ -138,6 +138,9 @@ ...@@ -138,6 +138,9 @@
/* Define if you don't have u_int32_t etc. typedef'd */ /* Define if you don't have u_int32_t etc. typedef'd */
#undef NEED_TYPEDEFS #undef NEED_TYPEDEFS
#ifdef __sun__
#define NEED_TYPEDEFS
#endif
/* Define to sizeof(char) */ /* Define to sizeof(char) */
#define SIZEOF_CHAR 1 #define SIZEOF_CHAR 1
......
...@@ -9,6 +9,9 @@ ...@@ -9,6 +9,9 @@
#include <slirp.h> #include <slirp.h>
#include "ip_icmp.h" #include "ip_icmp.h"
#include "main.h" #include "main.h"
#ifdef __sun__
#include <sys/filio.h>
#endif
void void
so_init() so_init()
......
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
#include <libutil.h> #include <libutil.h>
#endif #endif
#else #else
#ifndef __sun__
#include <linux/if.h> #include <linux/if.h>
#include <linux/if_tun.h> #include <linux/if_tun.h>
#include <pty.h> #include <pty.h>
...@@ -55,6 +56,7 @@ ...@@ -55,6 +56,7 @@
#include <linux/ppdev.h> #include <linux/ppdev.h>
#endif #endif
#endif #endif
#endif
#if defined(CONFIG_SLIRP) #if defined(CONFIG_SLIRP)
#include "libslirp.h" #include "libslirp.h"
...@@ -2531,6 +2533,12 @@ static int tap_open(char *ifname, int ifname_size) ...@@ -2531,6 +2533,12 @@ static int tap_open(char *ifname, int ifname_size)
fcntl(fd, F_SETFL, O_NONBLOCK); fcntl(fd, F_SETFL, O_NONBLOCK);
return fd; 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 #else
static int tap_open(char *ifname, int ifname_size) static int tap_open(char *ifname, int ifname_size)
{ {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册