diff -Nur qemu_cvs2005mar09wed/Makefile qemu_SPARC/Makefile --- qemu_cvs2005mar09wed/Makefile 2005-02-10 22:48:51.000000000 +0100 +++ qemu_SPARC/Makefile 2005-03-10 00:37:52.000000000 +0100 @@ -86,11 +86,13 @@ qemu.1: qemu-doc.texi ./texi2pod.pl $< qemu.pod - pod2man --section=1 --center=" " --release=" " qemu.pod > $@ +# pod2man --section=1 --center=" " --release=" " qemu.pod > $@ + true --section=1 --center=" " --release=" " qemu.pod > $@ qemu-img.1: qemu-img.texi ./texi2pod.pl $< qemu-img.pod - pod2man --section=1 --center=" " --release=" " qemu-img.pod > $@ +# pod2man --section=1 --center=" " --release=" " qemu-img.pod > $@ + true --section=1 --center=" " --release=" " qemu-img.pod > $@ FILE=qemu-$(shell cat VERSION) diff -Nur qemu_cvs2005mar09wed/Makefile.target qemu_SPARC/Makefile.target --- qemu_cvs2005mar09wed/Makefile.target 2005-03-01 22:37:28.000000000 +0100 +++ qemu_SPARC/Makefile.target 2005-03-10 01:12:08.000000000 +0100 @@ -160,9 +160,9 @@ endif ifeq ($(ARCH),sparc) -CFLAGS+=-m32 -ffixed-g1 -ffixed-g2 -ffixed-g3 -ffixed-g6 +CFLAGS+=-m32 -ffixed-g4 -ffixed-g2 -ffixed-g3 LDFLAGS+=-m32 -OP_CFLAGS=$(CFLAGS) -fno-delayed-branch -ffixed-i0 +OP_CFLAGS=$(CFLAGS) -fno-delayed-branch -O6 HELPER_CFLAGS=$(CFLAGS) -ffixed-i0 -mflat # -static is used to avoid g1/g3 usage by the dynamic linker LDFLAGS+=-Wl,-T,$(SRC_PATH)/sparc.ld -static @@ -217,6 +217,9 @@ ifdef CONFIG_WIN32 LIBS+=-lwinmm -lws2_32 -liphlpapi endif +ifdef CONFIG_SVR4 +LIBS+=-lsocket -lnsl +endif # profiling code ifdef TARGET_GPROF @@ -314,7 +317,7 @@ AUDIODRV += ossaudio.o endif -pc.o: DEFINES := -DUSE_SB16 $(DEFINES) +DEFINES := -DUSE_SB16 $(DEFINES) ifdef CONFIG_ADLIB SOUND_HW += fmopl.o adlib.o @@ -368,9 +371,11 @@ endif ifndef CONFIG_DARWIN ifndef CONFIG_WIN32 +ifndef CONFIG_SVR4 VL_LIBS=-lutil endif endif +endif ifdef TARGET_GPROF vl.o: CFLAGS+=-p VL_LDFLAGS+=-p diff -Nur qemu_cvs2005mar09wed/configure qemu_SPARC/configure --- qemu_cvs2005mar09wed/configure 2005-03-01 23:30:41.000000000 +0100 +++ qemu_SPARC/configure 2005-03-09 22:54:36.000000000 +0100 @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # # qemu configure script (c) 2003 Fabrice Bellard # @@ -50,7 +50,7 @@ s390) cpu="s390" ;; - sparc) + sparc|sun4u) cpu="sparc" ;; sparc64) @@ -107,6 +107,10 @@ bsd="yes" darwin="yes" ;; +SunOS) +solaris="yes" +svr4="yes" +;; *) oss="yes" linux="yes" @@ -116,7 +120,7 @@ ;; esac -if [ "$bsd" = "yes" ] ; then +if [ "$bsd" = "yes" -o "$solaris" = "yes" ] ; then if [ ! "$darwin" = "yes" ] ; then make="gmake" fi @@ -499,7 +503,7 @@ echo "ARCH=m68k" >> $config_mak echo "#define HOST_M68K 1" >> $config_h else - echo "Unsupported CPU" + echo "Unsupported CPU ($cpu)" exit 1 fi if test "$bigendian" = "yes" ; then @@ -512,10 +516,17 @@ elif test -f "/usr/include/byteswap.h" ; then echo "#define HAVE_BYTESWAP_H 1" >> $config_h fi +if test "$solaris" = "yes" ; then + echo "CONFIG_SOLARIS=yes" >> $config_mak +fi if test "$darwin" = "yes" ; then echo "CONFIG_DARWIN=yes" >> $config_mak echo "#define CONFIG_DARWIN 1" >> $config_h fi +if test "$svr4" = "yes" ; then + echo "CONFIG_SVR4=yes" >> $config_mak + echo "#define CONFIG_SVR4 1" >> $config_h +fi if test "$gdbstub" = "yes" ; then echo "CONFIG_GDBSTUB=yes" >> $config_mak echo "#define CONFIG_GDBSTUB 1" >> $config_h @@ -569,6 +580,13 @@ echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h echo "#define _BSD 1" >> $config_h fi +if [ "$solaris" = "yes" ] ; then + echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h + echo "#define _SOLARIS 1" >> $config_h +fi +if [ "$svr4" = yes ] ; then + echo "#define _SVR4 1" >> $config_h +fi for target in $target_list; do @@ -600,7 +618,8 @@ mkdir -p $target_dir/slirp fi -ln -sf $source_path/Makefile.target $target_dir/Makefile +test -f $target_dir/Makefile && 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 @@ -697,7 +716,8 @@ mkdir -p $dir done for f in $FILES ; do - ln -sf $source_path/$f $f + test -f $source_path/$f && rm -f $source_path/$f + ln -s $source_path/$f $f done fi diff -Nur qemu_cvs2005mar09wed/cpu-exec.c qemu_SPARC/cpu-exec.c --- qemu_cvs2005mar09wed/cpu-exec.c 2005-02-22 20:27:14.000000000 +0100 +++ qemu_SPARC/cpu-exec.c 2005-03-09 23:10:42.000000000 +0100 @@ -482,7 +482,8 @@ "mov %%o7,%%i0" : /* no outputs */ : "r" (gen_func) - : "i0", "i1", "i2", "i3", "i4", "i5"); + : "g0", "i0", "i1", "i2", "i3", "i4", "i5", "i7", + "l0", "l1", "l2", "l3", "l4", "l5", "l6", "l7"); #elif defined(__arm__) asm volatile ("mov pc, %0\n\t" ".global exec_loop\n\t" diff -Nur qemu_cvs2005mar09wed/dyngen-exec.h qemu_SPARC/dyngen-exec.h --- qemu_cvs2005mar09wed/dyngen-exec.h 2005-03-01 23:30:59.000000000 +0100 +++ qemu_SPARC/dyngen-exec.h 2005-03-09 23:56:47.000000000 +0100 @@ -25,6 +25,11 @@ host headers do not allow that. */ #include +#ifdef _SVR4 +#include +#include +#else + typedef unsigned char uint8_t; typedef unsigned short uint16_t; typedef unsigned int uint32_t; @@ -62,7 +67,10 @@ extern int printf(const char *, ...); #undef NULL #define NULL 0 -#if defined(_BSD) && !defined(__APPLE__) + +#endif /* !_SVR4 */ + +#if defined(_BSD) && !defined(__APPLE__) || defined(_SVR4) #include #define FE_TONEAREST FP_RN @@ -70,6 +78,7 @@ #define FE_UPWARD FP_RP #define FE_TOWARDZERO FP_RZ #define fesetround(x) fpsetround(x) +#define fegetround() fpgetround() #else #include #endif @@ -120,18 +129,19 @@ #define AREG3 "s2" #endif #ifdef __sparc__ -#define AREG0 "g6" -#define AREG1 "g1" -#define AREG2 "g2" -#define AREG3 "g3" -#define AREG4 "l0" -#define AREG5 "l1" -#define AREG6 "l2" -#define AREG7 "l3" -#define AREG8 "l4" -#define AREG9 "l5" -#define AREG10 "l6" -#define AREG11 "l7" +#define AREG0 "g4" +#define AREG1 "g2" +#define AREG2 "g3" +#define AREG3 "l0" +#if 0 +#define AREG4 "l1" +#define AREG5 "l2" +#define AREG6 "l3" +#define AREG7 "l4" +#define AREG8 "l5" +#define AREG9 "l6" +#define AREG10 "l7" +#endif #define USE_FP_CONVERT #endif #ifdef __s390__ diff -Nur qemu_cvs2005mar09wed/dyngen.c qemu_SPARC/dyngen.c --- qemu_cvs2005mar09wed/dyngen.c 2005-02-21 20:53:34.000000000 +0100 +++ qemu_SPARC/dyngen.c 2005-03-09 23:28:16.000000000 +0100 @@ -1407,12 +1407,14 @@ if ((start_insn & ~0x1fff) == 0x9de3a000) { p_start += 0x4; start_offset += 0x4; - if ((int)(start_insn | ~0x1fff) < -128) + if ((int)(start_insn | ~0x1fff) < -256) error("Found bogus save at the start of %s", name); if (end_insn1 != 0x81c7e008 || end_insn2 != 0x81e80000) error("ret; restore; not found at end of %s", name); } else { - error("No save at the beginning of %s", name); + //error("No save at the beginning of %s", name); + if (end_insn1 != 0x81c3e008 || end_insn2 != 0x01000000) + error("ret; nop; not found at end of %s (no save)", name); } #if 0 /* Skip a preceeding nop, if present. */ diff -Nur qemu_cvs2005mar09wed/hw/ide.c qemu_SPARC/hw/ide.c --- qemu_cvs2005mar09wed/hw/ide.c 2004-12-02 21:20:21.000000000 +0100 +++ qemu_SPARC/hw/ide.c 2005-03-10 00:10:57.000000000 +0100 @@ -500,6 +500,10 @@ static inline void ide_set_irq(IDEState *s) { if (!(s->cmd & IDE_CMD_DISABLE_IRQ)) { + BMDMAState *bm = s->bmdma; + if(bm) + bm->status |= BM_STATUS_INT; + #ifdef TARGET_PPC if (s->openpic) openpic_set_irq(s->openpic, s->irq, 1); @@ -2163,6 +2167,7 @@ pci_conf[0x01] = 0x80; pci_conf[0x02] = 0x00; // fake pci_conf[0x03] = 0x01; // fake + pci_conf[0x09] = 0x8a; // programming interface = PCI_IDE bus master is supported pci_conf[0x0a] = 0x01; // class_sub = PCI_IDE pci_conf[0x0b] = 0x01; // class_base = PCI_mass_storage pci_conf[0x0e] = 0x80; // header_type = PCI_multifunction, generic diff -Nur qemu_cvs2005mar09wed/linux-user/main.c qemu_SPARC/linux-user/main.c --- qemu_cvs2005mar09wed/linux-user/main.c 2005-02-19 18:25:31.000000000 +0100 +++ qemu_SPARC/linux-user/main.c 2005-03-10 00:15:49.000000000 +0100 @@ -33,6 +33,10 @@ # define environ (*_NSGetEnviron()) #endif +#if defined(unix) && !defined(linux) +extern char **environ; +#endif + static const char *interp_prefix = CONFIG_QEMU_PREFIX; #if defined(__i386__) && !defined(CONFIG_STATIC) diff -Nur qemu_cvs2005mar09wed/linux-user/syscall.c qemu_SPARC/linux-user/syscall.c --- qemu_cvs2005mar09wed/linux-user/syscall.c 2005-03-01 23:32:06.000000000 +0100 +++ qemu_SPARC/linux-user/syscall.c 2005-03-10 00:27:26.000000000 +0100 @@ -22,7 +22,9 @@ #include #include #include +#ifdef linux #include +#endif #include #include #include @@ -55,6 +57,7 @@ #define tchars host_tchars /* same as target */ #define ltchars host_ltchars /* same as target */ +#ifdef linux #include #include #include @@ -63,6 +66,7 @@ #include #include #include +#endif #include "qemu.h" diff -Nur qemu_cvs2005mar09wed/sdl.c qemu_SPARC/sdl.c --- qemu_cvs2005mar09wed/sdl.c 2005-01-17 23:32:23.000000000 +0100 +++ qemu_SPARC/sdl.c 2005-03-10 01:22:18.000000000 +0100 @@ -29,6 +29,10 @@ #include #endif +#if defined(_SVR4) +#define CONFIG_SDL_GENERIC_KBD +#endif + static SDL_Surface *screen; static int gui_grab; /* if true, all keyboard/mouse events are grabbed */ static int last_vm_running; diff -Nur qemu_cvs2005mar09wed/slirp/misc.c qemu_SPARC/slirp/misc.c --- qemu_cvs2005mar09wed/slirp/misc.c 2004-12-12 12:45:10.000000000 +0100 +++ qemu_SPARC/slirp/misc.c 2005-03-10 01:27:42.000000000 +0100 @@ -67,6 +67,10 @@ } #endif +#ifdef _SVR4 +#undef HAVE_INET_ATON +#endif + #ifndef HAVE_INET_ATON int inet_aton(cp, ia) diff -Nur qemu_cvs2005mar09wed/slirp/slirp.h qemu_SPARC/slirp/slirp.h --- qemu_cvs2005mar09wed/slirp/slirp.h 2005-01-11 00:19:34.000000000 +0100 +++ qemu_SPARC/slirp/slirp.h 2005-03-10 01:32:01.000000000 +0100 @@ -73,6 +73,12 @@ # endif #endif /* NEED_TYPEDEFS */ +#ifdef _SVR4 +typedef uint8_t u_int8_t; +typedef uint16_t u_int16_t; +typedef uint32_t u_int32_t; +#endif + #ifdef HAVE_UNISTD_H # include #endif diff -Nur qemu_cvs2005mar09wed/slirp/socket.c qemu_SPARC/slirp/socket.c --- qemu_cvs2005mar09wed/slirp/socket.c 2004-11-24 21:39:26.000000000 +0100 +++ qemu_SPARC/slirp/socket.c 2005-03-10 01:35:38.000000000 +0100 @@ -10,6 +10,10 @@ #include "ip_icmp.h" #include "main.h" +#ifdef _SVR4 +#include +#endif + void so_init() { diff -Nur qemu_cvs2005mar09wed/target-i386/cpu.h qemu_SPARC/target-i386/cpu.h --- qemu_cvs2005mar09wed/target-i386/cpu.h 2005-02-12 19:58:00.000000000 +0100 +++ qemu_SPARC/target-i386/cpu.h 2005-03-10 01:40:36.000000000 +0100 @@ -332,7 +332,7 @@ CC_OP_NB, }; -#if (defined(__i386__) || defined(__x86_64__)) && !defined(_BSD) +#if (defined(__i386__) || defined(__x86_64__)) && !defined(_BSD) && !defined(_SVR4) #define USE_X86LDOUBLE #endif diff -Nur qemu_cvs2005mar09wed/target-i386/exec.h qemu_SPARC/target-i386/exec.h --- qemu_cvs2005mar09wed/target-i386/exec.h 2005-03-01 23:33:39.000000000 +0100 +++ qemu_SPARC/target-i386/exec.h 2005-03-10 01:54:37.000000000 +0100 @@ -20,6 +20,10 @@ #include "config.h" #include "dyngen-exec.h" +#ifdef _SVR4 +#include +#endif + /* XXX: factorize this mess */ #ifdef TARGET_X86_64 #define TARGET_LONG_BITS 64 @@ -373,7 +377,7 @@ #define rint rintl #endif -#if !defined(_BSD) +#if !defined(_BSD) && !defined(_SVR4) extern int lrint(CPU86_LDouble x); extern int64_t llrint(CPU86_LDouble x); #else diff -Nur qemu_cvs2005mar09wed/target-i386/op.c qemu_SPARC/target-i386/op.c --- qemu_cvs2005mar09wed/target-i386/op.c 2005-03-03 02:14:55.000000000 +0100 +++ qemu_SPARC/target-i386/op.c 2005-03-10 02:06:33.000000000 +0100 @@ -1858,10 +1858,11 @@ { #if defined(__sparc__) && !defined(__sparc_v9__) register CPU86_LDouble d asm("o0"); + int64_t val; #else CPU86_LDouble d; -#endif int val; +#endif d = ST0; val = lrint(d); diff -Nur qemu_cvs2005mar09wed/target-i386/translate.c qemu_SPARC/target-i386/translate.c --- qemu_cvs2005mar09wed/target-i386/translate.c 2005-03-03 02:14:55.000000000 +0100 +++ qemu_SPARC/target-i386/translate.c 2005-03-10 02:15:33.000000000 +0100 @@ -6265,7 +6265,7 @@ /* if irq were inhibited with HF_INHIBIT_IRQ_MASK, we clear the flag and abort the translation to give the irqs a change to be happen */ - if (dc->tf || dc->singlestep_enabled || + if (1||dc->tf || dc->singlestep_enabled || (flags & HF_INHIBIT_IRQ_MASK) || (cflags & CF_SINGLE_INSN)) { gen_jmp_im(pc_ptr - dc->cs_base); diff -Nur qemu_cvs2005mar09wed/target-ppc/exec.h qemu_SPARC/target-ppc/exec.h --- qemu_cvs2005mar09wed/target-ppc/exec.h 2005-01-04 00:42:39.000000000 +0100 +++ qemu_SPARC/target-ppc/exec.h 2005-03-10 02:19:07.000000000 +0100 @@ -22,6 +22,10 @@ #include "dyngen-exec.h" +#ifdef _SVR4 +#include +#endif + register struct CPUPPCState *env asm(AREG0); register uint32_t T0 asm(AREG1); register uint32_t T1 asm(AREG2); diff -Nur qemu_cvs2005mar09wed/target-ppc/helper.c qemu_SPARC/target-ppc/helper.c --- qemu_cvs2005mar09wed/target-ppc/helper.c 2005-02-16 00:06:19.000000000 +0100 +++ qemu_SPARC/target-ppc/helper.c 2005-03-10 02:22:19.000000000 +0100 @@ -17,6 +17,7 @@ * 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 "config.h" #include "exec.h" //#define DEBUG_MMU diff -Nur qemu_cvs2005mar09wed/target-ppc/op_helper.c qemu_SPARC/target-ppc/op_helper.c --- qemu_cvs2005mar09wed/target-ppc/op_helper.c 2005-02-16 00:06:19.000000000 +0100 +++ qemu_SPARC/target-ppc/op_helper.c 2005-03-10 02:25:29.000000000 +0100 @@ -17,6 +17,7 @@ * 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 "config.h" #include #include "exec.h" diff -Nur qemu_cvs2005mar09wed/vl.c qemu_SPARC/vl.c --- qemu_cvs2005mar09wed/vl.c 2005-03-01 22:37:28.000000000 +0100 +++ qemu_SPARC/vl.c 2005-03-10 02:47:49.000000000 +0100 @@ -46,6 +46,9 @@ #include #endif #else +#if defined(_SVR4) || defined(_SOLARIS) +#include +#else #include #include #include @@ -53,6 +56,7 @@ #include #endif #endif +#endif #if defined(CONFIG_SLIRP) #include "libslirp.h" @@ -515,7 +519,30 @@ } #else -#error unsupported CPU + + /* Derived from: "m68k updates #2" by Richard Zidlicky + "crude hack to get some sort of rdtsc support" */ + +#include +static int64_t cputicks=0; +static struct timeval lastcptcall={0,0}; + +// assume 550 MHz Pentium, min 80 ticks between rdtsc calls + +int64_t cpu_get_real_ticks(void) +{ + struct timeval tp; + gettimeofday(&tp,(void*)0); + if (tp.tv_sec == lastcptcall.tv_sec && + tp.tv_usec == lastcptcall.tv_usec ){ + cputicks += 1; + } else { + cputicks=0; + lastcptcall=tp; + } + return ((int64_t)tp.tv_sec*1000000+tp.tv_usec)*550+cputicks; +} + #endif static int64_t cpu_ticks_offset; @@ -1596,6 +1623,12 @@ fcntl(fd, F_SETFL, O_NONBLOCK); return fd; } +#elif defined(_SVR4) +static int tun_open(char *ifname, int ifname_size) +{ + fprintf(stderr, "warning: tun_open not yet implemented\n"); + return -1; +} #else static int tun_open(char *ifname, int ifname_size) {