Commit ec530c81efea6ddb1f75758658fd6769a29c3ade
1 parent
96b74a02
Solaris port (Ben Taylor)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1855 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
9 changed files
with
134 additions
and
4 deletions
Makefile.target
@@ -166,6 +166,9 @@ endif | @@ -166,6 +166,9 @@ endif | ||
166 | ifdef CONFIG_WIN32 | 166 | ifdef CONFIG_WIN32 |
167 | LIBS+=-lwinmm -lws2_32 -liphlpapi | 167 | LIBS+=-lwinmm -lws2_32 -liphlpapi |
168 | endif | 168 | endif |
169 | +ifdef CONFIG_SOLARIS | ||
170 | +LIBS+=-lsocket -lnsl -lresolv | ||
171 | +endif | ||
169 | 172 | ||
170 | # profiling code | 173 | # profiling code |
171 | ifdef TARGET_GPROF | 174 | 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 | ||
369 | endif | 372 | endif |
370 | ifndef CONFIG_DARWIN | 373 | ifndef CONFIG_DARWIN |
371 | ifndef CONFIG_WIN32 | 374 | ifndef CONFIG_WIN32 |
375 | +ifndef CONFIG_SOLARIS | ||
372 | VL_LIBS=-lutil | 376 | VL_LIBS=-lutil |
373 | endif | 377 | endif |
374 | endif | 378 | endif |
379 | +endif | ||
375 | ifdef TARGET_GPROF | 380 | ifdef TARGET_GPROF |
376 | vl.o: CFLAGS+=-p | 381 | vl.o: CFLAGS+=-p |
377 | VL_LDFLAGS+=-p | 382 | VL_LDFLAGS+=-p |
block.c
@@ -44,6 +44,10 @@ | @@ -44,6 +44,10 @@ | ||
44 | #include <CoreFoundation/CoreFoundation.h> | 44 | #include <CoreFoundation/CoreFoundation.h> |
45 | #endif | 45 | #endif |
46 | 46 | ||
47 | +#ifdef __sun__ | ||
48 | +#include <sys/dkio.h> | ||
49 | +#endif | ||
50 | + | ||
47 | static BlockDriverState *bdrv_first; | 51 | static BlockDriverState *bdrv_first; |
48 | static BlockDriver *first_drv; | 52 | static BlockDriver *first_drv; |
49 | 53 | ||
@@ -648,7 +652,6 @@ void bdrv_info(void) | @@ -648,7 +652,6 @@ void bdrv_info(void) | ||
648 | } | 652 | } |
649 | } | 653 | } |
650 | 654 | ||
651 | - | ||
652 | /**************************************************************/ | 655 | /**************************************************************/ |
653 | /* RAW block driver */ | 656 | /* RAW block driver */ |
654 | 657 | ||
@@ -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) | ||
669 | #ifdef _BSD | 672 | #ifdef _BSD |
670 | struct stat sb; | 673 | struct stat sb; |
671 | #endif | 674 | #endif |
675 | +#ifdef __sun__ | ||
676 | + struct dk_minfo minfo; | ||
677 | + int rv; | ||
678 | +#endif | ||
672 | 679 | ||
673 | fd = open(filename, O_RDWR | O_BINARY | O_LARGEFILE); | 680 | fd = open(filename, O_RDWR | O_BINARY | O_LARGEFILE); |
674 | if (fd < 0) { | 681 | if (fd < 0) { |
@@ -689,6 +696,17 @@ static int raw_open(BlockDriverState *bs, const char *filename) | @@ -689,6 +696,17 @@ static int raw_open(BlockDriverState *bs, const char *filename) | ||
689 | #endif | 696 | #endif |
690 | } else | 697 | } else |
691 | #endif | 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 | size = lseek(fd, 0, SEEK_END); | 711 | size = lseek(fd, 0, SEEK_END); |
694 | } | 712 | } |
configure
@@ -125,6 +125,9 @@ Darwin) | @@ -125,6 +125,9 @@ Darwin) | ||
125 | bsd="yes" | 125 | bsd="yes" |
126 | darwin="yes" | 126 | darwin="yes" |
127 | ;; | 127 | ;; |
128 | +SunOS) | ||
129 | +solaris="yes" | ||
130 | +;; | ||
128 | *) | 131 | *) |
129 | oss="yes" | 132 | oss="yes" |
130 | linux="yes" | 133 | linux="yes" |
@@ -141,6 +144,15 @@ if [ "$bsd" = "yes" ] ; then | @@ -141,6 +144,15 @@ if [ "$bsd" = "yes" ] ; then | ||
141 | fi | 144 | fi |
142 | fi | 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 | # find source path | 156 | # find source path |
145 | source_path=`dirname "$0"` | 157 | source_path=`dirname "$0"` |
146 | if [ -z "$source_path" ]; then | 158 | if [ -z "$source_path" ]; then |
@@ -299,6 +311,57 @@ if test "$mingw32" = "yes" ; then | @@ -299,6 +311,57 @@ if test "$mingw32" = "yes" ; then | ||
299 | fi | 311 | fi |
300 | fi | 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 | if test -z "$target_list" ; then | 365 | if test -z "$target_list" ; then |
303 | # these targets are portable | 366 | # these targets are portable |
304 | if [ "$softmmu" = "yes" ] ; then | 367 | if [ "$softmmu" = "yes" ] ; then |
@@ -585,6 +648,12 @@ if test "$darwin" = "yes" ; then | @@ -585,6 +648,12 @@ if test "$darwin" = "yes" ; then | ||
585 | echo "CONFIG_DARWIN=yes" >> $config_mak | 648 | echo "CONFIG_DARWIN=yes" >> $config_mak |
586 | echo "#define CONFIG_DARWIN 1" >> $config_h | 649 | echo "#define CONFIG_DARWIN 1" >> $config_h |
587 | fi | 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 | if test "$gdbstub" = "yes" ; then | 657 | if test "$gdbstub" = "yes" ; then |
589 | echo "CONFIG_GDBSTUB=yes" >> $config_mak | 658 | echo "CONFIG_GDBSTUB=yes" >> $config_mak |
590 | echo "#define CONFIG_GDBSTUB 1" >> $config_h | 659 | 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 | ||
690 | mkdir -p $target_dir/slirp | 759 | mkdir -p $target_dir/slirp |
691 | fi | 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 | echo "# Automatically generated by configure - do not modify" > $config_mak | 769 | echo "# Automatically generated by configure - do not modify" > $config_mak |
696 | echo "/* Automatically generated by configure - do not modify */" > $config_h | 770 | 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 | ||
802 | for dir in $DIRS ; do | 876 | for dir in $DIRS ; do |
803 | mkdir -p $dir | 877 | mkdir -p $dir |
804 | done | 878 | done |
879 | + # remove the link and recreate it, as not all "ln -sf" overwrite the link | ||
805 | for f in $FILES ; do | 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 | done | 883 | done |
808 | fi | 884 | fi |
809 | 885 |
dyngen-exec.h
@@ -20,6 +20,13 @@ | @@ -20,6 +20,13 @@ | ||
20 | #if !defined(__DYNGEN_EXEC_H__) | 20 | #if !defined(__DYNGEN_EXEC_H__) |
21 | #define __DYNGEN_EXEC_H__ | 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 | /* NOTE: standard headers should be used with special care at this | 30 | /* NOTE: standard headers should be used with special care at this |
24 | point because host CPU registers are used as global variables. Some | 31 | point because host CPU registers are used as global variables. Some |
25 | host headers do not allow that. */ | 32 | host headers do not allow that. */ |
@@ -35,7 +42,12 @@ typedef unsigned long uint64_t; | @@ -35,7 +42,12 @@ typedef unsigned long uint64_t; | ||
35 | typedef unsigned long long uint64_t; | 42 | typedef unsigned long long uint64_t; |
36 | #endif | 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 | typedef signed char int8_t; | 49 | typedef signed char int8_t; |
50 | +#endif | ||
39 | typedef signed short int16_t; | 51 | typedef signed short int16_t; |
40 | typedef signed int int32_t; | 52 | typedef signed int int32_t; |
41 | #if defined (__x86_64__) || defined(__ia64) | 53 | #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; | ||
231 | #ifdef __sparc__ | 243 | #ifdef __sparc__ |
232 | #define EXIT_TB() asm volatile ("jmpl %i0 + 8, %g0\n" \ | 244 | #define EXIT_TB() asm volatile ("jmpl %i0 + 8, %g0\n" \ |
233 | "nop") | 245 | "nop") |
246 | +#define GOTO_LABEL_PARAM(n) asm volatile ( \ | ||
247 | + "set " ASM_NAME(__op_gen_label) #n ", %g1; jmp %g1; nop") | ||
234 | #endif | 248 | #endif |
235 | #ifdef __arm__ | 249 | #ifdef __arm__ |
236 | #define EXIT_TB() asm volatile ("b exec_loop") | 250 | #define EXIT_TB() asm volatile ("b exec_loop") |
fpu/softfloat-native.h
@@ -3,8 +3,11 @@ | @@ -3,8 +3,11 @@ | ||
3 | #if defined(_BSD) && !defined(__APPLE__) | 3 | #if defined(_BSD) && !defined(__APPLE__) |
4 | #include <ieeefp.h> | 4 | #include <ieeefp.h> |
5 | #else | 5 | #else |
6 | +#if !defined(_PRESOLARIS10) | ||
6 | #include <fenv.h> | 7 | #include <fenv.h> |
7 | #endif | 8 | #endif |
9 | +#endif | ||
10 | +#include "gnu-c99-math.h" | ||
8 | 11 | ||
9 | typedef float float32; | 12 | typedef float float32; |
10 | typedef double float64; | 13 | typedef double float64; |
fpu/softfloat.h
@@ -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); | ||
177 | | Routine to raise any or all of the software IEC/IEEE floating-point | 177 | | Routine to raise any or all of the software IEC/IEEE floating-point |
178 | | exception flags. | 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 | | Software IEC/IEEE integer-to-floating-point conversion routines. | 183 | | Software IEC/IEEE integer-to-floating-point conversion routines. |
slirp/slirp_config.h
@@ -138,6 +138,9 @@ | @@ -138,6 +138,9 @@ | ||
138 | 138 | ||
139 | /* Define if you don't have u_int32_t etc. typedef'd */ | 139 | /* Define if you don't have u_int32_t etc. typedef'd */ |
140 | #undef NEED_TYPEDEFS | 140 | #undef NEED_TYPEDEFS |
141 | +#ifdef __sun__ | ||
142 | +#define NEED_TYPEDEFS | ||
143 | +#endif | ||
141 | 144 | ||
142 | /* Define to sizeof(char) */ | 145 | /* Define to sizeof(char) */ |
143 | #define SIZEOF_CHAR 1 | 146 | #define SIZEOF_CHAR 1 |
slirp/socket.c
vl.c
@@ -47,6 +47,7 @@ | @@ -47,6 +47,7 @@ | ||
47 | #include <libutil.h> | 47 | #include <libutil.h> |
48 | #endif | 48 | #endif |
49 | #else | 49 | #else |
50 | +#ifndef __sun__ | ||
50 | #include <linux/if.h> | 51 | #include <linux/if.h> |
51 | #include <linux/if_tun.h> | 52 | #include <linux/if_tun.h> |
52 | #include <pty.h> | 53 | #include <pty.h> |
@@ -55,6 +56,7 @@ | @@ -55,6 +56,7 @@ | ||
55 | #include <linux/ppdev.h> | 56 | #include <linux/ppdev.h> |
56 | #endif | 57 | #endif |
57 | #endif | 58 | #endif |
59 | +#endif | ||
58 | 60 | ||
59 | #if defined(CONFIG_SLIRP) | 61 | #if defined(CONFIG_SLIRP) |
60 | #include "libslirp.h" | 62 | #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) | ||
2531 | fcntl(fd, F_SETFL, O_NONBLOCK); | 2533 | fcntl(fd, F_SETFL, O_NONBLOCK); |
2532 | return fd; | 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 | #else | 2542 | #else |
2535 | static int tap_open(char *ifname, int ifname_size) | 2543 | static int tap_open(char *ifname, int ifname_size) |
2536 | { | 2544 | { |