From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1D5XE3-0005qD-Ud for qemu-devel@nongnu.org; Sun, 27 Feb 2005 17:49:24 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1D5XDo-0005jC-Qx for qemu-devel@nongnu.org; Sun, 27 Feb 2005 17:49:17 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1D5XDn-0005hd-Ch for qemu-devel@nongnu.org; Sun, 27 Feb 2005 17:49:07 -0500 Received: from [66.210.106.28] (helo=blue.fries.net) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.34) id 1D5Wv5-0007KU-96 for qemu-devel@nongnu.org; Sun, 27 Feb 2005 17:29:53 -0500 Received: from blue.fries.net (localhost.fries.net [IPv6:::1]) by blue.fries.net (8.13.3/8.13.2) with ESMTP id j1RMRw54005657 for ; Sun, 27 Feb 2005 16:27:58 -0600 (CST) Received: (from todd@localhost) by blue.fries.net (8.13.3/8.13.1/Submit) id j1RMRwUw008865 for qemu-devel@nongnu.org; Sun, 27 Feb 2005 16:27:58 -0600 (CST) Date: Sun, 27 Feb 2005 16:27:58 -0600 From: "Todd T. Fries" Message-ID: <20050227222758.GA25849@fries.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Subject: [Qemu-devel] diffs for OpenBSD, and a problem .. Reply-To: todd@fries.net, 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 Current cvs no longer builds on OpenBSD. I'm trying to track this down. Here is what ends up happening for me: for d in i386-softmmu ppc-softmmu sparc-softmmu x86_64-softmmu; do \ gmake -C $d all || exit 1 ; \ done gmake[1]: Entering directory `/usr/obj/ports/qemu-20050227/qemu-20050227/i386-so ftmmu' gcc -O2 -pipe -fomit-frame-pointer -I. -I/usr/obj/ports/qemu-20050227/qemu-20050 227/target-i386 -I/usr/obj/ports/qemu-20050227/qemu-20050227 -D_GNU_SOURCE -D_FI LE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -I/usr/obj/ports/qemu-20050227/qemu-200502 27/slirp -c -o translate-all.o /usr/obj/ports/qemu-20050227/qemu-20050227/transl ate-all.c In file included from /usr/obj/ports/qemu-20050227/qemu-20050227/translate-all.c :41: op.h: In function `dyngen_code': op.h:6997: error: syntax error before ')' token op.h:7074: error: syntax error before ')' token op.h:7105: error: syntax error before ')' token op.h:7124: error: syntax error before ')' token op.h:7155: error: syntax error before ')' token op.h:7174: error: syntax error before ')' token op.h:7808: error: syntax error before ')' token op.h:7830: error: syntax error before ')' token op.h:7851: error: syntax error before ')' token op.h:7872: error: syntax error before ')' token op.h:7896: error: syntax error before ')' token op.h:8611: error: syntax error before ')' token op.h:8629: error: syntax error before ')' token op.h:8646: error: syntax error before ')' token op.h:8664: error: syntax error before ')' token op.h:9257: error: syntax error before ')' token op.h:9276: error: syntax error before ')' token op.h:9295: error: syntax error before ')' token op.h:9314: error: syntax error before ')' token op.h:9333: error: syntax error before ')' token op.h:9352: error: syntax error before ')' token op.h:9372: error: syntax error before ')' token op.h:9391: error: syntax error before ')' token op.h:9410: error: syntax error before ')' token op.h:9429: error: syntax error before ')' token op.h:9449: error: syntax error before ')' token gmake[1]: *** [translate-all.o] Error 1 gmake[1]: Leaving directory `/usr/obj/ports/qemu-20050227/qemu-20050227/i386-sof tmmu' gmake: *** [all] Error 1 *** Error code 2 Stop in /tmp_mnt/10.0.0.66/ccd0/OpenBSD/wip/testing-ports/mystuff/emulators/qemu -snap (line 1716 of /usr/ports/infrastructure/mk/bsd.port.mk). *** Error code 1 Stop in /tmp_mnt/10.0.0.66/ccd0/OpenBSD/wip/testing-ports/mystuff/emulators/qemu -snap (line 1517 of /usr/ports/infrastructure/mk/bsd.port.mk). todd@eclipse/p0 21$ Here are the diffs that are presently necessary, adapted from 0.6.1, I expect to be necessary to build qemu on OpenBSD/i386 and OpenBSD/macppc, that I have in my tree as well, incase you think any of them might be a culprit. Index: Makefile =================================================================== RCS file: /cvsroot/qemu/qemu/Makefile,v retrieving revision 1.82 diff -u -r1.82 Makefile --- Makefile 10 Feb 2005 21:48:51 -0000 1.82 +++ Makefile 27 Feb 2005 22:26:38 -0000 @@ -1,10 +1,10 @@ -include config-host.mak -CFLAGS=-Wall -O2 -g -fno-strict-aliasing +#CFLAGS=-Wall -O2 -g -fno-strict-aliasing ifdef CONFIG_DARWIN CFLAGS+= -mdynamic-no-pic endif -LDFLAGS=-g +#LDFLAGS=-g LIBS= DEFINES+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE TOOLS=qemu-img$(EXESUF) @@ -50,21 +50,19 @@ common de-ch es fo fr-ca hu ja mk nl-be pt sl tr install: all - mkdir -p "$(bindir)" - install -m 755 -s $(TOOLS) "$(bindir)" - mkdir -p "$(datadir)" + mkdir -p $(PREFIX)/share/qemu + install -m 755 -s $(TOOLS) $(PREFIX)/bin install -m 644 pc-bios/bios.bin pc-bios/vgabios.bin \ pc-bios/vgabios-cirrus.bin \ pc-bios/ppc_rom.bin \ pc-bios/proll.elf \ - pc-bios/linux_boot.bin "$(datadir)" - mkdir -p "$(docdir)" - install -m 644 qemu-doc.html qemu-tech.html "$(docdir)" + pc-bios/linux_boot.bin $(PREFIX)/share/qemu + mkdir -p $(PREFIX)/share/doc/qemu + install -m 644 qemu-doc.html qemu-tech.html $(PREFIX)/share/doc/qemu ifndef CONFIG_WIN32 - mkdir -p "$(mandir)/man1" - install qemu.1 qemu-img.1 "$(mandir)/man1" - mkdir -p "$(datadir)/keymaps" - install -m 644 $(addprefix keymaps/,$(KEYMAPS)) "$(datadir)/keymaps" + install qemu.1 qemu-img.1 $(PREFIX)/man/man1 + mkdir -p $(PREFIX)/share/qemu/keymaps + install -m 644 $(addprefix keymaps/,$(KEYMAPS)) $(PREFIX)/share/qemu/keymaps endif for d in $(TARGET_DIRS); do \ $(MAKE) -C $$d $@ || exit 1 ; \ Index: Makefile.target =================================================================== RCS file: /cvsroot/qemu/qemu/Makefile.target,v retrieving revision 1.58 diff -u -r1.58 Makefile.target --- Makefile.target 22 Feb 2005 19:27:14 -0000 1.58 +++ Makefile.target 27 Feb 2005 22:26:38 -0000 @@ -14,7 +14,7 @@ VPATH+=:$(SRC_PATH)/linux-user DEFINES+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ARCH) endif -CFLAGS=-Wall -O2 -g -fno-strict-aliasing +#CFLAGS=-Wall -O2 -g -fno-strict-aliasing #CFLAGS+=-Werror LDFLAGS=-g LIBS= @@ -312,6 +312,9 @@ endif ifdef CONFIG_OSS AUDIODRV += ossaudio.o +ifdef CONFIG_OSS_LIBRARY +LIBS += -lossaudio +endif endif pc.o: DEFINES := -DUSE_SB16 $(DEFINES) @@ -439,7 +442,7 @@ install: all ifneq ($(PROGS),) - install -m 755 -s $(PROGS) "$(bindir)" + install -m 755 -s $(PROGS) $(PREFIX)/bin/ endif ifneq ($(wildcard .depend),) Index: configure =================================================================== RCS file: /cvsroot/qemu/qemu/configure,v retrieving revision 1.56 diff -u -r1.56 configure --- configure 19 Feb 2005 17:24:28 -0000 1.56 +++ configure 27 Feb 2005 22:26:39 -0000 @@ -41,7 +41,7 @@ alpha) cpu="alpha" ;; - "Power Macintosh"|ppc|ppc64) + "Power Macintosh"|macppc|ppc|ppc64) cpu="powerpc" ;; mips) @@ -100,6 +100,7 @@ ;; OpenBSD) bsd="yes" +openbsd="yes" oss="yes" ;; Darwin) @@ -341,7 +342,7 @@ if test -z "$prefix" ; then prefix="/usr/local" fi -mandir="$prefix/share/man" +mandir="$prefix/man" datadir="$prefix/share/qemu" docdir="$prefix/share/doc/qemu" bindir="$prefix/bin" @@ -533,6 +534,9 @@ if test "$oss" = "yes" ; then echo "CONFIG_OSS=yes" >> $config_mak echo "#define CONFIG_OSS 1" >> $config_h + if test "$openbsd"="yes" ; then + echo "CONFIG_OSS_LIBRARY=yes" >> $config_mak + fi fi if test "$fmod" = "yes" ; then echo "CONFIG_FMOD=yes" >> $config_mak @@ -564,6 +568,15 @@ echo "#define _BSD 1" >> $config_h fi +if [ "$openbsd" = "yes" ] ; then + echo "#define ENOTSUP 4096" >> $config_h + echo "#define PRIx64 \"llX\"" >> $config_h + echo "#define qemu_siginfo siginfo_t" >> $config_h +else + echo "#define qemu_siginfo struct siginfo" >> $config_h +fi + + for target in $target_list; do target_dir="$target" Index: dis-asm.h =================================================================== RCS file: /cvsroot/qemu/qemu/dis-asm.h,v retrieving revision 1.7 diff -u -r1.7 dis-asm.h --- dis-asm.h 3 Jan 2005 23:35:10 -0000 1.7 +++ dis-asm.h 27 Feb 2005 22:26:40 -0000 @@ -13,6 +13,7 @@ #include #include #include +#include "config.h" #define PARAMS(x) x typedef void *PTR; Index: dyngen-exec.h =================================================================== RCS file: /cvsroot/qemu/qemu/dyngen-exec.h,v retrieving revision 1.20 diff -u -r1.20 dyngen-exec.h --- dyngen-exec.h 26 Jan 2005 21:30:57 -0000 1.20 +++ dyngen-exec.h 27 Feb 2005 22:26:40 -0000 @@ -20,11 +20,15 @@ #if !defined(__DYNGEN_EXEC_H__) #define __DYNGEN_EXEC_H__ +#include "config.h" + /* 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. */ #include - +#ifdef __OpenBSD__ +#include +#else typedef unsigned char uint8_t; typedef unsigned short uint16_t; typedef unsigned int uint32_t; @@ -43,6 +47,7 @@ #else typedef signed long long int64_t; #endif +#endif #define INT8_MIN (-128) #define INT16_MIN (-32767-1) @@ -57,11 +62,15 @@ #define UINT32_MAX (4294967295U) #define UINT64_MAX ((uint64_t)(18446744073709551615)) +#ifdef __OpenBSD__ +typedef struct __sFILE FILE; +#else typedef struct FILE FILE; extern int fprintf(FILE *, const char *, ...); extern int printf(const char *, ...); #undef NULL #define NULL 0 +#endif #if defined(_BSD) && !defined(__APPLE__) #include @@ -70,6 +79,7 @@ #define FE_UPWARD FP_RP #define FE_TOWARDZERO FP_RZ #define fesetround(x) fpsetround(x) +#define fegetround() fpgetround() #else #include #endif Index: osdep.h =================================================================== RCS file: /cvsroot/qemu/qemu/osdep.h,v retrieving revision 1.5 diff -u -r1.5 osdep.h --- osdep.h 10 Feb 2005 21:59:25 -0000 1.5 +++ osdep.h 27 Feb 2005 22:26:40 -0000 @@ -2,6 +2,10 @@ #define QEMU_OSDEP_H #include +#ifdef __OpenBSD__ +#include +#include +#endif int qemu_vsnprintf(char *buf, int buflen, const char *fmt, va_list args); void qemu_vprintf(const char *fmt, va_list ap); @@ -31,7 +35,7 @@ struct qemu_sigaction { union { void (*_sa_handler)(int); - void (*_sa_sigaction)(int, struct siginfo *, void *); + void (*_sa_sigaction)(int, qemu_siginfo *, void *); } _u; unsigned long sa_flags; void (*sa_restorer)(void); Index: vl.c =================================================================== RCS file: /cvsroot/qemu/qemu/vl.c,v retrieving revision 1.120 diff -u -r1.120 vl.c --- vl.c 10 Feb 2005 22:00:06 -0000 1.120 +++ vl.c 27 Feb 2005 22:26:44 -0000 @@ -42,7 +42,7 @@ #include #ifdef _BSD #include -#ifndef __APPLE__ +#if !defined(__APPLE__) && !defined(__OpenBSD__) #include #endif #else @@ -1574,11 +1574,32 @@ char *dev; struct stat s; +#ifdef __OpenBSD__ + int i = 0, enoentcount = 0, err = 0; + char dname[100]; + + for (; i < 10; i++) { + snprintf(dname, sizeof dname, "%s%d", "/dev/tun", i); + fd = open(dname, O_RDWR); + if (fd >= 0) + break; + else if (errno != ENOENT || ++enoentcount > 3) { + err = errno; + break; + } else + err = errno; + } + if (fd < 0) { + fprintf(stderr, "warning: could not open %s (%s): no virtual network emulation\n", dname, strerror(err)); + return -1; + } +#else fd = open("/dev/tap", O_RDWR); if (fd < 0) { fprintf(stderr, "warning: could not open /dev/tap: no virtual network emulation\n"); return -1; } +#endif fstat(fd, &s); dev = devname(s.st_rdev, S_IFCHR); Index: audio/audio.c =================================================================== RCS file: /cvsroot/qemu/qemu/audio/audio.c,v retrieving revision 1.5 diff -u -r1.5 audio.c --- audio/audio.c 6 Dec 2004 23:14:48 -0000 1.5 +++ audio/audio.c 27 Feb 2005 22:26:46 -0000 @@ -35,6 +35,10 @@ #define ldebug(...) #endif +#ifdef __OpenBSD__ +#define INT16_MAX (32767) +#endif + #define QC_AUDIO_DRV "QEMU_AUDIO_DRV" #define QC_VOICES "QEMU_VOICES" #define QC_FIXED_FORMAT "QEMU_FIXED_FORMAT" Index: audio/ossaudio.c =================================================================== RCS file: /cvsroot/qemu/qemu/audio/ossaudio.c,v retrieving revision 1.4 diff -u -r1.4 ossaudio.c --- audio/ossaudio.c 14 Nov 2004 16:02:51 -0000 1.4 +++ audio/ossaudio.c 27 Feb 2005 22:26:46 -0000 @@ -21,10 +21,15 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ +#ifdef __OpenBSD__ +#include +#include +#else +#include +#endif #include #include #include -#include #include #include "vl.h" Index: slirp/slirp_config.h =================================================================== RCS file: /cvsroot/qemu/qemu/slirp/slirp_config.h,v retrieving revision 1.3 diff -u -r1.3 slirp_config.h --- slirp/slirp_config.h 12 Jul 2004 22:33:05 -0000 1.3 +++ slirp/slirp_config.h 27 Feb 2005 22:26:46 -0000 @@ -92,7 +92,7 @@ #undef BAD_SPRINTF /* Define if you have readv */ -#undef HAVE_READV +#define HAVE_READV /* Define if iovec needs to be declared */ #undef DECLARE_IOVEC @@ -104,7 +104,7 @@ #undef DECLARE_SPRINTF /* Define if you have a POSIX.1 sys/wait.h */ -#undef HAVE_SYS_WAIT_H +#define HAVE_SYS_WAIT_H /* Define if you have sys/select.h */ #undef HAVE_SYS_SELECT_H @@ -122,7 +122,7 @@ #endif /* Define if you have sys/signal.h */ -#undef HAVE_SYS_SIGNAL_H +#define HAVE_SYS_SIGNAL_H /* Define if you have sys/stropts.h */ #undef HAVE_SYS_STROPTS_H @@ -198,7 +198,7 @@ #undef HAVE_GRANTPT /* Define if you have fchmod */ -#undef HAVE_FCHMOD +#define HAVE_FCHMOD /* Define if you have */ #undef HAVE_SYS_TYPES32_H Index: target-arm/cpu.h =================================================================== RCS file: /cvsroot/qemu/qemu/target-arm/cpu.h,v retrieving revision 1.7 diff -u -r1.7 cpu.h --- target-arm/cpu.h 22 Feb 2005 19:27:29 -0000 1.7 +++ target-arm/cpu.h 27 Feb 2005 22:26:46 -0000 @@ -97,7 +97,7 @@ signal handlers to inform the virtual CPU of exceptions. non zero is returned if the signal was handled by the virtual CPU. */ struct siginfo; -int cpu_arm_signal_handler(int host_signum, struct siginfo *info, +int cpu_arm_signal_handler(int host_signum, qemu_siginfo *info, void *puc); #define TARGET_PAGE_BITS 12 Index: target-i386/cpu.h =================================================================== RCS file: /cvsroot/qemu/qemu/target-i386/cpu.h,v retrieving revision 1.27 diff -u -r1.27 cpu.h --- target-i386/cpu.h 12 Feb 2005 18:58:00 -0000 1.27 +++ target-i386/cpu.h 27 Feb 2005 22:26:48 -0000 @@ -609,8 +609,7 @@ /* you can call this signal handler from your SIGBUS and SIGSEGV signal handlers to inform the virtual CPU of exceptions. non zero is returned if the signal was handled by the virtual CPU. */ -struct siginfo; -int cpu_x86_signal_handler(int host_signum, struct siginfo *info, +int cpu_x86_signal_handler(int host_signum, qemu_siginfo *info, void *puc); void cpu_x86_set_a20(CPUX86State *env, int a20_state); Index: target-ppc/cpu.h =================================================================== RCS file: /cvsroot/qemu/qemu/target-ppc/cpu.h,v retrieving revision 1.15 diff -u -r1.15 cpu.h --- target-ppc/cpu.h 15 Feb 2005 23:06:19 -0000 1.15 +++ target-ppc/cpu.h 27 Feb 2005 22:26:48 -0000 @@ -163,8 +163,7 @@ /* you can call this signal handler from your SIGBUS and SIGSEGV signal handlers to inform the virtual CPU of exceptions. non zero is returned if the signal was handled by the virtual CPU. */ -struct siginfo; -int cpu_ppc_signal_handler(int host_signum, struct siginfo *info, +int cpu_ppc_signal_handler(int host_signum, qemu_siginfo *info, void *puc); void do_interrupt (CPUPPCState *env); Index: target-ppc/op_helper.c =================================================================== RCS file: /cvsroot/qemu/qemu/target-ppc/op_helper.c,v retrieving revision 1.11 diff -u -r1.11 op_helper.c --- target-ppc/op_helper.c 15 Feb 2005 23:06:19 -0000 1.11 +++ target-ppc/op_helper.c 27 Feb 2005 22:26:48 -0000 @@ -226,6 +226,18 @@ /* Set rounding mode */ switch (env->fpscr[0] & 0x3) { case 0: +#ifdef _BSD + fpsetround(FP_RN); + break; + case 1: + fpsetround(FP_RZ); + break; + case 2: + fpsetround(FP_RP); + break; + case 3: + fpsetround(FP_RM); +#else /* Best approximation (round to nearest) */ fesetround(FE_TONEAREST); break; @@ -240,6 +252,7 @@ case 3: /* Round toward -infinite */ fesetround(FE_DOWNWARD); +#endif break; } } @@ -267,9 +280,14 @@ double d; uint64_t i; } *p = (void *)&FT1; +#ifdef _BSD + int cround = fpgetround(); + fpsetround(FP_RZ); +#else int cround = fegetround(); fesetround(FE_TOWARDZERO); +#endif if (FT0 > (double)0x7FFFFFFF) p->i = 0x7FFFFFFFULL << 32; else if (FT0 < -(double)0x80000000) @@ -278,7 +296,11 @@ p->i = 0; p->i |= (uint32_t)FT0; FT0 = p->d; +#ifdef _BSD + fpsetround(cround); +#else fesetround(cround); +#endif } void do_fnmadd (void) Index: target-sparc/cpu.h =================================================================== RCS file: /cvsroot/qemu/qemu/target-sparc/cpu.h,v retrieving revision 1.15 diff -u -r1.15 cpu.h --- target-sparc/cpu.h 22 Feb 2005 19:08:57 -0000 1.15 +++ target-sparc/cpu.h 27 Feb 2005 22:26:49 -0000 @@ -189,8 +189,7 @@ cpu_set_cwp(env, _tmp & PSR_CWP & (NWINDOWS - 1)); \ } while (0) -struct siginfo; -int cpu_sparc_signal_handler(int hostsignum, struct siginfo *info, void *puc); +int cpu_sparc_signal_handler(int hostsignum, qemu_siginfo *info, void *puc); #define TARGET_PAGE_BITS 12 /* 4k */ #include "cpu-all.h" Index: target-sparc/op_helper.c =================================================================== RCS file: /cvsroot/qemu/qemu/target-sparc/op_helper.c,v retrieving revision 1.9 diff -u -r1.9 op_helper.c --- target-sparc/op_helper.c 22 Feb 2005 19:14:33 -0000 1.9 +++ target-sparc/op_helper.c 27 Feb 2005 22:26:49 -0000 @@ -1,5 +1,7 @@ #include +#ifndef _BSD #include +#endif #include "exec.h" //#define DEBUG_MMU -- Todd Fries .. todd@fries.net _____________________________________________ | \ 1.636.410.0632 (voice) | Free Daemon Consulting, LLC \ 1.405.227.9094 (voice) | http://FreeDaemonConsulting.com \ 1.866.792.3418 (FAX) | "..in support of free software solutions." \ 1.700.227.9094 (IAXTEL) | \ 250797 (FWD) \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ 37E7 D3EB 74D0 8D66 A68D B866 0326 204E 3F42 004A http://todd.fries.net/pgp.txt