Commit ec530c81 authored by bellard's avatar bellard

Solaris port (Ben Taylor)


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1855 c046a42c-6fe2-441c-8c8c-71466251a162
parent 96b74a02
......@@ -166,6 +166,9 @@ endif
ifdef CONFIG_WIN32
LIBS+=-lwinmm -lws2_32 -liphlpapi
endif
ifdef CONFIG_SOLARIS
LIBS+=-lsocket -lnsl -lresolv
endif
# profiling code
ifdef TARGET_GPROF
......@@ -369,9 +372,11 @@ VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/i386-vl.ld
endif
ifndef CONFIG_DARWIN
ifndef CONFIG_WIN32
ifndef CONFIG_SOLARIS
VL_LIBS=-lutil
endif
endif
endif
ifdef TARGET_GPROF
vl.o: CFLAGS+=-p
VL_LDFLAGS+=-p
......
......@@ -44,6 +44,10 @@
#include <CoreFoundation/CoreFoundation.h>
#endif
#ifdef __sun__
#include <sys/dkio.h>
#endif
static BlockDriverState *bdrv_first;
static BlockDriver *first_drv;
......@@ -648,7 +652,6 @@ void bdrv_info(void)
}
}
/**************************************************************/
/* RAW block driver */
......@@ -669,6 +672,10 @@ static int raw_open(BlockDriverState *bs, const char *filename)
#ifdef _BSD
struct stat sb;
#endif
#ifdef __sun__
struct dk_minfo minfo;
int rv;
#endif
fd = open(filename, O_RDWR | O_BINARY | O_LARGEFILE);
if (fd < 0) {
......@@ -688,6 +695,17 @@ static int raw_open(BlockDriverState *bs, const char *filename)
size = lseek(fd, 0LL, SEEK_END);
#endif
} else
#endif
#ifdef __sun__
/*
* use the DKIOCGMEDIAINFO ioctl to read the size.
*/
rv = ioctl ( fd, DKIOCGMEDIAINFO, &minfo );
if ( rv != -1 ) {
size = minfo.dki_lbsize * minfo.dki_capacity;
} else /* there are reports that lseek on some devices
fails, but irc discussion said that contingency
on contingency was overkill */
#endif
{
size = lseek(fd, 0, SEEK_END);
......
......@@ -125,6 +125,9 @@ Darwin)
bsd="yes"
darwin="yes"
;;
SunOS)
solaris="yes"
;;
*)
oss="yes"
linux="yes"
......@@ -141,6 +144,15 @@ if [ "$bsd" = "yes" ] ; then
fi
fi
if [ "$solaris" = "yes" ] ; then
make="gmake"
install="ginstall"
solarisrev=`uname -r | cut -f2 -d.`
if test $solarisrev -lt 10 ; then
presolaris10="yes"
fi
fi
# find source path
source_path=`dirname "$0"`
if [ -z "$source_path" ]; then
......@@ -299,6 +311,57 @@ if test "$mingw32" = "yes" ; then
fi
fi
#
# Solaris specific configure tool chain decisions
#
if test "$solaris" = "yes" ; then
#
# gcc for solaris 10/fcs in /usr/sfw/bin doesn't compile qemu correctly
# override the check with --disable-gcc-check
#
if test "$solarisrev" -eq 10 -a "$check_gcc" = "yes" ; then
solgcc=`which $cc`
if test "$solgcc" = "/usr/sfw/bin/gcc" ; then
echo "Solaris 10/FCS gcc in /usr/sfw/bin will not compiled qemu correctly."
echo "please get gcc-3.4.3 or later, from www.blastwave.org using pkg-get -i gcc3"
echo "or get the latest patch from SunSolve for gcc"
exit 1
fi
fi
solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
if test -z "$solinst" ; then
echo "Solaris install program not found. Use --install=/usr/ucb/install or"
echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
exit 1
fi
if test "$solinst" = "/usr/sbin/install" ; then
echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
echo "try ginstall from the GNU fileutils available from www.blastwave.org"
echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
exit 1
fi
soltexi2html=`which texi2html 2> /dev/null | /usr/bin/grep -v "no texi2html in"`
if test -z "$soltexi2html" ; then
echo "Error: No path includes texi2html."
if test -f /usr/sfw/bin/texi2html ; then
echo "Add /usr/sfw/bin to your path and rerun configure"
else
echo "Add the directory holding the texi2html to your path and rerun configure"
fi
exit 1
fi
sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
if test -z "$sol_ar" ; then
echo "Error: No path includes ar"
if test -f /usr/ccs/bin/ar ; then
echo "Add /usr/ccs/bin to your path and rerun configure"
fi
exit 1
fi
fi
if test -z "$target_list" ; then
# these targets are portable
if [ "$softmmu" = "yes" ] ; then
......@@ -585,6 +648,12 @@ if test "$darwin" = "yes" ; then
echo "CONFIG_DARWIN=yes" >> $config_mak
echo "#define CONFIG_DARWIN 1" >> $config_h
fi
if test "$solaris" = "yes" ; then
echo "CONFIG_SOLARIS=yes" >> $config_mak
if test "$presolaris10" = "yes" ; then
echo "#define _PRESOLARIS10 1" >> $config_h
fi
fi
if test "$gdbstub" = "yes" ; then
echo "CONFIG_GDBSTUB=yes" >> $config_mak
echo "#define CONFIG_GDBSTUB 1" >> $config_h
......@@ -690,7 +759,12 @@ if test "$target_user_only" = "no" ; then
mkdir -p $target_dir/slirp
fi
ln -sf $source_path/Makefile.target $target_dir/Makefile
#
# don't use ln -sf as not all "ln -sf" over write the file/link
#
rm -f $target_dir/Makefile
ln -s $source_path/Makefile.target $target_dir/Makefile
echo "# Automatically generated by configure - do not modify" > $config_mak
echo "/* Automatically generated by configure - do not modify */" > $config_h
......@@ -802,8 +876,10 @@ if test "$source_path_used" = "yes" ; then
for dir in $DIRS ; do
mkdir -p $dir
done
# remove the link and recreate it, as not all "ln -sf" overwrite the link
for f in $FILES ; do
ln -sf $source_path/$f $f
rm -f $f
ln -s $source_path/$f $f
done
fi
......
......@@ -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 uint64_t;
typedef unsigned long long uint64_t;
#endif
/* if Solaris/__sun__, don't typedef int8_t, as it will be typedef'd
prior to this and will cause an error in compliation, conflicting
with /usr/include/sys/int_types.h, line 75 */
#ifndef __sun__
typedef signed char int8_t;
#endif
typedef signed short int16_t;
typedef signed int int32_t;
#if defined (__x86_64__) || defined(__ia64)
......@@ -231,6 +243,8 @@ extern int __op_jmp0, __op_jmp1, __op_jmp2, __op_jmp3;
#ifdef __sparc__
#define EXIT_TB() asm volatile ("jmpl %i0 + 8, %g0\n" \
"nop")
#define GOTO_LABEL_PARAM(n) asm volatile ( \
"set " ASM_NAME(__op_gen_label) #n ", %g1; jmp %g1; nop")
#endif
#ifdef __arm__
#define EXIT_TB() asm volatile ("b exec_loop")
......
......@@ -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;
......
......@@ -177,7 +177,7 @@ void set_floatx80_rounding_precision(int val STATUS_PARAM);
| Routine to raise any or all of the software IEC/IEEE floating-point
| exception flags.
*----------------------------------------------------------------------------*/
void float_raise( signed char STATUS_PARAM);
void float_raise( int8 flags STATUS_PARAM);
/*----------------------------------------------------------------------------
| Software IEC/IEEE integer-to-floating-point conversion routines.
......
......@@ -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
......
......@@ -9,6 +9,9 @@
#include <slirp.h>
#include "ip_icmp.h"
#include "main.h"
#ifdef __sun__
#include <sys/filio.h>
#endif
void
so_init()
......
......@@ -47,6 +47,7 @@
#include <libutil.h>
#endif
#else
#ifndef __sun__
#include <linux/if.h>
#include <linux/if_tun.h>
#include <pty.h>
......@@ -55,6 +56,7 @@
#include <linux/ppdev.h>
#endif
#endif
#endif
#if defined(CONFIG_SLIRP)
#include "libslirp.h"
......@@ -2531,6 +2533,12 @@ static int tap_open(char *ifname, int ifname_size)
fcntl(fd, F_SETFL, O_NONBLOCK);
return fd;
}
#elif defined(__sun__)
static int tap_open(char *ifname, int ifname_size)
{
fprintf(stderr, "warning: tap_open not yet implemented\n");
return -1;
}
#else
static int tap_open(char *ifname, int ifname_size)
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment