From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DAD6E-0007c5-8e for qemu-devel@nongnu.org; Sat, 12 Mar 2005 15:20:38 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DAD61-0007Vm-CI for qemu-devel@nongnu.org; Sat, 12 Mar 2005 15:20:32 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DAD60-0007UV-CQ for qemu-devel@nongnu.org; Sat, 12 Mar 2005 15:20:24 -0500 Received: from [213.165.64.20] (helo=mail.gmx.net) by monty-python.gnu.org with smtp (Exim 4.34) id 1DACmu-00043o-FE for qemu-devel@nongnu.org; Sat, 12 Mar 2005 15:00:41 -0500 Subject: qemu_SPARC_HOST_cvs20050309wed.patch_/_Re: [Qemu-devel] actually i have a different problem ... From: Martin Bochnig In-Reply-To: References: <20050119023734.ZOBR9818.aamta03-winn.mailhost.ntl.com@[62.253.162.65]> Content-Type: multipart/mixed; boundary="=-q9/Dt0tktQq3TdAKw5p2" Message-Id: <1110657396.4023.173.camel@mb1x-ws0> Mime-Version: 1.0 Date: Sat, 12 Mar 2005 20:56:36 +0100 Reply-To: bochnig@pool.math.tu-berlin.de, qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org --=-q9/Dt0tktQq3TdAKw5p2 Content-Type: text/plain Content-Transfer-Encoding: 7bit Hi, On Wed, 2005-01-19 at 03:56, Johannes Schindelin wrote: > Hi, > > you might want to try to comment out the offending definition of int64_t > in dyngen... > > Please note that there's much more to getting QEmu to run on sparc than > getting it to compile. Indeed - you really did a great job, thanks again! (Beeing a very happy user of QEMU_cvs2004nov14 on a Solaris_10__03/05 SPARC host :)) > You might want to work with the SPARC host patch > (which you can get from http://libvncserver.sf.net/qemu/). It is a bit of > work to apply it to the current CVS, though. If you beat me to it, I will > try to adapt it. I tried my best to do that part - the resulting patch file should be attached. However, I got at least two major compile time errors I'm unable to solve {1.) and 2.)} : ***** 0a.) ***** First, my build environment looks like this: bash-3.00$ gcc -v Reading specs from /opt/sfw/lib/gcc/sparc-sun-solaris2.10/3.4.2/specs Configured with: ../gcc-3.4.2/configure --prefix=/opt/sfw --with-ld=/usr/ccs/bin/ld --with-gnu-as --with-as=/opt/sfw/bin/gas --enable-shared --disable-libgcj Thread model: posix gcc version 3.4.2 bash-3.00$ gmake -v GNU Make 3.80 Copyright (C) 2002 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. bash-3.00$ uname -a SunOS mb1x-ws0 5.10 Generic sun4u sparc SUNW,Sun-Blade-1000 bash-3.00$ isainfo -v 64-bit sparcv9 applications vis2 vis 32-bit sparc applications vis2 vis v8plus div32 mul32 bash-3.00$ ***** 0b.) ***** I configured QEMU with: ./configure --disable-slirp --disable-kqemu --target-list=i386-softmmu ***** error 1.) ***** The first problem is: gcc -Wall -O2 -g -fno-strict-aliasing -m32 -ffixed-g4 -ffixed-g2 -ffixed-g3 -DUSE_SB16 -I. -I/tmp/QEMU/qemu_SPARC/target-i386 -I/tmp/QEMU/qemu_SPARC -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -c -o exec.o /tmp/QEMU/qemu_SPARC/exec.c gcc -Wall -O2 -g -fno-strict-aliasing -m32 -ffixed-g4 -ffixed-g2 -ffixed-g3 -DUSE_SB16 -I. -I/tmp/QEMU/qemu_SPARC/target-i386 -I/tmp/QEMU/qemu_SPARC -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -c -o kqemu.o /tmp/QEMU/qemu_SPARC/kqemu.c gcc -Wall -O2 -g -fno-strict-aliasing -m32 -ffixed-g4 -ffixed-g2 -ffixed-g3 -fno-delayed-branch -O6 -fno-reorder-blocks -fno-optimize-sibling-calls -DUSE_SB16 -I. -I/tmp/QEMU/qemu_SPARC/target-i386 -I/tmp/QEMU/qemu_SPARC -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -c -o op.o /tmp/QEMU/qemu_SPARC/target-i386/op.c In file included from /tmp/QEMU/qemu_SPARC/target-i386/op.c:724: /tmp/QEMU/qemu_SPARC/target-i386/ops_template.h: In function `op_jb_subb': /tmp/QEMU/qemu_SPARC/target-i386/ops_template.h:278: warning: implicit declaration of function `GOTO_LABEL_PARAM' ../dyngen -o op.h op.o ../dyngen -c -o opc.h op.o gcc -Wall -O2 -g -fno-strict-aliasing -m32 -ffixed-g4 -ffixed-g2 -ffixed-g3 -DUSE_SB16 -I. -I/tmp/QEMU/qemu_SPARC/target-i386 -I/tmp/QEMU/qemu_SPARC -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -c -o translate-all.o /tmp/QEMU/qemu_SPARC/translate-all.c In file included from /tmp/QEMU/qemu_SPARC/translate-all.c:41: ./op.h: In function `dyngen_code': ./op.h:1310: error: `lo' undeclared (first use in this function) ./op.h:1310: error: (Each undeclared identifier is reported only once ./op.h:1310: error: for each function it appears in.) ./op.h:1310: error: parse error before ';' token ./op.h:1318: error: `op_imulb_AL_T0' undeclared (first use in this function) ./op.h:1319: error: parse error before ';' token ./op.h:1327: error: `op_mulw_AX_T0' undeclared (first use in this function) ./op.h:1328: error: parse error before ';' token ./op.h:1336: error: `op_imulw_AX_T0' undeclared (first use in this function) ./op.h:1337: error: parse error before ';' token ./op.h:1345: error: `op_mull_EAX_T0' undeclared (first use in this function) ./op.h:1335: warning: unused variable `__dot_umul' ./op.h:1364: error: parse error before ';' token ./op.h:1372: error: `op_imull_T0_T1' undeclared (first use in this function) ./op.h:1362: warning: unused variable `__dot_umul' ./op.h:1385: error: parse error before ';' token ./op.h:1386: error: parse error before ';' token ./op.h:1396: error: `op_idivb_AL_T0' undeclared (first use in this function) ./op.h:1398: error: parse error before ';' token ./op.h:1399: error: parse error before ';' token ./op.h:1409: error: `op_divw_AX_T0' undeclared (first use in this function) ./op.h:1411: error: parse error before ';' token ./op.h:1412: error: parse error before ';' token ./op.h:1422: error: `op_idivw_AX_T0' undeclared (first use in this function) ./op.h:1424: error: parse error before ';' token ./op.h:1425: error: parse error before ';' token ./op.h:1433: error: `op_divl_EAX_T0' undeclared (first use in this function) ./op.h:1407: warning: unused variable `__dot_udiv' ./op.h:1408: warning: unused variable `__dot_urem' ./op.h:1420: warning: unused variable `__dot_div' ./op.h:1421: warning: unused variable `__dot_rem' ./op.h:5104: error: parse error before ';' token ./op.h:5105: error: parse error before ';' token ./op.h:5114: error: `op_aad' undeclared (first use in this function) ./op.h:5118: error: parse error before ';' token ./op.h:5127: error: `op_aaa' undeclared (first use in this function) ./op.h:5098: warning: unused variable `__dot_div' ./op.h:5099: warning: unused variable `__dot_rem' ./op.h:5113: warning: unused variable `__dot_umul' ./op.h:5931: warning: built-in function 'rint' declared as non-function ./op.h:7242: error: parse error before ';' token ./op.h:7243: error: parse error before ';' token ./op.h:7244: error: parse error before ';' token ./op.h:7245: error: parse error before ';' token ./op.h:7257: error: `op_pmulhuw_mmx' undeclared (first use in this function) ./op.h:7264: error: parse error before ';' token ./op.h:7265: error: parse error before ';' token ./op.h:7266: error: parse error before ';' token ./op.h:7267: error: parse error before ';' token ./op.h:7279: error: `op_pmulhw_mmx' undeclared (first use in this function) ./op.h:7286: error: parse error before ';' token ./op.h:7287: error: parse error before ';' token ./op.h:7288: error: parse error before ';' token ./op.h:7289: error: parse error before ';' token ./op.h:7297: error: `op_pavgb_mmx' undeclared (first use in this function) ./op.h:7278: warning: unused variable `__dot_umul' ./op.h:7350: error: parse error before ';' token ./op.h:7351: error: parse error before ';' token ./op.h:7359: error: `op_psadbw_mmx' undeclared (first use in this function) ./op.h:7342: warning: unused variable `__dot_umul' ./op.h:8176: error: parse error before ';' token ./op.h:8177: error: parse error before ';' token ./op.h:8178: error: parse error before ';' token ./op.h:8179: error: parse error before ';' token ./op.h:8180: error: parse error before ';' token ./op.h:8181: error: parse error before ';' token ./op.h:8182: error: parse error before ';' token ./op.h:8183: error: parse error before ';' token ./op.h:8199: error: `op_pmulhuw_xmm' undeclared (first use in this function) ./op.h:8206: error: parse error before ';' token ./op.h:8207: error: parse error before ';' token ./op.h:8208: error: parse error before ';' token ./op.h:8209: error: parse error before ';' token ./op.h:8210: error: parse error before ';' token ./op.h:8211: error: parse error before ';' token ./op.h:8212: error: parse error before ';' token ./op.h:8213: error: parse error before ';' token ./op.h:8229: error: `op_pmulhw_xmm' undeclared (first use in this function) ./op.h:8236: error: parse error before ';' token ./op.h:8237: error: parse error before ';' token ./op.h:8238: error: parse error before ';' token ./op.h:8239: error: parse error before ';' token ./op.h:8240: error: parse error before ';' token ./op.h:8241: error: parse error before ';' token ./op.h:8242: error: parse error before ';' token ./op.h:8243: error: parse error before ';' token ./op.h:8251: error: `op_pavgb_xmm' undeclared (first use in this function) ./op.h:8228: warning: unused variable `__dot_umul' ./op.h:8306: error: parse error before ';' token ./op.h:8307: error: parse error before ';' token ./op.h:8315: error: `op_psadbw_xmm' undeclared (first use in this function) ./op.h:8298: warning: unused variable `__dot_umul' gmake[1]: *** [translate-all.o] Error 1 gmake[1]: Leaving directory `/tmp/QEMU/qemu_SPARC/i386-softmmu' gmake: *** [all] Error 1 ***** error 2.) ***** The second errors is: for d in i386-softmmu; do \ gmake -C $d all || exit 1 ; \ done gmake[1]: Entering directory `/tmp/QEMU/qemu_SPARC/i386-softmmu' gcc -Wall -O2 -g -fno-strict-aliasing -m32 -ffixed-g4 -ffixed-g2 -ffixed-g3 -DUSE_SB16 -I. -I/tmp/QEMU/qemu_SPARC/target-i386 -I/tmp/QEMU/qemu_SPARC -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -c -o cpu-exec.o /tmp/QEMU/qemu_SPARC/cpu-exec.c ../dyngen -g -o gen-op.h op.o gcc -Wall -O2 -g -fno-strict-aliasing -m32 -ffixed-g4 -ffixed-g2 -ffixed-g3 -DUSE_SB16 -I. -I/tmp/QEMU/qemu_SPARC/target-i386 -I/tmp/QEMU/qemu_SPARC -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -c -o translate.o /tmp/QEMU/qemu_SPARC/target-i386/translate.c /tmp/QEMU/qemu_SPARC/target-i386/translate.c:876: warning: initialization from incompatible pointer type /tmp/QEMU/qemu_SPARC/target-i386/translate.c:877: warning: initialization from incompatible pointer type /tmp/QEMU/qemu_SPARC/target-i386/translate.c:882: warning: initialization from incompatible pointer type /tmp/QEMU/qemu_SPARC/target-i386/translate.c:883: warning: initialization from incompatible pointer type /tmp/QEMU/qemu_SPARC/target-i386/translate.c:895: warning: initialization from incompatible pointer type /tmp/QEMU/qemu_SPARC/target-i386/translate.c:896: warning: initialization from incompatible pointer type /tmp/QEMU/qemu_SPARC/target-i386/translate.c:897: warning: initialization from incompatible pointer type /tmp/QEMU/qemu_SPARC/target-i386/translate.c:901: warning: initialization from incompatible pointer type /tmp/QEMU/qemu_SPARC/target-i386/translate.c:902: warning: initialization from incompatible pointer type /tmp/QEMU/qemu_SPARC/target-i386/translate.c:903: warning: initialization from incompatible pointer type /tmp/QEMU/qemu_SPARC/target-i386/translate.c:1176: warning: initialization from incompatible pointer type /tmp/QEMU/qemu_SPARC/target-i386/translate.c:1177: warning: initialization from incompatible pointer type /tmp/QEMU/qemu_SPARC/target-i386/translate.c:1178: warning: initialization from incompatible pointer type /tmp/QEMU/qemu_SPARC/target-i386/translate.c:1179: warning: initialization from incompatible pointer type /tmp/QEMU/qemu_SPARC/target-i386/translate.c:1181: warning: initialization from incompatible pointer type /tmp/QEMU/qemu_SPARC/target-i386/translate.c:1182: warning: initialization from incompatible pointer type /tmp/QEMU/qemu_SPARC/target-i386/translate.c:1186: warning: initialization from incompatible pointer type /tmp/QEMU/qemu_SPARC/target-i386/translate.c:1187: warning: initialization from incompatible pointer type /tmp/QEMU/qemu_SPARC/target-i386/translate.c:1188: warning: initialization from incompatible pointer type /tmp/QEMU/qemu_SPARC/target-i386/translate.c:1189: warning: initialization from incompatible pointer type /tmp/QEMU/qemu_SPARC/target-i386/translate.c:1191: warning: initialization from incompatible pointer type /tmp/QEMU/qemu_SPARC/target-i386/translate.c:1192: warning: initialization from incompatible pointer type /tmp/QEMU/qemu_SPARC/target-i386/translate.c:1196: warning: initialization from incompatible pointer type /tmp/QEMU/qemu_SPARC/target-i386/translate.c:1197: warning: initialization from incompatible pointer type /tmp/QEMU/qemu_SPARC/target-i386/translate.c:1198: warning: initialization from incompatible pointer type /tmp/QEMU/qemu_SPARC/target-i386/translate.c:1199: warning: initialization from incompatible pointer type /tmp/QEMU/qemu_SPARC/target-i386/translate.c:1201: warning: initialization from incompatible pointer type /tmp/QEMU/qemu_SPARC/target-i386/translate.c:1202: warning: initialization from incompatible pointer type /tmp/QEMU/qemu_SPARC/target-i386/translate.c:1219: warning: initialization from incompatible pointer type /tmp/QEMU/qemu_SPARC/target-i386/translate.c:1220: warning: initialization from incompatible pointer type /tmp/QEMU/qemu_SPARC/target-i386/translate.c:1221: warning: initialization from incompatible pointer type /tmp/QEMU/qemu_SPARC/target-i386/translate.c:1224: warning: initialization from incompatible pointer type /tmp/QEMU/qemu_SPARC/target-i386/translate.c:1225: warning: initialization from incompatible pointer type /tmp/QEMU/qemu_SPARC/target-i386/translate.c:1226: warning: initialization from incompatible pointer type /tmp/QEMU/qemu_SPARC/target-i386/translate.c: In function `gen_jcc': /tmp/QEMU/qemu_SPARC/target-i386/translate.c:1780: warning: assignment from incompatible pointer type /tmp/QEMU/qemu_SPARC/target-i386/translate.c:1819: error: too many arguments to function `gen_op_jnz_T0_label' /tmp/QEMU/qemu_SPARC/target-i386/translate.c:1821: error: too many arguments to function `gen_op_jmp_label' /tmp/QEMU/qemu_SPARC/target-i386/translate.c: In function `disas_insn': /tmp/QEMU/qemu_SPARC/target-i386/translate.c:5294: error: too many arguments to function `gen_op_jmp_label' gmake[1]: *** [translate.o] Error 1 gmake[1]: Leaving directory `/tmp/QEMU/qemu_SPARC/i386-softmmu' gmake: *** [all] Error 1 bash-3.00$ ***** comments ***** To error 2.) : Somebody reported a very similar/related problem ( http://lists.gnu.org/archive/html/qemu-devel/2005-03/msg00007.html ). Unfortunately patching dyngen-exec.h did not help. I added a line #define GOTO_LABEL_PARAM(n) asm volatile ("jmp " ASM_NAME(__op_gen_label) #n) to #ifdef __sparc__ in dyngen-exec.h, did a "gmake distclean;./configure --disable-slirp --disable-kqemu --target-list=i386-softmmu;gmake" and got the following error: ***** error 3.) ***** gcc -Wall -O2 -g -fno-strict-aliasing -m32 -ffixed-g4 -ffixed-g2 -ffixed-g3 -DUSE_SB16 -I. -I/tmp/QEMU/qemu_SPARC/target-i386 -I/tmp/QEMU/qemu_SPARC -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -I/opt/sfw/include/SDL -D_REENTRANT -c -o sdl.o /tmp/QEMU/qemu_SPARC/sdl.c gcc -Wall -O2 -g -fno-strict-aliasing -m32 -ffixed-g4 -ffixed-g2 -ffixed-g3 -DUSE_SB16 -I. -I/tmp/QEMU/qemu_SPARC/target-i386 -I/tmp/QEMU/qemu_SPARC -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -c -o exec.o /tmp/QEMU/qemu_SPARC/exec.c gcc -Wall -O2 -g -fno-strict-aliasing -m32 -ffixed-g4 -ffixed-g2 -ffixed-g3 -DUSE_SB16 -I. -I/tmp/QEMU/qemu_SPARC/target-i386 -I/tmp/QEMU/qemu_SPARC -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -c -o kqemu.o /tmp/QEMU/qemu_SPARC/kqemu.c gcc -Wall -O2 -g -fno-strict-aliasing -m32 -ffixed-g4 -ffixed-g2 -ffixed-g3 -fno-delayed-branch -O6 -fno-reorder-blocks -fno-optimize-sibling-calls -DUSE_SB16 -I. -I/tmp/QEMU/qemu_SPARC/target-i386 -I/tmp/QEMU/qemu_SPARC -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -c -o op.o /tmp/QEMU/qemu_SPARC/target-i386/op.c ../dyngen -o op.h op.o dyngen: unsupported sparc relocation (11) gmake[1]: *** [op.h] Error 1 gmake[1]: Leaving directory `/tmp/QEMU/qemu_SPARC/i386-softmmu' gmake: *** [all] Error 1 bash-3.00$ ***** ***** So the question is, what needs to be modified in order to avoid the latter error, dyngen.c or the line just added to dyngen-exec.h??? As I'm very unshure how to tweak dyngen.c in that aspect, I experimented with above line in dyngen-exec.h. I tried to replace the 'jmp' instruction with some other SPARCv8 assembly instruction ('jmpl' and so on - without too much sucess). Finally I found that 'call' seems to work instead of 'jmp'. At least it would continue the build processs "for now". I then tried to patch ./i386-softmmu/op.h by hand ("error: parse error before ';' token ." related trouble). It seems to me, that the lines in question have either one opening '(' to much or one missing closing ')'. The "best" I could eventually get was the following error message: gcc -Wall -O2 -g -fno-strict-aliasing -m32 -ffixed-g4 -ffixed-g2 -ffixed-g3 -DUSE_SB16 -I. -I/tmp/QEMU/qemu_SPARC/target-i386 -I/tmp/QEMU/qemu_SPARC -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -c -o sparc-dis.o /tmp/QEMU/qemu_SPARC/sparc-dis.c rm -f libqemu.a ar rcs libqemu.a exec.o kqemu.o translate-all.o cpu-exec.o translate.o op.o helper.o helper2.o disas.o i386-dis.o sparc-dis.o gcc -o qemu vl.o osdep.o block.o readline.o monitor.o pci.o console.o block-cow.o block-qcow.o aes.o block-vmdk.o block-cloop.o block-dmg.o ide.o ne2000.o pckbd.o vga.o sb16.o dma.o audio.o noaudio.o wavaudio.o sdlaudio.o fdc.o mc146818rtc.o serial.o i8259.o i8254.o pc.o cirrus_vga.o mixeng.o apic.o parallel.o gdbstub.o sdl.o libqemu.a -lm -lz -lsocket -lnsl -L/opt/sfw/lib -R/opt/sfw/lib -lSDL -lpthread -lposix4 Undefined first referenced symbol in file GOTO_LABEL_PARAM libqemu.a(translate-all.o) ld: fatal: Symbol referencing errors. No output written to qemu collect2: ld returned 1 exit status gmake[1]: *** [qemu] Error 1 gmake[1]: Leaving directory `/tmp/QEMU/qemu_SPARC/i386-softmmu' gmake: *** [all] Error 1 bash-3.00$ Please see the followings links as kind of "error reference": [Qemu-devel] powerpc host trouble http://lists.gnu.org/archive/html/qemu-devel/2005-01/msg00140.html and Re: [Qemu-devel] Too Many Arguments To Function gen_op_jmp_label http://lists.gnu.org/archive/html/qemu-devel/2005-03/msg00007.html It seems that the old SPARC patch doesn't like all the new MMX/SSE extensions recently added to the qemu cvs. Please continue your *great* work. Or should I say magic?! Thank You, Martin Bochnig --=-q9/Dt0tktQq3TdAKw5p2 Content-Disposition: attachment; filename=qemu_SPARC_HOST_cvs20050309wed.patch Content-Type: text/x-patch; name=qemu_SPARC_HOST_cvs20050309wed.patch; charset=us-ascii Content-Transfer-Encoding: 7bit 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) { --=-q9/Dt0tktQq3TdAKw5p2--