Index: Makefile =================================================================== RCS file: /home/pcvs/ports/emulators/qemu-devel/Makefile,v retrieving revision 1.102 diff -u -p -r1.102 Makefile --- Makefile 16 Aug 2009 18:04:36 -0000 1.102 +++ Makefile 4 Sep 2009 16:08:14 -0000 @@ -6,27 +6,22 @@ # PORTNAME= qemu -PORTVERSION= 0.9.1s.20080620 -PORTREVISION= 5 +PORTVERSION= 0.11.0r2 CATEGORIES= emulators -MASTER_SITES= http://bellard.org/qemu/:release \ - http://qemu-forum.ipi.fi/qemu-snapshots/:snapshot \ - http://people.fruitsalad.org/nox/qemu/:snapshot \ - ${MASTER_SITE_LOCAL}:snapshot +MASTER_SITES= ${MASTER_SITE_SAVANNAH}:release \ + http://bellard.org/qemu/:release +MASTER_SITE_SUBDIR= qemu PKGNAMESUFFIX= -devel -DISTNAME= ${PORTNAME}-snapshot-2008-06-20_19 -DISTFILES= ${DISTNAME}${EXTRACT_SUFX}:snapshot +DISTNAME= ${PORTNAME}-0.11.0-rc2 DIST_SUBDIR= qemu -EXTRACT_ONLY= ${DISTNAME}${EXTRACT_SUFX} MAINTAINER= nox@FreeBSD.org COMMENT= QEMU CPU Emulator - development snapshot HAS_CONFIGURE= yes -USE_BZIP2= yes USE_GMAKE= yes USE_PERL5= yes -PATCH_STRIP= -lp1 +PATCH_STRIP= -p1 MAKE_ENV+= BSD_MAKE="${MAKE}" LDFLAGS="${LDFLAGS}" MAN1= qemu.1 qemu-img.1 ONLY_FOR_ARCHS= amd64 i386 @@ -40,16 +35,18 @@ OPTIONS= KQEMU "Build with (alpha!) acce GNUTLS "gnutls dependency (vnc encryption)" On \ PCAP "pcap dependency (networking with bpf)" On \ CDROM_DMA "IDE CDROM DMA" On \ - ALL_TARGETS "Also build dyngen targets (requires gcc34)" On + ADD_AUDIO "Emulate more audio hardware (experimental!)" Off \ + ALL_TARGETS "Also build non-x86 targets" On .include +BUILD_DEPENDS+= ${LOCALBASE}/bin/as:${PORTSDIR}/devel/binutils + .if defined(WITHOUT_ALL_TARGETS) -CONFIGURE_ARGS+= --disable-gcc-check --target-list=i386-softmmu,sparc-softmmu,x86_64-softmmu,mips-softmmu,mipsel-softmmu,mips64-softmmu,mips64el-softmmu,arm-softmmu,m68k-softmmu,cris-softmmu -PLIST_SUB+= DYNGEN="@comment " +CONFIGURE_ARGS+= --target-list=i386-softmmu,x86_64-softmmu +PLIST_SUB+= ALLTARGETS="@comment " .else -USE_GCC= 3.4 -PLIST_SUB+= DYNGEN="" +PLIST_SUB+= ALLTARGETS="" .endif WITHOUT_CPU_CFLAGS=yes #to avoid problems with register allocation @@ -72,6 +69,13 @@ LIB_DEPENDS+= gnutls:${PORTSDIR}/securit CONFIGURE_ARGS+= --enable-pcap .endif +.if defined(WITH_ADD_AUDIO) +CONFIGURE_ARGS+= --audio-card-list=ac97,es1370,sb16,cs4231a,adlib,gus +.endif + +# XXX +CONFIGURE_ARGS+= --disable-bsd-user + .if defined(WITH_SAMBA) RUN_DEPENDS+= ${LOCALBASE}/sbin/smbd:${PORTSDIR}/net/samba3 .endif Index: distinfo =================================================================== RCS file: /home/pcvs/ports/emulators/qemu-devel/distinfo,v retrieving revision 1.50 diff -u -p -r1.50 distinfo --- distinfo 8 Jul 2008 18:42:08 -0000 1.50 +++ distinfo 4 Sep 2009 16:11:43 -0000 @@ -1,3 +1,3 @@ -MD5 (qemu/qemu-snapshot-2008-06-20_19.tar.bz2) = 7201553586b59e400664b2f9ae0b17a1 -SHA256 (qemu/qemu-snapshot-2008-06-20_19.tar.bz2) = e9a3654976b923c471f572961f244f2758d15a367cfc1b32054aa2cd4391cace -SIZE (qemu/qemu-snapshot-2008-06-20_19.tar.bz2) = 2629290 +MD5 (qemu/qemu-0.11.0-rc2.tar.gz) = 2a8f86e67d76aa4bd7db2602bda63bc6 +SHA256 (qemu/qemu-0.11.0-rc2.tar.gz) = e42e2247dc6249484b5132f6e7305ade0fcfbbf8f12c518eff1a5a16a3f0eafe +SIZE (qemu/qemu-0.11.0-rc2.tar.gz) = 3923290 Index: pkg-message =================================================================== RCS file: /home/pcvs/ports/emulators/qemu-devel/pkg-message,v retrieving revision 1.30 diff -u -p -r1.30 pkg-message --- pkg-message 24 Mar 2009 19:39:02 -0000 1.30 +++ pkg-message 4 Sep 2009 16:07:28 -0000 @@ -69,12 +69,6 @@ with qemu's now by default enabled cdrom CDROM_DMA disabled to disable it. - if you build qemu wihout SDL and then get crashes running it try passing it -nographic. This should probably be default in that case... -- slirp (-net user) seems to be unstable on amd64 hosts, if this affects -you please use tuntap for now. Scott Robbins posted a tap howto for --current here: - http://forums.bsdnexus.com/viewtopic.php?id=1563 -and one for 6 and 5(?) is here: - http://acidos.bandwidth-junkies.net/index.php?Sect=qemu - perhaps it should be noted that if you want to use qemu with -m 512 or larger on 6.x/i386 hosts you need to increase the kern.maxdsiz tunable in loader.conf(5) since the default is 512 MB, and qemu needs memory for @@ -84,7 +78,7 @@ isn't affected by kern.maxdsiz anymore.) kernel (like with any kld installed outside of base), i.e. rebuild its port whenever you update the kernel - especially if you are switching branches or are following a -stable or even -current branch! -- you can enable autoloading of kqemu (and aio) at boot by adding a line +- you can enable autoloading of kqemu at boot by adding a line kqemu_enable=YES to /etc/rc.conf - kqemu liked to panic the host on amd64 SMP until before 1.3.0.p11_6 @@ -130,17 +124,20 @@ been experimental and you should use raw raw is also usually faster.) You should be able to migrate existing images to raw using qemu-img(1)'s convert function; raw doesn't support advanced features like snapshots tho. +[an important qcow2 bugfix has been committed in the meantime so this +_might_ be less of an issue now.] - (also not FreeBSD-specific:) It is recommended to pass raw images using the new -drive syntax, specifying format=raw explicitly in order to avoid malicious guests being able to exploit the format autodetection thats otherwise getting used. (Not that you should run malicious guests anyway, but this eleminates at least a known attack vector.) -- qemu now uses aio at least for ide dma, so if you get `Invalid system call' -crashes that is because aio is not (kld)loaded. +- This version has improved physical cdrom support, but still there still +is at least one known problem: you need to have the guest eject the disc +if you want to change it/take it out, or otherwise the guest may continue +using state (like size) of the old disc. (You can also do like +`change ide1-cd0 /dev/acd0' in the monitor after taking out the disc +if a guest cannot eject it itself.) - The default configuration location (qemu-ifup script etc.) has been changed from /etc to PREFIX/etc (usually /usr/local/etc). Move your files accordingly. -- *** This port (qemu-devel) is currently at an older version -(0.9.1s.20080620) than the main port (qemu), so probably should only be -used if there are specific problems with the latter. *** ==== Index: pkg-plist =================================================================== RCS file: /home/pcvs/ports/emulators/qemu-devel/pkg-plist,v retrieving revision 1.25 diff -u -p -r1.25 pkg-plist --- pkg-plist 8 Jul 2008 18:42:08 -0000 1.25 +++ pkg-plist 4 Sep 2009 16:07:28 -0000 @@ -1,18 +1,20 @@ bin/qemu bin/qemu-img -bin/qemu-system-arm -bin/qemu-system-cris -bin/qemu-system-m68k -bin/qemu-system-mips -bin/qemu-system-mips64 -bin/qemu-system-mips64el -bin/qemu-system-mipsel -%%DYNGEN%%bin/qemu-system-ppc -%%DYNGEN%%bin/qemu-system-ppc64 -%%DYNGEN%%bin/qemu-system-ppcemb -%%DYNGEN%%bin/qemu-system-sh4 -%%DYNGEN%%bin/qemu-system-sh4eb -bin/qemu-system-sparc +%%ALLTARGETS%%bin/qemu-system-arm +%%ALLTARGETS%%bin/qemu-system-cris +%%ALLTARGETS%%bin/qemu-system-m68k +%%ALLTARGETS%%bin/qemu-system-microblaze +%%ALLTARGETS%%bin/qemu-system-mips +%%ALLTARGETS%%bin/qemu-system-mips64 +%%ALLTARGETS%%bin/qemu-system-mips64el +%%ALLTARGETS%%bin/qemu-system-mipsel +%%ALLTARGETS%%bin/qemu-system-ppc +%%ALLTARGETS%%bin/qemu-system-ppc64 +%%ALLTARGETS%%bin/qemu-system-ppcemb +%%ALLTARGETS%%bin/qemu-system-sh4 +%%ALLTARGETS%%bin/qemu-system-sh4eb +%%ALLTARGETS%%bin/qemu-system-sparc +%%ALLTARGETS%%bin/qemu-system-sparc64 bin/qemu-system-x86_64 @unexec if cmp -s %D/etc/qemu-ifup.sample %D/etc/qemu-ifup; then rm -f %D/etc/qemu-ifup; fi etc/qemu-ifup.sample @@ -27,12 +29,17 @@ etc/qemu-ifdown.sample %%DATADIR%%/vgabios.bin %%DATADIR%%/vgabios-cirrus.bin %%DATADIR%%/ppc_rom.bin +%%DATADIR%%/openbios-ppc %%DATADIR%%/openbios-sparc32 %%DATADIR%%/openbios-sparc64 %%DATADIR%%/video.x +%%DATADIR%%/pxe-e1000.bin %%DATADIR%%/pxe-ne2k_pci.bin %%DATADIR%%/pxe-rtl8139.bin %%DATADIR%%/pxe-pcnet.bin +%%DATADIR%%/multiboot.bin +%%DATADIR%%/petalogix-s3adsp1800.dtb +%%DATADIR%%/bamboo.dtb %%DATADIR%%/keymaps/ar %%DATADIR%%/keymaps/common %%DATADIR%%/keymaps/da Index: files/patch-90_security =================================================================== RCS file: /home/pcvs/ports/emulators/qemu-devel/files/patch-90_security,v retrieving revision 1.5 diff -u -p -r1.5 patch-90_security --- files/patch-90_security 8 Jul 2008 18:42:09 -0000 1.5 +++ files/patch-90_security 4 Sep 2009 16:07:28 -0000 @@ -80,100 +80,6 @@ Index: qemu-0.8.2/hw/sb16.c } return dma_pos; -Index: qemu-0.8.2/slirp/slirp.c -=================================================================== ---- qemu-0.8.2.orig/slirp/slirp.c 2006-07-22 20:23:34.000000000 +0300 -+++ qemu-0.8.2/slirp/slirp.c 2007-04-20 06:05:59.000000000 +0300 -@@ -611,6 +611,10 @@ void slirp_input(const uint8_t *pkt, int - if (!m) - return; - /* Note: we add to align the IP header */ -+ /* taviso: large values in ne2k TCNT register may exceed msize on transmit */ -+ if (M_FREEROOM(m) < pkt_len + 2) { -+ m_inc(m, pkt_len + 2); -+ } - m->m_len = pkt_len + 2; - memcpy(m->m_data + 2, pkt, pkt_len); - -Index: qemu-0.8.2/target-i386/translate.c -=================================================================== ---- qemu-0.8.2.orig/target-i386/translate.c 2006-07-22 20:23:34.000000000 +0300 -+++ qemu-0.8.2/target-i386/translate.c 2007-04-20 06:05:59.000000000 +0300 -@@ -5292,6 +5297,7 @@ static target_ulong disas_insn(DisasCont - gen_jmp_im(pc_start - s->cs_base); - gen_op_into(s->pc - pc_start); - break; -+#ifdef WANT_ICEBP - case 0xf1: /* icebp (undocumented, exits to external debugger) */ - #if 1 - gen_debug(s, pc_start - s->cs_base); -@@ -5301,6 +5307,7 @@ static target_ulong disas_insn(DisasCont - cpu_set_log(CPU_LOG_INT | CPU_LOG_TB_IN_ASM); - #endif - break; -+#endif /* icebp */ - case 0xfa: /* cli */ - if (!s->vm86) { - if (s->cpl <= s->iopl) { -Index: qemu-0.8.2/vl.c -=================================================================== ---- qemu-0.8.2.orig/vl.c 2007-04-20 06:05:59.000000000 +0300 -+++ qemu-0.8.2/vl.c 2007-04-20 06:05:59.000000000 +0300 -@@ -3139,8 +3139,8 @@ typedef struct NetSocketState { - VLANClientState *vc; - int fd; - int state; /* 0 = getting length, 1 = getting data */ -- int index; -- int packet_len; -+ unsigned int index; -+ unsigned int packet_len; - uint8_t buf[4096]; - struct sockaddr_in dgram_dst; /* contains inet host and port destination iff connectionless (SOCK_DGRAM) */ - } NetSocketState; -@@ -3171,7 +3171,8 @@ static void net_socket_receive_dgram(voi - static void net_socket_send(void *opaque) - { - NetSocketState *s = opaque; -- int l, size, err; -+ int size, err; -+ unsigned l; - uint8_t buf1[4096]; - const uint8_t *buf; - -@@ -3210,7 +3211,15 @@ static void net_socket_send(void *opaque - l = s->packet_len - s->index; - if (l > size) - l = size; -- memcpy(s->buf + s->index, buf, l); -+ if (s->index + l <= sizeof(s->buf)) { -+ memcpy(s->buf + s->index, buf, l); -+ } else { -+ fprintf(stderr, "serious error: oversized packet received," -+ "connection terminated.\n"); -+ s->state = 0; -+ goto eoc; -+ } -+ - s->index += l; - buf += l; - size -= l; -Index: qemu/block.c -@@ -539,8 +539,15 @@ - return -ENOMEDIUM; - if (bs->read_only) - return -EACCES; -+ if (sector_num < 0) -+ return -EACCES; - if (sector_num == 0 && bs->boot_sector_enabled && nb_sectors > 0) { - memcpy(bs->boot_sector_data, buf, 512); -+ } -+ { -+ unsigned int ns = sector_num * 512; -+ if (ns < 0) -+ return -EACCES; - } - if (drv->bdrv_pwrite) { - int ret, len; Index: qemu/hw/i8259.c @@ -302,7 +302,8 @@ s->init4 = val & 1; Index: files/patch-CVE-2008-0928 =================================================================== RCS file: /home/pcvs/ports/emulators/qemu-devel/files/patch-CVE-2008-0928,v retrieving revision 1.2 diff -u -p -r1.2 patch-CVE-2008-0928 --- files/patch-CVE-2008-0928 4 Dec 2008 22:36:46 -0000 1.2 +++ files/patch-CVE-2008-0928 4 Sep 2009 16:07:28 -0000 @@ -1,260 +0,0 @@ -Index: qemu/block-qcow.c -=================================================================== -RCS file: /sources/qemu/qemu/block-qcow.c,v -retrieving revision 1.15 -retrieving revision 1.16 -diff -u -p -u -p -r1.15 -r1.16 ---- block-qcow.c 11 Nov 2007 02:51:16 -0000 1.15 -+++ block-qcow.c 11 Mar 2008 17:17:58 -0000 1.16 -@@ -95,7 +95,7 @@ static int qcow_open(BlockDriverState *b - int len, i, shift, ret; - QCowHeader header; - -- ret = bdrv_file_open(&s->hd, filename, flags); -+ ret = bdrv_file_open(&s->hd, filename, flags | BDRV_O_AUTOGROW); - if (ret < 0) - return ret; - if (bdrv_pread(s->hd, 0, &header, sizeof(header)) != sizeof(header)) -Index: qemu/block-qcow2.c -=================================================================== -RCS file: /sources/qemu/qemu/block-qcow2.c,v -retrieving revision 1.10 -retrieving revision 1.11 -diff -u -p -u -p -r1.10 -r1.11 ---- block-qcow2.c 11 Nov 2007 02:51:16 -0000 1.10 -+++ block-qcow2.c 11 Mar 2008 17:17:58 -0000 1.11 -@@ -191,7 +191,7 @@ static int qcow_open(BlockDriverState *b - int len, i, shift, ret; - QCowHeader header; - -- ret = bdrv_file_open(&s->hd, filename, flags); -+ ret = bdrv_file_open(&s->hd, filename, flags | BDRV_O_AUTOGROW); - if (ret < 0) - return ret; - if (bdrv_pread(s->hd, 0, &header, sizeof(header)) != sizeof(header)) -Index: qemu/block-vmdk.c -=================================================================== -RCS file: /sources/qemu/qemu/block-vmdk.c,v -retrieving revision 1.19 -retrieving revision 1.20 -diff -u -p -u -p -r1.19 -r1.20 ---- block-vmdk.c 14 Jan 2008 03:48:37 -0000 1.19 -+++ block-vmdk.c 11 Mar 2008 17:17:58 -0000 1.20 -@@ -378,7 +378,7 @@ static int vmdk_open(BlockDriverState *b - flags = BDRV_O_RDONLY; - fprintf(stderr, "(VMDK) image open: flags=0x%x filename=%s\n", flags, bs->filename); - -- ret = bdrv_file_open(&s->hd, filename, flags); -+ ret = bdrv_file_open(&s->hd, filename, flags | BDRV_O_AUTOGROW); - if (ret < 0) - return ret; - if (bdrv_pread(s->hd, 0, &magic, sizeof(magic)) != sizeof(magic)) -Index: qemu/block.c -@@ -24,6 +24,9 @@ - #include "qemu-common.h" - #ifndef QEMU_IMG - #include "console.h" -+extern int vm_running; -+#else -+int vm_running = 0; - #endif - #include "block_int.h" - -@@ -124,6 +128,75 @@ - } - } - -+static int bdrv_rd_badreq_sectors(BlockDriverState *bs, -+ int64_t sector_num, int nb_sectors) -+{ -+ if (!vm_running) -+ return 0; -+ -+ return -+ nb_sectors < 0 || -+ sector_num < 0 || -+ nb_sectors > bs->total_sectors || -+ sector_num > bs->total_sectors - nb_sectors; -+} -+ -+static int bdrv_rd_badreq_bytes(BlockDriverState *bs, -+ int64_t offset, int count) -+{ -+ int64_t size = bs->total_sectors << SECTOR_BITS; -+ -+ if (!vm_running) -+ return 0; -+ -+ return -+ count < 0 || -+ size < 0 || -+ count > size || -+ offset > size - count; -+} -+ -+static int bdrv_wr_badreq_sectors(BlockDriverState *bs, -+ int64_t sector_num, int nb_sectors) -+{ -+ -+ if (!vm_running) -+ return 0; -+ -+ if (sector_num < 0 || -+ nb_sectors < 0) -+ return 1; -+ -+ if (sector_num > bs->total_sectors - nb_sectors) { -+ if (bs->autogrow) -+ bs->total_sectors = sector_num + nb_sectors; -+ else -+ return 1; -+ } -+ return 0; -+} -+ -+static int bdrv_wr_badreq_bytes(BlockDriverState *bs, -+ int64_t offset, int count) -+{ -+ int64_t size = bs->total_sectors << SECTOR_BITS; -+ -+ if (!vm_running) -+ return 0; -+ -+ if (count < 0 || -+ offset < 0) -+ return 1; -+ -+ if (offset > size - count) { -+ if (bs->autogrow) -+ bs->total_sectors = (offset + count + SECTOR_SIZE - 1) >> SECTOR_BITS; -+ else -+ return 1; -+ } -+ return 0; -+} -+ - - static void bdrv_register(BlockDriver *bdrv) - { -@@ -335,6 +389,10 @@ int bdrv_open2(BlockDriverState *bs, con - bs->read_only = 0; - bs->is_temporary = 0; - bs->encrypted = 0; -+ bs->autogrow = 0; -+ -+ if (flags & BDRV_O_AUTOGROW) -+ bs->autogrow = 1; - - if (flags & BDRV_O_SNAPSHOT) { - BlockDriverState *bs1; -@@ -379,6 +437,7 @@ int bdrv_open2(BlockDriverState *bs, con - } - bs->drv = drv; - bs->opaque = qemu_mallocz(drv->instance_size); -+ bs->total_sectors = 0; /* driver will set if it does not do getlength */ - if (bs->opaque == NULL && drv->instance_size > 0) - return -1; - /* Note: for compatibility, we open disk image files as RDWR, and -@@ -444,6 +503,7 @@ void bdrv_close(BlockDriverState *bs) - bs->drv = NULL; - - /* call the change callback */ -+ bs->total_sectors = 0; - bs->media_changed = 1; - if (bs->change_cb) - bs->change_cb(bs->change_opaque); -@@ -509,6 +569,8 @@ int bdrv_read(BlockDriverState *bs, int6 - if (!drv) - return -ENOMEDIUM; - -+ if (bdrv_rd_badreq_sectors(bs, sector_num, nb_sectors)) -+ return -EDOM; - if (sector_num == 0 && bs->boot_sector_enabled && nb_sectors > 0) { - memcpy(buf, bs->boot_sector_data, 512); - sector_num++; -@@ -549,6 +611,8 @@ int bdrv_write(BlockDriverState *bs, int - return -ENOMEDIUM; - if (bs->read_only) - return -EACCES; -+ if (bdrv_wr_badreq_sectors(bs, sector_num, nb_sectors)) -+ return -EDOM; - if (sector_num == 0 && bs->boot_sector_enabled && nb_sectors > 0) { - memcpy(bs->boot_sector_data, buf, 512); - } -@@ -674,6 +738,8 @@ int bdrv_pread(BlockDriverState *bs, int - return -ENOMEDIUM; - if (!drv->bdrv_pread) - return bdrv_pread_em(bs, offset, buf1, count1); -+ if (bdrv_rd_badreq_bytes(bs, offset, count1)) -+ return -EDOM; - return drv->bdrv_pread(bs, offset, buf1, count1); - } - -@@ -689,6 +755,8 @@ int bdrv_pwrite(BlockDriverState *bs, in - return -ENOMEDIUM; - if (!drv->bdrv_pwrite) - return bdrv_pwrite_em(bs, offset, buf1, count1); -+ if (bdrv_wr_badreq_bytes(bs, offset, count1)) -+ return -EDOM; - return drv->bdrv_pwrite(bs, offset, buf1, count1); - } - -@@ -955,6 +1023,8 @@ int bdrv_write_compressed(BlockDriverSta - return -ENOMEDIUM; - if (!drv->bdrv_write_compressed) - return -ENOTSUP; -+ if (bdrv_wr_badreq_sectors(bs, sector_num, nb_sectors)) -+ return -EDOM; - return drv->bdrv_write_compressed(bs, sector_num, buf, nb_sectors); - } - -@@ -1101,6 +1171,8 @@ BlockDriverAIOCB *bdrv_aio_read(BlockDri - - if (!drv) - return NULL; -+ if (bdrv_rd_badreq_sectors(bs, sector_num, nb_sectors)) -+ return NULL; - - /* XXX: we assume that nb_sectors == 0 is suppored by the async read */ - if (sector_num == 0 && bs->boot_sector_enabled && nb_sectors > 0) { -@@ -1132,6 +1204,8 @@ BlockDriverAIOCB *bdrv_aio_write(BlockDr - return NULL; - if (bs->read_only) - return NULL; -+ if (bdrv_wr_badreq_sectors(bs, sector_num, nb_sectors)) -+ return NULL; - if (sector_num == 0 && bs->boot_sector_enabled && nb_sectors > 0) { - memcpy(bs->boot_sector_data, buf, 512); - } -Index: qemu/block.h -=================================================================== -RCS file: /sources/qemu/qemu/block.h,v -retrieving revision 1.6 -retrieving revision 1.7 -diff -u -p -u -p -r1.6 -r1.7 ---- block.h 24 Dec 2007 16:10:43 -0000 1.6 -+++ block.h 11 Mar 2008 17:17:59 -0000 1.7 -@@ -45,6 +45,7 @@ typedef struct QEMUSnapshotInfo { - it (default for - bdrv_file_open()) */ - #define BDRV_O_DIRECT 0x0020 -+#define BDRV_O_AUTOGROW 0x0040 /* Allow backing file to extend when writing past end of file */ - - #ifndef QEMU_IMG - void bdrv_info(void); -Index: qemu/block_int.h -=================================================================== -RCS file: /sources/qemu/qemu/block_int.h,v -retrieving revision 1.16 -retrieving revision 1.17 -diff -u -p -u -p -r1.16 -r1.17 ---- block_int.h 24 Dec 2007 16:10:43 -0000 1.16 -+++ block_int.h 11 Mar 2008 17:17:59 -0000 1.17 -@@ -97,6 +97,7 @@ struct BlockDriverState { - int locked; /* if true, the media cannot temporarily be ejected */ - int encrypted; /* if true, the media is encrypted */ - int sg; /* if true, the device is a /dev/sg* */ -+ int autogrow; /* if true, the backing store can auto-extend to allocate new extents */ - /* event callback when inserting/removing */ - void (*change_cb)(void *opaque); - void *change_opaque; Index: files/patch-CVE-2008-4539 =================================================================== RCS file: /home/pcvs/ports/emulators/qemu-devel/files/patch-CVE-2008-4539,v retrieving revision 1.1 diff -u -p -r1.1 patch-CVE-2008-4539 --- files/patch-CVE-2008-4539 2 Nov 2008 22:59:10 -0000 1.1 +++ files/patch-CVE-2008-4539 4 Sep 2009 16:07:28 -0000 @@ -1,27 +0,0 @@ -Index: qemu/hw/cirrus_vga.c -=================================================================== ---- trunk/hw/cirrus_vga.c 2008-11-01 00:53:30 UTC (rev 5586) -+++ trunk/hw/cirrus_vga.c 2008-11-01 00:53:39 UTC (rev 5587) -@@ -785,15 +785,14 @@ - - static int cirrus_bitblt_videotovideo_copy(CirrusVGAState * s) - { -+ if (BLTUNSAFE(s)) -+ return 0; -+ - if (s->ds->dpy_copy) { - cirrus_do_copy(s, s->cirrus_blt_dstaddr - s->start_addr, - s->cirrus_blt_srcaddr - s->start_addr, - s->cirrus_blt_width, s->cirrus_blt_height); - } else { -- -- if (BLTUNSAFE(s)) -- return 0; -- - (*s->cirrus_rop) (s, s->vram_ptr + - (s->cirrus_blt_dstaddr & s->cirrus_addr_mask), - s->vram_ptr + - - - - Index: files/patch-Makefile =================================================================== RCS file: /home/pcvs/ports/emulators/qemu-devel/files/patch-Makefile,v retrieving revision 1.6 diff -u -p -r1.6 patch-Makefile --- files/patch-Makefile 8 Jul 2008 18:42:09 -0000 1.6 +++ files/patch-Makefile 4 Sep 2009 16:07:28 -0000 @@ -1,5 +1,5 @@ Index: qemu/Makefile -@@ -17,7 +17,11 @@ +@@ -25,7 +25,11 @@ LDFLAGS += -static endif ifdef BUILD_DOCS @@ -11,19 +11,19 @@ Index: qemu/Makefile else DOCS= endif -@@ -203,13 +211,13 @@ - common de-ch es fo fr-ca hu ja mk nl-be pt sl tr +@@ -260,13 +264,13 @@ + endif install-doc: $(DOCS) +ifndef NOPORTDOCS - mkdir -p "$(DESTDIR)$(docdir)" - $(INSTALL) -m 644 qemu-doc.html qemu-tech.html "$(DESTDIR)$(docdir)" + $(INSTALL_DIR) "$(DESTDIR)$(docdir)" + $(INSTALL_DATA) qemu-doc.html qemu-tech.html "$(DESTDIR)$(docdir)" +endif ifndef CONFIG_WIN32 - mkdir -p "$(DESTDIR)$(mandir)/man1" - $(INSTALL) qemu.1 qemu-img.1 "$(DESTDIR)$(mandir)/man1" -- mkdir -p "$(DESTDIR)$(mandir)/man8" -- $(INSTALL) qemu-nbd.8 "$(DESTDIR)$(mandir)/man8" + $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1" + $(INSTALL_DATA) qemu.1 qemu-img.1 "$(DESTDIR)$(mandir)/man1" +- $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man8" +- $(INSTALL_DATA) qemu-nbd.8 "$(DESTDIR)$(mandir)/man8" endif install: all $(if $(BUILD_DOCS),install-doc) Index: files/patch-aa =================================================================== RCS file: /home/pcvs/ports/emulators/qemu-devel/files/patch-aa,v retrieving revision 1.5 diff -u -p -r1.5 patch-aa --- files/patch-aa 10 Mar 2007 17:03:05 -0000 1.5 +++ files/patch-aa 4 Sep 2009 16:07:28 -0000 @@ -1,12 +0,0 @@ -diff -urd --exclude=CVS ../cvs/qemu/Makefile qemu-0.5.5/Makefile ---- ../cvs/qemu/Makefile Mon May 17 21:06:42 2004 -+++ qemu-0.5.5/Makefile Sun May 30 05:26:19 2004 -@@ -70,7 +70,7 @@ - - # documentation - %.html: %.texi -- texi2html -monolithic -number $< -+ -texi2html -monolithic -number $< - - qemu.1: qemu-doc.texi - ./texi2pod.pl $< qemu.pod Index: files/patch-ac =================================================================== RCS file: /home/pcvs/ports/emulators/qemu-devel/files/patch-ac,v retrieving revision 1.4 diff -u -p -r1.4 patch-ac --- files/patch-ac 9 Aug 2007 20:03:30 -0000 1.4 +++ files/patch-ac 4 Sep 2009 16:07:28 -0000 @@ -1,8 +1,8 @@ Index: qemu/configure -@@ -540,7 +540,7 @@ +@@ -868,7 +868,7 @@ sdl_too_old=no - if test -z "$sdl" ; then + if test "$sdl" = "yes" ; then - sdl_config="sdl-config" + sdl_config="${SDL_CONFIG}" sdl=no Index: files/patch-audio-4 =================================================================== RCS file: /home/pcvs/ports/emulators/qemu-devel/files/patch-audio-4,v retrieving revision 1.2 diff -u -p -r1.2 patch-audio-4 --- files/patch-audio-4 10 Mar 2007 17:03:05 -0000 1.2 +++ files/patch-audio-4 4 Sep 2009 16:07:28 -0000 @@ -1,24 +0,0 @@ -Index: qemu/audio/audio_template.h -@@ -32,6 +32,10 @@ - #define SW glue (SWVoice, In) - #endif - -+#ifndef UINT64_MAX -+#define UINT64_MAX ((uint64_t)(18446744073709551615ULL)) -+#endif -+ - static void glue (audio_pcm_sw_fini_, TYPE) (SW *sw) - { - glue (audio_pcm_sw_free_resources_, TYPE) (sw); -Index: qemu/audio/audio.c -@@ -36,6 +36,10 @@ - /* #define DEBUG_LIVE */ - /* #define DEBUG_OUT */ - -+#ifndef INT16_MAX -+#define INT16_MAX (32767) -+#endif -+ - static struct audio_driver *drvtab[] = { - #ifdef CONFIG_OSS - &oss_audio_driver, Index: files/patch-bc =================================================================== RCS file: /home/pcvs/ports/emulators/qemu-devel/files/patch-bc,v retrieving revision 1.2 diff -u -p -r1.2 patch-bc --- files/patch-bc 10 Mar 2007 17:03:05 -0000 1.2 +++ files/patch-bc 4 Sep 2009 16:07:28 -0000 @@ -1,12 +0,0 @@ -Index: qemu/i386-dis.c -@@ -2896,6 +2896,10 @@ - OP_E (bytemode, sizeflag); - } - -+#ifndef PRIx64 -+#define PRIx64 "llx" -+#endif -+ - static void - print_operand_value (buf, hex, disp) - char *buf; Index: files/patch-be =================================================================== RCS file: /home/pcvs/ports/emulators/qemu-devel/files/patch-be,v retrieving revision 1.6 diff -u -p -r1.6 patch-be --- files/patch-be 25 Mar 2007 16:33:01 -0000 1.6 +++ files/patch-be 4 Sep 2009 16:07:28 -0000 @@ -1,19 +0,0 @@ -Index: qemu/vl.c -@@ -541,7 +541,7 @@ - static void init_get_clock(void) - { - use_rt_clock = 0; --#if defined(__linux__) -+#if defined(__linux__) || (defined(__FreeBSD__) && __FreeBSD_version >= 500000) - { - struct timespec ts; - if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0) { -@@ -553,7 +553,7 @@ - - static int64_t get_clock(void) - { --#if defined(__linux__) -+#if defined(__linux__) || (defined(__FreeBSD__) && __FreeBSD_version >= 500000) - if (use_rt_clock) { - struct timespec ts; - clock_gettime(CLOCK_MONOTONIC, &ts); Index: files/patch-bg =================================================================== RCS file: /home/pcvs/ports/emulators/qemu-devel/files/patch-bg,v retrieving revision 1.8 diff -u -p -r1.8 patch-bg --- files/patch-bg 3 Apr 2008 20:18:40 -0000 1.8 +++ files/patch-bg 4 Sep 2009 16:07:28 -0000 @@ -1,15 +1,25 @@ +Index: qemu/Makefile +@@ -19,6 +19,7 @@ + CPPFLAGS += -I. -I$(SRC_PATH) -MMD -MP -MT $@ + CPPFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE + CPPFLAGS += -U_FORTIFY_SOURCE ++CPPFLAGS += -DSMBD_COMMAND=\"${LOCALBASE}/sbin/smbd\" -I${LOCALBASE}/include -DPREFIX=\"${PREFIX}\" + LIBS= + ifdef CONFIG_STATIC + LDFLAGS += -static Index: qemu/Makefile.target -@@ -179,7 +179,7 @@ +@@ -54,6 +54,7 @@ - ######################################################### - --CPPFLAGS+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -+CPPFLAGS+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DSMBD_COMMAND=\"${LOCALBASE}/sbin/smbd\" -I${LOCALBASE}/include -DPREFIX=\"${PREFIX}\" + CPPFLAGS+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE + CPPFLAGS+=-U_FORTIFY_SOURCE ++CPPFLAGS+=-DSMBD_COMMAND=\"${LOCALBASE}/sbin/smbd\" -I${LOCALBASE}/include -DPREFIX=\"${PREFIX}\" LIBS+=-lm - ifndef CONFIG_USER_ONLY - LIBS+=-lz -Index: qemu/vl.c -@@ -133,10 +133,12 @@ + ifdef CONFIG_WIN32 + LIBS+=-lwinmm -lws2_32 -liphlpapi +Index: qemu/net.h +@@ -99,12 +99,14 @@ + int slirp_is_inited(void); + void net_client_check(void); -#define DEFAULT_NETWORK_SCRIPT "/etc/qemu-ifup" -#define DEFAULT_NETWORK_DOWN_SCRIPT "/etc/qemu-ifdown" @@ -20,7 +30,7 @@ Index: qemu/vl.c #define SMBD_COMMAND "/usr/sfw/sbin/smbd" #else #define SMBD_COMMAND "/usr/sbin/smbd" -+#endif #endif ++#endif - //#define DEBUG_UNUSED_IOPORT + #endif Index: files/patch-block.c =================================================================== RCS file: /home/pcvs/ports/emulators/qemu-devel/files/patch-block.c,v retrieving revision 1.5 diff -u -p -r1.5 patch-block.c --- files/patch-block.c 10 Mar 2007 17:03:05 -0000 1.5 +++ files/patch-block.c 4 Sep 2009 16:07:28 -0000 @@ -1,10 +0,0 @@ -Index: qemu/block.c -@@ -381,7 +381,7 @@ - else - open_flags = flags & ~(BDRV_O_FILE | BDRV_O_SNAPSHOT); - ret = drv->bdrv_open(bs, filename, open_flags); -- if (ret == -EACCES && !(flags & BDRV_O_FILE)) { -+ if ((ret == -EACCES || ret == -EPERM) && !(flags & BDRV_O_FILE)) { - ret = drv->bdrv_open(bs, filename, BDRV_O_RDONLY); - bs->read_only = 1; - } Index: files/patch-bsdusb.patch =================================================================== RCS file: /home/pcvs/ports/emulators/qemu-devel/files/patch-bsdusb.patch,v retrieving revision 1.10 diff -u -p -r1.10 patch-bsdusb.patch --- files/patch-bsdusb.patch 11 Mar 2008 23:34:13 -0000 1.10 +++ files/patch-bsdusb.patch 4 Sep 2009 16:07:28 -0000 @@ -1,691 +0,0 @@ -Index: qemu/configure -@@ -139,6 +139,7 @@ - oss="yes" - linux="yes" - linux_user="yes" -+usb="linux" - if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then - kqemu="yes" - fi -@@ -148,6 +149,7 @@ - if [ "$bsd" = "yes" ] ; then - if [ "$darwin" != "yes" ] ; then - make="gmake" -+ usb="bsd" - fi - fi - -@@ -786,6 +788,19 @@ - fi - - echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h -+ -+# USB host support -+case "$usb" in -+linux) -+ echo "HOST_USB=linux" >> $conig_mak -+;; -+bsd) -+ echo "HOST_USB=bsd" >> $config_mak -+;; -+*) -+ echo "HOST_USB=stub" >> $config_mak -+;; -+esac - - for target in $target_list; do - target_dir="$target" -Index: qemu/Makefile -@@ -58,7 +58,7 @@ - OBJS+=ssd0303.o ssd0323.o ads7846.o stellaris_input.o - OBJS+=scsi-disk.o cdrom.o - OBJS+=scsi-generic.o --OBJS+=usb.o usb-hub.o usb-linux.o usb-hid.o usb-msd.o usb-wacom.o usb-serial.o -+OBJS+=usb.o usb-hub.o usb-$(HOST_USB).o usb-hid.o usb-msd.o usb-wacom.o usb-serial.o - OBJS+=sd.o ssi-sd.o - - ifdef CONFIG_WIN32 -Index: qemu/usb-stub.c -@@ -0,0 +1,11 @@ -+#include "vl.h" -+ -+void usb_host_info(void) -+{ -+ term_printf("USB host devices not supported\n"); -+} -+ -+USBDevice *usb_host_device_open(const char *devname) -+{ -+ return NULL; -+} -Index: qemu/usb-bsd.c -@@ -0,0 +1,601 @@ -+/* -+ * BSD host USB redirector -+ * -+ * Copyright (c) 2006 Lonnie Mendez -+ * Portions of code and concepts borrowed from -+ * usb-linux.c and libusb's bsd.c and are copyright their respective owners. -+ * -+ * Permission is hereby granted, free of charge, to any person obtaining a copy -+ * of this software and associated documentation files (the "Software"), to deal -+ * in the Software without restriction, including without limitation the rights -+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -+ * copies of the Software, and to permit persons to whom the Software is -+ * furnished to do so, subject to the following conditions: -+ * -+ * The above copyright notice and this permission notice shall be included in -+ * all copies or substantial portions of the Software. -+ * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -+ * THE SOFTWARE. -+ */ -+ -+#include "qemu-common.h" -+#include "hw/usb.h" -+ -+/* usb.h declares these */ -+#undef USB_SPEED_HIGH -+#undef USB_SPEED_FULL -+#undef USB_SPEED_LOW -+ -+#include -+#include -+#include -+ -+/* This value has maximum potential at 16. -+ * You should also set hw.usb.debug to gain -+ * more detailed view. -+ */ -+//#define DEBUG -+#define UGEN_DEBUG_LEVEL 0 -+ -+ -+typedef int USBScanFunc(void *opaque, int bus_num, int addr, int class_id, -+ int vendor_id, int product_id, -+ const char *product_name, int speed); -+static int usb_host_find_device(int *pbus_num, int *paddr, -+ const char *devname); -+ -+typedef struct USBHostDevice { -+ USBDevice dev; -+ int ep_fd[USB_MAX_ENDPOINTS]; -+ int devfd; -+ char devpath[32]; -+} USBHostDevice; -+ -+ -+static int ensure_ep_open(USBHostDevice *dev, int ep, int mode) -+{ -+ char buf[32]; -+ int fd; -+ -+ /* Get the address for this endpoint */ -+ ep = UE_GET_ADDR(ep); -+ -+ if (dev->ep_fd[ep] < 0) { -+#if __FreeBSD__ -+ snprintf(buf, sizeof(buf) - 1, "%s.%d", dev->devpath, ep); -+#else -+ snprintf(buf, sizeof(buf) - 1, "%s.%02d", dev->devpath, ep); -+#endif -+ /* Try to open it O_RDWR first for those devices which have in and out -+ * endpoints with the same address (eg 0x02 and 0x82) -+ */ -+ fd = open(buf, O_RDWR); -+ if (fd < 0 && errno == ENXIO) -+ fd = open(buf, mode); -+ if (fd < 0) { -+#ifdef DEBUG -+ printf("ensure_ep_open: failed to open device endpoint %s: %s\n", -+ buf, strerror(errno)); -+#endif -+ } -+ dev->ep_fd[ep] = fd; -+ } -+ -+ return dev->ep_fd[ep]; -+} -+ -+static void ensure_eps_closed(USBHostDevice *dev) -+{ -+ int epnum = 1; -+ -+ if (!dev) -+ return; -+ -+ while (epnum < USB_MAX_ENDPOINTS) { -+ if (dev->ep_fd[epnum] >= 0) { -+ close(dev->ep_fd[epnum]); -+ dev->ep_fd[epnum] = -1; -+ } -+ epnum++; -+ } -+} -+ -+static void usb_host_handle_reset(USBDevice *dev) -+{ -+#if 0 -+ USBHostDevice *s = (USBHostDevice *)dev; -+#endif -+} -+ -+/* XXX: -+ * -check device states against transfer requests -+ * and return appropriate response -+ */ -+static int usb_host_handle_control(USBDevice *dev, -+ int request, -+ int value, -+ int index, -+ int length, -+ uint8_t *data) -+{ -+ USBHostDevice *s = (USBHostDevice *)dev; -+ struct usb_ctl_request req; -+ struct usb_alt_interface aiface; -+ int ret, timeout = 50; -+ -+ if ((request >> 8) == UT_WRITE_DEVICE && -+ (request & 0xff) == UR_SET_ADDRESS) { -+ -+ /* specific SET_ADDRESS support */ -+ dev->addr = value; -+ return 0; -+ } else if ((request >> 8) == UT_WRITE_DEVICE && -+ (request & 0xff) == UR_SET_CONFIG) { -+ -+ ensure_eps_closed(s); /* can't do this without all eps closed */ -+ -+ ret = ioctl(s->devfd, USB_SET_CONFIG, &value); -+ if (ret < 0) { -+#ifdef DEBUG -+ printf("handle_control: failed to set configuration - %s\n", -+ strerror(errno)); -+#endif -+ return USB_RET_STALL; -+ } -+ -+ return 0; -+ } else if ((request >> 8) == UT_WRITE_INTERFACE && -+ (request & 0xff) == UR_SET_INTERFACE) { -+ -+ aiface.uai_interface_index = index; -+ aiface.uai_alt_no = value; -+ -+ ensure_eps_closed(s); /* can't do this without all eps closed */ -+ ret = ioctl(s->devfd, USB_SET_ALTINTERFACE, &aiface); -+ if (ret < 0) { -+#ifdef DEBUG -+ printf("handle_control: failed to set alternate interface - %s\n", -+ strerror(errno)); -+#endif -+ return USB_RET_STALL; -+ } -+ -+ return 0; -+ } else { -+ req.ucr_request.bmRequestType = request >> 8; -+ req.ucr_request.bRequest = request & 0xff; -+ USETW(req.ucr_request.wValue, value); -+ USETW(req.ucr_request.wIndex, index); -+ USETW(req.ucr_request.wLength, length); -+ req.ucr_data = data; -+ req.ucr_flags = USBD_SHORT_XFER_OK; -+ -+ ret = ioctl(s->devfd, USB_SET_TIMEOUT, &timeout); -+#if (__NetBSD__ || __OpenBSD__) -+ if (ret < 0 && errno != EINVAL) { -+#else -+ if (ret < 0) { -+#endif -+#ifdef DEBUG -+ printf("handle_control: setting timeout failed - %s\n", -+ strerror(errno)); -+#endif -+ } -+ -+ ret = ioctl(s->devfd, USB_DO_REQUEST, &req); -+ /* ugen returns EIO for usbd_do_request_ no matter what -+ * happens with the transfer */ -+ if (ret < 0) { -+#ifdef DEBUG -+ printf("handle_control: error after request - %s\n", -+ strerror(errno)); -+#endif -+ return USB_RET_NAK; // STALL -+ } else { -+ return req.ucr_actlen; -+ } -+ } -+} -+ -+static int usb_host_handle_data(USBDevice *dev, USBPacket *p) -+{ -+ USBHostDevice *s = (USBHostDevice *)dev; -+ int ret, fd, mode; -+ int one = 1, shortpacket = 0, timeout = 50; -+ sigset_t new_mask, old_mask; -+ uint8_t devep = p->devep; -+ -+ /* protect data transfers from SIGALRM signal */ -+ sigemptyset(&new_mask); -+ sigaddset(&new_mask, SIGALRM); -+ sigprocmask(SIG_BLOCK, &new_mask, &old_mask); -+ -+ if (p->pid == USB_TOKEN_IN) { -+ devep |= 0x80; -+ mode = O_RDONLY; -+ shortpacket = 1; -+ } else { -+ mode = O_WRONLY; -+ } -+ -+ fd = ensure_ep_open(s, devep, mode); -+ if (fd < 0) { -+ sigprocmask(SIG_SETMASK, &old_mask, NULL); -+ return USB_RET_NODEV; -+ } -+ -+ if (ioctl(fd, USB_SET_TIMEOUT, &timeout) < 0) { -+#ifdef DEBUG -+ printf("handle_data: failed to set timeout - %s\n", -+ strerror(errno)); -+#endif -+ } -+ -+ if (shortpacket) { -+ if (ioctl(fd, USB_SET_SHORT_XFER, &one) < 0) { -+#ifdef DEBUG -+ printf("handle_data: failed to set short xfer mode - %s\n", -+ strerror(errno)); -+#endif -+ sigprocmask(SIG_SETMASK, &old_mask, NULL); -+ } -+ } -+ -+ if (p->pid == USB_TOKEN_IN) -+ ret = read(fd, p->data, p->len); -+ else -+ ret = write(fd, p->data, p->len); -+ -+ sigprocmask(SIG_SETMASK, &old_mask, NULL); -+ -+ if (ret < 0) { -+#ifdef DEBUG -+ printf("handle_data: error after %s data - %s\n", -+ pid == USB_TOKEN_IN ? "reading" : "writing", strerror(errno)); -+#endif -+ switch(errno) { -+ case ETIMEDOUT: -+ case EINTR: -+ return USB_RET_NAK; -+ default: -+ return USB_RET_STALL; -+ } -+ } else { -+ return ret; -+ } -+} -+ -+static void usb_host_handle_destroy(USBDevice *opaque) -+{ -+ USBHostDevice *s = (USBHostDevice *)opaque; -+ int i; -+ -+ for (i = 0; i < USB_MAX_ENDPOINTS; i++) -+ if (s->ep_fd[i] >= 0) -+ close(s->ep_fd[i]); -+ -+ if (s->devfd < 0) -+ return; -+ -+ close(s->devfd); -+ -+ qemu_free(s); -+} -+ -+USBDevice *usb_host_device_open(const char *devname) -+{ -+ struct usb_device_info bus_info, dev_info; -+ USBHostDevice *dev; -+ char ctlpath[PATH_MAX + 1]; -+ char buspath[PATH_MAX + 1]; -+ int bfd, dfd, bus, address, i; -+ int ugendebug = UGEN_DEBUG_LEVEL; -+ -+ if (usb_host_find_device(&bus, &address, devname) < 0) -+ return NULL; -+ -+ snprintf(buspath, PATH_MAX, "/dev/usb%d", bus); -+ -+ bfd = open(buspath, O_RDWR); -+ if (bfd < 0) { -+#ifdef DEBUG -+ printf("usb_host_device_open: failed to open usb bus - %s\n", -+ strerror(errno)); -+#endif -+ return NULL; -+ } -+ -+ bus_info.udi_addr = address; -+ if (ioctl(bfd, USB_DEVICEINFO, &bus_info) < 0) { -+#ifdef DEBUG -+ printf("usb_host_device_open: failed to grab bus information - %s\n", -+ strerror(errno)); -+#endif -+ return NULL; -+ } -+ -+#if __FreeBSD__ -+ snprintf(ctlpath, PATH_MAX, "/dev/%s", bus_info.udi_devnames[0]); -+#else -+ snprintf(ctlpath, PATH_MAX, "/dev/%s.00", bus_info.udi_devnames[0]); -+#endif -+ -+ dfd = open(ctlpath, O_RDWR); -+ if (dfd < 0) { -+ dfd = open(ctlpath, O_RDONLY); -+ if (dfd < 0) { -+#ifdef DEBUG -+ printf("usb_host_device_open: failed to open usb device %s - %s\n", -+ ctlpath, strerror(errno)); -+#endif -+ } -+ } -+ -+ if (dfd >= 0) { -+ dev = qemu_mallocz(sizeof(USBHostDevice)); -+ if (!dev) -+ goto fail; -+ dev->devfd = dfd; -+ -+ if (ioctl(dfd, USB_GET_DEVICEINFO, &dev_info) < 0) { -+#ifdef DEBUG -+ printf("usb_host_device_open: failed to grab device info - %s\n", -+ strerror(errno)); -+#endif -+ goto fail; -+ } -+ -+ if (dev_info.udi_speed == 1) -+ dev->dev.speed = USB_SPEED_LOW - 1; -+ else -+ dev->dev.speed = USB_SPEED_FULL - 1; -+ -+ dev->dev.handle_packet = usb_generic_handle_packet; -+ -+ dev->dev.handle_reset = usb_host_handle_reset; -+ dev->dev.handle_control = usb_host_handle_control; -+ dev->dev.handle_data = usb_host_handle_data; -+ dev->dev.handle_destroy = usb_host_handle_destroy; -+ -+ if (strncmp(dev_info.udi_product, "product", 7) != 0) -+ pstrcpy(dev->dev.devname, sizeof(dev->dev.devname), -+ dev_info.udi_product); -+ else -+ snprintf(dev->dev.devname, sizeof(dev->dev.devname), -+ "host:%s", devname); -+ -+ pstrcpy(dev->devpath, sizeof(dev->devpath), "/dev/"); -+ strcat(dev->devpath, dev_info.udi_devnames[0]); -+ -+ /* Mark the endpoints as not yet open */ -+ for (i = 0; i < USB_MAX_ENDPOINTS; i++) -+ dev->ep_fd[i] = -1; -+ -+ ioctl(dfd, USB_SETDEBUG, &ugendebug); -+ -+ return (USBDevice *)dev; -+ } -+ -+fail: -+ return NULL; -+} -+ -+static int usb_host_scan(void *opaque, USBScanFunc *func) -+{ -+ struct usb_device_info bus_info; -+ struct usb_device_info dev_info; -+ uint16_t vendor_id, product_id, class_id, speed; -+ int bfd, dfd, bus, address; -+ char busbuf[20], devbuf[20], product_name[256]; -+ int ret = 0; -+ -+ for (bus = 0; bus < 10; bus++) { -+ -+ snprintf(busbuf, sizeof(busbuf) - 1, "/dev/usb%d", bus); -+ bfd = open(busbuf, O_RDWR); -+ if (bfd < 0) -+ continue; -+ -+ for (address = 1; address < 127; address++) { -+ -+ bus_info.udi_addr = address; -+ if (ioctl(bfd, USB_DEVICEINFO, &bus_info) < 0) -+ continue; -+ -+ /* only list devices that can be used by generic layer */ -+ if (strncmp(bus_info.udi_devnames[0], "ugen", 4) != 0) -+ continue; -+ -+#if __FreeBSD__ -+ 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]); -+#endif -+ -+ dfd = open(devbuf, O_RDONLY); -+ if (dfd < 0) { -+#ifdef DEBUG -+ printf("usb_host_scan: couldn't open device %s - %s\n", devbuf, -+ strerror(errno)); -+#endif -+ continue; -+ } -+ -+ if (ioctl(dfd, USB_GET_DEVICEINFO, &dev_info) < 0) -+ printf("usb_host_scan: couldn't get device information for %s - %s\n", -+ devbuf, strerror(errno)); -+ -+ // XXX: might need to fixup endianess of word values before copying over -+ -+ vendor_id = dev_info.udi_vendorNo; -+ product_id = dev_info.udi_productNo; -+ class_id = dev_info.udi_class; -+ speed = dev_info.udi_speed; -+ -+ if (strncmp(dev_info.udi_product, "product", 7) != 0) -+ pstrcpy(product_name, sizeof(product_name), -+ dev_info.udi_product); -+ else -+ product_name[0] = '\0'; -+ -+ ret = func(opaque, bus, address, class_id, vendor_id, -+ product_id, product_name, speed); -+ -+ close(dfd); -+ -+ if (ret) -+ goto the_end; -+ } -+ -+ close(bfd); -+ } -+ -+the_end: -+ return ret; -+} -+ -+typedef struct FindDeviceState { -+ int vendor_id; -+ int product_id; -+ int bus_num; -+ int addr; -+} FindDeviceState; -+ -+static int usb_host_find_device_scan(void *opaque, int bus_num, int addr, -+ int class_id, -+ int vendor_id, int product_id, -+ const char *product_name, int speed) -+{ -+ FindDeviceState *s = opaque; -+ if (vendor_id == s->vendor_id && -+ product_id == s->product_id) { -+ s->bus_num = bus_num; -+ s->addr = addr; -+ return 1; -+ } else { -+ return 0; -+ } -+} -+ -+ -+/* the syntax is : -+ 'bus.addr' (decimal numbers) or -+ 'vendor_id:product_id' (hexa numbers) */ -+static int usb_host_find_device(int *pbus_num, int *paddr, -+ const char *devname) -+{ -+ const char *p; -+ int ret; -+ FindDeviceState fs; -+ -+ p = strchr(devname, '.'); -+ if (p) { -+ *pbus_num = strtoul(devname, NULL, 0); -+ *paddr = strtoul(p + 1, NULL, 0); -+ return 0; -+ } -+ p = strchr(devname, ':'); -+ if (p) { -+ fs.vendor_id = strtoul(devname, NULL, 16); -+ fs.product_id = strtoul(p + 1, NULL, 16); -+ ret = usb_host_scan(&fs, usb_host_find_device_scan); -+ if (ret) { -+ *pbus_num = fs.bus_num; -+ *paddr = fs.addr; -+ return 0; -+ } -+ } -+ return -1; -+} -+ -+/**********************/ -+/* USB host device info */ -+ -+struct usb_class_info { -+ int class; -+ const char *class_name; -+}; -+ -+static const struct usb_class_info usb_class_info[] = { -+ { USB_CLASS_AUDIO, "Audio"}, -+ { USB_CLASS_COMM, "Communication"}, -+ { USB_CLASS_HID, "HID"}, -+ { USB_CLASS_HUB, "Hub" }, -+ { USB_CLASS_PHYSICAL, "Physical" }, -+ { USB_CLASS_PRINTER, "Printer" }, -+ { USB_CLASS_MASS_STORAGE, "Storage" }, -+ { USB_CLASS_CDC_DATA, "Data" }, -+ { USB_CLASS_APP_SPEC, "Application Specific" }, -+ { USB_CLASS_VENDOR_SPEC, "Vendor Specific" }, -+ { USB_CLASS_STILL_IMAGE, "Still Image" }, -+ { USB_CLASS_CSCID, "Smart Card" }, -+ { USB_CLASS_CONTENT_SEC, "Content Security" }, -+ { -1, NULL } -+}; -+ -+static const char *usb_class_str(uint8_t class) -+{ -+ const struct usb_class_info *p; -+ for (p = usb_class_info; p->class != -1; p++) { -+ if (p->class == class) -+ break; -+ } -+ return p->class_name; -+} -+ -+void usb_info_device(int bus_num, int addr, int class_id, -+ int vendor_id, int product_id, -+ const char *product_name, -+ int speed) -+{ -+ const char *class_str, *speed_str; -+ -+ switch(speed) { -+ case USB_SPEED_LOW: -+ speed_str = "1.5"; -+ break; -+ case USB_SPEED_FULL: -+ speed_str = "12"; -+ break; -+ case USB_SPEED_HIGH: -+ speed_str = "480"; -+ break; -+ default: -+ speed_str = "?"; -+ break; -+ } -+ -+ term_printf(" Device %d.%d, speed %s Mb/s\n", -+ bus_num, addr, speed_str); -+ class_str = usb_class_str(class_id); -+ if (class_str) -+ term_printf(" %s:", class_str); -+ else -+ term_printf(" Class %02x:", class_id); -+ term_printf(" USB device %04x:%04x", vendor_id, product_id); -+ if (product_name[0] != '\0') -+ term_printf(", %s", product_name); -+ term_printf("\n"); -+} -+ -+static int usb_host_info_device(void *opaque, int bus_num, int addr, -+ int class_id, -+ int vendor_id, int product_id, -+ const char *product_name, -+ int speed) -+{ -+ usb_info_device(bus_num, addr, class_id, vendor_id, product_id, -+ product_name, speed); -+ return 0; -+} -+ -+void usb_host_info(void) -+{ -+ usb_host_scan(NULL, usb_host_info_device); -+} -Index: qemu/usb-linux.c -@@ -23,7 +23,6 @@ - */ - #include "vl.h" - --#if defined(__linux__) - #include - #include - #include -@@ -505,18 +504,3 @@ - { - usb_host_scan(NULL, usb_host_info_device); - } -- --#else -- --void usb_host_info(void) --{ -- term_printf("USB host devices not supported\n"); --} -- --/* XXX: modify configure to compile the right host driver */ --USBDevice *usb_host_device_open(const char *devname) --{ -- return NULL; --} -- --#endif Index: files/patch-bt =================================================================== RCS file: /home/pcvs/ports/emulators/qemu-devel/files/patch-bt,v retrieving revision 1.6 diff -u -p -r1.6 patch-bt --- files/patch-bt 9 Aug 2007 20:03:30 -0000 1.6 +++ files/patch-bt 4 Sep 2009 16:07:28 -0000 @@ -1,4 +1,4 @@ -Index: qemu/vl.c +Index: qemu/net.c @@ -76,6 +76,11 @@ #endif #endif @@ -19,7 +19,7 @@ Index: qemu/vl.c +#define LOAD_QUIETLY 1 +#define LOAD_VERBOSLY 2 + -+int ++static int +loadmodules(int how, const char *module, ...) +{ + int loaded = 0; Index: files/patch-configure =================================================================== RCS file: /home/pcvs/ports/emulators/qemu-devel/files/patch-configure,v retrieving revision 1.3 diff -u -p -r1.3 patch-configure --- files/patch-configure 3 Jun 2008 18:39:51 -0000 1.3 +++ files/patch-configure 4 Sep 2009 16:07:28 -0000 @@ -1,10 +1,10 @@ Index: qemu/configure -@@ -689,7 +689,7 @@ - fi # test "$curses" +@@ -1348,7 +1348,7 @@ + fi # Check if tools are available to build documentation. --if [ -x "`which texi2html 2>/dev/null`" ] && \ -+if [ "x$NOPORTDOCS" != "x" -o -x "`which texi2html 2>/dev/null`" ] && \ - [ -x "`which pod2man 2>/dev/null`" ]; then - build_docs="yes" +-if test "$build_docs" = "yes" -a \( ! -x "`which texi2html 2>/dev/null`" -o ! -x "`which pod2man 2>/dev/null`" \) ; then ++if test "$build_docs" = "yes" -a \( "x$NOPORTDOCS" != "x" -o ! -x "`which texi2html 2>/dev/null`" -o ! -x "`which pod2man 2>/dev/null`" \) ; then + build_docs="no" fi + Index: files/patch-cpu-exec.c =================================================================== RCS file: /home/pcvs/ports/emulators/qemu-devel/files/patch-cpu-exec.c,v retrieving revision 1.5 diff -u -p -r1.5 patch-cpu-exec.c --- files/patch-cpu-exec.c 8 Jul 2008 18:42:09 -0000 1.5 +++ files/patch-cpu-exec.c 4 Sep 2009 16:07:28 -0000 @@ -1,27 +0,0 @@ -Index: qemu/cpu-exec.c -@@ -394,16 +394,18 @@ - (env->eflags & IF_MASK && - !(env->hflags & HF_INHIBIT_IRQ_MASK))))) { - int intno; -- svm_check_intercept(SVM_EXIT_INTR); - env->interrupt_request &= ~(CPU_INTERRUPT_HARD | CPU_INTERRUPT_VIRQ); - intno = cpu_get_pic_interrupt(env); -- if (loglevel & CPU_LOG_TB_IN_ASM) { -- fprintf(logfile, "Servicing hardware INT=0x%02x\n", intno); -+ if (intno>=0) { -+ svm_check_intercept(SVM_EXIT_INTR); -+ if (loglevel & CPU_LOG_TB_IN_ASM) { -+ fprintf(logfile, "Servicing hardware INT=0x%02x\n", intno); -+ } -+ do_interrupt(intno, 0, 0, 0, 1); -+ /* ensure that no TB jump will be modified as -+ the program flow was changed */ -+ next_tb = 0; - } -- do_interrupt(intno, 0, 0, 0, 1); -- /* ensure that no TB jump will be modified as -- the program flow was changed */ -- next_tb = 0; - #if !defined(CONFIG_USER_ONLY) - } else if ((interrupt_request & CPU_INTERRUPT_VIRQ) && - (env->eflags & IF_MASK) && Index: files/patch-exec.c =================================================================== RCS file: /home/pcvs/ports/emulators/qemu-devel/files/patch-exec.c,v retrieving revision 1.3 diff -u -p -r1.3 patch-exec.c --- files/patch-exec.c 8 Jul 2008 18:42:09 -0000 1.3 +++ files/patch-exec.c 4 Sep 2009 16:07:28 -0000 @@ -1,30 +0,0 @@ -Index: qemu/exec.c -@@ -405,6 +405,28 @@ - exit(1); - } - } -+#elif defined(__FreeBSD__) -+ { -+ int flags; -+ void *addr = NULL; -+ flags = MAP_PRIVATE | MAP_ANONYMOUS; -+#if defined(__x86_64__) -+ /* FreeBSD doesn't have MAP_32BIT, use MAP_FIXED and assume -+ * 0x40000000 is free */ -+ flags |= MAP_FIXED; -+ addr = (void *)0x40000000; -+ /* Cannot map more than that */ -+ if (code_gen_buffer_size > (800 * 1024 * 1024)) -+ code_gen_buffer_size = (800 * 1024 * 1024); -+#endif -+ code_gen_buffer = mmap(addr, code_gen_buffer_size, -+ PROT_WRITE | PROT_READ | PROT_EXEC, -+ flags, -1, 0); -+ if (code_gen_buffer == MAP_FAILED) { -+ fprintf(stderr, "Could not allocate dynamic translator buffer\n"); -+ exit(1); -+ } -+ } - #else - code_gen_buffer = qemu_malloc(code_gen_buffer_size); - if (!code_gen_buffer) { Index: files/patch-fbsd =================================================================== RCS file: /home/pcvs/ports/emulators/qemu-devel/files/patch-fbsd,v retrieving revision 1.13 diff -u -p -r1.13 patch-fbsd --- files/patch-fbsd 24 Mar 2009 19:39:02 -0000 1.13 +++ files/patch-fbsd 4 Sep 2009 16:15:44 -0000 @@ -1,61 +1,76 @@ Index: qemu/Makefile -@@ -25,7 +25,10 @@ - DOCS= +@@ -45,7 +45,10 @@ + LIBS+=-lwinmm -lws2_32 -liphlpapi endif --all: $(TOOLS) $(DOCS) recurse-all -+all: bsd/libmath.a $(TOOLS) $(DOCS) recurse-all +-build-all: $(TOOLS) $(DOCS) recurse-all ++build-all: bsd/libmath.a $(TOOLS) $(DOCS) recurse-all + +bsd/libmath.a: + ( cd bsd ; unset MAKEFLAGS ; $(BSD_MAKE) CC=$(CC) ) - subdir-%: dyngen$(EXESUF) - $(MAKE) -C $(subst subdir-,,$@) all -@@ -40,6 +43,7 @@ + config-host.mak: configure + ifneq ($(wildcard config-host.mak),) +@@ -242,6 +245,7 @@ clean: # avoid old build problems by removing potentially incorrect old files + ( cd bsd ; $(BSD_MAKE) clean ) - rm -f config.mak config.h op-i386.h opc-i386.h gen-op-i386.h op-arm.h opc-arm.h gen-op-arm.h - rm -f *.o *.a $(TOOLS) dyngen$(EXESUF) TAGS *.pod *~ */*~ - $(MAKE) -C tests clean + rm -f config.mak config.h op-i386.h opc-i386.h gen-op-i386.h op-arm.h opc-arm.h gen-op-arm.h + rm -f *.o *.d *.a $(TOOLS) TAGS cscope.* *.pod *~ */*~ + rm -f slirp/*.o slirp/*.d audio/*.o audio/*.d block/*.o block/*.d Index: qemu/Makefile.target -@@ -651,8 +651,8 @@ - main.o: CFLAGS+=-p +@@ -339,7 +339,7 @@ + # WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object + # that the kernel ELF loader considers as an executable. I think this + # is the simplest way to make it self virtualizable! +-LDFLAGS+=-Wl,-shared ++#LDFLAGS+=-Wl,-shared endif + endif + +@@ -408,7 +408,7 @@ + # cpu_signal_handler() in cpu-exec.c. + signal.o: CFLAGS += $(HELPER_CFLAGS) + +-ARLIBS=libqemu.a ../libqemu_user.a ++ARLIBS=libqemu.a ../libqemu_user.a ../bsd/libmath.a + + endif #CONFIG_BSD_USER + +@@ -658,7 +658,7 @@ + monitor.o: qemu-monitor.h --$(QEMU_PROG): $(OBJS) ../libqemu_common.a libqemu.a -- $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(COCOA_LIBS) $(CURSES_LIBS) $(BRLAPI_LIBS) -+$(QEMU_PROG): $(OBJS) ../libqemu_common.a libqemu.a ../bsd/libmath.a -+ $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(COCOA_LIBS) $(CURSES_LIBS) $(BRLAPI_LIBS) ../bsd/libmath.a + LIBS += $(SDL_LIBS) $(COCOA_LIBS) $(CURSES_LIBS) $(BRLAPI_LIBS) $(VDE_LIBS) $(CURL_LIBS) +-ARLIBS=../libqemu_common.a libqemu.a $(HWLIB) ++ARLIBS=../libqemu_common.a libqemu.a $(HWLIB) ../bsd/libmath.a endif # !CONFIG_USER_ONLY Index: qemu/fpu/softfloat-native.c -@@ -2,11 +2,16 @@ - context is supported */ - #include "softfloat.h" - #include +@@ -6,10 +6,15 @@ + #include + #endif + +#if defined(__FreeBSD__) && __FreeBSD_version < 500000 +#include +#endif - ++ void set_float_rounding_mode(int val STATUS_PARAM) { STATUS(float_rounding_mode) = val; --#if defined(_BSD) && !defined(__APPLE__) || (defined(HOST_SOLARIS) && HOST_SOLARIS < 10) -+#if defined(_BSD) && !defined(__APPLE__) && !defined(__FreeBSD__) || \ +-#if defined(HOST_BSD) && !defined(__APPLE__) || \ ++#if defined(HOST_BSD) && !defined(__APPLE__) && !defined(__FreeBSD__) || \ + (defined(__FreeBSD__) && __FreeBSD_version < 500000) || \ -+ (defined(HOST_SOLARIS) && HOST_SOLARIS < 10) + (defined(HOST_SOLARIS) && HOST_SOLARIS < 10) fpsetround(val); #elif defined(__arm__) - /* nothing to do */ -@@ -22,7 +25,7 @@ +@@ -26,7 +31,7 @@ } #endif --#if defined(_BSD) || (defined(HOST_SOLARIS) && HOST_SOLARIS < 10) -+#if (defined(_BSD) && !defined(__FreeBSD__)) || (defined(HOST_SOLARIS) && HOST_SOLARIS < 10) +-#if defined(HOST_BSD) || (defined(HOST_SOLARIS) && HOST_SOLARIS < 10) ++#if (defined(HOST_BSD) && !defined(__FreeBSD__)) || (defined(HOST_SOLARIS) && HOST_SOLARIS < 10) #define lrint(d) ((int32_t)rint(d)) #define llrint(d) ((int64_t)rint(d)) #define lrintf(f) ((int32_t)rint(f)) @@ -64,7 +79,7 @@ Index: qemu/fpu/softfloat-native.h /* Native implementation of soft float functions */ #include --#if (defined(_BSD) && !defined(__APPLE__)) || defined(HOST_SOLARIS) +-#if (defined(HOST_BSD) && !defined(__APPLE__)) || defined(HOST_SOLARIS) +#ifdef __FreeBSD__ +#include +long double fabsl(long double x); @@ -75,7 +90,7 @@ Index: qemu/fpu/softfloat-native.h +long long llrintl(long double x); +#endif + -+#if (defined(_BSD) && !defined(__APPLE__) && \ ++#if (defined(HOST_BSD) && !defined(__APPLE__) && \ + (!defined(__FreeBSD__) || __FreeBSD_version < 500000)) || \ + defined(HOST_SOLARIS) #include @@ -90,43 +105,42 @@ Index: qemu/fpu/softfloat-native.h #define fabsf(f) ((float)fabs(f)) #else #include -@@ -60,7 +80,9 @@ - /*---------------------------------------------------------------------------- +@@ -109,6 +109,8 @@ | Software IEC/IEEE floating-point rounding mode. *----------------------------------------------------------------------------*/ --#if (defined(_BSD) && !defined(__APPLE__)) || defined(HOST_SOLARIS) -+#if (defined(_BSD) && !defined(__APPLE__) && \ -+ (!defined(__FreeBSD__) || __FreeBSD_version < 500000)) || \ -+ defined(HOST_SOLARIS) - enum { - float_round_nearest_even = FP_RN, - float_round_down = FP_RM, +-#if (defined(HOST_BSD) && !defined(__APPLE__)) || defined(HOST_SOLARIS) ++#if (defined(HOST_BSD) && !defined(__APPLE__) && \ ++ (!defined(__FreeBSD__) || __FreeBSD_version < 500000)) || \ ++ defined(HOST_SOLARIS) + #if defined(__OpenBSD__) + #define FE_RM FP_RM + #define FE_RP FP_RP Index: qemu/fpu/softfloat.h @@ -84,7 +84,8 @@ #define FLOAT128 #else /* native float support */ --#if (defined(__i386__) || defined(__x86_64__)) && !defined(_BSD) +-#if (defined(__i386__) || defined(__x86_64__)) && !defined(HOST_BSD) +#if (defined(__i386__) || defined(__x86_64__)) && \ -+ (!defined(_BSD) || defined(__FreeBSD__)) ++ (!defined(HOST_BSD) || defined(__FreeBSD__)) #define FLOATX80 #endif #endif /* !CONFIG_SOFTFLOAT */ Index: qemu/target-ppc/op_helper.c -@@ -303,6 +303,13 @@ - FT0 = sqrt(FT0); +@@ -293,6 +293,13 @@ + uint32_t exp = (u.ll >> 52) & 0x7FF; + return ((0 < exp) && (exp < 0x7FF)); } - ++#else +#ifndef isnormal +#define isnormal(x) \ + ((sizeof (x) == sizeof (float)) ? __isnormalf(x) \ + : (sizeof (x) == sizeof (double)) ? __isnormal(x) \ + : __isnormall(x)) +#endif -+ - void do_fres (void) - { - union { + #endif + + uint32_t helper_compute_fprf (uint64_t arg, uint32_t set_fprf) Index: qemu/x86_64.ld @@ -2,7 +2,7 @@ OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64") @@ -137,3 +151,23 @@ Index: qemu/x86_64.ld SECTIONS { /* Read-only sections, merged into text segment: */ +@@ -59,8 +59,6 @@ + .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } + .rodata1 : { *(.rodata1) } + .eh_frame_hdr : { *(.eh_frame_hdr) } +- .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) } +- .gcc_except_table : ONLY_IF_RO { *(.gcc_except_table) } + /* Adjust the address for the data segment. We want to adjust up to + the same address within the page on the next page up. */ + . = ALIGN (0x100000) - ((0x100000 - .) & (0x100000 - 1)); . = DATA_SEGMENT_ALIGN (0x100000, 0x1000); +@@ -86,8 +84,8 @@ + .data1 : { *(.data1) } + .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) } + .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } +- .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) } +- .gcc_except_table : ONLY_IF_RW { *(.gcc_except_table) } ++ .eh_frame : { KEEP (*(.eh_frame)) } ++ .gcc_except_table : { *(.gcc_except_table) } + .dynamic : { *(.dynamic) } + .ctors : + { Index: files/patch-fpu-softfloat-native.c =================================================================== RCS file: /home/pcvs/ports/emulators/qemu-devel/files/patch-fpu-softfloat-native.c,v retrieving revision 1.3 diff -u -p -r1.3 patch-fpu-softfloat-native.c --- files/patch-fpu-softfloat-native.c 11 Mar 2008 23:34:13 -0000 1.3 +++ files/patch-fpu-softfloat-native.c 4 Sep 2009 16:07:28 -0000 @@ -1,17 +0,0 @@ -Index: qemu/fpu/softfloat-native.c -@@ -228,7 +228,15 @@ - *----------------------------------------------------------------------------*/ - float64 float64_trunc_to_int( float64 a STATUS_PARAM ) - { -+#if defined(__FreeBSD__) && __FreeBSD__ <= 4 -+ float64 ret; -+ fpsetround(FP_RZ); -+ ret = rint(a); -+ fpsetround(STATUS(float_rounding_mode)); -+ return ret; -+#else - return trunc(a); -+#endif - } - - float64 float64_round_to_int( float64 a STATUS_PARAM ) Index: files/patch-hw-vmware_vga.c =================================================================== RCS file: /home/pcvs/ports/emulators/qemu-devel/files/patch-hw-vmware_vga.c,v retrieving revision 1.1 diff -u -p -r1.1 patch-hw-vmware_vga.c --- files/patch-hw-vmware_vga.c 2 May 2007 19:55:07 -0000 1.1 +++ files/patch-hw-vmware_vga.c 4 Sep 2009 16:16:57 -0000 @@ -1,12 +1,74 @@ Index: qemu/hw/vmware_vga.c -@@ -26,8 +26,8 @@ +@@ -28,9 +28,9 @@ #define VERBOSE #define EMBED_STDVGA #undef DIRECT_VRAM -#define HW_RECT_ACCEL -#define HW_FILL_ACCEL +-#define HW_MOUSE_ACCEL +/* #define HW_RECT_ACCEL */ +/* #define HW_FILL_ACCEL */ - #define HW_MOUSE_ACCEL ++/* #define HW_MOUSE_ACCEL */ #ifdef EMBED_STDVGA + # include "vga_int.h" +@@ -76,6 +76,7 @@ + uint32_t wblue; + int syncing; + int fb_size; ++ int empty; + + union { + uint32_t *fifo; +@@ -487,7 +488,7 @@ + + static inline int vmsvga_fifo_empty(struct vmsvga_state_s *s) + { +- if (!s->config || !s->enable) ++ if (!s->config || !s->enable || s->empty) + return 1; + return (s->cmd->next_cmd == s->cmd->stop); + } +@@ -495,6 +496,10 @@ + static inline uint32_t vmsvga_fifo_read_raw(struct vmsvga_state_s *s) + { + uint32_t cmd = s->fifo[CMD(stop) >> 2]; ++ if (s->cmd->next_cmd == s->cmd->stop) { ++ s->empty = 1; ++ return 0; ++ } + s->cmd->stop = cpu_to_le32(CMD(stop) + 4); + if (CMD(stop) >= CMD(max)) + s->cmd->stop = s->cmd->min; +@@ -512,6 +517,7 @@ + int args = 0; + int x, y, dx, dy, width, height; + struct vmsvga_cursor_definition_s cursor; ++ s->empty = 0; + while (!vmsvga_fifo_empty(s)) + switch (cmd = vmsvga_fifo_read(s)) { + case SVGA_CMD_UPDATE: +@@ -533,6 +539,7 @@ + vmsvga_fill_rect(s, colour, x, y, width, height); + break; + #else ++ args = 0; + goto badcmd; + #endif + +@@ -547,6 +554,7 @@ + vmsvga_copy_rect(s, x, y, dx, dy, width, height); + break; + #else ++ args = 0; + goto badcmd; + #endif + +@@ -609,6 +617,7 @@ + break; /* Nop */ + + default: ++ args = 0; + badcmd: + while (args --) + vmsvga_fifo_read(s); Index: files/patch-libmath4 =================================================================== RCS file: /home/pcvs/ports/emulators/qemu-devel/files/patch-libmath4,v retrieving revision 1.2 diff -u -p -r1.2 patch-libmath4 --- files/patch-libmath4 10 Mar 2007 17:03:05 -0000 1.2 +++ files/patch-libmath4 4 Sep 2009 16:07:28 -0000 @@ -1,45 +0,0 @@ -Index: qemu/bsd/i386/s_ldexpl.c -@@ -2,6 +2,30 @@ - #include - #include - -+/* 4.x doesnt have isfinite */ -+#ifndef isfinite -+#define isfinite __isfinitel -+ -+union IEEEl2bits { -+ long double e; -+ struct { -+ unsigned int manl :32; -+ unsigned int manh :32; -+ unsigned int exp :15; -+ unsigned int sign :1; -+ unsigned int junk :16; -+ } bits; -+}; -+ -+static int __isfinitel(long double x) -+{ -+ union IEEEl2bits u; -+ -+ u.e = x; -+ return (u.bits.exp != 32767); -+} -+#endif -+ - long double __ldexpl(long double x, int expn) - { - long double res; -Index: qemu/bsd/i386/s_round.c -@@ -29,6 +29,11 @@ - - #include - -+/* 4.x doesnt have isfinite */ -+#ifndef isfinite -+#define isfinite(x) (!isnan(x) && !isinf(x)) -+#endif -+ - double - round(double x) - { Index: files/patch-osdep.c =================================================================== RCS file: /home/pcvs/ports/emulators/qemu-devel/files/patch-osdep.c,v retrieving revision 1.4 diff -u -p -r1.4 patch-osdep.c --- files/patch-osdep.c 8 Jul 2008 18:42:09 -0000 1.4 +++ files/patch-osdep.c 4 Sep 2009 16:07:28 -0000 @@ -1,43 +1,11 @@ Index: qemu/osdep.c -@@ -68,7 +68,9 @@ - - #if defined(USE_KQEMU) - -+#ifndef __FreeBSD__ - #include -+#endif - #include - #include - -@@ -79,6 +81,7 @@ - const char *tmpdir; - char phys_ram_file[1024]; - void *ptr; -+#ifndef __FreeBSD__ - #ifdef HOST_SOLARIS - struct statvfs stfs; - #else -@@ -138,7 +141,9 @@ +@@ -179,7 +179,9 @@ } unlink(phys_ram_file); } -+#endif ++#endif /* !(__OpenBSD__ || __FreeBSD__ || __DragonFly__) */ size = (size + 4095) & ~4095; -+#ifndef __FreeBSD__ ++#if !defined(__OpenBSD__) && !defined(__FreeBSD__) && !defined(__DragonFly__) ftruncate(phys_ram_fd, phys_ram_size + size); + #endif /* !(__OpenBSD__ || __FreeBSD__ || __DragonFly__) */ ptr = mmap(NULL, - size, -@@ -148,6 +153,13 @@ - fprintf(stderr, "Could not map physical memory\n"); - exit(1); - } -+#else -+ ptr = malloc(size); -+ if (ptr == NULL) { -+ fprintf(stderr, "Could not allocate physical memory\n"); -+ exit(1); -+ } -+#endif - phys_ram_size += size; - return ptr; - } Index: files/patch-target-i386-translate.c =================================================================== RCS file: /home/pcvs/ports/emulators/qemu-devel/files/patch-target-i386-translate.c,v retrieving revision 1.3 diff -u -p -r1.3 patch-target-i386-translate.c --- files/patch-target-i386-translate.c 8 Jul 2008 18:42:09 -0000 1.3 +++ files/patch-target-i386-translate.c 4 Sep 2009 16:07:28 -0000 @@ -1,16 +0,0 @@ -Index: qemu/target-i386/translate.c -@@ -3330,8 +3330,12 @@ - op1_offset = offsetof(CPUX86State,xmm_regs[reg]); - tcg_gen_addi_ptr(cpu_ptr0, cpu_env, op1_offset); - sse_op2 = sse_op_table3[(s->dflag == 2) * 2 + ((b >> 8) - 2)]; -- tcg_gen_trunc_tl_i32(cpu_tmp2_i32, cpu_T[0]); -- tcg_gen_helper_0_2(sse_op2, cpu_ptr0, cpu_tmp2_i32); -+ if (ot == OT_LONG) { -+ tcg_gen_trunc_tl_i32(cpu_tmp2_i32, cpu_T[0]); -+ tcg_gen_helper_0_2(sse_op2, cpu_ptr0, cpu_tmp2_i32); -+ } else { -+ tcg_gen_helper_0_2(sse_op2, cpu_ptr0, cpu_T[0]); -+ } - break; - case 0x02c: /* cvttps2pi */ - case 0x12c: /* cvttpd2pi */ Index: files/patch-target-mips-cpu.h =================================================================== RCS file: /home/pcvs/ports/emulators/qemu-devel/files/patch-target-mips-cpu.h,v retrieving revision 1.2 diff -u -p -r1.2 patch-target-mips-cpu.h --- files/patch-target-mips-cpu.h 10 Mar 2007 17:03:05 -0000 1.2 +++ files/patch-target-mips-cpu.h 4 Sep 2009 16:07:28 -0000 @@ -1,15 +0,0 @@ -Index: qemu/target-mips/cpu.h -@@ -8,6 +8,13 @@ - #include "config.h" - #include "softfloat.h" - -+#ifdef __FreeBSD__ -+#if __FreeBSD__ <= 4 -+typedef uint32_t uint_fast8_t; -+typedef uint32_t uint_fast16_t; -+#endif -+#endif -+ - typedef union fpr_t fpr_t; - union fpr_t { - double d; Index: files/patch-tcg-i386-tcg-target.c =================================================================== RCS file: /home/pcvs/ports/emulators/qemu-devel/files/patch-tcg-i386-tcg-target.c,v retrieving revision 1.1 diff -u -p -r1.1 patch-tcg-i386-tcg-target.c --- files/patch-tcg-i386-tcg-target.c 8 Jul 2008 18:42:09 -0000 1.1 +++ files/patch-tcg-i386-tcg-target.c 4 Sep 2009 16:07:28 -0000 @@ -1,28 +0,0 @@ -Index: qemu/tcg/i386/tcg-target.c -@@ -360,22 +360,22 @@ - case TCG_COND_LT: - tcg_out_brcond(s, TCG_COND_LT, args[1], args[3], const_args[3], args[5]); - tcg_out_jxx(s, JCC_JNE, label_next); -- tcg_out_brcond(s, TCG_COND_LT, args[0], args[2], const_args[2], args[5]); -+ tcg_out_brcond(s, TCG_COND_LTU, args[0], args[2], const_args[2], args[5]); - break; - case TCG_COND_LE: - tcg_out_brcond(s, TCG_COND_LT, args[1], args[3], const_args[3], args[5]); - tcg_out_jxx(s, JCC_JNE, label_next); -- tcg_out_brcond(s, TCG_COND_LE, args[0], args[2], const_args[2], args[5]); -+ tcg_out_brcond(s, TCG_COND_LEU, args[0], args[2], const_args[2], args[5]); - break; - case TCG_COND_GT: - tcg_out_brcond(s, TCG_COND_GT, args[1], args[3], const_args[3], args[5]); - tcg_out_jxx(s, JCC_JNE, label_next); -- tcg_out_brcond(s, TCG_COND_GT, args[0], args[2], const_args[2], args[5]); -+ tcg_out_brcond(s, TCG_COND_GTU, args[0], args[2], const_args[2], args[5]); - break; - case TCG_COND_GE: - tcg_out_brcond(s, TCG_COND_GT, args[1], args[3], const_args[3], args[5]); - tcg_out_jxx(s, JCC_JNE, label_next); -- tcg_out_brcond(s, TCG_COND_GE, args[0], args[2], const_args[2], args[5]); -+ tcg_out_brcond(s, TCG_COND_GEU, args[0], args[2], const_args[2], args[5]); - break; - case TCG_COND_LTU: - tcg_out_brcond(s, TCG_COND_LTU, args[1], args[3], const_args[3], args[5]); Index: files/patch-usb-stub.c =================================================================== RCS file: /home/pcvs/ports/emulators/qemu-devel/files/patch-usb-stub.c,v retrieving revision 1.1 diff -u -p -r1.1 patch-usb-stub.c --- files/patch-usb-stub.c 13 Jun 2009 19:26:28 -0000 1.1 +++ files/patch-usb-stub.c 4 Sep 2009 16:07:28 -0000 @@ -1,9 +0,0 @@ -Index: qemu/usb-stub.c -@@ -1,4 +1,6 @@ --#include "vl.h" -+#include "qemu-common.h" -+#include "console.h" -+#include "hw/usb.h" - - void usb_host_info(void) - { Index: files/patch-vl.c =================================================================== RCS file: /home/pcvs/ports/emulators/qemu-devel/files/patch-vl.c,v retrieving revision 1.11 diff -u -p -r1.11 patch-vl.c --- files/patch-vl.c 8 Jul 2008 18:42:09 -0000 1.11 +++ files/patch-vl.c 4 Sep 2009 16:07:28 -0000 @@ -1,39 +1,82 @@ Index: qemu/vl.c -@@ -1727,6 +1728,7 @@ - chr->chr_ioctl = pp_ioctl; - return chr; - } -+#endif /* defined(__linux__) */ - +@@ -57,6 +57,7 @@ + #include + #if defined(__FreeBSD__) || defined(__DragonFly__) + #include ++#include #else - CharDriverState *qemu_chr_open_pty(void) -@@ -2334,7 +2334,7 @@ - } + #include #endif +@@ -4782,6 +4783,10 @@ --#if defined(__linux__) || defined(__sun__) -+#if defined(__linux__) || defined(__sun__) || defined(__FreeBSD__) - static CharDriverState *qemu_chr_open_pty(void) - { - struct termios tty; -@@ -3036,7 +3036,7 @@ - return qemu_chr_open_pp(filename); - } else #endif --#if defined(__linux__) || defined(__sun__) -+#if defined(__linux__) || defined(__sun__) || defined(__FreeBSD__) - if (strstart(filename, "/dev/", NULL)) { - return qemu_chr_open_tty(filename); - } else -@@ -8423,6 +8423,11 @@ - nb_nics = 0; - /* default mac address of the first network interface */ - -+#ifdef __FreeBSD__ -+ if (modfind("aio") == -1) -+ fprintf(stderr, "warning: aio not (kld)loaded, may cause `Invalid system call' traps on disk IO\n"); + ++#if !defined(CONFIG_USER_ONLY) ++void io_mem_init(void); +#endif + - optind = 1; - for(;;) { - if (optind >= argc) + int main(int argc, char **argv, char **envp) + { + #ifdef CONFIG_GDBSTUB +@@ -5621,6 +5626,10 @@ + #ifdef CONFIG_KQEMU + if (smp_cpus > 1) + kqemu_allowed = 0; ++ if (kqemu_allowed && ram_size > (1536 << 20)) { ++ fprintf(stderr, "qemu: at most 1536 MB RAM can be simulated with kqemu\n"); ++ exit(1); ++ } + #endif + if (qemu_init_main_loop()) { + fprintf(stderr, "qemu_init_main_loop failed\n"); +@@ -5715,6 +5724,9 @@ + if (ram_size == 0) + ram_size = DEFAULT_RAM_SIZE * 1024 * 1024; + ++ /* init the dynamic translator */ ++ cpu_exec_init_all(tb_size * 1024 * 1024); ++ + #ifdef CONFIG_KQEMU + /* FIXME: This is a nasty hack because kqemu can't cope with dynamic + guest ram allocation. It needs to go away. */ +@@ -5727,9 +5739,9 @@ + } + } + #endif +- +- /* init the dynamic translator */ +- cpu_exec_init_all(tb_size * 1024 * 1024); ++#if !defined(CONFIG_USER_ONLY) ++ io_mem_init(); ++#endif + + bdrv_init(); + dma_helper_init(); +Index: qemu/exec.c +@@ -179,7 +179,7 @@ + static PhysPageDesc **l1_phys_map; + + #if !defined(CONFIG_USER_ONLY) +-static void io_mem_init(void); ++void io_mem_init(void); + + /* io memory support */ + CPUWriteMemoryFunc *io_mem_write[IO_MEM_NB_ENTRIES][4]; +@@ -503,7 +503,7 @@ + code_gen_alloc(tb_size); + code_gen_ptr = code_gen_buffer; + page_init(); +-#if !defined(CONFIG_USER_ONLY) ++#if 0 && !defined(CONFIG_USER_ONLY) + io_mem_init(); + #endif + } +@@ -2993,7 +2993,7 @@ + return -1; + } + +-static void io_mem_init(void) ++void io_mem_init(void) + { + int i; + Index: files/patch-vl.c-ppbus =================================================================== RCS file: /home/pcvs/ports/emulators/qemu-devel/files/patch-vl.c-ppbus,v retrieving revision 1.5 diff -u -p -r1.5 patch-vl.c-ppbus --- files/patch-vl.c-ppbus 9 Aug 2007 20:03:30 -0000 1.5 +++ files/patch-vl.c-ppbus 4 Sep 2009 16:07:28 -0000 @@ -1,92 +0,0 @@ -Index: qemu/vl.c -@@ -78,8 +78,10 @@ - #endif - #ifdef __FreeBSD__ - #include - #include - #include -+#include -+#include - #endif - - #if defined(CONFIG_SLIRP) -@@ -1728,7 +1730,64 @@ - chr->chr_ioctl = pp_ioctl; - return chr; - } --#endif /* defined(__linux__) */ -+#if defined(__FreeBSD__) -+static int pp_ioctl(CharDriverState *chr, int cmd, void *arg) -+{ -+ int fd = (int)chr->opaque; -+ uint8_t b; -+ -+ switch(cmd) { -+ case CHR_IOCTL_PP_READ_DATA: -+ if (ioctl(fd, PPIGDATA, &b) < 0) -+ return -ENOTSUP; -+ *(uint8_t *)arg = b; -+ break; -+ case CHR_IOCTL_PP_WRITE_DATA: -+ b = *(uint8_t *)arg; -+ if (ioctl(fd, PPISDATA, &b) < 0) -+ return -ENOTSUP; -+ break; -+ case CHR_IOCTL_PP_READ_CONTROL: -+ if (ioctl(fd, PPIGCTRL, &b) < 0) -+ return -ENOTSUP; -+ *(uint8_t *)arg = b; -+ break; -+ case CHR_IOCTL_PP_WRITE_CONTROL: -+ b = *(uint8_t *)arg; -+ if (ioctl(fd, PPISCTRL, &b) < 0) -+ return -ENOTSUP; -+ break; -+ case CHR_IOCTL_PP_READ_STATUS: -+ if (ioctl(fd, PPIGSTATUS, &b) < 0) -+ return -ENOTSUP; -+ *(uint8_t *)arg = b; -+ break; -+ default: -+ return -ENOTSUP; -+ } -+ return 0; -+} -+ -+CharDriverState *qemu_chr_open_pp(const char *filename) -+{ -+ CharDriverState *chr; -+ int fd; -+ -+ fd = open(filename, O_RDWR); -+ if (fd < 0) -+ return NULL; -+ -+ chr = qemu_mallocz(sizeof(CharDriverState)); -+ if (!chr) { -+ close(fd); -+ return NULL; -+ } -+ chr->opaque = (void *)fd; -+ chr->chr_write = null_chr_write; -+ chr->chr_ioctl = pp_ioctl; -+ return chr; -+} -+#endif - - #else - CharDriverState *qemu_chr_open_pty(void) -@@ -2562,6 +2622,13 @@ - #endif - #if defined(__linux__) - if (strstart(filename, "/dev/parport", NULL)) { -+ return qemu_chr_open_pp(filename); -+ } else -+ if (strstart(filename, "/dev/", NULL)) { -+ return qemu_chr_open_tty(filename); -+ } else -+#elif defined(__FreeBSD__) -+ if (strstart(filename, "/dev/ppi", NULL)) { - return qemu_chr_open_pp(filename); - } else - if (strstart(filename, "/dev/", NULL)) { Index: files/patch-vl.c-serial =================================================================== RCS file: /home/pcvs/ports/emulators/qemu-devel/files/patch-vl.c-serial,v retrieving revision 1.2 diff -u -p -r1.2 patch-vl.c-serial --- files/patch-vl.c-serial 10 Mar 2007 17:03:05 -0000 1.2 +++ files/patch-vl.c-serial 4 Sep 2009 16:07:28 -0000 @@ -1,4 +1,4 @@ -Index: qemu/vl.c +Index: qemu/qemu-char.c @@ -1606,10 +1606,13 @@ cfsetospeed(&tty, spd); Index: files/patch-z-bandaid-usb-current =================================================================== RCS file: /home/pcvs/ports/emulators/qemu-devel/files/patch-z-bandaid-usb-current,v retrieving revision 1.1 diff -u -p -r1.1 patch-z-bandaid-usb-current --- files/patch-z-bandaid-usb-current 28 Feb 2009 17:31:36 -0000 1.1 +++ files/patch-z-bandaid-usb-current 4 Sep 2009 16:07:28 -0000 @@ -1,14 +1,14 @@ Index: qemu/usb-bsd.c -@@ -34,7 +34,12 @@ - #undef USB_SPEED_LOW +@@ -35,7 +35,12 @@ #include + #ifndef __DragonFly__ +#include +#if __FreeBSD_version >= 800064 +#include +#else #include +#endif - #include - - /* This value has maximum potential at 16. + #else + #include + #endif Index: files/pcap-patch =================================================================== RCS file: /home/pcvs/ports/emulators/qemu-devel/files/pcap-patch,v retrieving revision 1.1 diff -u -p -r1.1 pcap-patch --- files/pcap-patch 2 Aug 2008 18:29:39 -0000 1.1 +++ files/pcap-patch 4 Sep 2009 16:07:28 -0000 @@ -14,27 +14,26 @@ ifdef CONFIG_SLIRP CPPFLAGS+=-I$(SRC_PATH)/slirp endif ---- configure.orig 2008-07-18 15:18:42.000000000 -0400 -+++ configure 2008-07-18 15:22:24.000000000 -0400 -@@ -88,6 +88,7 @@ - mingw32="no" - EXESUF="" - gdbstub="yes" +Index: configure +@@ -203,6 +203,7 @@ + sdl_x11="no" + xen="yes" + pkgversion="" +pcap="no" - slirp="yes" - fmod_lib="" - fmod_inc="" -@@ -278,6 +279,8 @@ + + # OS specific + if check_define __linux__ ; then +@@ -428,6 +429,8 @@ ;; - --enable-mingw32) mingw32="yes" ; cross_prefix="i386-mingw32-" ; linux_user="no" + --disable-vnc-sasl) vnc_sasl="no" ;; + --enable-pcap) pcap="yes" + ;; --disable-slirp) slirp="no" ;; - --disable-kqemu) kqemu="no" -@@ -712,6 +715,28 @@ - fi # -z $sdl + --disable-vde) vde="no" +@@ -925,6 +928,28 @@ + fi ########################################## +# pcap probe @@ -61,36 +60,35 @@ +########################################## # VNC TLS detection if test "$vnc_tls" = "yes" ; then - `pkg-config gnutls` || vnc_tls="no" -@@ -865,6 +890,7 @@ - echo " TLS CFLAGS $vnc_tls_cflags" - echo " TLS LIBS $vnc_tls_libs" + cat > $TMPC <> $config_h + echo "#define CONFIG_PROFILER 1" >> $config_host_h fi +if test "$pcap" = "yes" ; then -+ echo "CONFIG_PCAP=yes" >> $config_mak -+ echo "#define CONFIG_PCAP 1" >> $config_h ++ echo "CONFIG_PCAP=yes" >> $config_host_mak ++ echo "#define CONFIG_PCAP 1" >> $config_host_h + if test "$mingw32" = "no" ; then + if test -c /dev/bpf0 ; then -+ echo "#define HAVE_BPF 1" >> $config_h ++ echo "#define HAVE_BPF 1" >> $config_host_h + fi + fi +fi if test "$slirp" = "yes" ; then - echo "CONFIG_SLIRP=yes" >> $config_mak - echo "#define CONFIG_SLIRP 1" >> $config_h ---- vl.c.orig 2008-07-18 15:19:26.000000000 -0400 -+++ vl.c 2008-07-18 15:31:25.000000000 -0400 -@@ -102,6 +102,13 @@ - int inet_aton(const char *cp, struct in_addr *ia); - #endif + echo "CONFIG_SLIRP=y" >> $config_host_mak + echo "#define CONFIG_SLIRP 1" >> $config_host_h +Index: net.c +@@ -694,6 +694,179 @@ + va_end(ap); + } +#if defined(CONFIG_PCAP) +#if defined(_WIN32) @@ -99,13 +97,6 @@ +#include +#endif + - #if defined(CONFIG_SLIRP) - #include "libslirp.h" - #endif -@@ -3914,6 +3921,164 @@ - } - } - +#if defined(CONFIG_PCAP) + +typedef struct PCAPState { @@ -113,11 +104,11 @@ + pcap_t *handle; +} PCAPState; + -+static void pcap_receive(void *opaque, const uint8_t *buf, int size) ++static ssize_t pcap_receive(VLANClientState *vc, const uint8_t *buf, size_t size) +{ -+ PCAPState *s = (PCAPState *)opaque; ++ PCAPState *s = (PCAPState *)vc->opaque; + -+ pcap_sendpacket(s->handle, (u_char*)buf, size); ++ return pcap_inject(s->handle, (u_char*)buf, size); +} + +static void pcap_callback(u_char *user, struct pcap_pkthdr *phdr, u_char *pdata) @@ -134,7 +125,15 @@ + pcap_dispatch(s->handle, 1, (pcap_handler)&pcap_callback, (u_char *)s->vc); +} + -+static int net_pcap_init(VLANState *vlan, char *ifname) ++static void pcap_cleanup(VLANClientState *vc) ++{ ++ PCAPState *s = vc->opaque; ++ ++ pcap_close(s->handle); ++ qemu_free(s); ++} ++ ++static int net_pcap_init(VLANState *vlan, const char *model, const char *name, char *ifname) +{ + PCAPState *s = NULL; + struct bpf_program fcode = { 0, NULL }; @@ -231,7 +230,7 @@ +#endif /* HAVE_BPF */ +#endif /* _WIN32 */ + -+ s->vc = qemu_new_vlan_client(vlan, pcap_receive, NULL, s); ++ s->vc = qemu_new_vlan_client(vlan, model, name, NULL, pcap_receive, NULL, pcap_cleanup, s); + snprintf(s->vc->info_str, sizeof(s->vc->info_str), "pcap redirector"); + +#if defined(_WIN32) @@ -267,7 +266,7 @@ #if defined(CONFIG_SLIRP) /* slirp network adapter */ -@@ -4983,6 +5150,16 @@ +@@ -2585,6 +2758,16 @@ are wanted */ ret = 0; } else @@ -276,22 +275,23 @@ + char ifname[64]; + vlan->nb_host_devs++; + if (get_param_value(ifname, sizeof(ifname), "ifname", p) <= 0) -+ ret = net_pcap_init(vlan, NULL); ++ ret = net_pcap_init(vlan, device, name, NULL); + else -+ ret = net_pcap_init(vlan, ifname); ++ ret = net_pcap_init(vlan, device, name, ifname); + } else +#endif #ifdef CONFIG_SLIRP if (!strcmp(device, "user")) { - if (get_param_value(buf, sizeof(buf), "hostname", p)) { -@@ -7398,6 +7575,10 @@ - "Network options:\n" - "-net nic[,vlan=n][,macaddr=addr][,model=type]\n" - " create a new Network Interface Card and connect it to VLAN 'n'\n" + static const char * const slirp_params[] = { +Index: qemu-options.hx +@@ -731,6 +731,10 @@ + " connect the user mode network stack to VLAN 'n' and send\n" + " hostname 'host' to DHCP clients\n" + #endif +#ifdef CONFIG_PCAP -+ "-net pcap[,vlan=n][,ifname=name]\n" -+ " connect the host network interface using PCAP to VLAN 'n'\n" ++ "-net pcap[,vlan=n][,ifname=name]\n" ++ " connect the host network interface using PCAP to VLAN 'n'\n" +#endif - #ifdef CONFIG_SLIRP - "-net user[,vlan=n][,hostname=host]\n" - " connect the user mode network stack to VLAN 'n' and send\n" + #ifdef _WIN32 + "-net tap[,vlan=n][,name=str],ifname=name\n" + " connect the host TAP network interface to VLAN 'n'\n" Index: files/patch-iopl-workaround @@ -0,0 +1,64 @@ +Index: qemu/target-i386/op_helper.c +@@ -517,6 +517,12 @@ + #endif + } + ++#if 1 ++#define IOPL_WORKAROUND ++#define VMPORT 0x5658 ++int vmware_svga_io_base; ++#endif ++ + /* check if Port I/O is allowed in TSS */ + static inline void check_io(int addr, int size) + { +@@ -527,6 +533,27 @@ + ((env->tr.flags >> DESC_TYPE_SHIFT) & 0xf) != 9 || + env->tr.limit < 103) + goto fail; ++#ifdef IOPL_WORKAROUND ++ if (addr == VMPORT) { ++ static int last_vmport_iopl = -1; ++ int iopl = (env->eflags >> IOPL_SHIFT) & 3; ++ if (iopl != last_vmport_iopl) { ++ printf("check_io: vmport workaround: iopl = %d\n", iopl); ++ last_vmport_iopl = iopl; ++ } ++ return; ++ } ++ if (vmware_svga_io_base && ++ addr >= vmware_svga_io_base && addr < vmware_svga_io_base + 3) { ++ static int last_svga_iopl = -1; ++ int iopl = (env->eflags >> IOPL_SHIFT) & 3; ++ if (iopl != last_svga_iopl) { ++ printf("check_io: vmware svga workaround: iopl = %d\n", iopl); ++ last_svga_iopl = iopl; ++ } ++ return; ++ } ++#endif + io_offset = lduw_kernel(env->tr.base + 0x66); + io_offset += (addr >> 3); + /* Note: the check needs two bytes */ +Index: qemu/hw/vmware_vga.c +@@ -1175,12 +1175,20 @@ + return 0; + } + ++#if 1 && defined(TARGET_I386) ++#define IOPL_WORKAROUND ++extern int vmware_svga_io_base; ++#endif ++ + static void pci_vmsvga_map_ioport(PCIDevice *pci_dev, int region_num, + uint32_t addr, uint32_t size, int type) + { + struct pci_vmsvga_state_s *d = (struct pci_vmsvga_state_s *) pci_dev; + struct vmsvga_state_s *s = &d->chip; + ++#ifdef IOPL_WORKAROUND ++ vmware_svga_io_base = addr + SVGA_IO_MUL * SVGA_INDEX_PORT; ++#endif + register_ioport_read(addr + SVGA_IO_MUL * SVGA_INDEX_PORT, + 1, 4, vmsvga_index_read, s); + register_ioport_write(addr + SVGA_IO_MUL * SVGA_INDEX_PORT, Index: files/patch-libmath_FreeBSD-version @@ -0,0 +1,150 @@ +diff -ru qemu.orig/bsd/Makefile qemu/bsd/Makefile +--- qemu.orig/bsd/Makefile 2009-01-19 23:30:09.124413041 -0600 ++++ qemu/bsd/Makefile 2009-01-19 23:40:20.180704580 -0600 +@@ -1,23 +1,90 @@ +-SRCS= ${MACHINE_ARCH}/e_atan2l.c \ +- ${MACHINE_ARCH}/e_logl.S \ +- ${MACHINE_ARCH}/e_powl.S \ +- ${MACHINE_ARCH}/e_remainderl.S \ +- ${MACHINE_ARCH}/e_sqrtl.c \ +- ${MACHINE_ARCH}/s_ceill.S \ +- ${MACHINE_ARCH}/s_cosl.S \ +- ${MACHINE_ARCH}/s_floorl.S \ +- ${MACHINE_ARCH}/s_isnormal.c \ +- ${MACHINE_ARCH}/s_llrint.S \ +- ${MACHINE_ARCH}/s_llrintf.S \ +- ${MACHINE_ARCH}/s_llrintl.S \ +- ${MACHINE_ARCH}/s_lrint.S \ +- ${MACHINE_ARCH}/s_lrintf.S \ +- ${MACHINE_ARCH}/s_lrintl.S \ +- ${MACHINE_ARCH}/s_rintl.c \ +- ${MACHINE_ARCH}/s_round.c \ +- ${MACHINE_ARCH}/s_sinl.S \ +- ${MACHINE_ARCH}/s_tanl.S \ +- ${MACHINE_ARCH}/s_ldexpl.c ++AWK= /usr/bin/awk ++SYSCTL= /sbin/sysctl ++ ++.if !defined(OSVERSION) ++.if exists(/usr/include/sys/param.h) ++OSVERSION!= ${AWK} '/^\#define[[:blank:]]__FreeBSD_version/ {print $$3}' < /usr/include/sys/param.h ++.elif exists(/usr/src/sys/sys/param.h) ++OSVERSION!= ${AWK} '/^\#define[[:blank::]]__FreeBSD_version/ {print $$3}' < /usr/src/sys/sys/param.h ++.else ++OSVERSION!= ${SYSCTL} -n kern.osreldate ++.endif ++.endif ++ ++# Need to be implemented ++_logl= ${MACHINE_ARCH}/e_logl.S ++_powl= ${MACHINE_ARCH}/e_powl.S ++ ++# Implemented in -CURRENT ++.if ${OSVERSION} < 800042 ++_atan2l= ${MACHINE_ARCH}/e_atan2l.c ++.endif ++ ++.if ${OSVERSION} < 800030 ++_remainderl= ${MACHINE_ARCH}/e_remainderl.S ++.endif ++ ++.if ${OSVERSION} < 800025 ++_sqrtl= ${MACHINE_ARCH}/e_sqrtl.c ++.endif ++ ++.if ${OSVERSION} < 800022 ++_cosl= ${MACHINE_ARCH}/s_cosl.S ++_sinl= ${MACHINE_ARCH}/s_sinl.S ++_tanl= ${MACHINE_ARCH}/s_tanl.S ++.endif ++ ++.if ${OSVERSION} < 800012 ++_lrintl= ${MACHINE_ARCH}/s_lrintl.S ++_llrintl= ${MACHINE_ARCH}/s_llrintl.S ++_rintl= ${MACHINE_ARCH}/s_rintl.c ++.endif ++ ++.if ${OSVERSION} < 600020 ++_ldexpl= ${MACHINE_ARCH}/s_ldexpl.c ++.endif ++ ++.if ${OSVERSION} < 600008 ++_ceill= ${MACHINE_ARCH}/s_ceill.S ++_floorl= ${MACHINE_ARCH}/s_floorl.S ++_llrint= ${MACHINE_ARCH}/s_llrint.S ++_llrintf= ${MACHINE_ARCH}/s_llrintf.S ++_lrint= ${MACHINE_ARCH}/s_lrint.S ++_lrintf= ${MACHINE_ARCH}/s_lrintf.S ++.endif ++ ++.if ${OSVERSION} < 502121 ++_isnormal= ${MACHINE_ARCH}/s_isnormal.c ++.endif ++ ++.if ${OSVERSION} < 502114 ++_round= ${MACHINE_ARCH}/s_round.c ++.endif ++ ++#.if ${OSVERSION} < 501113 ++#_fabsl= ${MACHINE_ARCH}/e_fabsl.c ++#.endif ++ ++SRCS= ${_atan2l} \ ++ ${_logl} \ ++ ${_powl} \ ++ ${_remainderl} \ ++ ${_sqrtl} \ ++ ${_ceill} \ ++ ${_cosl} \ ++ ${_floorl} \ ++ ${_isnormal} \ ++ ${_llrint} \ ++ ${_llrintf} \ ++ ${_llrintl} \ ++ ${_lrint} \ ++ ${_lrintf} \ ++ ${_lrintl} \ ++ ${_rintl} \ ++ ${_round} \ ++ ${_sinl} \ ++ ${_tanl} \ ++ ${_ldexpl} + + OBJS= ${SRCS:R:S/$/.o/} + +diff -ru qemu.orig/fpu/softfloat-native.h qemu/fpu/softfloat-native.h +--- qemu.orig/fpu/softfloat-native.h 2009-01-19 23:30:08.833416100 -0600 ++++ qemu/fpu/softfloat-native.h 2009-01-19 23:28:08.682949000 -0600 +@@ -1,15 +1,26 @@ ++#ifndef SOFTFLOAT_NATIVE_H ++#define SOFTFLOAT_NATIVE_H ++ + /* Native implementation of soft float functions */ + #include + + #ifdef __FreeBSD__ + #include ++#if __FreeBSD_version < 501113 + long double fabsl(long double x); ++#endif ++#if __FreeBSD_version < 800030 + long double remainderl(long double x, long double y); ++#endif ++#if __FreeBSD_version < 800025 + long double sqrtl(long double x); ++#endif ++#if __FreeBSD_version < 800012 + long double rintl(long double x); + long lrintl(long double x); + long long llrintl(long double x); + #endif ++#endif + + #if (defined(_BSD) && !defined(__APPLE__) && \ + (!defined(__FreeBSD__) || __FreeBSD_version < 500000)) || \ +@@ -516,3 +527,5 @@ + } + + #endif ++ ++#endif /* SOFTFLOAT_NATIVE_H */ Index: files/patch-pc-bios-optionrom-Makefile @@ -0,0 +1,13 @@ +Index: qemu/pc-bios/optionrom/Makefile +@@ -30,8 +30,10 @@ + + build-all: multiboot.bin + ++#%.o: %.S ++# $(CC) $(CFLAGS) -o $@ -c $< + %.o: %.S +- $(CC) $(CFLAGS) -o $@ -c $< ++ $(CC) -E $(CFLAGS) -o - -c $< |${LOCALBASE}/bin/as -V -Qy -o $@ + + %.img: %.o + $(LD) -Ttext 0 -e _start -s -o $@ $< Index: files/patch-tapclose @@ -0,0 +1,18 @@ +Index: qemu/net.c +@@ -1643,12 +1643,13 @@ static void tap_cleanup(VLANClientState + + qemu_purge_queued_packets(vc); + +- if (s->down_script[0]) +- launch_script(s->down_script, s->down_script_arg, s->fd); +- + tap_read_poll(s, 0); + tap_write_poll(s, 0); + close(s->fd); ++ ++ if (s->down_script[0]) ++ launch_script(s->down_script, s->down_script_arg, -1); ++ + qemu_free(s); + } +