Index: Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/emulators/qemu/Makefile,v
retrieving revision 1.56
diff -u -p -r1.56 Makefile
--- Makefile	13 May 2009 19:02:18 -0000	1.56
+++ Makefile	30 Aug 2009 17:41:16 -0000
@@ -1,13 +1,12 @@
 # $NetBSD: Makefile,v 1.56 2009/05/13 19:02:18 kefren Exp $
 #
 
-DISTNAME=		qemu-0.9.1
-PKGREVISION=		1
+DISTNAME=		qemu-0.10.6
 CATEGORIES=		emulators
-MASTER_SITES=		http://bellard.org/qemu/
+MASTER_SITES=		http://download.savannah.gnu.org/releases/qemu/
 
 MAINTAINER=		pkgsrc-users@NetBSD.org
-HOMEPAGE=		http://bellard.org/qemu/
+HOMEPAGE=		http://www.nongnu.org/qemu/
 COMMENT=		CPU emulator using dynamic translation
 
 PKG_DESTDIR_SUPPORT=	user-destdir
@@ -22,19 +21,14 @@ BUILD_DEPENDS+=		texi2html-[0-9]*:../../
 
 # Workaround for PR/41007 - ensure WRKSRC comes before any buildlinked
 # directories so we pickup our audio/audio.h. Cannot use CPPFLAGS for this
-CFLAGS+=	-I${WRKSRC}
+CFLAGS+=		-I${WRKSRC} -I${WRKSRC}/slirp
 
 .include "../../mk/bsd.prefs.mk"
 
-GCC_REQD+=		3.0
-
-.if !empty(MACHINE_PLATFORM:MNetBSD-[4-9]*)
-USE_PKGSRC_GCC=	yes
-.endif
-
 CONFIGURE_ENV+=		PKGMANDIR=${PKGMANDIR}
 CONFIGURE_ARGS+=	--prefix=${PREFIX:Q}
 CONFIGURE_ARGS+=	--interp-prefix=${PREFIX:Q}/share/qemu
+CONFIGURE_ARGS+=	--disable-bsd-user
 
 .if !empty(MACHINE_PLATFORM:MNetBSD-*)
 SUBST_CLASSES+=		lib
@@ -56,6 +50,15 @@ SUBST_FILES.smbd=	vl.c
 SUBST_SED.smbd=		-e s,/usr/sbin/smbd,${PREFIX:Q}/sbin/smbd,g
 SUBST_MESSAGE.smbd=	Fixing hardcoded paths.
 
+pre-patch:
+	mv ${WRKSRC}/audio/audio.h ${WRKSRC}/audio/qaudio.h
+
+SUBST_CLASSES+=		qaudio
+SUBST_STAGE.qaudio=	pre-configure
+SUBST_FILES.qaudio=	*.c audio/*.c hw/*.c
+SUBST_SED.qaudio=	-e s,audio.h\",qaudio.h\",g
+SUBST_MESSAGE.qaudio= 	Fixing audio.h confusion
+
 REPLACE_PERL+=		texi2pod.pl
 
 # Remove -march/-mcpu from CFLAGS, otherwise it will fail
@@ -65,18 +68,6 @@ BUILDLINK_TRANSFORM+=	rm-optarg:-march r
 BUILDLINK_PASSTHRU_DIRS+= /usr/lib
 BUILDLINK_PASSTHRU_RPATHDIRS+= /usr/lib
 
-# Does not build with the stack protector
-.if ${OPSYS} == "DragonFly"
-CFLAGS+=		-fno-stack-protector
-.endif
-
-.include "../../mk/compiler.mk"
-
-.if !empty(CC_VERSION:Mgcc-4*)
-CONFIGURE_ARGS+=	--disable-gcc-check
-.endif
-
-
 INSTALLATION_DIRS=	${PKGMANDIR}/man1 share/doc/qemu
 
 post-install:
Index: PLIST
===================================================================
RCS file: /cvsroot/pkgsrc/emulators/qemu/PLIST,v
retrieving revision 1.18
diff -u -p -r1.18 PLIST
--- PLIST	14 Jun 2009 17:51:07 -0000	1.18
+++ PLIST	30 Aug 2009 17:41:16 -0000
@@ -17,9 +17,11 @@ bin/qemu-system-sparc
 bin/qemu-system-x86_64
 man/man1/qemu-img.1
 man/man1/qemu.1
+man/man8/qemu-nbd.8
 share/doc/qemu/Makefile.multinode-NetBSD
 share/doc/qemu/qemu-doc.html
 share/doc/qemu/qemu-tech.html
+share/qemu/bamboo.dtb
 share/qemu/bios.bin
 share/qemu/keymaps/ar
 share/qemu/keymaps/common
@@ -56,8 +58,11 @@ share/qemu/keymaps/sl
 share/qemu/keymaps/sv
 share/qemu/keymaps/th
 share/qemu/keymaps/tr
+share/qemu/openbios-ppc
 share/qemu/openbios-sparc32
+share/qemu/openbios-sparc64
 share/qemu/ppc_rom.bin
+share/qemu/pxe-e1000.bin
 share/qemu/pxe-ne2k_pci.bin
 share/qemu/pxe-pcnet.bin
 share/qemu/pxe-rtl8139.bin
Index: distinfo
===================================================================
RCS file: /cvsroot/pkgsrc/emulators/qemu/distinfo,v
retrieving revision 1.42
diff -u -p -r1.42 distinfo
--- distinfo	13 May 2009 19:02:18 -0000	1.42
+++ distinfo	30 Aug 2009 17:41:16 -0000
@@ -1,20 +1,20 @@
 $NetBSD: distinfo,v 1.42 2009/05/13 19:02:18 kefren Exp $
 
-SHA1 (qemu-0.9.1.tar.gz) = 630ea20b5989f0df00128de7f7be661c573ed041
-RMD160 (qemu-0.9.1.tar.gz) = ee7bdb55a4540df2082d4bde9ebfd2f4e6f201a5
-Size (qemu-0.9.1.tar.gz) = 2804104 bytes
-SHA1 (patch-aa) = 455575215bad8864da285e1979da9ff7d8476a24
-SHA1 (patch-ab) = ba77da578f528ca549c48336b40378dcbb2a2fbb
-SHA1 (patch-ac) = 3d73b46db4f824d16d40472cc3bd516599469966
-SHA1 (patch-ad) = ac69a03e4945e8c8fd5aadca070b876d0970910d
-SHA1 (patch-ae) = a82f6c1a02c6bc03f4da9bc2b52f817b260ced8a
-SHA1 (patch-ag) = 3469af1ec2a4f95c09a67c16b1071f0ec27dab74
-SHA1 (patch-ak) = ed5766e36d5a192cf4559142e6ef9e0287e61b43
-SHA1 (patch-am) = a22a3b23284c377afa8113768d68c8ef40c514f9
+SHA1 (qemu-0.10.6.tar.gz) = 9432738ba513e07c981097468945b2e3ad9cb81e
+RMD160 (qemu-0.10.6.tar.gz) = 1321a10777d2e0c6b53887d0525a28cc1b36ec9b
+Size (qemu-0.10.6.tar.gz) = 3664559 bytes
 SHA1 (patch-ao) = e515093b6ea99f9cba665de022fd62f3be911569
 SHA1 (patch-au) = 2892cae63796c76014288f4a700acbee5aadc529
 SHA1 (patch-av) = 715e9680d70c1aa1c83bda0270125144a26d6140
-SHA1 (patch-aw) = f3bc77cdec3a876fa69406c91590d02161e80753
-SHA1 (patch-ax) = 66b060005ecbf9fd0451f7960e81eccbabf959ca
-SHA1 (patch-ay) = f41e230bd0fef6437aa187b346fc06ef4f32a31c
 SHA1 (patch-ba) = 7c5043a39405f52b512e479a46fc76108580b7bc
+SHA1 (patch-da) = 708a0d7d4b1efd83113e49bf91655d4d8ad85126
+SHA1 (patch-db) = eff52b0fbe50e9908b568018e4c4bd052d29a962
+SHA1 (patch-dc) = 6bc91531dbe30efc83e81ff2ed921213e6469c5e
+SHA1 (patch-dd) = e97072e73cc84d3616738d0309aecada2ce342a6
+SHA1 (patch-de) = 78ea63c249f533a8558661a37054acea021de028
+SHA1 (patch-df) = a60d06536cad601b332e84aae187b937b909057e
+SHA1 (patch-dg) = 3d9d78594c0e0a51a124a0273672e4385be9e2b9
+SHA1 (patch-dh) = 28482ca3f072196aad05c65521657e83ecd5edd5
+SHA1 (patch-di) = 04f7024d61fae611ad9d67a5fd9b42e9b7c39516
+SHA1 (patch-dj) = 6602f3edc52b6661479f287bbc2ef91fb19e7e76
+SHA1 (patch-dk) = d95375899f08e0ed4d579cae111aba5ab49d20f3
--- patches/patch-aa	2009-08-30 20:39:50 +0300
+++ /dev/null	2009-08-30 20:23:05 +0300
@@ -1,26 +0,0 @@
-$NetBSD: patch-aa,v 1.3 2004/12/14 01:02:19 dbj Exp $
-
---- bswap.h.orig	Sun Nov 14 15:51:33 2004
-+++ bswap.h
-@@ -5,6 +5,12 @@
- 
- #include <inttypes.h>
- 
-+#ifdef HAVE_MACHINE_BSWAP_H
-+#include <sys/endian.h>
-+#include <sys/types.h>
-+#include <machine/bswap.h>
-+#else
-+
- #ifdef HAVE_BYTESWAP_H
- #include <byteswap.h>
- #else
-@@ -57,6 +63,8 @@ static inline uint64_t bswap64(uint64_t 
- {
-     return bswap_64(x);
- }
-+
-+#endif /* ! HAVE_MACHINE_BSWAP_H */
- 
- static inline void bswap16s(uint16_t *s)
- {
--- patches/patch-ab	2009-08-30 20:39:50 +0300
+++ /dev/null	2009-08-30 20:23:05 +0300
@@ -1,26 +0,0 @@
-$NetBSD: patch-ab,v 1.9 2009/01/22 07:27:28 jmmv Exp $
-
---- Makefile.target.orig	2008-01-06 20:38:41.000000000 +0100
-+++ Makefile.target
-@@ -115,6 +115,10 @@ OP_CFLAGS+=$(call cc-option, -fno-align-
- OP_CFLAGS+=$(call cc-option, -fno-align-functions, $(call cc-option, -malign-functions=0, ""))
- OP_CFLAGS+=$(call cc-option, -fno-section-anchors, "")
- 
-+ifdef STACK_PROTECTOR_PRESENT
-+OP_CFLAGS+=$(call cc-option, -fno-stack-protector, "")
-+endif
-+
- ifeq ($(ARCH),i386)
- HELPER_CFLAGS+=-fomit-frame-pointer
- OP_CFLAGS+=-mpreferred-stack-boundary=2 -fomit-frame-pointer
-@@ -537,7 +541,9 @@ endif
- ifndef CONFIG_DARWIN
- ifndef CONFIG_WIN32
- ifndef CONFIG_SOLARIS
--VL_LIBS+=-lutil
-+ifndef CONFIG_DRAGONFLY
-+VL_LIBS+=-lutil -lrt
-+endif
- endif
- endif
- endif
--- patches/patch-ac	2009-08-30 20:39:50 +0300
+++ /dev/null	2009-08-30 20:23:05 +0300
@@ -1,73 +0,0 @@
-$NetBSD: patch-ac,v 1.11 2009/05/13 19:02:18 kefren Exp $
-
---- vl.c.orig	2008-01-06 21:38:42.000000000 +0200
-+++ vl.c	2009-05-13 21:49:15.000000000 +0300
-@@ -61,7 +61,7 @@
- #include <arpa/inet.h>
- #ifdef _BSD
- #include <sys/stat.h>
--#ifndef __APPLE__
-+#ifndef _BSD
- #include <libutil.h>
- #endif
- #elif defined (__GLIBC__) && defined (__FreeBSD_kernel__)
-@@ -2385,6 +2385,9 @@
- 
- static int pp_ioctl(CharDriverState *chr, int cmd, void *arg)
- {
-+#ifdef __NetBSD__
-+    return ENOTSUP;
-+#endif
-     ParallelCharDriver *drv = chr->opaque;
-     int fd = drv->fd;
-     uint8_t b;
-@@ -2473,6 +2476,9 @@
- 
- static CharDriverState *qemu_chr_open_pp(const char *filename)
- {
-+#ifdef __NetBSD__
-+    return ENOTSUP;
-+#endif
-     CharDriverState *chr;
-     ParallelCharDriver *drv;
-     int fd;
-@@ -4877,13 +4883,14 @@
-     int bus_id, unit_id;
-     int cyls, heads, secs, translation;
-     BlockDriverState *bdrv;
-+    BlockDriver *drv = NULL;
-     int max_devs;
-     int index;
-     int cache;
-     int bdrv_flags;
-     char *params[] = { "bus", "unit", "if", "index", "cyls", "heads",
-                        "secs", "trans", "media", "snapshot", "file",
--                       "cache", NULL };
-+                       "cache", "format", NULL };
- 
-     if (check_params(buf, sizeof(buf), params, str) < 0) {
-          fprintf(stderr, "qemu: unknowm parameter '%s' in '%s'\n",
-@@ -5051,6 +5058,14 @@
-         }
-     }
- 
-+    if (get_param_value(buf, sizeof(buf), "format", str)) {
-+	drv = bdrv_find_format(buf);
-+	if (!drv) {
-+	    fprintf(stderr, "qemu: '%s' invalid format\n", buf);
-+	    return -1;
-+	}
-+    }
-+
-     get_param_value(file, sizeof(file), "file", str);
- 
-     /* compute bus and unit according index */
-@@ -5150,7 +5165,7 @@
-         bdrv_flags |= BDRV_O_SNAPSHOT;
-     if (!cache)
-         bdrv_flags |= BDRV_O_DIRECT;
--    if (bdrv_open(bdrv, file, bdrv_flags) < 0 || qemu_key_check(bdrv, file)) {
-+    if (bdrv_open2(bdrv, file, bdrv_flags, drv) < 0 || qemu_key_check(bdrv, file)) {
-         fprintf(stderr, "qemu: could not open disk image %s\n",
-                         file);
-         return -1;
--- patches/patch-ad	2009-08-30 20:39:50 +0300
+++ /dev/null	2009-08-30 20:23:05 +0300
@@ -1,15 +0,0 @@
-$NetBSD: patch-ad,v 1.3 2007/12/30 17:12:45 joerg Exp $
-
---- block.c.orig	2007-02-05 23:01:54 +0000
-+++ block.c
-@@ -29,8 +29,10 @@
- #include <sys/stat.h>
- #include <sys/ioctl.h>
- #include <sys/queue.h>
-+#ifndef __DragonFly__
- #include <sys/disk.h>
- #endif
-+#endif
- 
- #define SECTOR_BITS 9
- #define SECTOR_SIZE (1 << SECTOR_BITS)
--- patches/patch-ae	2009-08-30 20:39:50 +0300
+++ /dev/null	2009-08-30 20:23:05 +0300
@@ -1,12 +0,0 @@
-$NetBSD: patch-ae,v 1.4 2009/01/22 07:27:28 jmmv Exp $
-
---- osdep.h.orig	2008-01-06 20:38:42.000000000 +0100
-+++ osdep.h
-@@ -1,6 +1,7 @@
- #ifndef QEMU_OSDEP_H
- #define QEMU_OSDEP_H
- 
-+#include <sys/types.h>
- #include <stdarg.h>
- 
- #ifndef glue
--- patches/patch-ag	2009-08-30 20:39:50 +0300
+++ /dev/null	2009-08-30 20:23:05 +0300
@@ -1,77 +0,0 @@
-$NetBSD: patch-ag,v 1.12 2009/01/22 07:27:28 jmmv Exp $
-
---- configure.orig	2008-01-06 20:38:42.000000000 +0100
-+++ configure
-@@ -44,7 +44,7 @@ case "$cpu" in
-   alpha)
-     cpu="alpha"
-   ;;
--  "Power Macintosh"|ppc|ppc64)
-+  "Power Macintosh"|ppc|ppc64|powerpc)
-     cpu="powerpc"
-   ;;
-   mips)
-@@ -136,6 +136,12 @@ if [ "$cpu" = "i386" -o "$cpu" = "x86_64
-     kqemu="yes"
- fi
- ;;
-+DragonFly)
-+bsd="yes"
-+oss="yes"
-+dragonfly="yes"
-+;;
-+
- NetBSD)
- bsd="yes"
- oss="yes"
-@@ -478,6 +484,16 @@ EOF
-     fi
- fi
- 
-+# Check for stack protector
-+cat > $TMPC <<EOF
-+extern int foo;
-+EOF
-+if "$cc" -o $TMPE $TMPC -fno-stack-protector 2> /dev/null ; then
-+  stack_protector_present="yes"
-+else
-+  stack_protector_present="no"
-+fi
-+
- #
- # Solaris specific configure tool chain decisions
- #
-@@ -680,7 +696,7 @@ else
-   if test -z "$prefix" ; then
-       prefix="/usr/local"
-   fi
--  mansuffix="/share/man"
-+  mansuffix="/$PKGMANDIR"
-   datasuffix="/share/qemu"
-   docsuffix="/share/doc/qemu"
-   binsuffix="/bin"
-@@ -848,8 +864,13 @@ int main(void) { return bswap_32(0); }
- EOF
-   if $cc -o $TMPE $TMPC 2> /dev/null ; then
-     echo "#define HAVE_BYTESWAP_H 1" >> $config_h
-+  elif test -f "/usr/include/machine/bswap.h" ; then
-+    echo "#define HAVE_MACHINE_BSWAP_H 1" >> $config_h
-   fi
- fi
-+if test "$dragonfly" = "yes" ; then
-+  echo "CONFIG_DRAGONFLY=yes" >> $config_mak
-+fi
- if test "$darwin" = "yes" ; then
-   echo "CONFIG_DARWIN=yes" >> $config_mak
-   echo "#define CONFIG_DARWIN 1" >> $config_h
-@@ -960,6 +981,10 @@ if [ "$bsd" = "yes" ] ; then
-   echo "#define _BSD 1" >> $config_h
- fi
- 
-+if [ "$stack_protector_present" = "yes" ] ; then
-+  echo "STACK_PROTECTOR_PRESENT=yes" >> $config_mak
-+fi
-+
- echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
- 
- tools=
--- patches/patch-ak	2009-08-30 20:39:50 +0300
+++ /dev/null	2009-08-30 20:23:05 +0300
@@ -1,57 +0,0 @@
-$NetBSD: patch-ak,v 1.13 2009/01/22 07:27:28 jmmv Exp $
-
---- Makefile.orig	2008-01-06 20:38:41.000000000 +0100
-+++ Makefile
-@@ -16,6 +16,15 @@ BASE_LDFLAGS += $(OS_LDFLAGS) $(ARCH_LDF
- CPPFLAGS += -I. -I$(SRC_PATH) -MMD -MP
- CPPFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
- LIBS=
-+ifndef CONFIG_DARWIN
-+ifndef CONFIG_WIN32
-+ifndef CONFIG_SOLARIS
-+ifndef CONFIG_DRAGONFLY
-+LIBS+=-lrt
-+endif
-+endif
-+endif
-+endif
- ifdef CONFIG_STATIC
- BASE_LDFLAGS += -static
- endif
-@@ -164,28 +173,28 @@ ar      de     en-us  fi  fr-be  hr     
- common  de-ch  es     fo  fr-ca  hu     ja  mk  nl-be      pt  sl     tr
- 
- install-doc: $(DOCS)
--	mkdir -p "$(DESTDIR)$(docdir)"
--	$(INSTALL) -m 644 qemu-doc.html  qemu-tech.html "$(DESTDIR)$(docdir)"
-+	$(BSD_INSTALL_MAN_DIR) $(DESTDIR)$(docdir)
-+	$(BSD_INSTALL_DATA) qemu-doc.html  qemu-tech.html "$(DESTDIR)$(docdir)"
- ifndef CONFIG_WIN32
- 	mkdir -p "$(DESTDIR)$(mandir)/man1"
- 	$(INSTALL) qemu.1 qemu-img.1 "$(DESTDIR)$(mandir)/man1"
- endif
- 
- install: all $(if $(BUILD_DOCS),install-doc)
--	mkdir -p "$(DESTDIR)$(bindir)"
-+	$(BSD_INSTALL_PROGRAM_DIR) $(DESTDIR)$(bindir)
- ifneq ($(TOOLS),)
--	$(INSTALL) -m 755 -s $(TOOLS) "$(DESTDIR)$(bindir)"
-+	$(BSD_INSTALL_PROGRAM) $(TOOLS) "$(DESTDIR)$(bindir)"
- endif
--	mkdir -p "$(DESTDIR)$(datadir)"
-+	$(BSD_INSTALL_DATA_DIR) $(DESTDIR)$(datadir)
- 	for x in bios.bin vgabios.bin vgabios-cirrus.bin ppc_rom.bin \
- 		video.x openbios-sparc32 pxe-ne2k_pci.bin \
- 		pxe-rtl8139.bin pxe-pcnet.bin; do \
--		$(INSTALL) -m 644 $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \
-+		$(BSD_INSTALL_DATA) $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \
- 	done
- ifndef CONFIG_WIN32
--	mkdir -p "$(DESTDIR)$(datadir)/keymaps"
-+	$(BSD_INSTALL_DATA_DIR) $(DESTDIR)$(datadir)/keymaps
- 	for x in $(KEYMAPS); do \
--		$(INSTALL) -m 644 $(SRC_PATH)/keymaps/$$x "$(DESTDIR)$(datadir)/keymaps"; \
-+		$(BSD_INSTALL_DATA) $(SRC_PATH)/keymaps/$$x "$(DESTDIR)$(datadir)/keymaps"; \
- 	done
- endif
- 	for d in $(TARGET_DIRS); do \
--- patches/patch-am	2009-08-30 20:39:50 +0300
+++ /dev/null	2009-08-30 20:23:05 +0300
@@ -1,13 +0,0 @@
-$NetBSD: patch-am,v 1.2 2006/01/01 13:48:45 xtraeme Exp $
-
---- audio/ossaudio.c.orig	2005-12-19 17:51:53.000000000 -0500
-+++ audio/ossaudio.c
-@@ -229,7 +229,7 @@ static int oss_open (int in, struct oss_
-         goto err;
-     }
- 
--    if (ioctl (fd, SNDCTL_DSP_NONBLOCK)) {
-+    if (ioctl (fd, SNDCTL_DSP_NONBLOCK, NULL)) {
-         oss_logerr2 (errno, typ, "Failed to set non-blocking mode\n");
-         goto err;
-     }
--- patches/patch-aw	2009-08-30 20:39:50 +0300
+++ /dev/null	2009-08-30 20:23:05 +0300
@@ -1,24 +0,0 @@
-$NetBSD: patch-aw,v 1.3 2009/01/22 07:27:28 jmmv Exp $
-
-Workaround for x86_64 target, patch from Hubert Feyrer.
-
---- dyngen.c.orig	2008-01-06 20:38:42.000000000 +0100
-+++ dyngen.c
-@@ -1738,6 +1738,7 @@ void gen_code(const char *name, host_ulo
-                 if(!sym_name)
-                     continue;
-                 if (*sym_name &&
-+                    !strstart(sym_name, "bswap64", NULL) && /* HF hack */
-                     !strstart(sym_name, "__op_param", NULL) &&
-                     !strstart(sym_name, "__op_jmp", NULL) &&
-                     !strstart(sym_name, "__op_gen_label", NULL)) {
-@@ -1762,6 +1763,9 @@ void gen_code(const char *name, host_ulo
- 				 */
- 				fprintf(outfile, "    extern char %s;\n",
- 					sym_name);
-+#elif defined(HOST_PPC)
-+                    if(strcmp("bswap32", sym_name))
-+                        fprintf(outfile, "extern char %s;\n", sym_name);
- #else
-                     fprintf(outfile, "extern char %s;\n", sym_name);
- #endif
--- patches/patch-ax	2009-08-30 20:39:50 +0300
+++ /dev/null	2009-08-30 20:23:05 +0300
@@ -1,24 +0,0 @@
-$NetBSD: patch-ax,v 1.3 2006/01/06 09:17:03 xtraeme Exp $
-
---- target-i386/op.c.orig	2006-01-06 05:10:30.000000000 +0100
-+++ target-i386/op.c
-@@ -2099,14 +2099,17 @@ void OPPROTO op_fdivr_STN_ST0(void)
- }
- 
- /* misc FPU operations */
-+
-+void fchs_dummy() {ST0 = floatx_chs(ST0);}
- void OPPROTO op_fchs_ST0(void)
- {
--    ST0 = floatx_chs(ST0);
-+    fchs_dummy();
- }
- 
-+void fabs_dummy() {ST0 = floatx_abs(ST0);}
- void OPPROTO op_fabs_ST0(void)
- {
--    ST0 = floatx_abs(ST0);
-+    fabs_dummy();
- }
- 
- void OPPROTO op_fxam_ST0(void)
--- patches/patch-ay	2009-08-30 20:39:50 +0300
+++ /dev/null	2009-08-30 20:23:05 +0300
@@ -1,92 +0,0 @@
-$NetBSD: patch-ay,v 1.9 2009/01/23 08:15:28 jmmv Exp $
-
---- block-raw-posix.c.orig	2008-01-06 20:38:42.000000000 +0100
-+++ block-raw-posix.c
-@@ -28,7 +28,9 @@
- #endif
- #include "block_int.h"
- #include <assert.h>
-+#ifdef _POSIX_ASYNCHRONOUS_IO
- #include <aio.h>
-+#endif
- 
- #ifdef CONFIG_COCOA
- #include <paths.h>
-@@ -230,6 +232,7 @@ label__raw_write__success:
-     return ret;
- }
- 
-+#ifdef _POSIX_ASYNCHRONOUS_IO
- /***********************************************************/
- /* Unix AIO using POSIX AIO */
- 
-@@ -455,6 +458,7 @@ static void raw_aio_cancel(BlockDriverAI
-         pacb = &acb->next;
-     }
- }
-+#endif
- 
- static void raw_close(BlockDriverState *bs)
- {
-@@ -545,6 +549,35 @@ static void raw_flush(BlockDriverState *
-     fsync(s->fd);
- }
- 
-+#ifndef _POSIX_ASYNCHRONOUS_IO
-+void qemu_aio_init(void)
-+{
-+}
-+
-+void qemu_aio_poll(void)
-+{
-+}
-+
-+void qemu_aio_flush(void)
-+{
-+}
-+
-+void qemu_aio_wait_start(void)
-+{
-+}
-+
-+void qemu_aio_wait(void)
-+{
-+#ifndef QEMU_IMG
-+    qemu_bh_poll();
-+#endif
-+}
-+
-+void qemu_aio_wait_end(void)
-+{
-+}
-+#endif
-+
- BlockDriver bdrv_raw = {
-     "raw",
-     sizeof(BDRVRawState),
-@@ -556,10 +589,12 @@ BlockDriver bdrv_raw = {
-     raw_create,
-     raw_flush,
- 
-+#ifdef _POSIX_ASYNCHRONOUS_IO
-     .bdrv_aio_read = raw_aio_read,
-     .bdrv_aio_write = raw_aio_write,
-     .bdrv_aio_cancel = raw_aio_cancel,
-     .aiocb_size = sizeof(RawAIOCB),
-+#endif
-     .protocol_name = "file",
-     .bdrv_pread = raw_pread,
-     .bdrv_pwrite = raw_pwrite,
-@@ -908,10 +943,12 @@ BlockDriver bdrv_host_device = {
-     NULL,
-     raw_flush,
- 
-+#ifdef _POSIX_ASYNCHRONOUS_IO
-     .bdrv_aio_read = raw_aio_read,
-     .bdrv_aio_write = raw_aio_write,
-     .bdrv_aio_cancel = raw_aio_cancel,
-     .aiocb_size = sizeof(RawAIOCB),
-+#endif
-     .bdrv_pread = raw_pread,
-     .bdrv_pwrite = raw_pwrite,
-     .bdrv_getlength = raw_getlength,
--- /dev/null	2009-08-30 20:23:05 +0300
+++ patches/patch-da	2009-08-30 20:36:33 +0300
@@ -0,0 +1,13 @@
+$NetBSD$
+
+--- audio/sdlaudio.c.orig	2009-08-30 08:33:14 +0300
++++ audio/sdlaudio.c	2009-08-30 08:41:26 +0300
+@@ -29,7 +29,7 @@
+ #ifndef _WIN32
+ #ifdef __sun__
+ #define _POSIX_PTHREAD_SEMANTICS 1
+-#elif defined(__OpenBSD__) || defined(__FreeBSD__)
++#elif defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__DragonFly__)
+ #include <pthread.h>
+ #endif
+ #include <signal.h>
--- /dev/null	2009-08-30 20:23:05 +0300
+++ patches/patch-db	2009-08-30 20:36:37 +0300
@@ -0,0 +1,32 @@
+$NetBSD$
+
+--- block-raw-posix.c.orig	2009-07-17 03:56:22 +0300
++++ block-raw-posix.c	2009-08-30 15:51:48 +0300
+@@ -63,6 +63,11 @@
+ #include <sys/dkio.h>
+ #endif
+ 
++#ifdef __DragonFly__
++#include <sys/ioctl.h>
++#include <sys/diskslice.h>
++#endif
++
+ //#define DEBUG_FLOPPY
+ 
+ //#define DEBUG_BLOCK
+@@ -766,6 +771,15 @@ static int64_t  raw_getlength(BlockDrive
+     if (!fstat(fd, &sb) && (S_IFCHR & sb.st_mode)) {
+ #ifdef DIOCGMEDIASIZE
+ 	if (ioctl(fd, DIOCGMEDIASIZE, (off_t *)&size))
++#elif defined(DIOCGPART)
++        {
++                struct partinfo pi;
++                if (ioctl(fd, DIOCGPART, &pi) == 0)
++                        size = pi.media_size;
++                else
++                        size = 0;
++        }
++        if (size == 0)
+ #endif
+ #ifdef CONFIG_COCOA
+         size = LONG_LONG_MAX;
--- /dev/null	2009-08-30 20:23:05 +0300
+++ patches/patch-dc	2009-08-30 20:36:43 +0300
@@ -0,0 +1,15 @@
+$NetBSD$
+
+--- block.c.orig	2009-07-17 03:56:22 +0300
++++ block.c	2009-08-30 15:53:21 +0300
+@@ -35,8 +35,10 @@
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <sys/ioctl.h>
++#ifndef __DragonFly__
+ #include <sys/disk.h>
+ #endif
++#endif
+ 
+ #define SECTOR_BITS 9
+ #define SECTOR_SIZE (1 << SECTOR_BITS)
--- /dev/null	2009-08-30 20:23:05 +0300
+++ patches/patch-dd	2009-08-30 19:38:22 +0300
@@ -0,0 +1,27 @@
+--- configure.orig	2009-07-17 03:56:22 +0300
++++ configure	2009-08-30 19:37:40 +0300
+@@ -228,6 +228,15 @@ if [ "$cpu" = "i386" -o "$cpu" = "x86_64
+     kqemu="yes"
+ fi
+ ;;
++DragonFly)
++bsd="yes"
++audio_drv_list="oss"
++audio_possible_drivers="oss sdl esd pa"
++if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
++    kqemu="yes"
++fi
++aio="no"
++;;
+ NetBSD)
+ bsd="yes"
+ audio_drv_list="oss"
+@@ -1102,7 +1111,7 @@ else
+   if test -z "$prefix" ; then
+       prefix="/usr/local"
+   fi
+-  mansuffix="/share/man"
++  mansuffix="/man"
+   datasuffix="/share/qemu"
+   docsuffix="/share/doc/qemu"
+   binsuffix="/bin"
--- /dev/null	2009-08-30 20:23:05 +0300
+++ patches/patch-de	2009-08-30 20:36:50 +0300
@@ -0,0 +1,13 @@
+$NetBSD$
+
+--- exec.c.orig	2009-07-17 03:56:22 +0300
++++ exec.c	2009-08-30 15:57:26 +0300
+@@ -454,7 +454,7 @@ static void code_gen_alloc(unsigned long
+             exit(1);
+         }
+     }
+-#elif defined(__FreeBSD__)
++#elif defined(__FreeBSD__) || defined(__DragonFly__)
+     {
+         int flags;
+         void *addr = NULL;
--- /dev/null	2009-08-30 20:23:05 +0300
+++ patches/patch-df	2009-08-30 20:36:54 +0300
@@ -0,0 +1,13 @@
+$NetBSD$
+
+--- net.c.orig	2009-08-30 08:33:13 +0300
++++ net.c	2009-08-30 15:58:08 +0300
+@@ -59,7 +59,7 @@
+ #include <sys/select.h>
+ #ifdef _BSD
+ #include <sys/stat.h>
+-#ifdef __FreeBSD__
++#if defined(__FreeBSD__) || defined(__DragonFly__)
+ #include <libutil.h>
+ #else
+ #include <util.h>
--- /dev/null	2009-08-30 20:23:05 +0300
+++ patches/patch-dg	2009-08-30 20:36:59 +0300
@@ -0,0 +1,22 @@
+$NetBSD$
+
+--- osdep.c.orig	2009-07-17 03:56:24 +0300
++++ osdep.c	2009-08-30 15:59:25 +0300
+@@ -90,7 +90,7 @@ static void *kqemu_vmalloc(size_t size)
+     void *ptr;
+ 
+ /* no need (?) for a dummy file on OpenBSD/FreeBSD */
+-#if defined(__OpenBSD__) || defined(__FreeBSD__)
++#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__DragonFly__)
+     int map_anon = MAP_ANON;
+ #else
+     int map_anon = 0;
+@@ -157,7 +157,7 @@ static void *kqemu_vmalloc(size_t size)
+     }
+     size = (size + 4095) & ~4095;
+     ftruncate(phys_ram_fd, phys_ram_size + size);
+-#endif /* !(__OpenBSD__ || __FreeBSD__) */
++#endif /* !(__OpenBSD__ || __FreeBSD__ || __DragonFly__) */
+     ptr = mmap(NULL,
+                size,
+                PROT_WRITE | PROT_READ, map_anon | MAP_SHARED,
--- /dev/null	2009-08-30 20:23:05 +0300
+++ patches/patch-dh	2009-08-30 20:37:04 +0300
@@ -0,0 +1,58 @@
+$NetBSD$
+
+--- qemu-char.c.orig	2009-07-17 03:56:24 +0300
++++ qemu-char.c	2009-08-30 16:00:34 +0300
+@@ -66,6 +66,10 @@
+ #include <libutil.h>
+ #include <dev/ppbus/ppi.h>
+ #include <dev/ppbus/ppbconf.h>
++#elif defined(__DragonFly__)
++#include <libutil.h>
++#include <dev/misc/ppi/ppi.h>
++#include <bus/ppbus/ppbconf.h>
+ #else
+ #include <util.h>
+ #endif
+@@ -798,7 +802,7 @@ void cfmakeraw (struct termios *termios_
+ #endif
+ 
+ #if defined(__linux__) || defined(__sun__) || defined(__FreeBSD__) \
+-    || defined(__NetBSD__) || defined(__OpenBSD__)
++    || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
+ 
+ typedef struct {
+     int fd;
+@@ -928,7 +932,7 @@ static CharDriverState *qemu_chr_open_pt
+     PtyCharDriver *s;
+     struct termios tty;
+     int slave_fd, len;
+-#if defined(__OpenBSD__)
++#if defined(__OpenBSD__) || defined(__DragonFly__)
+     char pty_name[PATH_MAX];
+ #define q_ptsname(x) pty_name
+ #else
+@@ -1274,7 +1278,7 @@ static CharDriverState *qemu_chr_open_pp
+ }
+ #endif /* __linux__ */
+ 
+-#if defined(__FreeBSD__)
++#if defined(__FreeBSD__) || defined(__DragonFly__)
+ static int pp_ioctl(CharDriverState *chr, int cmd, void *arg)
+ {
+     int fd = (int)chr->opaque;
+@@ -2162,13 +2166,13 @@ CharDriverState *qemu_chr_open(const cha
+     if (strstart(filename, "/dev/parport", NULL)) {
+         chr = qemu_chr_open_pp(filename);
+     } else
+-#elif defined(__FreeBSD__)
++#elif defined(__FreeBSD__) || defined(__DragonFly__)
+     if (strstart(filename, "/dev/ppi", NULL)) {
+         chr = qemu_chr_open_pp(filename);
+     } else
+ #endif
+ #if defined(__linux__) || defined(__sun__) || defined(__FreeBSD__) \
+-    || defined(__NetBSD__) || defined(__OpenBSD__)
++    || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
+     if (strstart(filename, "/dev/", NULL)) {
+         chr = qemu_chr_open_tty(filename);
+     } else
--- /dev/null	2009-08-30 20:23:05 +0300
+++ patches/patch-di	2009-08-30 20:37:09 +0300
@@ -0,0 +1,13 @@
+$NetBSD$
+
+--- savevm.c.orig	2009-08-30 08:33:14 +0300
++++ savevm.c	2009-08-30 16:01:20 +0300
+@@ -63,7 +63,7 @@
+ #include <sys/select.h>
+ #ifdef _BSD
+ #include <sys/stat.h>
+-#ifdef __FreeBSD__
++#if defined(__FreeBSD__) || defined(__DragonFly__)
+ #include <libutil.h>
+ #else
+ #include <util.h>
--- /dev/null	2009-08-30 20:23:05 +0300
+++ patches/patch-dj	2009-08-30 20:37:14 +0300
@@ -0,0 +1,43 @@
+$NetBSD$
+
+--- usb-bsd.c.orig	2009-07-17 03:56:26 +0300
++++ usb-bsd.c	2009-08-30 16:01:57 +0300
+@@ -34,7 +34,11 @@
+ #undef USB_SPEED_LOW
+ 
+ #include <sys/ioctl.h>
++#ifndef __DragonFly__
+ #include <dev/usb/usb.h>
++#else
++#include <bus/usb/usb.h>
++#endif
+ #include <signal.h>
+ 
+ /* This value has maximum potential at 16.
+@@ -68,7 +72,7 @@ static int ensure_ep_open(USBHostDevice 
+     ep = UE_GET_ADDR(ep);
+ 
+     if (dev->ep_fd[ep] < 0) {
+-#ifdef __FreeBSD__
++#if defined(__FreeBSD__) || defined(__DragonFly__)
+         snprintf(buf, sizeof(buf) - 1, "%s.%d", dev->devpath, ep);
+ #else
+         snprintf(buf, sizeof(buf) - 1, "%s.%02d", dev->devpath, ep);
+@@ -321,7 +325,7 @@ USBDevice *usb_host_device_open(const ch
+         return NULL;
+     }
+ 
+-#ifdef __FreeBSD__
++#if defined(__FreeBSD__) || defined(__DragonFly__)
+     snprintf(ctlpath, PATH_MAX, "/dev/%s", bus_info.udi_devnames[0]);
+ #else
+     snprintf(ctlpath, PATH_MAX, "/dev/%s.00", bus_info.udi_devnames[0]);
+@@ -411,7 +415,7 @@ static int usb_host_scan(void *opaque, U
+             if (strncmp(bus_info.udi_devnames[0], "ugen", 4) != 0)
+                 continue;
+ 
+-#ifdef __FreeBSD__
++#if defined(__FreeBSD__) || defined(__DragonFly__)
+             snprintf(devbuf, sizeof(devbuf) - 1, "/dev/%s", bus_info.udi_devnames[0]);
+ #else
+             snprintf(devbuf, sizeof(devbuf) - 1, "/dev/%s.00", bus_info.udi_devnames[0]);
--- /dev/null	2009-08-30 20:23:05 +0300
+++ patches/patch-dk	2009-08-30 20:37:19 +0300
@@ -0,0 +1,33 @@
+$NetBSD$
+
+--- vl.c.orig	2009-08-30 08:33:14 +0300
++++ vl.c	2009-08-30 16:02:53 +0300
+@@ -74,7 +74,7 @@
+ #include <sys/select.h>
+ #ifdef _BSD
+ #include <sys/stat.h>
+-#ifdef __FreeBSD__
++#if defined(__FreeBSD__) || defined(__DragonFly__)
+ #include <libutil.h>
+ #else
+ #include <util.h>
+@@ -755,7 +755,8 @@ static int use_rt_clock;
+ static void init_get_clock(void)
+ {
+     use_rt_clock = 0;
+-#if defined(__linux__) || (defined(__FreeBSD__) && __FreeBSD_version >= 500000)
++#if defined(__linux__) || (defined(__FreeBSD__) && __FreeBSD_version >= 500000) \
++    || defined(__DragonFly__)
+     {
+         struct timespec ts;
+         if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0) {
+@@ -767,7 +768,8 @@ static void init_get_clock(void)
+ 
+ static int64_t get_clock(void)
+ {
+-#if defined(__linux__) || (defined(__FreeBSD__) && __FreeBSD_version >= 500000)
++#if defined(__linux__) || (defined(__FreeBSD__) && __FreeBSD_version >= 500000) \
++	|| defined(__DragonFly__)
+     if (use_rt_clock) {
+         struct timespec ts;
+         clock_gettime(CLOCK_MONOTONIC, &ts);
