Commit ec530c81efea6ddb1f75758658fd6769a29c3ade

Authored by bellard
1 parent 96b74a02

Solaris port (Ben Taylor)


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1855 c046a42c-6fe2-441c-8c8c-71466251a162
Makefile.target
... ... @@ -166,6 +166,9 @@ endif
166 166 ifdef CONFIG_WIN32
167 167 LIBS+=-lwinmm -lws2_32 -liphlpapi
168 168 endif
  169 +ifdef CONFIG_SOLARIS
  170 +LIBS+=-lsocket -lnsl -lresolv
  171 +endif
169 172  
170 173 # profiling code
171 174 ifdef TARGET_GPROF
... ... @@ -369,9 +372,11 @@ VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/i386-vl.ld
369 372 endif
370 373 ifndef CONFIG_DARWIN
371 374 ifndef CONFIG_WIN32
  375 +ifndef CONFIG_SOLARIS
372 376 VL_LIBS=-lutil
373 377 endif
374 378 endif
  379 +endif
375 380 ifdef TARGET_GPROF
376 381 vl.o: CFLAGS+=-p
377 382 VL_LDFLAGS+=-p
... ...
... ... @@ -44,6 +44,10 @@
44 44 #include <CoreFoundation/CoreFoundation.h>
45 45 #endif
46 46  
  47 +#ifdef __sun__
  48 +#include <sys/dkio.h>
  49 +#endif
  50 +
47 51 static BlockDriverState *bdrv_first;
48 52 static BlockDriver *first_drv;
49 53  
... ... @@ -648,7 +652,6 @@ void bdrv_info(void)
648 652 }
649 653 }
650 654  
651   -
652 655 /**************************************************************/
653 656 /* RAW block driver */
654 657  
... ... @@ -669,6 +672,10 @@ static int raw_open(BlockDriverState *bs, const char *filename)
669 672 #ifdef _BSD
670 673 struct stat sb;
671 674 #endif
  675 +#ifdef __sun__
  676 + struct dk_minfo minfo;
  677 + int rv;
  678 +#endif
672 679  
673 680 fd = open(filename, O_RDWR | O_BINARY | O_LARGEFILE);
674 681 if (fd < 0) {
... ... @@ -689,6 +696,17 @@ static int raw_open(BlockDriverState *bs, const char *filename)
689 696 #endif
690 697 } else
691 698 #endif
  699 +#ifdef __sun__
  700 + /*
  701 + * use the DKIOCGMEDIAINFO ioctl to read the size.
  702 + */
  703 + rv = ioctl ( fd, DKIOCGMEDIAINFO, &minfo );
  704 + if ( rv != -1 ) {
  705 + size = minfo.dki_lbsize * minfo.dki_capacity;
  706 + } else /* there are reports that lseek on some devices
  707 + fails, but irc discussion said that contingency
  708 + on contingency was overkill */
  709 +#endif
692 710 {
693 711 size = lseek(fd, 0, SEEK_END);
694 712 }
... ...
configure
... ... @@ -125,6 +125,9 @@ Darwin)
125 125 bsd="yes"
126 126 darwin="yes"
127 127 ;;
  128 +SunOS)
  129 +solaris="yes"
  130 +;;
128 131 *)
129 132 oss="yes"
130 133 linux="yes"
... ... @@ -141,6 +144,15 @@ if [ &quot;$bsd&quot; = &quot;yes&quot; ] ; then
141 144 fi
142 145 fi
143 146  
  147 +if [ "$solaris" = "yes" ] ; then
  148 + make="gmake"
  149 + install="ginstall"
  150 + solarisrev=`uname -r | cut -f2 -d.`
  151 + if test $solarisrev -lt 10 ; then
  152 + presolaris10="yes"
  153 + fi
  154 +fi
  155 +
144 156 # find source path
145 157 source_path=`dirname "$0"`
146 158 if [ -z "$source_path" ]; then
... ... @@ -299,6 +311,57 @@ if test &quot;$mingw32&quot; = &quot;yes&quot; ; then
299 311 fi
300 312 fi
301 313  
  314 +#
  315 +# Solaris specific configure tool chain decisions
  316 +#
  317 +if test "$solaris" = "yes" ; then
  318 + #
  319 + # gcc for solaris 10/fcs in /usr/sfw/bin doesn't compile qemu correctly
  320 + # override the check with --disable-gcc-check
  321 + #
  322 + if test "$solarisrev" -eq 10 -a "$check_gcc" = "yes" ; then
  323 + solgcc=`which $cc`
  324 + if test "$solgcc" = "/usr/sfw/bin/gcc" ; then
  325 + echo "Solaris 10/FCS gcc in /usr/sfw/bin will not compiled qemu correctly."
  326 + echo "please get gcc-3.4.3 or later, from www.blastwave.org using pkg-get -i gcc3"
  327 + echo "or get the latest patch from SunSolve for gcc"
  328 + exit 1
  329 + fi
  330 + fi
  331 + solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
  332 + if test -z "$solinst" ; then
  333 + echo "Solaris install program not found. Use --install=/usr/ucb/install or"
  334 + echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
  335 + echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
  336 + exit 1
  337 + fi
  338 + if test "$solinst" = "/usr/sbin/install" ; then
  339 + echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
  340 + echo "try ginstall from the GNU fileutils available from www.blastwave.org"
  341 + echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
  342 + exit 1
  343 + fi
  344 + soltexi2html=`which texi2html 2> /dev/null | /usr/bin/grep -v "no texi2html in"`
  345 + if test -z "$soltexi2html" ; then
  346 + echo "Error: No path includes texi2html."
  347 + if test -f /usr/sfw/bin/texi2html ; then
  348 + echo "Add /usr/sfw/bin to your path and rerun configure"
  349 + else
  350 + echo "Add the directory holding the texi2html to your path and rerun configure"
  351 + fi
  352 + exit 1
  353 + fi
  354 + sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
  355 + if test -z "$sol_ar" ; then
  356 + echo "Error: No path includes ar"
  357 + if test -f /usr/ccs/bin/ar ; then
  358 + echo "Add /usr/ccs/bin to your path and rerun configure"
  359 + fi
  360 + exit 1
  361 + fi
  362 +fi
  363 +
  364 +
302 365 if test -z "$target_list" ; then
303 366 # these targets are portable
304 367 if [ "$softmmu" = "yes" ] ; then
... ... @@ -585,6 +648,12 @@ if test &quot;$darwin&quot; = &quot;yes&quot; ; then
585 648 echo "CONFIG_DARWIN=yes" >> $config_mak
586 649 echo "#define CONFIG_DARWIN 1" >> $config_h
587 650 fi
  651 +if test "$solaris" = "yes" ; then
  652 + echo "CONFIG_SOLARIS=yes" >> $config_mak
  653 + if test "$presolaris10" = "yes" ; then
  654 + echo "#define _PRESOLARIS10 1" >> $config_h
  655 + fi
  656 +fi
588 657 if test "$gdbstub" = "yes" ; then
589 658 echo "CONFIG_GDBSTUB=yes" >> $config_mak
590 659 echo "#define CONFIG_GDBSTUB 1" >> $config_h
... ... @@ -690,7 +759,12 @@ if test &quot;$target_user_only&quot; = &quot;no&quot; ; then
690 759 mkdir -p $target_dir/slirp
691 760 fi
692 761  
693   -ln -sf $source_path/Makefile.target $target_dir/Makefile
  762 +#
  763 +# don't use ln -sf as not all "ln -sf" over write the file/link
  764 +#
  765 +rm -f $target_dir/Makefile
  766 +ln -s $source_path/Makefile.target $target_dir/Makefile
  767 +
694 768  
695 769 echo "# Automatically generated by configure - do not modify" > $config_mak
696 770 echo "/* Automatically generated by configure - do not modify */" > $config_h
... ... @@ -802,8 +876,10 @@ if test &quot;$source_path_used&quot; = &quot;yes&quot; ; then
802 876 for dir in $DIRS ; do
803 877 mkdir -p $dir
804 878 done
  879 + # remove the link and recreate it, as not all "ln -sf" overwrite the link
805 880 for f in $FILES ; do
806   - ln -sf $source_path/$f $f
  881 + rm -f $f
  882 + ln -s $source_path/$f $f
807 883 done
808 884 fi
809 885  
... ...
dyngen-exec.h
... ... @@ -20,6 +20,13 @@
20 20 #if !defined(__DYNGEN_EXEC_H__)
21 21 #define __DYNGEN_EXEC_H__
22 22  
  23 +/* prevent Solaris from trying to typedef FILE in gcc's
  24 + include/floatingpoint.h which will conflict with the
  25 + definition down below */
  26 +#ifdef __sun__
  27 +#define _FILEDEFED
  28 +#endif
  29 +
23 30 /* NOTE: standard headers should be used with special care at this
24 31 point because host CPU registers are used as global variables. Some
25 32 host headers do not allow that. */
... ... @@ -35,7 +42,12 @@ typedef unsigned long uint64_t;
35 42 typedef unsigned long long uint64_t;
36 43 #endif
37 44  
  45 +/* if Solaris/__sun__, don't typedef int8_t, as it will be typedef'd
  46 + prior to this and will cause an error in compliation, conflicting
  47 + with /usr/include/sys/int_types.h, line 75 */
  48 +#ifndef __sun__
38 49 typedef signed char int8_t;
  50 +#endif
39 51 typedef signed short int16_t;
40 52 typedef signed int int32_t;
41 53 #if defined (__x86_64__) || defined(__ia64)
... ... @@ -231,6 +243,8 @@ extern int __op_jmp0, __op_jmp1, __op_jmp2, __op_jmp3;
231 243 #ifdef __sparc__
232 244 #define EXIT_TB() asm volatile ("jmpl %i0 + 8, %g0\n" \
233 245 "nop")
  246 +#define GOTO_LABEL_PARAM(n) asm volatile ( \
  247 + "set " ASM_NAME(__op_gen_label) #n ", %g1; jmp %g1; nop")
234 248 #endif
235 249 #ifdef __arm__
236 250 #define EXIT_TB() asm volatile ("b exec_loop")
... ...
fpu/softfloat-native.h
... ... @@ -3,8 +3,11 @@
3 3 #if defined(_BSD) && !defined(__APPLE__)
4 4 #include <ieeefp.h>
5 5 #else
  6 +#if !defined(_PRESOLARIS10)
6 7 #include <fenv.h>
7 8 #endif
  9 +#endif
  10 +#include "gnu-c99-math.h"
8 11  
9 12 typedef float float32;
10 13 typedef double float64;
... ...
fpu/softfloat.h
... ... @@ -177,7 +177,7 @@ void set_floatx80_rounding_precision(int val STATUS_PARAM);
177 177 | Routine to raise any or all of the software IEC/IEEE floating-point
178 178 | exception flags.
179 179 *----------------------------------------------------------------------------*/
180   -void float_raise( signed char STATUS_PARAM);
  180 +void float_raise( int8 flags STATUS_PARAM);
181 181  
182 182 /*----------------------------------------------------------------------------
183 183 | Software IEC/IEEE integer-to-floating-point conversion routines.
... ...
slirp/slirp_config.h
... ... @@ -138,6 +138,9 @@
138 138  
139 139 /* Define if you don't have u_int32_t etc. typedef'd */
140 140 #undef NEED_TYPEDEFS
  141 +#ifdef __sun__
  142 +#define NEED_TYPEDEFS
  143 +#endif
141 144  
142 145 /* Define to sizeof(char) */
143 146 #define SIZEOF_CHAR 1
... ...
slirp/socket.c
... ... @@ -9,6 +9,9 @@
9 9 #include <slirp.h>
10 10 #include "ip_icmp.h"
11 11 #include "main.h"
  12 +#ifdef __sun__
  13 +#include <sys/filio.h>
  14 +#endif
12 15  
13 16 void
14 17 so_init()
... ...
... ... @@ -47,6 +47,7 @@
47 47 #include <libutil.h>
48 48 #endif
49 49 #else
  50 +#ifndef __sun__
50 51 #include <linux/if.h>
51 52 #include <linux/if_tun.h>
52 53 #include <pty.h>
... ... @@ -55,6 +56,7 @@
55 56 #include <linux/ppdev.h>
56 57 #endif
57 58 #endif
  59 +#endif
58 60  
59 61 #if defined(CONFIG_SLIRP)
60 62 #include "libslirp.h"
... ... @@ -2531,6 +2533,12 @@ static int tap_open(char *ifname, int ifname_size)
2531 2533 fcntl(fd, F_SETFL, O_NONBLOCK);
2532 2534 return fd;
2533 2535 }
  2536 +#elif defined(__sun__)
  2537 +static int tap_open(char *ifname, int ifname_size)
  2538 +{
  2539 + fprintf(stderr, "warning: tap_open not yet implemented\n");
  2540 + return -1;
  2541 +}
2534 2542 #else
2535 2543 static int tap_open(char *ifname, int ifname_size)
2536 2544 {
... ...