aboutsummaryrefslogtreecommitdiff
path: root/emulators/qemu/files
diff options
context:
space:
mode:
authorMuhammad Moinur Rahman <bofh@FreeBSD.org>2015-12-16 14:15:19 +0000
committerMuhammad Moinur Rahman <bofh@FreeBSD.org>2015-12-16 14:15:19 +0000
commitcb11558b75bc84cf6c824c94aad9b343fea1224b (patch)
treeb7fe8a5e75d0b2b53b0fed24f2817e5986b0e7bc /emulators/qemu/files
parent6e3ef4bb11ee38a266998c4205e4dc1b8e397a01 (diff)
downloadports-cb11558b75bc84cf6c824c94aad9b343fea1224b.tar.gz
ports-cb11558b75bc84cf6c824c94aad9b343fea1224b.zip
emulators/qemu: Update version 0.11.1=>2.4.1
- MASTER_SITES has been changed from SAVANNAH and local repo of nox@ to new wiki.qemu.org - Take MAINTAINERSHIP - Updated to maintain version release with UPSTREAM. qemu-devel will be updated to maintain with SNAPSHOTS - Some of the patches has been converted to OPTIONSNG with post-patch - Most of the patches are now makepatch compatible - Converted most of the LEGACY OPTIONS to OPTIONSNG
Notes
Notes: svn path=/head/; revision=403864
Diffstat (limited to 'emulators/qemu/files')
-rw-r--r--emulators/qemu/files/cdrom-dma-patch10
-rw-r--r--emulators/qemu/files/gns3-patch160
-rw-r--r--emulators/qemu/files/patch-0001-qcow2-Bring-synchronous-read-write-back-to-life144
-rw-r--r--emulators/qemu/files/patch-90_security93
-rw-r--r--emulators/qemu/files/patch-CVE-2015-320982
-rw-r--r--emulators/qemu/files/patch-CVE-2015-345644
-rw-r--r--emulators/qemu/files/patch-Makefile50
-rw-r--r--emulators/qemu/files/patch-configure94
-rw-r--r--emulators/qemu/files/patch-disas_libvixl_a64_disasm-a64.cc11
-rw-r--r--emulators/qemu/files/patch-fbsd173
-rw-r--r--emulators/qemu/files/patch-hw-eepro100.c50
-rw-r--r--emulators/qemu/files/patch-hw-vmware_vga.c74
-rw-r--r--emulators/qemu/files/patch-include_net_net.h13
-rw-r--r--emulators/qemu/files/patch-include_qemu-common.h12
-rw-r--r--emulators/qemu/files/patch-iopl-workaround64
-rw-r--r--emulators/qemu/files/patch-libmath2524
-rw-r--r--emulators/qemu/files/patch-libmath257
-rw-r--r--emulators/qemu/files/patch-libmath_FreeBSD-version150
-rw-r--r--emulators/qemu/files/patch-net_tap-bsd.c10
-rw-r--r--emulators/qemu/files/patch-osdep.c18
-rw-r--r--emulators/qemu/files/patch-pc-bios-optionrom-multiboot.S16
-rw-r--r--emulators/qemu/files/patch-qemu-char.c (renamed from emulators/qemu/files/patch-vl.c-serial)6
-rw-r--r--emulators/qemu/files/patch-qemu-doc.texi5
-rw-r--r--emulators/qemu/files/patch-qemu_Makefiles36
-rw-r--r--emulators/qemu/files/patch-qemu_configure_110
-rw-r--r--emulators/qemu/files/patch-qemu_configure_210
-rw-r--r--emulators/qemu/files/patch-qemu_net.c109
-rw-r--r--emulators/qemu/files/patch-slirp_slirp__config.h (renamed from emulators/qemu/files/patch-qemu_slirp_slirp_config.h)19
-rw-r--r--emulators/qemu/files/patch-smc-fix38
-rw-r--r--emulators/qemu/files/patch-tapclose18
-rw-r--r--emulators/qemu/files/patch-ui_x__keymap.c (renamed from emulators/qemu/files/patch-x_keymap.c)11
-rw-r--r--emulators/qemu/files/patch-vl.c82
-rw-r--r--emulators/qemu/files/patch-z-bandaid-usb-current14
-rw-r--r--emulators/qemu/files/pcap-patch275
-rw-r--r--emulators/qemu/files/rtl8139-re-patch10
35 files changed, 311 insertions, 4181 deletions
diff --git a/emulators/qemu/files/cdrom-dma-patch b/emulators/qemu/files/cdrom-dma-patch
deleted file mode 100644
index 7b6bed2e6adc..000000000000
--- a/emulators/qemu/files/cdrom-dma-patch
+++ /dev/null
@@ -1,10 +0,0 @@
-Index: hw/ide.c
-@@ -27,7 +27,7 @@
- //#define DEBUG_IDE
- //#define DEBUG_IDE_ATAPI
- //#define DEBUG_AIO
--#define USE_DMA_CDROM
-+// #define USE_DMA_CDROM
-
- /* Bits of HD_STATUS */
- #define ERR_STAT 0x01
diff --git a/emulators/qemu/files/gns3-patch b/emulators/qemu/files/gns3-patch
deleted file mode 100644
index fb17b7f1c44f..000000000000
--- a/emulators/qemu/files/gns3-patch
+++ /dev/null
@@ -1,160 +0,0 @@
-diff -crB qemu-0.11.0/hw/e1000.c qemu-0.11.0.patched/hw/e1000.c
-*** qemu-0.11.0/hw/e1000.c 2009-09-24 05:01:32.000000000 +1000
---- qemu-0.11.0.patched/hw/e1000.c 2009-11-01 14:08:38.000000000 +1100
-***************
-*** 550,556 ****
- if (rctl & E1000_RCTL_UPE) // promiscuous
- return 1;
-
-! if ((buf[0] & 1) && (rctl & E1000_RCTL_MPE)) // promiscuous mcast
- return 1;
-
- if ((rctl & E1000_RCTL_BAM) && !memcmp(buf, bcast, sizeof bcast))
---- 550,556 ----
- if (rctl & E1000_RCTL_UPE) // promiscuous
- return 1;
-
-! if ((buf[0] & 1)) // && (rctl & E1000_RCTL_MPE)) // promiscuous mcast
- return 1;
-
- if ((rctl & E1000_RCTL_BAM) && !memcmp(buf, bcast, sizeof bcast))
-diff -crB qemu-0.11.0/hw/eepro100.c qemu-0.11.0.patched/hw/eepro100.c
-*** qemu-0.11.0/hw/eepro100.c 2009-09-24 05:01:32.000000000 +1000
---- qemu-0.11.0.patched/hw/eepro100.c 2009-10-31 18:17:43.000000000 +1100
-***************
-*** 1484,1490 ****
- assert(!(s->configuration[21] & BIT(3)));
- int mcast_idx = compute_mcast_idx(buf);
- if (!(s->mult[mcast_idx >> 3] & (1 << (mcast_idx & 7)))) {
-! return size;
- }
- rfd_status |= 0x0002;
- } else if (s->configuration[15] & 1) {
---- 1484,1490 ----
- assert(!(s->configuration[21] & BIT(3)));
- int mcast_idx = compute_mcast_idx(buf);
- if (!(s->mult[mcast_idx >> 3] & (1 << (mcast_idx & 7)))) {
-! //return size;
- }
- rfd_status |= 0x0002;
- } else if (s->configuration[15] & 1) {
-diff -uprB qemu-0.11.0/net.c qemu-0.11.0.patched/net.c
---- qemu-0.11.0/net.c
-+++ qemu-0.11.0.patched/net.c
-@@ -2513,6 +2513,73 @@ static int net_socket_mcast_init(VLANSta
-
- }
-
-+typedef struct DUDPState {
-+ VLANClientState *vc;
-+ int rfd;
-+ struct sockaddr_in sender;
-+} DUDPState;
-+
-+// Called when packet is received
-+static void dudp_send (void *opaque) {
-+ DUDPState *s=opaque;
-+ uint8_t buf[4096];
-+ int size;
-+
-+ //printf ("dudp_send() ");
-+ size = recvfrom(s->rfd,buf,sizeof(buf),0,NULL,NULL);
-+ //printf ("Receiving packet size=%i\n",size);
-+ if (size > 0) {
-+ qemu_send_packet(s->vc, buf, size);
-+ }
-+}
-+
-+// Called when packet is sended
-+static ssize_t dudp_receive(VLANClientState *vc, const uint8_t *buf, size_t size) {
-+ DUDPState *s = vc->opaque;
-+ int res;
-+
-+ //printf ("dusp_receive(). Sending packet size=%i)\n", (int)size);
-+ res = sendto(s->rfd, buf, size, 0, (struct sockaddr *)&s->sender, sizeof (s->sender));
-+ return res;
-+}
-+
-+static int net_dudp_init(VLANState *vlan, const char *model, const char *name,
-+ int lport, char *rhost, int rport) {
-+ DUDPState *s;
-+ struct sockaddr_in receiver;
-+ int res;
-+
-+ s=qemu_mallocz(sizeof(DUDPState));
-+ if (!s) {
-+ return -1;
-+ }
-+
-+ printf ("\nnet_dudp_init(%i,%s,%i)\n", lport, rhost, rport);
-+
-+ s->rfd=socket(AF_INET,SOCK_DGRAM,IPPROTO_UDP);
-+
-+ receiver.sin_family=AF_INET;
-+ receiver.sin_addr.s_addr=INADDR_ANY;
-+ receiver.sin_port=htons(lport);
-+ res=bind(s->rfd, (struct sockaddr *)&receiver, sizeof (receiver));
-+
-+ if (res == -1) {
-+ fprintf (stderr,"bind error:%s\n",strerror(errno));
-+ return res;
-+ }
-+
-+ memset ((char*)&s->sender,sizeof(s->sender),0);
-+ s->sender.sin_family=AF_INET;
-+ s->sender.sin_port=htons(rport);
-+ inet_aton(rhost,&s->sender.sin_addr);
-+
-+ s->vc= qemu_new_vlan_client(vlan, model, name, NULL, dudp_receive, NULL, NULL, s);
-+
-+ qemu_set_fd_handler(s->rfd, dudp_send, NULL, s);
-+ snprintf(s->vc->info_str, sizeof(s->vc->info_str),"dcap: %i->%s:%i",lport,rhost,rport);
-+ return 0;
-+}
-+
- typedef struct DumpState {
- VLANClientState *pcap_vc;
- int fd;
-@@ -3085,7 +3152,29 @@ int net_client_init(Monitor *mon, const
- ret = net_vde_init(vlan, device, name, vde_sock, vde_port, vde_group, vde_mode);
- } else
- #endif
-- if (!strcmp(device, "dump")) {
-+ if (!strcmp(device, "udp")) {
-+ int sport,dport;
-+ char daddr[128];
-+
-+ vlan->nb_host_devs++;
-+ if (get_param_value(daddr, sizeof(daddr), "dport",p)<=0) {
-+ printf ("must specify destination address with daddr=\n");
-+ exit(0);
-+ }
-+
-+ dport=atoi(daddr);
-+ if (get_param_value(daddr, sizeof(daddr), "sport",p)<=0) {
-+ printf ("must specify destination address with saddr=\n");
-+ exit(0);
-+ }
-+ sport=atoi(daddr);
-+ if (get_param_value(daddr, sizeof(daddr), "daddr",p)<=0) {
-+ printf ("must specify destination address with daddr=\n");
-+ exit(0);
-+ }
-+
-+ ret = net_dudp_init(vlan, device, name, sport, daddr, dport);
-+ } else if (!strcmp(device, "dump")) {
- int len = 65536;
-
- if (get_param_value(buf, sizeof(buf), "len", p) > 0) {
-diff -uprB qemu-0.11.0/qemu-options.hx qemu-0.11.0.patched/qemu-options.hx
---- qemu-0.11.0/qemu-options.hx
-+++ qemu-0.11.0.patched/qemu-options.hx
-@@ -782,6 +782,8 @@ DEF("net", HAS_ARG, QEMU_OPTION_net,
- " connect the user mode network stack to VLAN 'n', configure its\n"
- " DHCP server and enabled optional services\n"
- #endif
-+ "-net udp[,vlan=n],sport=sport,dport=dport,daddr=host\n"
-+ " connect the vlan 'n' to a udp host (for dynamips/pemu/GNS3)\n"
- #ifdef _WIN32
- "-net tap[,vlan=n][,name=str],ifname=name\n"
- " connect the host TAP network interface to VLAN 'n'\n"
diff --git a/emulators/qemu/files/patch-0001-qcow2-Bring-synchronous-read-write-back-to-life b/emulators/qemu/files/patch-0001-qcow2-Bring-synchronous-read-write-back-to-life
deleted file mode 100644
index b4ef8ae45b8f..000000000000
--- a/emulators/qemu/files/patch-0001-qcow2-Bring-synchronous-read-write-back-to-life
+++ /dev/null
@@ -1,144 +0,0 @@
-From 08fd2f30bd3ee5d04596da8293689af4d4f7eb6c Mon Sep 17 00:00:00 2001
-From: Kevin Wolf <kwolf@redhat.com>
-Date: Thu, 3 Dec 2009 10:28:44 +0100
-Subject: [PATCH] qcow2: Bring synchronous read/write back to life
-
-When the synchronous read and write functions were dropped, they were replaced
-by generic emulation functions. Unfortunately, these emulation functions don't
-provide the same semantics as the original functions did.
-
-The original bdrv_read would mean that we read some data synchronously and that
-we won't be interrupted during this read. The latter assumption is no longer
-true with the emulation function which needs to use qemu_aio_poll and therefore
-allows the callback of any other concurrent AIO request to be run during the
-read. Which in turn means that (meta)data read earlier could have changed and
-be invalid now. qcow2 is not prepared to work in this way and it's just scary
-how many places there are where other requests could run.
-
-I'm not sure yet where exactly it breaks, but you'll see breakage with virtio
-on qcow2 with a backing file. Providing synchronous functions again fixes the
-problem for me.
-
-Patchworks-ID: 35437
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
-(cherry picked from commit ef845c3bf421290153154635dc18eaa677cecb43)
-
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
----
- block/qcow2-cluster.c | 6 ++--
- block/qcow2.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++-
- block/qcow2.h | 3 ++
- 3 files changed, 55 insertions(+), 5 deletions(-)
-
-diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c
-index d4631c3..4d0ce16 100644
---- a/block/qcow2-cluster.c
-+++ b/block/qcow2-cluster.c
-@@ -306,8 +306,8 @@ void qcow2_encrypt_sectors(BDRVQcowState *s, int64_t sector_num,
- }
-
-
--static int qcow_read(BlockDriverState *bs, int64_t sector_num,
-- uint8_t *buf, int nb_sectors)
-+int qcow2_read(BlockDriverState *bs, int64_t sector_num, uint8_t *buf,
-+ int nb_sectors)
- {
- BDRVQcowState *s = bs->opaque;
- int ret, index_in_cluster, n, n1;
-@@ -358,7 +358,7 @@ static int copy_sectors(BlockDriverState *bs, uint64_t start_sect,
- n = n_end - n_start;
- if (n <= 0)
- return 0;
-- ret = qcow_read(bs, start_sect + n_start, s->cluster_data, n);
-+ ret = qcow2_read(bs, start_sect + n_start, s->cluster_data, n);
- if (ret < 0)
- return ret;
- if (s->crypt_method) {
-diff --git a/block/qcow2.c b/block/qcow2.c
-index dd32ea2..ced257e 100644
---- a/block/qcow2.c
-+++ b/block/qcow2.c
-@@ -855,6 +855,51 @@ static int qcow_make_empty(BlockDriverState *bs)
- return 0;
- }
-
-+static int qcow2_write(BlockDriverState *bs, int64_t sector_num,
-+ const uint8_t *buf, int nb_sectors)
-+{
-+ BDRVQcowState *s = bs->opaque;
-+ int ret, index_in_cluster, n;
-+ uint64_t cluster_offset;
-+ int n_end;
-+ QCowL2Meta l2meta;
-+
-+ while (nb_sectors > 0) {
-+ memset(&l2meta, 0, sizeof(l2meta));
-+
-+ index_in_cluster = sector_num & (s->cluster_sectors - 1);
-+ n_end = index_in_cluster + nb_sectors;
-+ if (s->crypt_method &&
-+ n_end > QCOW_MAX_CRYPT_CLUSTERS * s->cluster_sectors)
-+ n_end = QCOW_MAX_CRYPT_CLUSTERS * s->cluster_sectors;
-+ cluster_offset = qcow2_alloc_cluster_offset(bs, sector_num << 9,
-+ index_in_cluster,
-+ n_end, &n, &l2meta);
-+ if (!cluster_offset)
-+ return -1;
-+ if (s->crypt_method) {
-+ qcow2_encrypt_sectors(s, sector_num, s->cluster_data, buf, n, 1,
-+ &s->aes_encrypt_key);
-+ ret = bdrv_pwrite(s->hd, cluster_offset + index_in_cluster * 512,
-+ s->cluster_data, n * 512);
-+ } else {
-+ ret = bdrv_pwrite(s->hd, cluster_offset + index_in_cluster * 512, buf, n * 512);
-+ }
-+ if (ret != n * 512 || qcow2_alloc_cluster_link_l2(bs, cluster_offset, &l2meta) < 0) {
-+ qcow2_free_any_clusters(bs, cluster_offset, l2meta.nb_clusters);
-+ return -1;
-+ }
-+ nb_sectors -= n;
-+ sector_num += n;
-+ buf += n * 512;
-+ if (l2meta.nb_clusters != 0) {
-+ LIST_REMOVE(&l2meta, next_in_flight);
-+ }
-+ }
-+ s->cluster_cache_offset = -1; /* disable compressed cache */
-+ return 0;
-+}
-+
- /* XXX: put compressed sectors first, then all the cluster aligned
- tables to avoid losing bytes in alignment */
- static int qcow_write_compressed(BlockDriverState *bs, int64_t sector_num,
-@@ -1037,8 +1082,10 @@ static BlockDriver bdrv_qcow2 = {
- .bdrv_set_key = qcow_set_key,
- .bdrv_make_empty = qcow_make_empty,
-
-- .bdrv_aio_readv = qcow_aio_readv,
-- .bdrv_aio_writev = qcow_aio_writev,
-+ .bdrv_read = qcow2_read,
-+ .bdrv_write = qcow2_write,
-+ .bdrv_aio_readv = qcow_aio_readv,
-+ .bdrv_aio_writev = qcow_aio_writev,
- .bdrv_write_compressed = qcow_write_compressed,
-
- .bdrv_snapshot_create = qcow2_snapshot_create,
-diff --git a/block/qcow2.h b/block/qcow2.h
-index 965a2f4..b41aa63 100644
---- a/block/qcow2.h
-+++ b/block/qcow2.h
-@@ -202,6 +202,9 @@ uint64_t qcow2_alloc_compressed_cluster_offset(BlockDriverState *bs,
- int qcow2_alloc_cluster_link_l2(BlockDriverState *bs, uint64_t cluster_offset,
- QCowL2Meta *m);
-
-+int qcow2_read(BlockDriverState *bs, int64_t sector_num, uint8_t *buf,
-+ int nb_sectors);
-+
- /* qcow2-snapshot.c functions */
- int qcow2_snapshot_create(BlockDriverState *bs, QEMUSnapshotInfo *sn_info);
- int qcow2_snapshot_goto(BlockDriverState *bs, const char *snapshot_id);
---
-1.6.5.2
-
diff --git a/emulators/qemu/files/patch-90_security b/emulators/qemu/files/patch-90_security
deleted file mode 100644
index 4df76e9b5e39..000000000000
--- a/emulators/qemu/files/patch-90_security
+++ /dev/null
@@ -1,93 +0,0 @@
-Index: qemu-0.8.2/hw/dma.c
-===================================================================
---- qemu-0.8.2.orig/hw/dma.c 2006-07-22 20:23:34.000000000 +0300
-+++ qemu-0.8.2/hw/dma.c 2007-04-20 06:05:59.000000000 +0300
-@@ -340,9 +340,11 @@ static void channel_run (int ncont, int
- #endif
-
- r = dma_controllers[ncont].regs + ichan;
-- n = r->transfer_handler (r->opaque, ichan + (ncont << 2),
-- r->now[COUNT], (r->base[COUNT] + 1) << ncont);
-- r->now[COUNT] = n;
-+ if (r->transfer_handler) {
-+ n = r->transfer_handler (r->opaque, ichan + (ncont << 2),
-+ r->now[COUNT], (r->base[COUNT] + 1) << ncont);
-+ r->now[COUNT] = n;
-+ }
- ldebug ("dma_pos %d size %d\n", n, (r->base[COUNT] + 1) << ncont);
- }
-
-Index: qemu/hw/fdc.c
-@@ -1322,7 +1322,8 @@
- fd_sector(cur_drv));
- return 0;
- }
-- if (bdrv_read(cur_drv->bs, fd_sector(cur_drv), fdctrl->fifo, 1) < 0) {
-+ if (cur_drv->bs == NULL ||
-+ bdrv_read(cur_drv->bs, fd_sector(cur_drv), fdctrl->fifo, 1) < 0) {
- FLOPPY_DPRINTF("error getting sector %d\n",
- fd_sector(cur_drv));
- /* Sure, image size is too small... */
-@@ -1776,7 +1777,8 @@
- if (pos == FD_SECTOR_LEN - 1 ||
- fdctrl->data_pos == fdctrl->data_len) {
- cur_drv = get_cur_drv(fdctrl);
-- if (bdrv_write(cur_drv->bs, fd_sector(cur_drv), fdctrl->fifo, 1) < 0) {
-+ if (cur_drv->bs == NULL ||
-+ bdrv_write(cur_drv->bs, fd_sector(cur_drv), fdctrl->fifo, 1) < 0) {
- FLOPPY_ERROR("writing sector %d\n", fd_sector(cur_drv));
- return;
- }
-Index: qemu-0.8.2/hw/pc.c
-===================================================================
---- qemu-0.8.2.orig/hw/pc.c 2007-04-20 06:05:58.000000000 +0300
-+++ qemu-0.8.2/hw/pc.c 2007-04-20 06:05:59.000000000 +0300
-@@ -312,7 +312,8 @@ void bochs_bios_write(void *opaque, uint
- case 0x400:
- case 0x401:
- fprintf(stderr, "BIOS panic at rombios.c, line %d\n", val);
-- exit(1);
-+ /* according to documentation, these can be safely ignored */
-+ break;
- case 0x402:
- case 0x403:
- #ifdef DEBUG_BIOS
-@@ -335,8 +336,9 @@ void bochs_bios_write(void *opaque, uint
- /* LGPL'ed VGA BIOS messages */
- case 0x501:
- case 0x502:
-+ /* according to documentation, these can be safely ignored */
- fprintf(stderr, "VGA BIOS panic, line %d\n", val);
-- exit(1);
-+ break;
- case 0x500:
- case 0x503:
- #ifdef DEBUG_BIOS
-Index: qemu-0.8.2/hw/sb16.c
-===================================================================
---- qemu-0.8.2.orig/hw/sb16.c 2006-07-22 20:23:34.000000000 +0300
-+++ qemu-0.8.2/hw/sb16.c 2007-04-20 06:05:59.000000000 +0300
-@@ -1235,8 +1235,10 @@ static int SB_read_DMA (void *opaque, in
- s->block_size);
- #endif
-
-- while (s->left_till_irq <= 0) {
-- s->left_till_irq = s->block_size + s->left_till_irq;
-+ if (s->block_size) {
-+ while (s->left_till_irq <= 0) {
-+ s->left_till_irq = s->block_size + s->left_till_irq;
-+ }
- }
-
- return dma_pos;
-Index: qemu/hw/i8259.c
-@@ -302,7 +302,8 @@
- s->init4 = val & 1;
- s->single_mode = val & 2;
- if (val & 0x08)
-- hw_error("level sensitive irq not supported");
-+ /* hw_error("level sensitive irq not supported"); */
-+ return;
- } else if (val & 0x08) {
- if (val & 0x04)
- s->poll = 1;
diff --git a/emulators/qemu/files/patch-CVE-2015-3209 b/emulators/qemu/files/patch-CVE-2015-3209
deleted file mode 100644
index 4eb1d6093827..000000000000
--- a/emulators/qemu/files/patch-CVE-2015-3209
+++ /dev/null
@@ -1,82 +0,0 @@
---- a/hw/pcnet.c
-+++ b/hw/pcnet.c
-@@ -1263,7 +1263,7 @@ static void pcnet_transmit(PCNetState *s
- target_phys_addr_t xmit_cxda = 0;
- int count = CSR_XMTRL(s)-1;
- int add_crc = 0;
--
-+ int bcnt;
- s->xmit_pos = -1;
-
- if (!CSR_TXON(s)) {
-@@ -1289,34 +1289,47 @@ static void pcnet_transmit(PCNetState *s
- if (BCR_SWSTYLE(s) != 1)
- add_crc = GET_FIELD(tmd.status, TMDS, ADDFCS);
- }
-+
-+ if (s->xmit_pos < 0) {
-+ goto txdone;
-+ }
-+
-+ bcnt = 4096 - GET_FIELD(tmd.length, TMDL, BCNT);
-+
-+ /* if multi-tmd packet outsizes s->buffer then skip it silently.
-+ Note: this is not what real hw does */
-+ if (s->xmit_pos + bcnt > sizeof(s->buffer)) {
-+ s->xmit_pos = -1;
-+ goto txdone;
-+ }
-+
-+ s->phys_mem_read(s->dma_opaque, PHYSADDR(s, tmd.tbadr),
-+ s->buffer + s->xmit_pos, bcnt, CSR_BSWP(s));
-+ s->xmit_pos += bcnt;
-+
- if (!GET_FIELD(tmd.status, TMDS, ENP)) {
-- int bcnt = 4096 - GET_FIELD(tmd.length, TMDL, BCNT);
-- s->phys_mem_read(s->dma_opaque, PHYSADDR(s, tmd.tbadr),
-- s->buffer + s->xmit_pos, bcnt, CSR_BSWP(s));
-- s->xmit_pos += bcnt;
-- } else if (s->xmit_pos >= 0) {
-- int bcnt = 4096 - GET_FIELD(tmd.length, TMDL, BCNT);
-- s->phys_mem_read(s->dma_opaque, PHYSADDR(s, tmd.tbadr),
-- s->buffer + s->xmit_pos, bcnt, CSR_BSWP(s));
-- s->xmit_pos += bcnt;
-+ goto txdone;
-+ }
- #ifdef PCNET_DEBUG
-- printf("pcnet_transmit size=%d\n", s->xmit_pos);
-+ printf("pcnet_transmit size=%d\n", s->xmit_pos);
- #endif
-- if (CSR_LOOP(s)) {
-- if (BCR_SWSTYLE(s) == 1)
-- add_crc = !GET_FIELD(tmd.status, TMDS, NOFCS);
-- s->looptest = add_crc ? PCNET_LOOPTEST_CRC : PCNET_LOOPTEST_NOCRC;
-- pcnet_receive(s->vc, s->buffer, s->xmit_pos);
-- s->looptest = 0;
-- } else
-- if (s->vc)
-- qemu_send_packet(s->vc, s->buffer, s->xmit_pos);
--
-- s->csr[0] &= ~0x0008; /* clear TDMD */
-- s->csr[4] |= 0x0004; /* set TXSTRT */
-- s->xmit_pos = -1;
-+ if (CSR_LOOP(s)) {
-+ if (BCR_SWSTYLE(s) == 1)
-+ add_crc = !GET_FIELD(tmd.status, TMDS, NOFCS);
-+ s->looptest = add_crc ? PCNET_LOOPTEST_CRC : PCNET_LOOPTEST_NOCRC;
-+ pcnet_receive(s->vc, s->buffer, s->xmit_pos);
-+ s->looptest = 0;
-+ } else {
-+ if (s->vc) {
-+ qemu_send_packet(s->vc, s->buffer, s->xmit_pos);
-+ }
- }
-
-+ s->csr[0] &= ~0x0008; /* clear TDMD */
-+ s->csr[4] |= 0x0004; /* set TXSTRT */
-+ s->xmit_pos = -1;
-+
-+ txdone:
- SET_FIELD(&tmd.status, TMDS, OWN, 0);
- TMDSTORE(&tmd, PHYSADDR(s,CSR_CXDA(s)));
- if (!CSR_TOKINTD(s) || (CSR_LTINTEN(s) && GET_FIELD(tmd.status, TMDS, LTINT)))
diff --git a/emulators/qemu/files/patch-CVE-2015-3456 b/emulators/qemu/files/patch-CVE-2015-3456
deleted file mode 100644
index 3ea061ea2056..000000000000
--- a/emulators/qemu/files/patch-CVE-2015-3456
+++ /dev/null
@@ -1,44 +0,0 @@
---- a/hw/fdc.c
-+++ b/hw/fdc.c
-@@ -1324,7 +1324,7 @@ static uint32_t fdctrl_read_data (fdctrl
- {
- fdrive_t *cur_drv;
- uint32_t retval = 0;
-- int pos;
-+ uint32_t pos;
-
- cur_drv = get_cur_drv(fdctrl);
- fdctrl->dsr &= ~FD_DSR_PWRDOWN;
-@@ -1333,8 +1333,8 @@ static uint32_t fdctrl_read_data (fdctrl
- return 0;
- }
- pos = fdctrl->data_pos;
-+ pos %= FD_SECTOR_LEN;
- if (fdctrl->msr & FD_MSR_NONDMA) {
-- pos %= FD_SECTOR_LEN;
- if (pos == 0) {
- if (fdctrl->data_pos != 0)
- if (!fdctrl_seek_to_next_sect(fdctrl, cur_drv)) {
-@@ -1680,8 +1680,11 @@ static void fdctrl_handle_option (fdctrl
- static void fdctrl_handle_drive_specification_command (fdctrl_t *fdctrl, int direction)
- {
- fdrive_t *cur_drv = get_cur_drv(fdctrl);
-+ uint32_t pos;
-+
-+ pos = fdctrl->data_pos - 1;
-+ pos %= FD_SECTOR_LEN;
--
-- if (fdctrl->fifo[fdctrl->data_pos - 1] & 0x80) {
-+ if (fdctrl->fifo[pos] & 0x80) {
- /* Command parameters done */
- if (fdctrl->fifo[fdctrl->data_pos - 1] & 0x40) {
- fdctrl->fifo[0] = fdctrl->fifo[1];
-@@ -1778,7 +1782,7 @@ static uint8_t command_to_handler[256];
- static void fdctrl_write_data (fdctrl_t *fdctrl, uint32_t value)
- {
- fdrive_t *cur_drv;
-- int pos;
-+ uint32_t pos;
-
- /* Reset mode */
- if (!(fdctrl->dor & FD_DOR_nRESET)) {
diff --git a/emulators/qemu/files/patch-Makefile b/emulators/qemu/files/patch-Makefile
index ba61a5f20acd..74d2971e0d2a 100644
--- a/emulators/qemu/files/patch-Makefile
+++ b/emulators/qemu/files/patch-Makefile
@@ -1,47 +1,25 @@
-Index: qemu/Makefile
-@@ -25,7 +25,11 @@
- LDFLAGS += -static
- endif
+--- Makefile.orig 2015-11-03 20:01:30 UTC
++++ Makefile
+@@ -88,7 +88,11 @@ LIBS+=-lz $(LIBS_TOOLS)
+ HELPERS-$(CONFIG_LINUX) = qemu-bridge-helper$(EXESUF)
+
ifdef BUILD_DOCS
+ifdef NOPORTDOCS
+DOCS=qemu.1 qemu-img.1 qemu-nbd.8
+else
- DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1 qemu-nbd.8
+ DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1 qemu-nbd.8 qmp-commands.txt
+endif
- else
- DOCS=
- endif
-@@ -190,6 +190,8 @@
- obj-$(CONFIG_XEN) += xen_backend.o xen_devconfig.o
- obj-$(CONFIG_XEN) += xen_console.o xenfb.o xen_disk.o xen_nic.o
-
-+QEMU_CFLAGS+=$(CURL_CFLAGS)
-+
- LIBS+=$(CURL_LIBS)
-
- cocoa.o: cocoa.m
-@@ -260,13 +264,13 @@
+ ifdef CONFIG_LINUX
+ DOCS+=kvm_stat.1
endif
+@@ -390,8 +394,10 @@ endif
install-doc: $(DOCS)
+ $(INSTALL_DIR) "$(DESTDIR)$(qemu_docdir)"
+ifndef NOPORTDOCS
- $(INSTALL_DIR) "$(DESTDIR)$(docdir)"
- $(INSTALL_DATA) qemu-doc.html qemu-tech.html "$(DESTDIR)$(docdir)"
+ $(INSTALL_DATA) qemu-doc.html qemu-tech.html "$(DESTDIR)$(qemu_docdir)"
+ $(INSTALL_DATA) qmp-commands.txt "$(DESTDIR)$(qemu_docdir)"
+endif
- ifndef CONFIG_WIN32
+ ifdef CONFIG_POSIX
$(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)
-@@ -321,7 +321,7 @@ cscope:
-
- # documentation
- %.html: %.texi
-- $(call quiet-command,texi2html -I=. -monolithic -number $<," GEN $@")
-+ $(call quiet-command,texi2html -I=. -monolithic --number-sections $<," GEN $@")
-
- %.info: %.texi
- $(call quiet-command,makeinfo -I . $< -o $@," GEN $@")
+ $(INSTALL_DATA) qemu.1 "$(DESTDIR)$(mandir)/man1"
diff --git a/emulators/qemu/files/patch-configure b/emulators/qemu/files/patch-configure
index 23f4f37da2fb..f08019d7b3ce 100644
--- a/emulators/qemu/files/patch-configure
+++ b/emulators/qemu/files/patch-configure
@@ -1,33 +1,73 @@
-Index: qemu/configure
-@@ -1154,8 +1154,9 @@
- #include <curl/curl.h>
- int main(void) { return curl_easy_init(); }
- EOF
-+ curl_cflags=`curl-config --cflags 2>/dev/null`
- curl_libs=`curl-config --libs 2>/dev/null`
-- if $cc $ARCH_CFLAGS $curl_libs -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
-+ if $cc $ARCH_CFLAGS $curl_cflags $curl_libs -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
- curl=yes
- fi
- fi # test "$curl"
-@@ -1395,9 +1395,9 @@
+--- configure.orig 2015-11-03 20:01:31 UTC
++++ configure
+@@ -273,7 +273,7 @@ DSOSUF=".so"
+ LDFLAGS_SHARED="-shared"
+ modules="no"
+ prefix="/usr/local"
+-mandir="\${prefix}/share/man"
++mandir="\${prefix}/man"
+ datadir="\${prefix}/share"
+ qemu_docdir="\${prefix}/share/doc/qemu"
+ bindir="\${prefix}/bin"
+@@ -2102,7 +2102,7 @@ if test "$gtk" != "no"; then
+ gtk_cflags="$gtk_cflags $x11_cflags"
+ gtk_libs="$gtk_libs $x11_libs"
+ fi
+- libs_softmmu="$gtk_libs $libs_softmmu"
++ libs_softmmu="$gtk_libs -lintl $libs_softmmu"
+ gtk="yes"
+ elif test "$gtk" = "yes"; then
+ feature_not_found "gtk" "Install gtk2 or gtk3 devel"
+@@ -3643,15 +3643,18 @@ if compile_prog "" "" ; then
fi
# Check if tools are available to build documentation.
--if test "$build_docs" = "yes" -a \( ! -x "`which texi2html 2>/dev/null`" -o ! -x "`which pod2man 2>/dev/null`" \) ; then
-- build_docs="no"
--fi
-+#if test "$build_docs" = "yes" -a \( ! -x "`which texi2html 2>/dev/null`" -o ! -x "`which pod2man 2>/dev/null`" \) ; then
-+# build_docs="no"
++#if test "$docs" != "no" ; then
++# if has makeinfo && has pod2man; then
++# docs=yes
++# else
++# if test "$docs" = "yes" ; then
++# feature_not_found "docs" "Install texinfo and Perl/perl-podlators"
++# fi
++# docs=no
++# fi
+#fi
+ if test "$docs" != "no" ; then
+- if has makeinfo && has pod2man; then
+- docs=yes
+- else
+- if test "$docs" = "yes" ; then
+- feature_not_found "docs" "Install texinfo and Perl/perl-podlators"
+- fi
+- docs=no
+- fi
++ docs=yes
+ fi
+
+ # Search for bswap_32 function
+@@ -3793,6 +3796,17 @@ fi
- ##########################################
- # Do we need librt
-@@ -1760,6 +1761,7 @@
- echo "CONFIG_CURL=y" >> $config_host_mak
- echo "CURL_LIBS=$curl_libs" >> $config_host_mak
- echo "#define CONFIG_CURL 1" >> $config_host_h
-+ echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak
+ # check for libusb
+ if test "$libusb" != "no" ; then
++ cat > $TMPC << EOF
++#include <libusb.h>
++
++int main(void) { return libusb_get_port_path(NULL, NULL, NULL, 0); }
++EOF
++ if compile_prog "-Werror" "-lusb -pthread" ; then
++ libusb="yes"
++ libusb_cflags=""
++ libusb_libs=-lusb
++ libs_softmmu="$libs_softmmu $libusb_libs"
++ else
+ if $pkg_config --atleast-version=1.0.13 libusb-1.0; then
+ libusb="yes"
+ libusb_cflags=$($pkg_config --cflags libusb-1.0)
+@@ -3805,6 +3819,7 @@ if test "$libusb" != "no" ; then
+ fi
+ libusb="no"
+ fi
++ fi
fi
- if test "$brlapi" = "yes" ; then
- echo "CONFIG_BRLAPI=y" >> $config_host_mak
+
+ # check for usbredirparser for usb network redirection support
diff --git a/emulators/qemu/files/patch-disas_libvixl_a64_disasm-a64.cc b/emulators/qemu/files/patch-disas_libvixl_a64_disasm-a64.cc
new file mode 100644
index 000000000000..3544f6d34501
--- /dev/null
+++ b/emulators/qemu/files/patch-disas_libvixl_a64_disasm-a64.cc
@@ -0,0 +1,11 @@
+--- disas/libvixl/a64/disasm-a64.cc.orig 2015-11-03 20:01:31 UTC
++++ disas/libvixl/a64/disasm-a64.cc
+@@ -1362,7 +1362,7 @@ void Disassembler::AppendPCRelativeOffse
+ int64_t offset) {
+ USE(instr);
+ char sign = (offset < 0) ? '-' : '+';
+- AppendToOutput("#%c0x%" PRIx64, sign, std::abs(offset));
++ AppendToOutput("#%c0x%" PRIx64, sign, offset < 0 ? -offset : offset);
+ }
+
+
diff --git a/emulators/qemu/files/patch-fbsd b/emulators/qemu/files/patch-fbsd
deleted file mode 100644
index 75cded3c7cae..000000000000
--- a/emulators/qemu/files/patch-fbsd
+++ /dev/null
@@ -1,173 +0,0 @@
-Index: qemu/Makefile
-@@ -45,7 +45,10 @@
- LIBS+=-lwinmm -lws2_32 -liphlpapi
- endif
-
--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) )
-
- 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 *.d *.a $(TOOLS) TAGS cscope.* *.pod *~ */*~
- rm -f slirp/*.o slirp/*.d audio/*.o audio/*.d block/*.o block/*.d
-Index: qemu/Makefile.target
-@@ -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
-
- 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
-@@ -6,10 +6,15 @@
- #include <fenv.h>
- #endif
-
-+#if defined(__FreeBSD__) && __FreeBSD_version < 500000
-+#include <ieeefp.h>
-+#endif
-+
- void set_float_rounding_mode(int val STATUS_PARAM)
- {
- STATUS(float_rounding_mode) = val;
--#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)
- fpsetround(val);
- #elif defined(__arm__)
-@@ -26,7 +31,7 @@
- }
- #endif
-
--#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))
-Index: qemu/fpu/softfloat-native.h
-@@ -1,8 +1,28 @@
- /* Native implementation of soft float functions */
- #include <math.h>
-
--#if (defined(HOST_BSD) && !defined(__APPLE__)) || defined(HOST_SOLARIS)
-+#ifdef __FreeBSD__
-+#include <osreldate.h>
-+long double fabsl(long double x);
-+long double remainderl(long double x, long double y);
-+long double sqrtl(long double x);
-+long double rintl(long double x);
-+long lrintl(long double x);
-+long long llrintl(long double x);
-+#endif
-+
-+#if (defined(HOST_BSD) && !defined(__APPLE__) && \
-+ (!defined(__FreeBSD__) || __FreeBSD_version < 500000)) || \
-+ defined(HOST_SOLARIS)
- #include <ieeefp.h>
-+#if defined(__FreeBSD__)
-+#define isgreater(x, y) __builtin_isgreater((x), (y))
-+#define isgreaterequal(x, y) __builtin_isgreaterequal((x), (y))
-+#define isless(x, y) __builtin_isless((x), (y))
-+#define islessequal(x, y) __builtin_islessequal((x), (y))
-+#define islessgreater(x, y) __builtin_islessgreater((x), (y))
-+#define isunordered(x, y) __builtin_isunordered((x), (y))
-+#endif
- #define fabsf(f) ((float)fabs(f))
- #else
- #include <fenv.h>
-@@ -109,6 +109,8 @@
- | Software IEC/IEEE floating-point rounding mode.
- *----------------------------------------------------------------------------*/
--#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(HOST_BSD)
-+#if (defined(__i386__) || defined(__x86_64__)) && \
-+ (!defined(HOST_BSD) || defined(__FreeBSD__))
- #define FLOATX80
- #endif
- #endif /* !CONFIG_SOFTFLOAT */
-Index: qemu/target-ppc/op_helper.c
-@@ -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
- #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")
- OUTPUT_ARCH(i386:x86-64)
- ENTRY(_start)
--SEARCH_DIR("/lib64"); SEARCH_DIR("/usr/lib64"); SEARCH_DIR("/usr/local/lib64");
-+SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib"); SEARCH_DIR("/usr/local/lib");
- 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 :
- {
diff --git a/emulators/qemu/files/patch-hw-eepro100.c b/emulators/qemu/files/patch-hw-eepro100.c
deleted file mode 100644
index 79337757bde1..000000000000
--- a/emulators/qemu/files/patch-hw-eepro100.c
+++ /dev/null
@@ -1,50 +0,0 @@
-Index: qemu/hw/eepro100.c
-@@ -729,6 +729,7 @@
- logout
- ("TBD (simplified mode): buffer address 0x%08x, size 0x%04x\n",
- tx_buffer_address, tx_buffer_size);
-+ assert(size + tx_buffer_size <= sizeof(buf));
- cpu_physical_memory_read(tx_buffer_address, &buf[size],
- tx_buffer_size);
- size += tx_buffer_size;
-@@ -749,9 +750,13 @@
- logout
- ("TBD (extended mode): buffer address 0x%08x, size 0x%04x\n",
- tx_buffer_address, tx_buffer_size);
-- cpu_physical_memory_read(tx_buffer_address, &buf[size],
-- tx_buffer_size);
-- size += tx_buffer_size;
-+ if (size + tx_buffer_size > sizeof(buf)) {
-+ logout("bad extended TCB with size 0x%04x\n", tx_buffer_size);
-+ } else {
-+ cpu_physical_memory_read(tx_buffer_address, &buf[size],
-+ tx_buffer_size);
-+ size += tx_buffer_size;
-+ }
- if (tx_buffer_el & 1) {
- break;
- }
-@@ -766,14 +771,20 @@
- logout
- ("TBD (flexible mode): buffer address 0x%08x, size 0x%04x\n",
- tx_buffer_address, tx_buffer_size);
-- cpu_physical_memory_read(tx_buffer_address, &buf[size],
-- tx_buffer_size);
-- size += tx_buffer_size;
-+ if (size + tx_buffer_size > sizeof(buf)) {
-+ logout("bad flexible TCB with size 0x%04x\n", tx_buffer_size);
-+ } else {
-+ cpu_physical_memory_read(tx_buffer_address, &buf[size],
-+ tx_buffer_size);
-+ size += tx_buffer_size;
-+ }
- if (tx_buffer_el & 1) {
- break;
- }
- }
- }
-+ logout("%p sending frame, len=%d,%s\n", s, size, nic_dump(buf, size));
-+ assert(size <= sizeof(buf));
- qemu_send_packet(s->vc, buf, size);
- s->statistics.tx_good_frames++;
- /* Transmit with bad status would raise an CX/TNO interrupt.
diff --git a/emulators/qemu/files/patch-hw-vmware_vga.c b/emulators/qemu/files/patch-hw-vmware_vga.c
deleted file mode 100644
index fb404a749946..000000000000
--- a/emulators/qemu/files/patch-hw-vmware_vga.c
+++ /dev/null
@@ -1,74 +0,0 @@
-Index: qemu/hw/vmware_vga.c
-@@ -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 */
-
- #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);
diff --git a/emulators/qemu/files/patch-include_net_net.h b/emulators/qemu/files/patch-include_net_net.h
new file mode 100644
index 000000000000..95d3b5e33654
--- /dev/null
+++ b/emulators/qemu/files/patch-include_net_net.h
@@ -0,0 +1,13 @@
+--- include/net/net.h.orig 2015-11-03 20:01:34 UTC
++++ include/net/net.h
+@@ -202,8 +202,8 @@ void qmp_netdev_add(QDict *qdict, QObjec
+ int net_hub_id_for_client(NetClientState *nc, int *id);
+ NetClientState *net_hub_port_find(int hub_id);
+
+-#define DEFAULT_NETWORK_SCRIPT "/etc/qemu-ifup"
+-#define DEFAULT_NETWORK_DOWN_SCRIPT "/etc/qemu-ifdown"
++#define DEFAULT_NETWORK_SCRIPT PREFIX "/etc/qemu-ifup"
++#define DEFAULT_NETWORK_DOWN_SCRIPT PREFIX "/etc/qemu-ifdown"
+ #define DEFAULT_BRIDGE_HELPER CONFIG_QEMU_HELPERDIR "/qemu-bridge-helper"
+ #define DEFAULT_BRIDGE_INTERFACE "br0"
+
diff --git a/emulators/qemu/files/patch-include_qemu-common.h b/emulators/qemu/files/patch-include_qemu-common.h
new file mode 100644
index 000000000000..198e5e22c3c7
--- /dev/null
+++ b/emulators/qemu/files/patch-include_qemu-common.h
@@ -0,0 +1,12 @@
+--- include/qemu-common.h.orig 2015-11-03 20:01:34 UTC
++++ include/qemu-common.h
+@@ -568,7 +568,9 @@ void qemu_hexdump(const char *buf, FILE
+ #define VEC_OR(v1, v2) ((v1) | (v2))
+ /* altivec.h may redefine the bool macro as vector type.
+ * Reset it to POSIX semantics. */
++#ifndef __cplusplus
+ #define bool _Bool
++#endif
+ #elif defined __SSE2__
+ #include <emmintrin.h>
+ #define VECTYPE __m128i
diff --git a/emulators/qemu/files/patch-iopl-workaround b/emulators/qemu/files/patch-iopl-workaround
deleted file mode 100644
index b123bd600976..000000000000
--- a/emulators/qemu/files/patch-iopl-workaround
+++ /dev/null
@@ -1,64 +0,0 @@
-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,
diff --git a/emulators/qemu/files/patch-libmath b/emulators/qemu/files/patch-libmath
deleted file mode 100644
index 1591dbedcd42..000000000000
--- a/emulators/qemu/files/patch-libmath
+++ /dev/null
@@ -1,2524 +0,0 @@
-diff -Nru qemu-0.7.0/bsd.orig/Makefile qemu-0.7.0/bsd/Makefile
---- qemu-0.7.0/bsd.orig/Makefile Wed Dec 31 19:00:00 1969
-+++ qemu-0.7.0/bsd/Makefile Fri Apr 29 02:11:27 2005
-@@ -0,0 +1,32 @@
-+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
-+
-+OBJS= ${SRCS:R:S/$/.o/}
-+
-+CFLAGS+= -I.
-+
-+all: libmath.a
-+
-+libmath.a: ${OBJS}
-+ rm -f $@
-+ ${AR} rcs $@ ${OBJS:T}
-+
-+clean:
-+ rm -f ${OBJS:T} libmath.a
-diff -Nru qemu-0.7.0/bsd.orig/amd64/e_atan2l.c qemu-0.7.0/bsd/amd64/e_atan2l.c
---- qemu-0.7.0/bsd.orig/amd64/e_atan2l.c Wed Dec 31 19:00:00 1969
-+++ qemu-0.7.0/bsd/amd64/e_atan2l.c Fri Apr 29 02:11:27 2005
-@@ -0,0 +1,20 @@
-+/*
-+ * Written by J.T. Conklin <jtc@netbsd.org>.
-+ * Public domain.
-+ *
-+ * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
-+ */
-+
-+#include <sysdep.h>
-+
-+long double
-+__ieee754_atan2l (long double y, long double x)
-+{
-+ long double res;
-+
-+ asm ("fpatan" : "=t" (res) : "u" (y), "0" (x) : "st(1)");
-+
-+ return res;
-+}
-+
-+weak_alias(__ieee754_atan2l, atan2l)
-diff -Nru qemu-0.7.0/bsd.orig/amd64/e_logl.S qemu-0.7.0/bsd/amd64/e_logl.S
---- qemu-0.7.0/bsd.orig/amd64/e_logl.S Wed Dec 31 19:00:00 1969
-+++ qemu-0.7.0/bsd/amd64/e_logl.S Fri Apr 29 02:11:27 2005
-@@ -0,0 +1,59 @@
-+/*
-+ * Written by J.T. Conklin <jtc@netbsd.org>.
-+ * Public domain.
-+ *
-+ * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
-+ * Adapted for x86-64 by Andreas Jaeger <aj@suse.de>.
-+ */
-+
-+#include <machine/asm.h>
-+#include <sysdep.h>
-+
-+RCSID("$NetBSD: $")
-+
-+
-+#ifdef __ELF__
-+ .section .rodata
-+#else
-+ .text
-+#endif
-+ .align ALIGNARG(4)
-+ ASM_TYPE_DIRECTIVE(one,@object)
-+one: .double 1.0
-+ ASM_SIZE_DIRECTIVE(one)
-+ /* It is not important that this constant is precise. It is only
-+ a value which is known to be on the safe side for using the
-+ fyl2xp1 instruction. */
-+ ASM_TYPE_DIRECTIVE(limit,@object)
-+limit: .double 0.29
-+ ASM_SIZE_DIRECTIVE(limit)
-+
-+
-+#ifdef PIC
-+#define MO(op) op##(%rip)
-+#else
-+#define MO(op) op
-+#endif
-+
-+ .text
-+ENTRY(__ieee754_logl)
-+ fldln2 // log(2)
-+ fldt 8(%rsp) // x : log(2)
-+ fld %st // x : x : log(2)
-+ fsubl MO(one) // x-1 : x : log(2)
-+ fld %st // x-1 : x-1 : x : log(2)
-+ fabs // |x-1| : x-1 : x : log(2)
-+ fcompl MO(limit) // x-1 : x : log(2)
-+ fnstsw // x-1 : x : log(2)
-+ andb $0x45, %ah
-+ jz 2f
-+ fstp %st(1) // x-1 : log(2)
-+ fyl2xp1 // log(x)
-+ ret
-+
-+2: fstp %st(0) // x : log(2)
-+ fyl2x // log(x)
-+ ret
-+END (__ieee754_logl)
-+
-+weak_alias(__ieee754_logl,logl)
-diff -Nru qemu-0.7.0/bsd.orig/amd64/e_powl.S qemu-0.7.0/bsd/amd64/e_powl.S
---- qemu-0.7.0/bsd.orig/amd64/e_powl.S Wed Dec 31 19:00:00 1969
-+++ qemu-0.7.0/bsd/amd64/e_powl.S Fri Apr 29 02:11:27 2005
-@@ -0,0 +1,341 @@
-+/* ix87 specific implementation of pow function.
-+ Copyright (C) 1996, 1997, 1998, 1999, 2001, 2004 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA. */
-+
-+#include <machine/asm.h>
-+#include <sysdep.h>
-+
-+#ifdef __ELF__
-+ .section .rodata
-+#else
-+ .text
-+#endif
-+
-+ .align ALIGNARG(4)
-+ ASM_TYPE_DIRECTIVE(infinity,@object)
-+inf_zero:
-+infinity:
-+ .byte 0, 0, 0, 0, 0, 0, 0xf0, 0x7f
-+ ASM_SIZE_DIRECTIVE(infinity)
-+ ASM_TYPE_DIRECTIVE(zero,@object)
-+zero: .double 0.0
-+ ASM_SIZE_DIRECTIVE(zero)
-+ ASM_TYPE_DIRECTIVE(minf_mzero,@object)
-+minf_mzero:
-+minfinity:
-+ .byte 0, 0, 0, 0, 0, 0, 0xf0, 0xff
-+mzero:
-+ .byte 0, 0, 0, 0, 0, 0, 0, 0x80
-+ ASM_SIZE_DIRECTIVE(minf_mzero)
-+ ASM_TYPE_DIRECTIVE(one,@object)
-+one: .double 1.0
-+ ASM_SIZE_DIRECTIVE(one)
-+ ASM_TYPE_DIRECTIVE(limit,@object)
-+limit: .double 0.29
-+ ASM_SIZE_DIRECTIVE(limit)
-+ ASM_TYPE_DIRECTIVE(p63,@object)
-+p63:
-+ .byte 0, 0, 0, 0, 0, 0, 0xe0, 0x43
-+ ASM_SIZE_DIRECTIVE(p63)
-+
-+#ifdef PIC
-+#define MO(op) op##(%rip)
-+#else
-+#define MO(op) op
-+#endif
-+
-+ .text
-+ENTRY(__ieee754_powl)
-+ fldt 24(%rsp) // y
-+ fxam
-+
-+
-+ fnstsw
-+ movb %ah, %dl
-+ andb $0x45, %ah
-+ cmpb $0x40, %ah // is y == 0 ?
-+ je 11f
-+
-+ cmpb $0x05, %ah // is y == ±inf ?
-+ je 12f
-+
-+ cmpb $0x01, %ah // is y == NaN ?
-+ je 30f
-+
-+ fldt 8(%rsp) // x : y
-+
-+ fxam
-+ fnstsw
-+ movb %ah, %dh
-+ andb $0x45, %ah
-+ cmpb $0x40, %ah
-+ je 20f // x is ±0
-+
-+ cmpb $0x05, %ah
-+ je 15f // x is ±inf
-+
-+ fxch // y : x
-+
-+ /* fistpll raises invalid exception for |y| >= 1L<<63. */
-+ fldl MO(p63) // 1L<<63 : y : x
-+ fld %st(1) // y : 1L<<63 : y : x
-+ fabs // |y| : 1L<<63 : y : x
-+ fcomip %st(1), %st // 1L<<63 : y : x
-+ fstp %st(0) // y : x
-+ jnc 2f
-+
-+ /* First see whether `y' is a natural number. In this case we
-+ can use a more precise algorithm. */
-+ fld %st // y : y : x
-+ fistpll -8(%rsp) // y : x
-+ fildll -8(%rsp) // int(y) : y : x
-+ fucomip %st(1),%st // y : x
-+ jne 2f
-+
-+ /* OK, we have an integer value for y. */
-+ mov -8(%rsp),%eax
-+ mov -4(%rsp),%edx
-+ orl $0, %edx
-+ fstp %st(0) // x
-+ jns 4f // y >= 0, jump
-+ fdivrl MO(one) // 1/x (now referred to as x)
-+ negl %eax
-+ adcl $0, %edx
-+ negl %edx
-+4: fldl MO(one) // 1 : x
-+ fxch
-+
-+6: shrdl $1, %edx, %eax
-+ jnc 5f
-+ fxch
-+ fmul %st(1) // x : ST*x
-+ fxch
-+5: fmul %st(0), %st // x*x : ST*x
-+ shrl $1, %edx
-+ movl %eax, %ecx
-+ orl %edx, %ecx
-+ jnz 6b
-+ fstp %st(0) // ST*x
-+ ret
-+
-+ /* y is ±NAN */
-+30: fldt 8(%rsp) // x : y
-+ fldl MO(one) // 1.0 : x : y
-+ fucomip %st(1),%st // x : y
-+ je 31f
-+ fxch // y : x
-+31: fstp %st(1)
-+ ret
-+
-+ .align ALIGNARG(4)
-+2: /* y is a real number. */
-+ fxch // x : y
-+ fldl MO(one) // 1.0 : x : y
-+ fld %st(1) // x : 1.0 : x : y
-+ fsub %st(1) // x-1 : 1.0 : x : y
-+ fabs // |x-1| : 1.0 : x : y
-+ fcompl MO(limit) // 1.0 : x : y
-+ fnstsw
-+ fxch // x : 1.0 : y
-+ test $4500,%eax
-+ jz 7f
-+ fsub %st(1) // x-1 : 1.0 : y
-+ fyl2xp1 // log2(x) : y
-+ jmp 8f
-+
-+7: fyl2x // log2(x) : y
-+8: fmul %st(1) // y*log2(x) : y
-+ fxam
-+ fnstsw
-+ andb $0x45, %ah
-+ cmpb $0x05, %ah // is y*log2(x) == ±inf ?
-+ je 28f
-+ fst %st(1) // y*log2(x) : y*log2(x)
-+ frndint // int(y*log2(x)) : y*log2(x)
-+ fsubr %st, %st(1) // int(y*log2(x)) : fract(y*log2(x))
-+ fxch // fract(y*log2(x)) : int(y*log2(x))
-+ f2xm1 // 2^fract(y*log2(x))-1 : int(y*log2(x))
-+ faddl MO(one) // 2^fract(y*log2(x)) : int(y*log2(x))
-+ fscale // 2^fract(y*log2(x))*2^int(y*log2(x)) : int(y*log2(x))
-+ fstp %st(1) // 2^fract(y*log2(x))*2^int(y*log2(x))
-+ ret
-+
-+28: fstp %st(1) // y*log2(x)
-+ fldl MO(one) // 1 : y*log2(x)
-+ fscale // 2^(y*log2(x)) : y*log2(x)
-+ fstp %st(1) // 2^(y*log2(x))
-+ ret
-+
-+ // pow(x,±0) = 1
-+ .align ALIGNARG(4)
-+11: fstp %st(0) // pop y
-+ fldl MO(one)
-+ ret
-+
-+ // y == ±inf
-+ .align ALIGNARG(4)
-+12: fstp %st(0) // pop y
-+ fldt 8(%rsp) // x
-+ fabs
-+ fcompl MO(one) // < 1, == 1, or > 1
-+ fnstsw
-+ andb $0x45, %ah
-+ cmpb $0x45, %ah
-+ je 13f // jump if x is NaN
-+
-+ cmpb $0x40, %ah
-+ je 14f // jump if |x| == 1
-+
-+ shlb $1, %ah
-+ xorb %ah, %dl
-+ andl $2, %edx
-+#ifdef PIC
-+ lea inf_zero(%rip),%rcx
-+ fldl (%rcx, %rdx, 4)
-+#else
-+ fldl inf_zero(,%rdx, 4)
-+#endif
-+ ret
-+
-+ .align ALIGNARG(4)
-+14: fldl MO(one)
-+ ret
-+
-+ .align ALIGNARG(4)
-+13: fldt 8(%rsp) // load x == NaN
-+ ret
-+
-+ .align ALIGNARG(4)
-+ // x is ±inf
-+15: fstp %st(0) // y
-+ testb $2, %dh
-+ jz 16f // jump if x == +inf
-+
-+ // We must find out whether y is an odd integer.
-+ fld %st // y : y
-+ fistpll -8(%rsp) // y
-+ fildll -8(%rsp) // int(y) : y
-+ fucomip %st(1),%st
-+ ffreep %st // <empty>
-+ jne 17f
-+
-+ // OK, the value is an integer, but is it odd?
-+ mov -8(%rsp), %eax
-+ mov -4(%rsp), %edx
-+ andb $1, %al
-+ jz 18f // jump if not odd
-+ // It's an odd integer.
-+ shrl $31, %edx
-+#ifdef PIC
-+ lea minf_mzero(%rip),%rcx
-+ fldl (%rcx, %rdx, 8)
-+#else
-+ fldl minf_mzero(,%rdx, 8)
-+#endif
-+ ret
-+
-+ .align ALIGNARG(4)
-+16: fcompl MO(zero)
-+ fnstsw
-+ shrl $5, %eax
-+ andl $8, %eax
-+#ifdef PIC
-+ lea inf_zero(%rip),%rcx
-+ fldl (%rcx, %rax, 1)
-+#else
-+ fldl inf_zero(,%rax, 1)
-+#endif
-+ ret
-+
-+ .align ALIGNARG(4)
-+17: shll $30, %edx // sign bit for y in right position
-+18: shrl $31, %edx
-+#ifdef PIC
-+ lea inf_zero(%rip),%rcx
-+ fldl (%rcx, %rdx, 8)
-+#else
-+ fldl inf_zero(,%rdx, 8)
-+#endif
-+ ret
-+
-+ .align ALIGNARG(4)
-+ // x is ±0
-+20: fstp %st(0) // y
-+ testb $2, %dl
-+ jz 21f // y > 0
-+
-+ // x is ±0 and y is < 0. We must find out whether y is an odd integer.
-+ testb $2, %dh
-+ jz 25f
-+
-+ fld %st // y : y
-+ fistpll -8(%rsp) // y
-+ fildll -8(%rsp) // int(y) : y
-+ fucomip %st(1),%st
-+ ffreep %st // <empty>
-+ jne 26f
-+
-+ // OK, the value is an integer, but is it odd?
-+ mov -8(%rsp),%eax
-+ mov -4(%rsp),%edx
-+ andb $1, %al
-+ jz 27f // jump if not odd
-+ // It's an odd integer.
-+ // Raise divide-by-zero exception and get minus infinity value.
-+ fldl MO(one)
-+ fdivl MO(zero)
-+ fchs
-+ ret
-+
-+25: fstp %st(0)
-+26:
-+27: // Raise divide-by-zero exception and get infinity value.
-+ fldl MO(one)
-+ fdivl MO(zero)
-+ ret
-+
-+ .align ALIGNARG(4)
-+ // x is ±0 and y is > 0. We must find out whether y is an odd integer.
-+21: testb $2, %dh
-+ jz 22f
-+
-+ fld %st // y : y
-+ fistpll -8(%rsp) // y
-+ fildll -8(%rsp) // int(y) : y
-+ fucomip %st(1),%st
-+ ffreep %st // <empty>
-+ jne 23f
-+
-+ // OK, the value is an integer, but is it odd?
-+ mov -8(%rsp),%eax
-+ mov -4(%rsp),%edx
-+ andb $1, %al
-+ jz 24f // jump if not odd
-+ // It's an odd integer.
-+ fldl MO(mzero)
-+ ret
-+
-+22: fstp %st(0)
-+23:
-+24: fldl MO(zero)
-+ ret
-+
-+END(__ieee754_powl)
-+
-+weak_alias(__ieee754_powl,powl)
-diff -Nru qemu-0.7.0/bsd.orig/amd64/e_remainderl.S qemu-0.7.0/bsd/amd64/e_remainderl.S
---- qemu-0.7.0/bsd.orig/amd64/e_remainderl.S Wed Dec 31 19:00:00 1969
-+++ qemu-0.7.0/bsd/amd64/e_remainderl.S Fri Apr 29 02:11:27 2005
-@@ -0,0 +1,23 @@
-+/*
-+ * Written by J.T. Conklin <jtc@netbsd.org>.
-+ * Public domain.
-+ *
-+ * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
-+ * Adapted for x86-64 by Andreas Jaeger <aj@suse.de>.
-+ */
-+
-+#include <machine/asm.h>
-+#include <sysdep.h>
-+
-+ENTRY(__ieee754_remainderl)
-+ fldt 24(%rsp)
-+ fldt 8(%rsp)
-+1: fprem1
-+ fstsw %ax
-+ testl $0x400,%eax
-+ jnz 1b
-+ fstp %st(1)
-+ ret
-+END (__ieee754_remainderl)
-+
-+weak_alias(__ieee754_remainderl,remainderl)
-diff -Nru qemu-0.7.0/bsd.orig/amd64/e_sqrtl.c qemu-0.7.0/bsd/amd64/e_sqrtl.c
---- qemu-0.7.0/bsd.orig/amd64/e_sqrtl.c Wed Dec 31 19:00:00 1969
-+++ qemu-0.7.0/bsd/amd64/e_sqrtl.c Fri Apr 29 02:11:27 2005
-@@ -0,0 +1,20 @@
-+/*
-+ * Written by J.T. Conklin <jtc@netbsd.org>.
-+ * Public domain.
-+ *
-+ * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
-+ */
-+
-+#include <sysdep.h>
-+
-+long double
-+__ieee754_sqrtl (long double x)
-+{
-+ long double res;
-+
-+ asm ("fsqrt" : "=t" (res) : "0" (x));
-+
-+ return res;
-+}
-+
-+weak_alias(__ieee754_sqrtl,sqrtl)
-diff -Nru qemu-0.7.0/bsd.orig/amd64/s_ceill.S qemu-0.7.0/bsd/amd64/s_ceill.S
---- qemu-0.7.0/bsd.orig/amd64/s_ceill.S Wed Dec 31 19:00:00 1969
-+++ qemu-0.7.0/bsd/amd64/s_ceill.S Fri Apr 29 02:22:18 2005
-@@ -0,0 +1,246 @@
-+/*
-+ * ====================================================
-+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
-+ *
-+ * Developed at SunPro, a Sun Microsystems, Inc. business.
-+ * Permission to use, copy, modify, and distribute this
-+ * software is freely granted, provided that this notice
-+ * is preserved.
-+ * ====================================================
-+ *
-+ * From: @(#)s_ceil.c 5.1 93/09/24
-+ */
-+/* XXX: generated from src/lib/msun/src/s_ceill.c */
-+
-+#include <machine/asm.h>
-+
-+__FBSDID("$FreeBSD: /tmp/pcvs/ports/emulators/qemu/files/patch-libmath,v 1.3 2006-08-21 23:02:01 shaun Exp $")
-+
-+ .file "s_ceill.c"
-+ .section .rodata.cst8,"aM",@progbits,8
-+ .p2align 3
-+.LC0:
-+ .long 2281731484
-+ .long 2117592124
-+ .text
-+ .p2align 4,,15
-+.globl ceill
-+ .type ceill, @function
-+ceill:
-+.LFB17:
-+ pushq %rbp
-+.LCFI0:
-+ pushq %rbx
-+.LCFI1:
-+ fldt 24(%rsp)
-+ movq $0, -16(%rsp)
-+ fld %st(0)
-+ fstpt -40(%rsp)
-+ movl -32(%rsp), %edi
-+ movq -40(%rsp), %rsi
-+ movl %edi, -16(%rsp)
-+ movl -16(%rsp), %r11d
-+ movq %rsi, -24(%rsp)
-+ movl %r11d, %r10d
-+ andl $32767, %r10d
-+ leal -16383(%r10), %r8d
-+ cmpl $30, %r8d
-+ jg .L2
-+ testl %r8d, %r8d
-+ js .L38
-+ movl -20(%rsp), %r9d
-+ leal 1(%r8), %ecx
-+ mov -24(%rsp), %eax
-+ movl $4294967295, %ebp
-+ movq %rsi, -40(%rsp)
-+ movl %edi, -32(%rsp)
-+ shrq %cl, %rbp
-+ mov %r9d, %ebx
-+ movq %rbx, %rdx
-+ andq %rbp, %rdx
-+ orq %rax, %rdx
-+ fldt -40(%rsp)
-+ je .L42
-+ ffreep %st(0)
-+ testb $-128, -15(%rsp)
-+ jne .L12
-+ movl $31, %ecx
-+ movl $1, %eax
-+ subl %r8d, %ecx
-+ salq %cl, %rax
-+ addl %eax, %r9d
-+ mov %r9d, %eax
-+ cmpq %rbx, %rax
-+ jae .L32
-+ leal 1(%r10), %edx
-+ movl %r11d, %eax
-+ orl $-2147483648, %r9d
-+ andw $-32768, %ax
-+ andw $32767, %dx
-+ orl %edx, %eax
-+ movw %ax, -16(%rsp)
-+.L32:
-+ movl %r9d, -20(%rsp)
-+.L12:
-+ faddl .LC0(%rip)
-+ fldz
-+ fxch %st(1)
-+ fucomip %st(1), %st
-+ fstp %st(0)
-+ jbe .L31
-+ movl %ebp, %eax
-+ movl $0, -24(%rsp)
-+ notl %eax
-+ andl %eax, %r9d
-+ movl %r9d, -20(%rsp)
-+ .p2align 4,,7
-+.L31:
-+ movq -24(%rsp), %rsi
-+ movl -16(%rsp), %edi
-+ movq %rsi, -40(%rsp)
-+ movl %edi, -32(%rsp)
-+ fldt -40(%rsp)
-+ popq %rbx
-+ popq %rbp
-+ ret
-+ .p2align 4,,7
-+.L2:
-+ cmpl $62, %r8d
-+ jle .L45
-+.L44:
-+ ffreep %st(0)
-+.L17:
-+ movq %rsi, -40(%rsp)
-+ movl %edi, -32(%rsp)
-+ fldt -40(%rsp)
-+ popq %rbx
-+ popq %rbp
-+ ret
-+ .p2align 4,,7
-+.L45:
-+ movl -24(%rsp), %edx
-+ leal 1(%r8), %ecx
-+ movq $-1, %rbx
-+ movq %rsi, -40(%rsp)
-+ movl %edi, -32(%rsp)
-+ shrq %cl, %rbx
-+ mov %edx, %r9d
-+ testq %rbx, %r9
-+ fldt -40(%rsp)
-+ je .L42
-+ ffreep %st(0)
-+ testb $-128, -15(%rsp)
-+ jne .L20
-+ cmpl $31, %r8d
-+ je .L36
-+ movl $63, %ecx
-+ movl $1, %eax
-+ subl %r8d, %ecx
-+ salq %cl, %rax
-+ leal (%rdx,%rax), %eax
-+ movl %eax, -24(%rsp)
-+ mov %eax, %eax
-+ cmpq %r9, %rax
-+ jae .L20
-+.L36:
-+ movl -20(%rsp), %eax
-+ leal 1(%rax), %ecx
-+ cmpl %eax, %ecx
-+ jae .L34
-+ leal 1(%r10), %edx
-+ movl %r11d, %eax
-+ orl $-2147483648, %ecx
-+ andw $-32768, %ax
-+ andw $32767, %dx
-+ orl %edx, %eax
-+ movw %ax, -16(%rsp)
-+.L34:
-+ movl %ecx, -20(%rsp)
-+ .p2align 4,,7
-+.L20:
-+ faddl .LC0(%rip)
-+ fldz
-+ fxch %st(1)
-+ fucomip %st(1), %st
-+ fstp %st(0)
-+ jbe .L31
-+ movl %ebx, %eax
-+ notl %eax
-+ andl %eax, -24(%rsp)
-+ jmp .L31
-+ .p2align 4,,7
-+.L42:
-+ fstp %st(1)
-+ popq %rbx
-+ popq %rbp
-+ ret
-+ .p2align 4,,7
-+.L38:
-+ fldl .LC0(%rip)
-+ faddp %st, %st(1)
-+ fldz
-+ fxch %st(1)
-+ fucomip %st(1), %st
-+ jbe .L44
-+ testl %r10d, %r10d
-+ jle .L39
-+.L7:
-+ movabsq $-9223372036854775808, %rsi
-+ movl $16383, %edi
-+ testb $-128, -15(%rsp)
-+ movq %rsi, -40(%rsp)
-+ movl %edi, -32(%rsp)
-+ fldt -40(%rsp)
-+ fcmovne %st(1), %st
-+ fstp %st(1)
-+ fstpt -40(%rsp)
-+ movq -40(%rsp), %rsi
-+ movl -32(%rsp), %edi
-+ movq %rsi, -24(%rsp)
-+ movl %edi, -16(%rsp)
-+ jmp .L17
-+.L39:
-+ movl -24(%rsp), %eax
-+ orl -20(%rsp), %eax
-+ je .L44
-+ jmp .L7
-+.LFE17:
-+ .size ceill, .-ceill
-+ .section .eh_frame,"a",@progbits
-+.Lframe1:
-+ .long .LECIE1-.LSCIE1
-+.LSCIE1:
-+ .long 0x0
-+ .byte 0x1
-+ .string ""
-+ .uleb128 0x1
-+ .sleb128 -8
-+ .byte 0x10
-+ .byte 0xc
-+ .uleb128 0x7
-+ .uleb128 0x8
-+ .byte 0x90
-+ .uleb128 0x1
-+ .p2align 3
-+.LECIE1:
-+.LSFDE1:
-+ .long .LEFDE1-.LASFDE1
-+.LASFDE1:
-+ .long .LASFDE1-.Lframe1
-+ .quad .LFB17
-+ .quad .LFE17-.LFB17
-+ .byte 0x4
-+ .long .LCFI0-.LFB17
-+ .byte 0xe
-+ .uleb128 0x10
-+ .byte 0x4
-+ .long .LCFI1-.LCFI0
-+ .byte 0xe
-+ .uleb128 0x18
-+ .byte 0x83
-+ .uleb128 0x3
-+ .byte 0x86
-+ .uleb128 0x2
-+ .p2align 3
-+.LEFDE1:
-+ .ident "GCC: (GNU) 3.4.4 [FreeBSD] 20050421"
-diff -Nru qemu-0.7.0/bsd.orig/amd64/s_cosl.S qemu-0.7.0/bsd/amd64/s_cosl.S
---- qemu-0.7.0/bsd.orig/amd64/s_cosl.S Wed Dec 31 19:00:00 1969
-+++ qemu-0.7.0/bsd/amd64/s_cosl.S Fri Apr 29 02:11:27 2005
-@@ -0,0 +1,33 @@
-+/*
-+ * Written by J.T. Conklin <jtc@netbsd.org>.
-+ * Public domain.
-+ *
-+ * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
-+ * Adapted for x86-64 by Andreas Jaeger <aj@suse.de>.
-+ */
-+
-+#include <machine/asm.h>
-+#include <sysdep.h>
-+
-+RCSID("$NetBSD: $")
-+
-+ENTRY(__cosl)
-+ fldt 8(%rsp)
-+ fcos
-+ fnstsw %ax
-+ testl $0x400,%eax
-+ jnz 1f
-+ ret
-+ .align ALIGNARG(4)
-+1: fldpi
-+ fadd %st(0)
-+ fxch %st(1)
-+2: fprem1
-+ fnstsw %ax
-+ testl $0x400,%eax
-+ jnz 2b
-+ fstp %st(1)
-+ fcos
-+ ret
-+END (__cosl)
-+weak_alias (__cosl, cosl)
-diff -Nru qemu-0.7.0/bsd.orig/amd64/s_floorl.S qemu-0.7.0/bsd/amd64/s_floorl.S
---- qemu-0.7.0/bsd.orig/amd64/s_floorl.S Wed Dec 31 19:00:00 1969
-+++ qemu-0.7.0/bsd/amd64/s_floorl.S Fri Apr 29 02:24:32 2005
-@@ -0,0 +1,247 @@
-+/*
-+ * ====================================================
-+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
-+ *
-+ * Developed at SunPro, a Sun Microsystems, Inc. business.
-+ * Permission to use, copy, modify, and distribute this
-+ * software is freely granted, provided that this notice
-+ * is preserved.
-+ * ====================================================
-+ *
-+ * From: @(#)s_floor.c 5.1 93/09/24
-+ */
-+/* XXX: generated from src/lib/msun/src/s_floorl.c */
-+
-+#include <machine/asm.h>
-+
-+__FBSDID("$FreeBSD: /tmp/pcvs/ports/emulators/qemu/files/patch-libmath,v 1.3 2006-08-21 23:02:01 shaun Exp $")
-+
-+ .file "s_floorl.c"
-+ .section .rodata.cst8,"aM",@progbits,8
-+ .p2align 3
-+.LC0:
-+ .long 2281731484
-+ .long 2117592124
-+ .section .rodata.cst4,"aM",@progbits,4
-+ .p2align 2
-+.LC2:
-+ .long 3212836864
-+ .text
-+ .p2align 4,,15
-+.globl floorl
-+ .type floorl, @function
-+floorl:
-+.LFB17:
-+ pushq %rbp
-+.LCFI0:
-+ pushq %rbx
-+.LCFI1:
-+ fldt 24(%rsp)
-+ movq $0, -16(%rsp)
-+ fld %st(0)
-+ fstpt -40(%rsp)
-+ movl -32(%rsp), %edi
-+ movq -40(%rsp), %rsi
-+ movl %edi, -16(%rsp)
-+ movl -16(%rsp), %r11d
-+ movq %rsi, -24(%rsp)
-+ movl %r11d, %r10d
-+ andl $32767, %r10d
-+ leal -16383(%r10), %r8d
-+ cmpl $30, %r8d
-+ jg .L2
-+ testl %r8d, %r8d
-+ js .L38
-+ movl -20(%rsp), %r9d
-+ leal 1(%r8), %ecx
-+ mov -24(%rsp), %eax
-+ movl $4294967295, %ebp
-+ movq %rsi, -40(%rsp)
-+ movl %edi, -32(%rsp)
-+ shrq %cl, %rbp
-+ mov %r9d, %ebx
-+ movq %rbx, %rdx
-+ andq %rbp, %rdx
-+ orq %rax, %rdx
-+ fldt -40(%rsp)
-+ je .L42
-+ ffreep %st(0)
-+ testb $-128, -15(%rsp)
-+ je .L12
-+ movl $31, %ecx
-+ movl $1, %eax
-+ subl %r8d, %ecx
-+ salq %cl, %rax
-+ addl %eax, %r9d
-+ mov %r9d, %eax
-+ cmpq %rbx, %rax
-+ jae .L32
-+ leal 1(%r10), %edx
-+ movl %r11d, %eax
-+ orl $-2147483648, %r9d
-+ andw $-32768, %ax
-+ andw $32767, %dx
-+ orl %edx, %eax
-+ movw %ax, -16(%rsp)
-+.L32:
-+ movl %r9d, -20(%rsp)
-+.L12:
-+ faddl .LC0(%rip)
-+ fldz
-+ fxch %st(1)
-+ fucomip %st(1), %st
-+ fstp %st(0)
-+ jbe .L31
-+ movl %ebp, %eax
-+ movl $0, -24(%rsp)
-+ notl %eax
-+ andl %eax, %r9d
-+ movl %r9d, -20(%rsp)
-+ .p2align 4,,7
-+.L31:
-+ movq -24(%rsp), %rsi
-+ movl -16(%rsp), %edi
-+ movq %rsi, -40(%rsp)
-+ movl %edi, -32(%rsp)
-+ fldt -40(%rsp)
-+ popq %rbx
-+ popq %rbp
-+ ret
-+ .p2align 4,,7
-+.L2:
-+ cmpl $62, %r8d
-+ jle .L45
-+.L44:
-+ ffreep %st(0)
-+.L17:
-+ movq %rsi, -40(%rsp)
-+ movl %edi, -32(%rsp)
-+ fldt -40(%rsp)
-+ popq %rbx
-+ popq %rbp
-+ ret
-+ .p2align 4,,7
-+.L45:
-+ movl -24(%rsp), %edx
-+ leal 1(%r8), %ecx
-+ movq $-1, %rbx
-+ movq %rsi, -40(%rsp)
-+ movl %edi, -32(%rsp)
-+ shrq %cl, %rbx
-+ mov %edx, %r9d
-+ testq %rbx, %r9
-+ fldt -40(%rsp)
-+ je .L42
-+ ffreep %st(0)
-+ testb $-128, -15(%rsp)
-+ je .L20
-+ cmpl $31, %r8d
-+ je .L36
-+ movl $63, %ecx
-+ movl $1, %eax
-+ subl %r8d, %ecx
-+ salq %cl, %rax
-+ leal (%rdx,%rax), %eax
-+ movl %eax, -24(%rsp)
-+ mov %eax, %eax
-+ cmpq %r9, %rax
-+ jae .L20
-+.L36:
-+ movl -20(%rsp), %eax
-+ leal 1(%rax), %ecx
-+ cmpl %eax, %ecx
-+ jae .L34
-+ leal 1(%r10), %edx
-+ movl %r11d, %eax
-+ orl $-2147483648, %ecx
-+ andw $-32768, %ax
-+ andw $32767, %dx
-+ orl %edx, %eax
-+ movw %ax, -16(%rsp)
-+.L34:
-+ movl %ecx, -20(%rsp)
-+ .p2align 4,,7
-+.L20:
-+ faddl .LC0(%rip)
-+ fldz
-+ fxch %st(1)
-+ fucomip %st(1), %st
-+ fstp %st(0)
-+ jbe .L31
-+ movl %ebx, %eax
-+ notl %eax
-+ andl %eax, -24(%rsp)
-+ jmp .L31
-+ .p2align 4,,7
-+.L42:
-+ fstp %st(1)
-+ popq %rbx
-+ popq %rbp
-+ ret
-+ .p2align 4,,7
-+.L38:
-+ fldl .LC0(%rip)
-+ faddp %st, %st(1)
-+ fldz
-+ fxch %st(1)
-+ fucomip %st(1), %st
-+ jbe .L44
-+ testl %r10d, %r10d
-+ jle .L39
-+.L7:
-+ testb $-128, -15(%rsp)
-+ je .L9
-+ ffreep %st(0)
-+ flds .LC2(%rip)
-+.L9:
-+ fstpt -40(%rsp)
-+ movq -40(%rsp), %rsi
-+ movl -32(%rsp), %edi
-+ movq %rsi, -24(%rsp)
-+ movl %edi, -16(%rsp)
-+ jmp .L17
-+.L39:
-+ movl -24(%rsp), %eax
-+ orl -20(%rsp), %eax
-+ je .L44
-+ jmp .L7
-+.LFE17:
-+ .size floorl, .-floorl
-+ .section .eh_frame,"a",@progbits
-+.Lframe1:
-+ .long .LECIE1-.LSCIE1
-+.LSCIE1:
-+ .long 0x0
-+ .byte 0x1
-+ .string ""
-+ .uleb128 0x1
-+ .sleb128 -8
-+ .byte 0x10
-+ .byte 0xc
-+ .uleb128 0x7
-+ .uleb128 0x8
-+ .byte 0x90
-+ .uleb128 0x1
-+ .p2align 3
-+.LECIE1:
-+.LSFDE1:
-+ .long .LEFDE1-.LASFDE1
-+.LASFDE1:
-+ .long .LASFDE1-.Lframe1
-+ .quad .LFB17
-+ .quad .LFE17-.LFB17
-+ .byte 0x4
-+ .long .LCFI0-.LFB17
-+ .byte 0xe
-+ .uleb128 0x10
-+ .byte 0x4
-+ .long .LCFI1-.LCFI0
-+ .byte 0xe
-+ .uleb128 0x18
-+ .byte 0x83
-+ .uleb128 0x3
-+ .byte 0x86
-+ .uleb128 0x2
-+ .p2align 3
-+.LEFDE1:
-+ .ident "GCC: (GNU) 3.4.4 [FreeBSD] 20050421"
-diff -Nru qemu-0.7.0/bsd.orig/amd64/s_isnormal.c qemu-0.7.0/bsd/amd64/s_isnormal.c
---- qemu-0.7.0/bsd.orig/amd64/s_isnormal.c Wed Dec 31 19:00:00 1969
-+++ qemu-0.7.0/bsd/amd64/s_isnormal.c Fri Apr 29 02:11:27 2005
-@@ -0,0 +1,85 @@
-+/*-
-+ * Copyright (c) 2003 Mike Barcroft <mike@FreeBSD.org>
-+ * Copyright (c) 2002-2004 David Schultz <das@FreeBSD.ORG>
-+ * All rights reserved.
-+ *
-+ * Redistribution and use in source and binary forms, with or without
-+ * modification, are permitted provided that the following conditions
-+ * are met:
-+ * 1. Redistributions of source code must retain the above copyright
-+ * notice, this list of conditions and the following disclaimer.
-+ * 2. Redistributions in binary form must reproduce the above copyright
-+ * notice, this list of conditions and the following disclaimer in the
-+ * documentation and/or other materials provided with the distribution.
-+ *
-+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-+ * SUCH DAMAGE.
-+ *
-+ * $FreeBSD: /tmp/pcvs/ports/emulators/qemu/files/patch-libmath,v 1.3 2006-08-21 23:02:01 shaun Exp $
-+ */
-+
-+union IEEEf2bits {
-+ float f;
-+ struct {
-+ unsigned int man :23;
-+ unsigned int exp :8;
-+ unsigned int sign :1;
-+ } bits;
-+};
-+
-+union IEEEd2bits {
-+ double d;
-+ struct {
-+ unsigned int manl :32;
-+ unsigned int manh :20;
-+ unsigned int exp :11;
-+ unsigned int sign :1;
-+ } bits;
-+};
-+
-+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;
-+};
-+
-+int
-+__isnormal(double d)
-+{
-+ union IEEEd2bits u;
-+
-+ u.d = d;
-+ return (u.bits.exp != 0 && u.bits.exp != 2047);
-+}
-+
-+int
-+__isnormalf(float f)
-+{
-+ union IEEEf2bits u;
-+
-+ u.f = f;
-+ return (u.bits.exp != 0 && u.bits.exp != 255);
-+}
-+
-+int
-+__isnormall(long double e)
-+{
-+ union IEEEl2bits u;
-+
-+ u.e = e;
-+ return (u.bits.exp != 0 && u.bits.exp != 32767);
-+}
-diff -Nru qemu-0.7.0/bsd.orig/amd64/s_llrint.S qemu-0.7.0/bsd/amd64/s_llrint.S
---- qemu-0.7.0/bsd.orig/amd64/s_llrint.S Wed Dec 31 19:00:00 1969
-+++ qemu-0.7.0/bsd/amd64/s_llrint.S Fri Apr 29 02:11:27 2005
-@@ -0,0 +1,6 @@
-+#include <machine/asm.h>
-+__FBSDID("$FreeBSD: /tmp/pcvs/ports/emulators/qemu/files/patch-libmath,v 1.3 2006-08-21 23:02:01 shaun Exp $")
-+
-+/* sizeof(long) == sizeof(long long) */
-+#define fn llrint
-+#include "s_lrint.S"
-diff -Nru qemu-0.7.0/bsd.orig/amd64/s_llrintf.S qemu-0.7.0/bsd/amd64/s_llrintf.S
---- qemu-0.7.0/bsd.orig/amd64/s_llrintf.S Wed Dec 31 19:00:00 1969
-+++ qemu-0.7.0/bsd/amd64/s_llrintf.S Fri Apr 29 02:11:27 2005
-@@ -0,0 +1,6 @@
-+#include <machine/asm.h>
-+__FBSDID("$FreeBSD: /tmp/pcvs/ports/emulators/qemu/files/patch-libmath,v 1.3 2006-08-21 23:02:01 shaun Exp $")
-+
-+/* sizeof(long) == sizeof(long long) */
-+#define fn llrintf
-+#include "s_lrintf.S"
-diff -Nru qemu-0.7.0/bsd.orig/amd64/s_llrintl.S qemu-0.7.0/bsd/amd64/s_llrintl.S
---- qemu-0.7.0/bsd.orig/amd64/s_llrintl.S Wed Dec 31 19:00:00 1969
-+++ qemu-0.7.0/bsd/amd64/s_llrintl.S Fri Apr 29 02:11:27 2005
-@@ -0,0 +1,35 @@
-+/* Round argument to nearest integral value according to current rounding
-+ direction.
-+ Copyright (C) 1997, 2002 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA. */
-+
-+#include <machine/asm.h>
-+#include <sysdep.h>
-+
-+ .text
-+ENTRY(__llrintl)
-+ fldt 8(%rsp)
-+ fistpll -8(%rsp)
-+ fwait
-+ movq -8(%rsp),%rax
-+ ret
-+END(__llrintl)
-+weak_alias (__llrintl, llrintl)
-+strong_alias (__llrintl, __lrintl)
-+weak_alias (__llrintl, lrintl)
-+
-diff -Nru qemu-0.7.0/bsd.orig/amd64/s_lrint.S qemu-0.7.0/bsd/amd64/s_lrint.S
---- qemu-0.7.0/bsd.orig/amd64/s_lrint.S Wed Dec 31 19:00:00 1969
-+++ qemu-0.7.0/bsd/amd64/s_lrint.S Fri Apr 29 02:11:27 2005
-@@ -0,0 +1,36 @@
-+/*-
-+ * Copyright (c) 2005 David Schultz <das@FreeBSD.ORG>
-+ * All rights reserved.
-+ *
-+ * Redistribution and use in source and binary forms, with or without
-+ * modification, are permitted provided that the following conditions
-+ * are met:
-+ * 1. Redistributions of source code must retain the above copyright
-+ * notice, this list of conditions and the following disclaimer.
-+ * 2. Redistributions in binary form must reproduce the above copyright
-+ * notice, this list of conditions and the following disclaimer in the
-+ * documentation and/or other materials provided with the distribution.
-+ *
-+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-+ * SUCH DAMAGE.
-+ */
-+
-+#include <machine/asm.h>
-+
-+#ifndef fn
-+__FBSDID("$FreeBSD: /tmp/pcvs/ports/emulators/qemu/files/patch-libmath,v 1.3 2006-08-21 23:02:01 shaun Exp $")
-+#define fn lrint
-+#endif
-+
-+ENTRY(fn)
-+ cvtsd2si %xmm0, %rax
-+ ret
-diff -Nru qemu-0.7.0/bsd.orig/amd64/s_lrintf.S qemu-0.7.0/bsd/amd64/s_lrintf.S
---- qemu-0.7.0/bsd.orig/amd64/s_lrintf.S Wed Dec 31 19:00:00 1969
-+++ qemu-0.7.0/bsd/amd64/s_lrintf.S Fri Apr 29 02:11:27 2005
-@@ -0,0 +1,36 @@
-+/*-
-+ * Copyright (c) 2005 David Schultz <das@FreeBSD.ORG>
-+ * All rights reserved.
-+ *
-+ * Redistribution and use in source and binary forms, with or without
-+ * modification, are permitted provided that the following conditions
-+ * are met:
-+ * 1. Redistributions of source code must retain the above copyright
-+ * notice, this list of conditions and the following disclaimer.
-+ * 2. Redistributions in binary form must reproduce the above copyright
-+ * notice, this list of conditions and the following disclaimer in the
-+ * documentation and/or other materials provided with the distribution.
-+ *
-+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-+ * SUCH DAMAGE.
-+ */
-+
-+#include <machine/asm.h>
-+
-+#ifndef fn
-+__FBSDID("$FreeBSD: /tmp/pcvs/ports/emulators/qemu/files/patch-libmath,v 1.3 2006-08-21 23:02:01 shaun Exp $")
-+#define fn lrintf
-+#endif
-+
-+ENTRY(fn)
-+ cvtss2si %xmm0, %rax
-+ ret
-diff -Nru qemu-0.7.0/bsd.orig/amd64/s_lrintl.S qemu-0.7.0/bsd/amd64/s_lrintl.S
---- qemu-0.7.0/bsd.orig/amd64/s_lrintl.S Wed Dec 31 19:00:00 1969
-+++ qemu-0.7.0/bsd/amd64/s_lrintl.S Fri Apr 29 02:11:27 2005
-@@ -0,0 +1 @@
-+/* Not needed, see s_llrintl.S. */
-diff -Nru qemu-0.7.0/bsd.orig/amd64/s_rintl.c qemu-0.7.0/bsd/amd64/s_rintl.c
---- qemu-0.7.0/bsd.orig/amd64/s_rintl.c Wed Dec 31 19:00:00 1969
-+++ qemu-0.7.0/bsd/amd64/s_rintl.c Fri Apr 29 02:11:27 2005
-@@ -0,0 +1,18 @@
-+/*
-+ * Written by J.T. Conklin <jtc@netbsd.org>.
-+ * Changes for long double by Ulrich Drepper <drepper@cygnus.com>
-+ * Public domain.
-+ */
-+
-+#include <sysdep.h>
-+
-+long double
-+__rintl (long double x)
-+{
-+ long double res;
-+
-+ asm ("frndint" : "=t" (res) : "0" (x));
-+ return res;
-+}
-+
-+weak_alias (__rintl, rintl)
-diff -Nru qemu-0.7.0/bsd.orig/amd64/s_round.c qemu-0.7.0/bsd/amd64/s_round.c
---- qemu-0.7.0/bsd.orig/amd64/s_round.c Wed Dec 31 19:00:00 1969
-+++ qemu-0.7.0/bsd/amd64/s_round.c Fri Apr 29 02:11:27 2005
-@@ -0,0 +1,51 @@
-+/*-
-+ * Copyright (c) 2003, Steven G. Kargl
-+ * All rights reserved.
-+ *
-+ * Redistribution and use in source and binary forms, with or without
-+ * modification, are permitted provided that the following conditions
-+ * are met:
-+ * 1. Redistributions of source code must retain the above copyright
-+ * notice unmodified, this list of conditions, and the following
-+ * disclaimer.
-+ * 2. Redistributions in binary form must reproduce the above copyright
-+ * notice, this list of conditions and the following disclaimer in the
-+ * documentation and/or other materials provided with the distribution.
-+ *
-+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-+ */
-+
-+#include <sys/cdefs.h>
-+__FBSDID("$FreeBSD: /tmp/pcvs/ports/emulators/qemu/files/patch-libmath,v 1.3 2006-08-21 23:02:01 shaun Exp $");
-+
-+#include <math.h>
-+
-+double
-+round(double x)
-+{
-+ double t;
-+
-+ if (!isfinite(x))
-+ return (x);
-+
-+ if (x >= 0.0) {
-+ t = floor(x);
-+ if (t - x <= -0.5)
-+ t += 1.0;
-+ return (t);
-+ } else {
-+ t = floor(-x);
-+ if (t + x <= -0.5)
-+ t += 1.0;
-+ return (-t);
-+ }
-+}
-diff -Nru qemu-0.7.0/bsd.orig/amd64/s_sinl.S qemu-0.7.0/bsd/amd64/s_sinl.S
---- qemu-0.7.0/bsd.orig/amd64/s_sinl.S Wed Dec 31 19:00:00 1969
-+++ qemu-0.7.0/bsd/amd64/s_sinl.S Fri Apr 29 02:11:27 2005
-@@ -0,0 +1,31 @@
-+/*
-+ * Written by J.T. Conklin <jtc@netbsd.org>.
-+ * Public domain.
-+ *
-+ * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
-+ * Adapted for x86-64 by Andreas Jaeger <aj@suse.de>.
-+ */
-+
-+#include <machine/asm.h>
-+#include <sysdep.h>
-+
-+ENTRY(__sinl)
-+ fldt 8(%rsp)
-+ fsin
-+ fnstsw %ax
-+ testl $0x400,%eax
-+ jnz 1f
-+ ret
-+ .align ALIGNARG(4)
-+1: fldpi
-+ fadd %st(0)
-+ fxch %st(1)
-+2: fprem1
-+ fnstsw %ax
-+ testl $0x400,%eax
-+ jnz 2b
-+ fstp %st(1)
-+ fsin
-+ ret
-+END (__sinl)
-+weak_alias (__sinl, sinl)
-diff -Nru qemu-0.7.0/bsd.orig/amd64/s_tanl.S qemu-0.7.0/bsd/amd64/s_tanl.S
---- qemu-0.7.0/bsd.orig/amd64/s_tanl.S Wed Dec 31 19:00:00 1969
-+++ qemu-0.7.0/bsd/amd64/s_tanl.S Fri Apr 29 02:11:27 2005
-@@ -0,0 +1,34 @@
-+/*
-+ * Written by J.T. Conklin <jtc@netbsd.org>.
-+ * Public domain.
-+ *
-+ * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
-+ * Adapted for x86-64 by Andreas Jaeger <aj@suse.de>.
-+ */
-+
-+#include <machine/asm.h>
-+#include <sysdep.h>
-+
-+RCSID("$NetBSD: $")
-+
-+ENTRY(__tanl)
-+ fldt 8(%rsp)
-+ fptan
-+ fnstsw %ax
-+ testl $0x400,%eax
-+ jnz 1f
-+ fstp %st(0)
-+ ret
-+1: fldpi
-+ fadd %st(0)
-+ fxch %st(1)
-+2: fprem1
-+ fstsw %ax
-+ testl $0x400,%eax
-+ jnz 2b
-+ fstp %st(1)
-+ fptan
-+ fstp %st(0)
-+ ret
-+END (__tanl)
-+weak_alias (__tanl, tanl)
-diff -Nru qemu-0.7.0/bsd.orig/i386/e_atan2l.c qemu-0.7.0/bsd/i386/e_atan2l.c
---- qemu-0.7.0/bsd.orig/i386/e_atan2l.c Wed Dec 31 19:00:00 1969
-+++ qemu-0.7.0/bsd/i386/e_atan2l.c Fri Apr 29 02:11:27 2005
-@@ -0,0 +1,20 @@
-+/*
-+ * Written by J.T. Conklin <jtc@netbsd.org>.
-+ * Public domain.
-+ *
-+ * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
-+ */
-+
-+#include <sysdep.h>
-+
-+long double
-+__ieee754_atan2l (long double y, long double x)
-+{
-+ long double res;
-+
-+ asm ("fpatan" : "=t" (res) : "u" (y), "0" (x) : "st(1)");
-+
-+ return res;
-+}
-+
-+weak_alias(__ieee754_atan2l, atan2l)
-diff -Nru qemu-0.7.0/bsd.orig/i386/e_logl.S qemu-0.7.0/bsd/i386/e_logl.S
---- qemu-0.7.0/bsd.orig/i386/e_logl.S Wed Dec 31 19:00:00 1969
-+++ qemu-0.7.0/bsd/i386/e_logl.S Fri Apr 29 02:11:27 2005
-@@ -0,0 +1,63 @@
-+/*
-+ * Written by J.T. Conklin <jtc@netbsd.org>.
-+ * Public domain.
-+ *
-+ * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
-+ */
-+
-+#include <machine/asm.h>
-+#include <sysdep.h>
-+
-+RCSID("$NetBSD: $")
-+
-+
-+#ifdef __ELF__
-+ .section .rodata
-+#else
-+ .text
-+#endif
-+ .align ALIGNARG(4)
-+ ASM_TYPE_DIRECTIVE(one,@object)
-+one: .double 1.0
-+ ASM_SIZE_DIRECTIVE(one)
-+ /* It is not important that this constant is precise. It is only
-+ a value which is known to be on the safe side for using the
-+ fyl2xp1 instruction. */
-+ ASM_TYPE_DIRECTIVE(limit,@object)
-+limit: .double 0.29
-+ ASM_SIZE_DIRECTIVE(limit)
-+
-+
-+#ifdef PIC
-+#define MO(op) op##@GOTOFF(%edx)
-+#else
-+#define MO(op) op
-+#endif
-+
-+ .text
-+ENTRY(__ieee754_logl)
-+ fldln2 // log(2)
-+ fldt 4(%esp) // x : log(2)
-+#ifdef PIC
-+ call 1f
-+1: popl %edx
-+ addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx
-+#endif
-+ fld %st // x : x : log(2)
-+ fsubl MO(one) // x-1 : x : log(2)
-+ fld %st // x-1 : x-1 : x : log(2)
-+ fabs // |x-1| : x-1 : x : log(2)
-+ fcompl MO(limit) // x-1 : x : log(2)
-+ fnstsw // x-1 : x : log(2)
-+ andb $0x45, %ah
-+ jz 2f
-+ fstp %st(1) // x-1 : log(2)
-+ fyl2xp1 // log(x)
-+ ret
-+
-+2: fstp %st(0) // x : log(2)
-+ fyl2x // log(x)
-+ ret
-+END (__ieee754_logl)
-+
-+weak_alias(__ieee754_logl,logl)
-diff -Nru qemu-0.7.0/bsd.orig/i386/e_powl.S qemu-0.7.0/bsd/i386/e_powl.S
---- qemu-0.7.0/bsd.orig/i386/e_powl.S Wed Dec 31 19:00:00 1969
-+++ qemu-0.7.0/bsd/i386/e_powl.S Fri Apr 29 02:11:27 2005
-@@ -0,0 +1,341 @@
-+/* ix87 specific implementation of pow function.
-+ Copyright (C) 1996, 1997, 1998, 1999, 2001, 2004
-+ Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA. */
-+
-+#include <machine/asm.h>
-+#include <sysdep.h>
-+
-+#ifdef __ELF__
-+ .section .rodata
-+#else
-+ .text
-+#endif
-+
-+ .align ALIGNARG(4)
-+ ASM_TYPE_DIRECTIVE(infinity,@object)
-+inf_zero:
-+infinity:
-+ .byte 0, 0, 0, 0, 0, 0, 0xf0, 0x7f
-+ ASM_SIZE_DIRECTIVE(infinity)
-+ ASM_TYPE_DIRECTIVE(zero,@object)
-+zero: .double 0.0
-+ ASM_SIZE_DIRECTIVE(zero)
-+ ASM_TYPE_DIRECTIVE(minf_mzero,@object)
-+minf_mzero:
-+minfinity:
-+ .byte 0, 0, 0, 0, 0, 0, 0xf0, 0xff
-+mzero:
-+ .byte 0, 0, 0, 0, 0, 0, 0, 0x80
-+ ASM_SIZE_DIRECTIVE(minf_mzero)
-+ ASM_TYPE_DIRECTIVE(one,@object)
-+one: .double 1.0
-+ ASM_SIZE_DIRECTIVE(one)
-+ ASM_TYPE_DIRECTIVE(limit,@object)
-+limit: .double 0.29
-+ ASM_SIZE_DIRECTIVE(limit)
-+ ASM_TYPE_DIRECTIVE(p63,@object)
-+p63: .byte 0, 0, 0, 0, 0, 0, 0xe0, 0x43
-+ ASM_SIZE_DIRECTIVE(p63)
-+
-+#ifdef PIC
-+#define MO(op) op##@GOTOFF(%ecx)
-+#define MOX(op,x,f) op##@GOTOFF(%ecx,x,f)
-+#else
-+#define MO(op) op
-+#define MOX(op,x,f) op(,x,f)
-+#endif
-+
-+ .text
-+ENTRY(__ieee754_powl)
-+ fldt 16(%esp) // y
-+ fxam
-+
-+#ifdef PIC
-+ call 1f
-+1: popl %ecx
-+ addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ecx
-+#endif
-+
-+ fnstsw
-+ movb %ah, %dl
-+ andb $0x45, %ah
-+ cmpb $0x40, %ah // is y == 0 ?
-+ je 11f
-+
-+ cmpb $0x05, %ah // is y == ±inf ?
-+ je 12f
-+
-+ cmpb $0x01, %ah // is y == NaN ?
-+ je 30f
-+
-+ fldt 4(%esp) // x : y
-+
-+ subl $8,%esp
-+
-+ fxam
-+ fnstsw
-+ movb %ah, %dh
-+ andb $0x45, %ah
-+ cmpb $0x40, %ah
-+ je 20f // x is ±0
-+
-+ cmpb $0x05, %ah
-+ je 15f // x is ±inf
-+
-+ fxch // y : x
-+
-+ /* fistpll raises invalid exception for |y| >= 1L<<63. */
-+ fld %st // y : y : x
-+ fabs // |y| : y : x
-+ fcompl MO(p63) // y : x
-+ fnstsw
-+ sahf
-+ jnc 2f
-+
-+ /* First see whether `y' is a natural number. In this case we
-+ can use a more precise algorithm. */
-+ fld %st // y : y : x
-+ fistpll (%esp) // y : x
-+ fildll (%esp) // int(y) : y : x
-+ fucomp %st(1) // y : x
-+ fnstsw
-+ sahf
-+ jne 2f
-+
-+ /* OK, we have an integer value for y. */
-+ popl %eax
-+ popl %edx
-+ orl $0, %edx
-+ fstp %st(0) // x
-+ jns 4f // y >= 0, jump
-+ fdivrl MO(one) // 1/x (now referred to as x)
-+ negl %eax
-+ adcl $0, %edx
-+ negl %edx
-+4: fldl MO(one) // 1 : x
-+ fxch
-+
-+6: shrdl $1, %edx, %eax
-+ jnc 5f
-+ fxch
-+ fmul %st(1) // x : ST*x
-+ fxch
-+5: fmul %st(0), %st // x*x : ST*x
-+ shrl $1, %edx
-+ movl %eax, %ecx
-+ orl %edx, %ecx
-+ jnz 6b
-+ fstp %st(0) // ST*x
-+ ret
-+
-+ /* y is ±NAN */
-+30: fldt 4(%esp) // x : y
-+ fldl MO(one) // 1.0 : x : y
-+ fucomp %st(1) // x : y
-+ fnstsw
-+ sahf
-+ je 31f
-+ fxch // y : x
-+31: fstp %st(1)
-+ ret
-+
-+ .align ALIGNARG(4)
-+2: /* y is a real number. */
-+ fxch // x : y
-+ fldl MO(one) // 1.0 : x : y
-+ fld %st(1) // x : 1.0 : x : y
-+ fsub %st(1) // x-1 : 1.0 : x : y
-+ fabs // |x-1| : 1.0 : x : y
-+ fcompl MO(limit) // 1.0 : x : y
-+ fnstsw
-+ fxch // x : 1.0 : y
-+ sahf
-+ ja 7f
-+ fsub %st(1) // x-1 : 1.0 : y
-+ fyl2xp1 // log2(x) : y
-+ jmp 8f
-+
-+7: fyl2x // log2(x) : y
-+8: fmul %st(1) // y*log2(x) : y
-+ fxam
-+ fnstsw
-+ andb $0x45, %ah
-+ cmpb $0x05, %ah // is y*log2(x) == ±inf ?
-+ je 28f
-+ fst %st(1) // y*log2(x) : y*log2(x)
-+ frndint // int(y*log2(x)) : y*log2(x)
-+ fsubr %st, %st(1) // int(y*log2(x)) : fract(y*log2(x))
-+ fxch // fract(y*log2(x)) : int(y*log2(x))
-+ f2xm1 // 2^fract(y*log2(x))-1 : int(y*log2(x))
-+ faddl MO(one) // 2^fract(y*log2(x)) : int(y*log2(x))
-+ fscale // 2^fract(y*log2(x))*2^int(y*log2(x)) : int(y*log2(x))
-+ addl $8, %esp
-+ fstp %st(1) // 2^fract(y*log2(x))*2^int(y*log2(x))
-+ ret
-+
-+28: fstp %st(1) // y*log2(x)
-+ fldl MO(one) // 1 : y*log2(x)
-+ fscale // 2^(y*log2(x)) : y*log2(x)
-+ addl $8, %esp
-+ fstp %st(1) // 2^(y*log2(x))
-+ ret
-+
-+ // pow(x,±0) = 1
-+ .align ALIGNARG(4)
-+11: fstp %st(0) // pop y
-+ fldl MO(one)
-+ ret
-+
-+ // y == ±inf
-+ .align ALIGNARG(4)
-+12: fstp %st(0) // pop y
-+ fldt 4(%esp) // x
-+ fabs
-+ fcompl MO(one) // < 1, == 1, or > 1
-+ fnstsw
-+ andb $0x45, %ah
-+ cmpb $0x45, %ah
-+ je 13f // jump if x is NaN
-+
-+ cmpb $0x40, %ah
-+ je 14f // jump if |x| == 1
-+
-+ shlb $1, %ah
-+ xorb %ah, %dl
-+ andl $2, %edx
-+ fldl MOX(inf_zero, %edx, 4)
-+ ret
-+
-+ .align ALIGNARG(4)
-+14: fldl MO(one)
-+ ret
-+
-+ .align ALIGNARG(4)
-+13: fldt 4(%esp) // load x == NaN
-+ ret
-+
-+ .align ALIGNARG(4)
-+ // x is ±inf
-+15: fstp %st(0) // y
-+ testb $2, %dh
-+ jz 16f // jump if x == +inf
-+
-+ // We must find out whether y is an odd integer.
-+ fld %st // y : y
-+ fistpll (%esp) // y
-+ fildll (%esp) // int(y) : y
-+ fucompp // <empty>
-+ fnstsw
-+ sahf
-+ jne 17f
-+
-+ // OK, the value is an integer, but is it odd?
-+ popl %eax
-+ popl %edx
-+ andb $1, %al
-+ jz 18f // jump if not odd
-+ // It's an odd integer.
-+ shrl $31, %edx
-+ fldl MOX(minf_mzero, %edx, 8)
-+ ret
-+
-+ .align ALIGNARG(4)
-+16: fcompl MO(zero)
-+ addl $8, %esp
-+ fnstsw
-+ shrl $5, %eax
-+ andl $8, %eax
-+ fldl MOX(inf_zero, %eax, 1)
-+ ret
-+
-+ .align ALIGNARG(4)
-+17: shll $30, %edx // sign bit for y in right position
-+ addl $8, %esp
-+18: shrl $31, %edx
-+ fldl MOX(inf_zero, %edx, 8)
-+ ret
-+
-+ .align ALIGNARG(4)
-+ // x is ±0
-+20: fstp %st(0) // y
-+ testb $2, %dl
-+ jz 21f // y > 0
-+
-+ // x is ±0 and y is < 0. We must find out whether y is an odd integer.
-+ testb $2, %dh
-+ jz 25f
-+
-+ fld %st // y : y
-+ fistpll (%esp) // y
-+ fildll (%esp) // int(y) : y
-+ fucompp // <empty>
-+ fnstsw
-+ sahf
-+ jne 26f
-+
-+ // OK, the value is an integer, but is it odd?
-+ popl %eax
-+ popl %edx
-+ andb $1, %al
-+ jz 27f // jump if not odd
-+ // It's an odd integer.
-+ // Raise divide-by-zero exception and get minus infinity value.
-+ fldl MO(one)
-+ fdivl MO(zero)
-+ fchs
-+ ret
-+
-+25: fstp %st(0)
-+26: addl $8, %esp
-+27: // Raise divide-by-zero exception and get infinity value.
-+ fldl MO(one)
-+ fdivl MO(zero)
-+ ret
-+
-+ .align ALIGNARG(4)
-+ // x is ±0 and y is > 0. We must find out whether y is an odd integer.
-+21: testb $2, %dh
-+ jz 22f
-+
-+ fld %st // y : y
-+ fistpll (%esp) // y
-+ fildll (%esp) // int(y) : y
-+ fucompp // <empty>
-+ fnstsw
-+ sahf
-+ jne 23f
-+
-+ // OK, the value is an integer, but is it odd?
-+ popl %eax
-+ popl %edx
-+ andb $1, %al
-+ jz 24f // jump if not odd
-+ // It's an odd integer.
-+ fldl MO(mzero)
-+ ret
-+
-+22: fstp %st(0)
-+23: addl $8, %esp // Don't use 2 x pop
-+24: fldl MO(zero)
-+ ret
-+
-+END(__ieee754_powl)
-+
-+weak_alias(__ieee754_powl,powl)
-diff -Nru qemu-0.7.0/bsd.orig/i386/e_remainderl.S qemu-0.7.0/bsd/i386/e_remainderl.S
---- qemu-0.7.0/bsd.orig/i386/e_remainderl.S Wed Dec 31 19:00:00 1969
-+++ qemu-0.7.0/bsd/i386/e_remainderl.S Fri Apr 29 02:11:27 2005
-@@ -0,0 +1,24 @@
-+/*
-+ * Written by J.T. Conklin <jtc@netbsd.org>.
-+ * Public domain.
-+ *
-+ * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
-+ */
-+
-+#include <machine/asm.h>
-+#include <sysdep.h>
-+
-+RCSID("$NetBSD: $")
-+
-+ENTRY(__ieee754_remainderl)
-+ fldt 16(%esp)
-+ fldt 4(%esp)
-+1: fprem1
-+ fstsw %ax
-+ sahf
-+ jp 1b
-+ fstp %st(1)
-+ ret
-+END (__ieee754_remainderl)
-+
-+weak_alias(__ieee754_remainderl,remainderl)
-diff -Nru qemu-0.7.0/bsd.orig/i386/e_sqrtl.c qemu-0.7.0/bsd/i386/e_sqrtl.c
---- qemu-0.7.0/bsd.orig/i386/e_sqrtl.c Wed Dec 31 19:00:00 1969
-+++ qemu-0.7.0/bsd/i386/e_sqrtl.c Fri Apr 29 02:11:27 2005
-@@ -0,0 +1,20 @@
-+/*
-+ * Written by J.T. Conklin <jtc@netbsd.org>.
-+ * Public domain.
-+ *
-+ * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
-+ */
-+
-+#include <sysdep.h>
-+
-+long double
-+__ieee754_sqrtl (long double x)
-+{
-+ long double res;
-+
-+ asm ("fsqrt" : "=t" (res) : "0" (x));
-+
-+ return res;
-+}
-+
-+weak_alias(__ieee754_sqrtl,sqrtl)
-diff -Nru qemu-0.7.0/bsd.orig/i386/s_ceill.S qemu-0.7.0/bsd/i386/s_ceill.S
---- qemu-0.7.0/bsd.orig/i386/s_ceill.S Wed Dec 31 19:00:00 1969
-+++ qemu-0.7.0/bsd/i386/s_ceill.S Fri Apr 29 02:11:27 2005
-@@ -0,0 +1,27 @@
-+/*
-+ * Based on code written by J.T. Conklin <jtc@NetBSD.org>.
-+ * Public domain.
-+ */
-+
-+#include <machine/asm.h>
-+RCSID("$FreeBSD: /tmp/pcvs/ports/emulators/qemu/files/patch-libmath,v 1.3 2006-08-21 23:02:01 shaun Exp $")
-+
-+ENTRY(ceill)
-+ pushl %ebp
-+ movl %esp,%ebp
-+ subl $8,%esp
-+
-+ fstcw -4(%ebp) /* store fpu control word */
-+ movw -4(%ebp),%dx
-+ orw $0x0800,%dx /* round towards +oo */
-+ andw $0xfbff,%dx
-+ movw %dx,-8(%ebp)
-+ fldcw -8(%ebp) /* load modfied control word */
-+
-+ fldt 8(%ebp) /* round */
-+ frndint
-+
-+ fldcw -4(%ebp) /* restore original control word */
-+
-+ leave
-+ ret
-diff -Nru qemu-0.7.0/bsd.orig/i386/s_cosl.S qemu-0.7.0/bsd/i386/s_cosl.S
---- qemu-0.7.0/bsd.orig/i386/s_cosl.S Wed Dec 31 19:00:00 1969
-+++ qemu-0.7.0/bsd/i386/s_cosl.S Fri Apr 29 02:11:27 2005
-@@ -0,0 +1,32 @@
-+/*
-+ * Written by J.T. Conklin <jtc@netbsd.org>.
-+ * Public domain.
-+ *
-+ * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
-+ */
-+
-+#include <machine/asm.h>
-+#include <sysdep.h>
-+
-+RCSID("$NetBSD: $")
-+
-+ENTRY(__cosl)
-+ fldt 4(%esp)
-+ fcos
-+ fnstsw %ax
-+ testl $0x400,%eax
-+ jnz 1f
-+ ret
-+ .align ALIGNARG(4)
-+1: fldpi
-+ fadd %st(0)
-+ fxch %st(1)
-+2: fprem1
-+ fnstsw %ax
-+ testl $0x400,%eax
-+ jnz 2b
-+ fstp %st(1)
-+ fcos
-+ ret
-+END (__cosl)
-+weak_alias (__cosl, cosl)
-diff -Nru qemu-0.7.0/bsd.orig/i386/s_floorl.S qemu-0.7.0/bsd/i386/s_floorl.S
---- qemu-0.7.0/bsd.orig/i386/s_floorl.S Wed Dec 31 19:00:00 1969
-+++ qemu-0.7.0/bsd/i386/s_floorl.S Fri Apr 29 02:11:27 2005
-@@ -0,0 +1,27 @@
-+/*
-+ * Based on code written by J.T. Conklin <jtc@NetBSD.org>.
-+ * Public domain.
-+ */
-+
-+#include <machine/asm.h>
-+RCSID("$FreeBSD: /tmp/pcvs/ports/emulators/qemu/files/patch-libmath,v 1.3 2006-08-21 23:02:01 shaun Exp $")
-+
-+ENTRY(floorl)
-+ pushl %ebp
-+ movl %esp,%ebp
-+ subl $8,%esp
-+
-+ fstcw -4(%ebp) /* store fpu control word */
-+ movw -4(%ebp),%dx
-+ orw $0x0400,%dx /* round towards -oo */
-+ andw $0xf7ff,%dx
-+ movw %dx,-8(%ebp)
-+ fldcw -8(%ebp) /* load modfied control word */
-+
-+ fldt 8(%ebp) /* round */
-+ frndint
-+
-+ fldcw -4(%ebp) /* restore original control word */
-+
-+ leave
-+ ret
-diff -Nru qemu-0.7.0/bsd.orig/i386/s_isnormal.c qemu-0.7.0/bsd/i386/s_isnormal.c
---- qemu-0.7.0/bsd.orig/i386/s_isnormal.c Wed Dec 31 19:00:00 1969
-+++ qemu-0.7.0/bsd/i386/s_isnormal.c Fri Apr 29 02:11:27 2005
-@@ -0,0 +1,85 @@
-+/*-
-+ * Copyright (c) 2003 Mike Barcroft <mike@FreeBSD.org>
-+ * Copyright (c) 2002-2004 David Schultz <das@FreeBSD.ORG>
-+ * All rights reserved.
-+ *
-+ * Redistribution and use in source and binary forms, with or without
-+ * modification, are permitted provided that the following conditions
-+ * are met:
-+ * 1. Redistributions of source code must retain the above copyright
-+ * notice, this list of conditions and the following disclaimer.
-+ * 2. Redistributions in binary form must reproduce the above copyright
-+ * notice, this list of conditions and the following disclaimer in the
-+ * documentation and/or other materials provided with the distribution.
-+ *
-+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-+ * SUCH DAMAGE.
-+ *
-+ * $FreeBSD: /tmp/pcvs/ports/emulators/qemu/files/patch-libmath,v 1.3 2006-08-21 23:02:01 shaun Exp $
-+ */
-+
-+union IEEEf2bits {
-+ float f;
-+ struct {
-+ unsigned int man :23;
-+ unsigned int exp :8;
-+ unsigned int sign :1;
-+ } bits;
-+};
-+
-+union IEEEd2bits {
-+ double d;
-+ struct {
-+ unsigned int manl :32;
-+ unsigned int manh :20;
-+ unsigned int exp :11;
-+ unsigned int sign :1;
-+ } bits;
-+};
-+
-+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;
-+};
-+
-+int
-+__isnormal(double d)
-+{
-+ union IEEEd2bits u;
-+
-+ u.d = d;
-+ return (u.bits.exp != 0 && u.bits.exp != 2047);
-+}
-+
-+int
-+__isnormalf(float f)
-+{
-+ union IEEEf2bits u;
-+
-+ u.f = f;
-+ return (u.bits.exp != 0 && u.bits.exp != 255);
-+}
-+
-+int
-+__isnormall(long double e)
-+{
-+ union IEEEl2bits u;
-+
-+ u.e = e;
-+ return (u.bits.exp != 0 && u.bits.exp != 32767);
-+}
-diff -Nru qemu-0.7.0/bsd.orig/i386/s_llrint.S qemu-0.7.0/bsd/i386/s_llrint.S
---- qemu-0.7.0/bsd.orig/i386/s_llrint.S Wed Dec 31 19:00:00 1969
-+++ qemu-0.7.0/bsd/i386/s_llrint.S Fri Apr 29 02:11:27 2005
-@@ -0,0 +1,36 @@
-+/*-
-+ * Copyright (c) 2005 David Schultz <das@FreeBSD.ORG>
-+ * All rights reserved.
-+ *
-+ * Redistribution and use in source and binary forms, with or without
-+ * modification, are permitted provided that the following conditions
-+ * are met:
-+ * 1. Redistributions of source code must retain the above copyright
-+ * notice, this list of conditions and the following disclaimer.
-+ * 2. Redistributions in binary form must reproduce the above copyright
-+ * notice, this list of conditions and the following disclaimer in the
-+ * documentation and/or other materials provided with the distribution.
-+ *
-+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-+ * SUCH DAMAGE.
-+ */
-+
-+#include <machine/asm.h>
-+RCSID("$FreeBSD: /tmp/pcvs/ports/emulators/qemu/files/patch-libmath,v 1.3 2006-08-21 23:02:01 shaun Exp $");
-+
-+ENTRY(llrint)
-+ fldl 4(%esp)
-+ subl $8,%esp
-+ fistpll (%esp)
-+ popl %eax
-+ popl %edx
-+ ret
-diff -Nru qemu-0.7.0/bsd.orig/i386/s_llrintf.S qemu-0.7.0/bsd/i386/s_llrintf.S
---- qemu-0.7.0/bsd.orig/i386/s_llrintf.S Wed Dec 31 19:00:00 1969
-+++ qemu-0.7.0/bsd/i386/s_llrintf.S Fri Apr 29 02:11:27 2005
-@@ -0,0 +1,36 @@
-+/*-
-+ * Copyright (c) 2005 David Schultz <das@FreeBSD.ORG>
-+ * All rights reserved.
-+ *
-+ * Redistribution and use in source and binary forms, with or without
-+ * modification, are permitted provided that the following conditions
-+ * are met:
-+ * 1. Redistributions of source code must retain the above copyright
-+ * notice, this list of conditions and the following disclaimer.
-+ * 2. Redistributions in binary form must reproduce the above copyright
-+ * notice, this list of conditions and the following disclaimer in the
-+ * documentation and/or other materials provided with the distribution.
-+ *
-+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-+ * SUCH DAMAGE.
-+ */
-+
-+#include <machine/asm.h>
-+RCSID("$FreeBSD: /tmp/pcvs/ports/emulators/qemu/files/patch-libmath,v 1.3 2006-08-21 23:02:01 shaun Exp $")
-+
-+ENTRY(llrintf)
-+ flds 4(%esp)
-+ subl $8,%esp
-+ fistpll (%esp)
-+ popl %eax
-+ popl %edx
-+ ret
-diff -Nru qemu-0.7.0/bsd.orig/i386/s_llrintl.S qemu-0.7.0/bsd/i386/s_llrintl.S
---- qemu-0.7.0/bsd.orig/i386/s_llrintl.S Wed Dec 31 19:00:00 1969
-+++ qemu-0.7.0/bsd/i386/s_llrintl.S Fri Apr 29 02:11:27 2005
-@@ -0,0 +1,35 @@
-+/* Round argument to nearest integral value according to current rounding
-+ direction.
-+ Copyright (C) 1997 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA. */
-+
-+#include <machine/asm.h>
-+#include <sysdep.h>
-+
-+ .text
-+ENTRY(__llrintl)
-+ fldt 4(%esp)
-+ subl $8, %esp
-+ fistpll (%esp)
-+ fwait
-+ popl %eax
-+ popl %edx
-+ ret
-+END(__llrintl)
-+weak_alias (__llrintl, llrintl)
-diff -Nru qemu-0.7.0/bsd.orig/i386/s_lrint.S qemu-0.7.0/bsd/i386/s_lrint.S
---- qemu-0.7.0/bsd.orig/i386/s_lrint.S Wed Dec 31 19:00:00 1969
-+++ qemu-0.7.0/bsd/i386/s_lrint.S Fri Apr 29 02:11:27 2005
-@@ -0,0 +1,35 @@
-+/*-
-+ * Copyright (c) 2005 David Schultz <das@FreeBSD.ORG>
-+ * All rights reserved.
-+ *
-+ * Redistribution and use in source and binary forms, with or without
-+ * modification, are permitted provided that the following conditions
-+ * are met:
-+ * 1. Redistributions of source code must retain the above copyright
-+ * notice, this list of conditions and the following disclaimer.
-+ * 2. Redistributions in binary form must reproduce the above copyright
-+ * notice, this list of conditions and the following disclaimer in the
-+ * documentation and/or other materials provided with the distribution.
-+ *
-+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-+ * SUCH DAMAGE.
-+ */
-+
-+#include <machine/asm.h>
-+RCSID("$FreeBSD: /tmp/pcvs/ports/emulators/qemu/files/patch-libmath,v 1.3 2006-08-21 23:02:01 shaun Exp $");
-+
-+ENTRY(lrint)
-+ fldl 4(%esp)
-+ subl $4,%esp
-+ fistpl (%esp)
-+ popl %eax
-+ ret
-diff -Nru qemu-0.7.0/bsd.orig/i386/s_lrintf.S qemu-0.7.0/bsd/i386/s_lrintf.S
---- qemu-0.7.0/bsd.orig/i386/s_lrintf.S Wed Dec 31 19:00:00 1969
-+++ qemu-0.7.0/bsd/i386/s_lrintf.S Fri Apr 29 02:11:27 2005
-@@ -0,0 +1,35 @@
-+/*-
-+ * Copyright (c) 2005 David Schultz <das@FreeBSD.ORG>
-+ * All rights reserved.
-+ *
-+ * Redistribution and use in source and binary forms, with or without
-+ * modification, are permitted provided that the following conditions
-+ * are met:
-+ * 1. Redistributions of source code must retain the above copyright
-+ * notice, this list of conditions and the following disclaimer.
-+ * 2. Redistributions in binary form must reproduce the above copyright
-+ * notice, this list of conditions and the following disclaimer in the
-+ * documentation and/or other materials provided with the distribution.
-+ *
-+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-+ * SUCH DAMAGE.
-+ */
-+
-+#include <machine/asm.h>
-+RCSID("$FreeBSD: /tmp/pcvs/ports/emulators/qemu/files/patch-libmath,v 1.3 2006-08-21 23:02:01 shaun Exp $")
-+
-+ENTRY(lrintf)
-+ flds 4(%esp)
-+ subl $4,%esp
-+ fistpl (%esp)
-+ popl %eax
-+ ret
-diff -Nru qemu-0.7.0/bsd.orig/i386/s_lrintl.S qemu-0.7.0/bsd/i386/s_lrintl.S
---- qemu-0.7.0/bsd.orig/i386/s_lrintl.S Wed Dec 31 19:00:00 1969
-+++ qemu-0.7.0/bsd/i386/s_lrintl.S Fri Apr 29 02:11:27 2005
-@@ -0,0 +1,34 @@
-+/* Round argument to nearest integral value according to current rounding
-+ direction.
-+ Copyright (C) 1997 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA. */
-+
-+#include <machine/asm.h>
-+#include <sysdep.h>
-+
-+ .text
-+ENTRY(__lrintl)
-+ fldt 4(%esp)
-+ subl $4, %esp
-+ fistpl (%esp)
-+ fwait
-+ popl %eax
-+ ret
-+END(__lrintl)
-+weak_alias (__lrintl, lrintl)
-diff -Nru qemu-0.7.0/bsd.orig/i386/s_rintl.c qemu-0.7.0/bsd/i386/s_rintl.c
---- qemu-0.7.0/bsd.orig/i386/s_rintl.c Wed Dec 31 19:00:00 1969
-+++ qemu-0.7.0/bsd/i386/s_rintl.c Fri Apr 29 02:11:27 2005
-@@ -0,0 +1,18 @@
-+/*
-+ * Written by J.T. Conklin <jtc@netbsd.org>.
-+ * Changes for long double by Ulrich Drepper <drepper@cygnus.com>
-+ * Public domain.
-+ */
-+
-+#include <sysdep.h>
-+
-+long double
-+__rintl (long double x)
-+{
-+ long double res;
-+
-+ asm ("frndint" : "=t" (res) : "0" (x));
-+ return res;
-+}
-+
-+weak_alias (__rintl, rintl)
-diff -Nru qemu-0.7.0/bsd.orig/i386/s_round.c qemu-0.7.0/bsd/i386/s_round.c
---- qemu-0.7.0/bsd.orig/i386/s_round.c Wed Dec 31 19:00:00 1969
-+++ qemu-0.7.0/bsd/i386/s_round.c Fri Apr 29 02:11:27 2005
-@@ -0,0 +1,51 @@
-+/*-
-+ * Copyright (c) 2003, Steven G. Kargl
-+ * All rights reserved.
-+ *
-+ * Redistribution and use in source and binary forms, with or without
-+ * modification, are permitted provided that the following conditions
-+ * are met:
-+ * 1. Redistributions of source code must retain the above copyright
-+ * notice unmodified, this list of conditions, and the following
-+ * disclaimer.
-+ * 2. Redistributions in binary form must reproduce the above copyright
-+ * notice, this list of conditions and the following disclaimer in the
-+ * documentation and/or other materials provided with the distribution.
-+ *
-+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-+ */
-+
-+#include <sys/cdefs.h>
-+__FBSDID("$FreeBSD: /tmp/pcvs/ports/emulators/qemu/files/patch-libmath,v 1.3 2006-08-21 23:02:01 shaun Exp $");
-+
-+#include <math.h>
-+
-+double
-+round(double x)
-+{
-+ double t;
-+
-+ if (!isfinite(x))
-+ return (x);
-+
-+ if (x >= 0.0) {
-+ t = floor(x);
-+ if (t - x <= -0.5)
-+ t += 1.0;
-+ return (t);
-+ } else {
-+ t = floor(-x);
-+ if (t + x <= -0.5)
-+ t += 1.0;
-+ return (-t);
-+ }
-+}
-diff -Nru qemu-0.7.0/bsd.orig/i386/s_sinl.S qemu-0.7.0/bsd/i386/s_sinl.S
---- qemu-0.7.0/bsd.orig/i386/s_sinl.S Wed Dec 31 19:00:00 1969
-+++ qemu-0.7.0/bsd/i386/s_sinl.S Fri Apr 29 02:11:27 2005
-@@ -0,0 +1,32 @@
-+/*
-+ * Written by J.T. Conklin <jtc@netbsd.org>.
-+ * Public domain.
-+ *
-+ * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
-+ */
-+
-+#include <machine/asm.h>
-+#include <sysdep.h>
-+
-+RCSID("$NetBSD: $")
-+
-+ENTRY(__sinl)
-+ fldt 4(%esp)
-+ fsin
-+ fnstsw %ax
-+ testl $0x400,%eax
-+ jnz 1f
-+ ret
-+ .align ALIGNARG(4)
-+1: fldpi
-+ fadd %st(0)
-+ fxch %st(1)
-+2: fprem1
-+ fnstsw %ax
-+ testl $0x400,%eax
-+ jnz 2b
-+ fstp %st(1)
-+ fsin
-+ ret
-+END (__sinl)
-+weak_alias (__sinl, sinl)
-diff -Nru qemu-0.7.0/bsd.orig/i386/s_tanl.S qemu-0.7.0/bsd/i386/s_tanl.S
---- qemu-0.7.0/bsd.orig/i386/s_tanl.S Wed Dec 31 19:00:00 1969
-+++ qemu-0.7.0/bsd/i386/s_tanl.S Fri Apr 29 02:11:27 2005
-@@ -0,0 +1,33 @@
-+/*
-+ * Written by J.T. Conklin <jtc@netbsd.org>.
-+ * Public domain.
-+ *
-+ * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
-+ */
-+
-+#include <machine/asm.h>
-+#include <sysdep.h>
-+
-+RCSID("$NetBSD: $")
-+
-+ENTRY(__tanl)
-+ fldt 4(%esp)
-+ fptan
-+ fnstsw %ax
-+ testl $0x400,%eax
-+ jnz 1f
-+ fstp %st(0)
-+ ret
-+1: fldpi
-+ fadd %st(0)
-+ fxch %st(1)
-+2: fprem1
-+ fstsw %ax
-+ testl $0x400,%eax
-+ jnz 2b
-+ fstp %st(1)
-+ fptan
-+ fstp %st(0)
-+ ret
-+END (__tanl)
-+weak_alias (__tanl, tanl)
-diff -Nru qemu-0.7.0/bsd.orig/sysdep.h qemu-0.7.0/bsd/sysdep.h
---- qemu-0.7.0/bsd.orig/sysdep.h Wed Dec 31 19:00:00 1969
-+++ qemu-0.7.0/bsd/sysdep.h Fri Apr 29 02:11:27 2005
-@@ -0,0 +1,20 @@
-+#ifndef _QEMU_BSD_SYSDEP_H_
-+#define _QEMU_BSD_SYSDEP_H_
-+
-+#include <sys/cdefs.h>
-+
-+#define HAVE_ELF
-+
-+#ifdef __ASSEMBLER__
-+#define ALIGNARG(log2) 1<<log2
-+#define ASM_TYPE_DIRECTIVE(name,typearg) .type name,typearg;
-+#define ASM_SIZE_DIRECTIVE(name) .size name,.-name;
-+#define END(x)
-+#define strong_alias(sym,alias) .set alias,sym;
-+#define weak_alias(sym,alias) .weak alias; .equ alias,sym;
-+#else
-+#define strong_alias(sym,alias) __strong_reference(sym,alias);
-+#define weak_alias(sym,alias) __weak_reference(sym,alias);
-+#endif
-+
-+#endif
diff --git a/emulators/qemu/files/patch-libmath2 b/emulators/qemu/files/patch-libmath2
deleted file mode 100644
index ecff96d0d89e..000000000000
--- a/emulators/qemu/files/patch-libmath2
+++ /dev/null
@@ -1,57 +0,0 @@
-Index: qemu/bsd/Makefile
-@@ -16,7 +16,8 @@
- ${MACHINE_ARCH}/s_rintl.c \
- ${MACHINE_ARCH}/s_round.c \
- ${MACHINE_ARCH}/s_sinl.S \
-- ${MACHINE_ARCH}/s_tanl.S
-+ ${MACHINE_ARCH}/s_tanl.S \
-+ ${MACHINE_ARCH}/s_ldexpl.c
-
- OBJS= ${SRCS:R:S/$/.o/}
-
-Index: qemu/bsd/i386/s_ldexpl.c
-@@ -0,0 +1,21 @@
-+#include <math.h>
-+#include <errno.h>
-+#include <sysdep.h>
-+
-+long double __ldexpl(long double x, int expn)
-+{
-+ long double res;
-+ if (!isfinite (x) || x == 0.0L)
-+ return x;
-+
-+ __asm__ ("fscale"
-+ : "=t" (res)
-+ : "0" (x), "u" ((long double) expn));
-+
-+ if (!isfinite (res) || res == 0.0L)
-+ errno = ERANGE;
-+
-+ return res;
-+}
-+
-+weak_alias(__ldexpl,ldexpl)
-Index: qemu/bsd/amd64/s_ldexpl.c
-@@ -0,0 +1,21 @@
-+#include <math.h>
-+#include <errno.h>
-+#include <sysdep.h>
-+
-+long double __ldexpl(long double x, int expn)
-+{
-+ long double res;
-+ if (!isfinite (x) || x == 0.0L)
-+ return x;
-+
-+ __asm__ ("fscale"
-+ : "=t" (res)
-+ : "0" (x), "u" ((long double) expn));
-+
-+ if (!isfinite (res) || res == 0.0L)
-+ errno = ERANGE;
-+
-+ return res;
-+}
-+
-+weak_alias(__ldexpl,ldexpl)
diff --git a/emulators/qemu/files/patch-libmath_FreeBSD-version b/emulators/qemu/files/patch-libmath_FreeBSD-version
deleted file mode 100644
index dcf87c0ef8c5..000000000000
--- a/emulators/qemu/files/patch-libmath_FreeBSD-version
+++ /dev/null
@@ -1,150 +0,0 @@
-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 <math.h>
-
- #ifdef __FreeBSD__
- #include <osreldate.h>
-+#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 */
diff --git a/emulators/qemu/files/patch-net_tap-bsd.c b/emulators/qemu/files/patch-net_tap-bsd.c
new file mode 100644
index 000000000000..8e027eda9e61
--- /dev/null
+++ b/emulators/qemu/files/patch-net_tap-bsd.c
@@ -0,0 +1,10 @@
+--- net/tap-bsd.c.orig 2015-11-03 20:01:34 UTC
++++ net/tap-bsd.c
+@@ -29,6 +29,7 @@
+
+ #if defined(__NetBSD__) || defined(__FreeBSD__)
+ #include <sys/ioctl.h>
++#include <sys/socket.h>
+ #include <net/if.h>
+ #include <net/if_tap.h>
+ #endif
diff --git a/emulators/qemu/files/patch-osdep.c b/emulators/qemu/files/patch-osdep.c
deleted file mode 100644
index a1b7cadcb08a..000000000000
--- a/emulators/qemu/files/patch-osdep.c
+++ /dev/null
@@ -1,18 +0,0 @@
-Index: qemu/osdep.c
-@@ -179,13 +179,15 @@ static void *kqemu_vmalloc(size_t size)
- }
- unlink(phys_ram_file);
- }
-+#endif /* !(__OpenBSD__ || __FreeBSD__ || __DragonFly__) */
- size = (size + 4095) & ~4095;
-+#if !defined(__OpenBSD__) && !defined(__FreeBSD__) && !defined(__DragonFly__)
- ftruncate(phys_ram_fd, phys_ram_size + size);
- #endif /* !(__OpenBSD__ || __FreeBSD__ || __DragonFly__) */
- ptr = mmap(NULL,
- size,
- PROT_WRITE | PROT_READ, map_anon | MAP_SHARED,
-- phys_ram_fd, phys_ram_size);
-+ phys_ram_fd, map_anon ? 0 : phys_ram_size);
- if (ptr == MAP_FAILED) {
- fprintf(stderr, "Could not map physical memory\n");
- exit(1);
diff --git a/emulators/qemu/files/patch-pc-bios-optionrom-multiboot.S b/emulators/qemu/files/patch-pc-bios-optionrom-multiboot.S
deleted file mode 100644
index 91a3c4e8decc..000000000000
--- a/emulators/qemu/files/patch-pc-bios-optionrom-multiboot.S
+++ /dev/null
@@ -1,16 +0,0 @@
---- a/pc-bios/optionrom/multiboot.S
-+++ b/pc-bios/optionrom/multiboot.S
-@@ -113,7 +113,10 @@ mmap_loop:
- /* entry size (mmap struct) & max buffer size (int15) */
- movl $20, %ecx
- /* store entry size */
-+ /* old as(1) doesn't like this insn so emit the bytes instead:
- movl %ecx, %es:-4(%edi)
-+ */
-+ .dc.b 0x26,0x67,0x66,0x89,0x4f,0xfc
- /* e820 */
- movl $0x0000e820, %eax
- /* 'SMAP' magic */
---
-1.6.5.2
-
diff --git a/emulators/qemu/files/patch-vl.c-serial b/emulators/qemu/files/patch-qemu-char.c
index 0918cd7a724f..40a9b529f3b9 100644
--- a/emulators/qemu/files/patch-vl.c-serial
+++ b/emulators/qemu/files/patch-qemu-char.c
@@ -1,5 +1,6 @@
-Index: qemu/qemu-char.c
-@@ -1606,10 +1606,13 @@
+--- qemu-char.c.orig 2015-12-16 00:54:18 UTC
++++ qemu-char.c
+@@ -1507,10 +1507,14 @@ static void tty_serial_init(int fd, int
cfsetospeed(&tty, spd);
tty.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP
@@ -12,6 +13,7 @@ Index: qemu/qemu-char.c
+#ifdef __FreeBSD__
+ cfmakeraw(&tty);
+#endif
++
switch(data_bits) {
default:
case 8:
diff --git a/emulators/qemu/files/patch-qemu-doc.texi b/emulators/qemu/files/patch-qemu-doc.texi
index 1a7d9ef2ca51..4bcda8581c01 100644
--- a/emulators/qemu/files/patch-qemu-doc.texi
+++ b/emulators/qemu/files/patch-qemu-doc.texi
@@ -1,5 +1,6 @@
-Index: qemu/qemu-doc.texi
-@@ -985,7 +985,8 @@
+--- qemu-doc.texi.orig 2015-11-03 20:01:35 UTC
++++ qemu-doc.texi
+@@ -355,7 +355,8 @@ Send Ctrl-a
@c man begin SEEALSO
The HTML documentation of QEMU for more precise information and Linux
diff --git a/emulators/qemu/files/patch-qemu_Makefiles b/emulators/qemu/files/patch-qemu_Makefiles
deleted file mode 100644
index 27c544f14341..000000000000
--- a/emulators/qemu/files/patch-qemu_Makefiles
+++ /dev/null
@@ -1,36 +0,0 @@
-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
-@@ -54,6 +54,7 @@
-
- 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
- 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"
-+#define DEFAULT_NETWORK_SCRIPT PREFIX "/etc/qemu-ifup"
-+#define DEFAULT_NETWORK_DOWN_SCRIPT PREFIX "/etc/qemu-ifdown"
-+#ifndef SMBD_COMMAND
- #ifdef __sun__
- #define SMBD_COMMAND "/usr/sfw/sbin/smbd"
- #else
- #define SMBD_COMMAND "/usr/sbin/smbd"
- #endif
-+#endif
-
- #endif
diff --git a/emulators/qemu/files/patch-qemu_configure_1 b/emulators/qemu/files/patch-qemu_configure_1
deleted file mode 100644
index cc7638d0f26e..000000000000
--- a/emulators/qemu/files/patch-qemu_configure_1
+++ /dev/null
@@ -1,10 +0,0 @@
-Index: qemu/configure
-@@ -868,7 +868,7 @@
- sdl_too_old=no
-
- if test "$sdl" = "yes" ; then
-- sdl_config="sdl-config"
-+ sdl_config="${SDL_CONFIG}"
- sdl=no
- sdl_static=no
-
diff --git a/emulators/qemu/files/patch-qemu_configure_2 b/emulators/qemu/files/patch-qemu_configure_2
deleted file mode 100644
index b8b49a136432..000000000000
--- a/emulators/qemu/files/patch-qemu_configure_2
+++ /dev/null
@@ -1,10 +0,0 @@
-Index: qemu/configure
-@@ -570,7 +570,7 @@
- if test -z "$prefix" ; then
- prefix="/usr/local"
- fi
-- mansuffix="/share/man"
-+ mansuffix="/man"
- datasuffix="/share/qemu"
- docsuffix="/share/doc/qemu"
- binsuffix="/bin"
diff --git a/emulators/qemu/files/patch-qemu_net.c b/emulators/qemu/files/patch-qemu_net.c
deleted file mode 100644
index 69e70482fefc..000000000000
--- a/emulators/qemu/files/patch-qemu_net.c
+++ /dev/null
@@ -1,109 +0,0 @@
-Index: qemu/net.c
-@@ -76,6 +76,11 @@
- #endif
- #endif
- #endif
-+#ifdef __FreeBSD__
-+#include <sys/param.h>
-+#include <sys/module.h>
-+#include <sys/linker.h>
-+#endif
-
- #if defined(CONFIG_SLIRP)
- #include "libslirp.h"
-@@ -3407,6 +3410,34 @@
-
- #endif /* CONFIG_SLIRP */
-
-+#ifdef __FreeBSD__
-+#define LOAD_QUIETLY 1
-+#define LOAD_VERBOSLY 2
-+
-+static int
-+loadmodules(int how, const char *module, ...)
-+{
-+ int loaded = 0;
-+ va_list ap;
-+
-+ va_start(ap, module);
-+#ifndef NO_MODULES
-+ while (module != NULL) {
-+ if (modfind(module) == -1) {
-+ if (kldload(module) == -1) {
-+ if (how == LOAD_VERBOSLY)
-+ fprintf(stderr, "%s: Cannot load module\n", module);
-+ } else
-+ loaded++;
-+ }
-+ module = va_arg(ap, const char *);
-+ }
-+ va_end(ap);
-+#endif
-+ return loaded;
-+}
-+#endif
-+
- #if !defined(_WIN32)
-
- typedef struct TAPState {
-@@ -3470,11 +3501,59 @@
- char *dev;
- struct stat s;
-
-+#ifdef __FreeBSD__
-+ int i, kldtried = 0, enoentcount = 0, err = 0;
-+ char dname[100];
-+#ifdef USE_DEVTAP
-+ /*
-+ * 5.x has /dev/tap, but that seems to just blindly increase its
-+ * couter on every open() for some people(??), i.e. on every qemu run.
-+ */
-+ i = -1;
-+#else
-+ i = 0;
-+#endif
-+ for (; i < 10; i++) {
-+ if (*ifname)
-+ snprintf(dname, sizeof dname, "/dev/%s", ifname);
-+ else if (i == -1)
-+ strcpy(dname, "/dev/tap");
-+ else
-+ snprintf(dname, sizeof dname, "%s%d",
-+ "/dev/tap", i);
-+ TFR(fd = open(dname, O_RDWR));
-+ if (fd >= 0)
-+ break;
-+ else if (errno == ENXIO || errno == ENOENT) {
-+ if (i == 0 && !kldtried++) {
-+ /*
-+ * Attempt to load the tunnel interface KLD if it isn't loaded
-+ * already.
-+ */
-+ if (loadmodules(LOAD_VERBOSLY, "if_tap", NULL))
-+ i = -1;
-+ continue;
-+ }
-+ if (errno != ENOENT || ++enoentcount > 3) {
-+ err = errno;
-+ break;
-+ }
-+ } else
-+ err = errno;
-+ if (*ifname)
-+ break;
-+ }
-+ if (fd < 0) {
-+ fprintf(stderr, "warning: could not open %s (%s): no virtual network emulation\n", dname, strerror(err));
-+ return -1;
-+ }
-+#else
- TFR(fd = open("/dev/tap", O_RDWR));
- if (fd < 0) {
-- fprintf(stderr, "warning: could not open /dev/tap: no virtual network emulation\n");
-+ fprintf(stderr, "warning: could not open /dev/tap (%s): no virtual network emulation\n", strerror(errno));
- return -1;
- }
-+#endif
-
- fstat(fd, &s);
- dev = devname(s.st_rdev, S_IFCHR);
diff --git a/emulators/qemu/files/patch-qemu_slirp_slirp_config.h b/emulators/qemu/files/patch-slirp_slirp__config.h
index 57cc889e3119..4aa0dd7c10cf 100644
--- a/emulators/qemu/files/patch-qemu_slirp_slirp_config.h
+++ b/emulators/qemu/files/patch-slirp_slirp__config.h
@@ -1,6 +1,7 @@
-Index: qemu/slirp/slirp_config.h
-@@ -86,7 +86,7 @@
- #undef BAD_SPRINTF
+--- slirp/slirp_config.h.orig 2015-11-03 20:01:35 UTC
++++ slirp/slirp_config.h
+@@ -83,7 +83,7 @@
+ //#undef HOST_WORDS_BIGENDIAN
/* Define if you have readv */
-#undef HAVE_READV
@@ -8,17 +9,17 @@ Index: qemu/slirp/slirp_config.h
/* Define if iovec needs to be declared */
#undef DECLARE_IOVEC
-@@ -95,7 +95,7 @@
- #undef DECLARE_SPRINTF
+@@ -92,7 +92,7 @@
+ #endif
/* Define if you have a POSIX.1 sys/wait.h */
-#undef HAVE_SYS_WAIT_H
+#define HAVE_SYS_WAIT_H
/* Define if you have sys/select.h */
- #define HAVE_SYS_SELECT_H
-@@ -107,7 +107,7 @@
- #define HAVE_ARPA_INET_H
+ #undef HAVE_SYS_SELECT_H
+@@ -110,7 +110,7 @@
+ #endif
/* Define if you have sys/signal.h */
-#undef HAVE_SYS_SIGNAL_H
@@ -26,7 +27,7 @@ Index: qemu/slirp/slirp_config.h
/* Define if you have sys/stropts.h */
#undef HAVE_SYS_STROPTS_H
-@@ -180,7 +180,7 @@
+@@ -179,7 +179,7 @@
#undef HAVE_GRANTPT
/* Define if you have fchmod */
diff --git a/emulators/qemu/files/patch-smc-fix b/emulators/qemu/files/patch-smc-fix
deleted file mode 100644
index 0fb2a1ae7adb..000000000000
--- a/emulators/qemu/files/patch-smc-fix
+++ /dev/null
@@ -1,38 +0,0 @@
-diff --git a/hw/smc91c111.c b/hw/smc91c111.c
-index c1a88c9..e4a2447 100644
---- qemu/hw/smc91c111.c
-+++ qemu/hw/smc91c111.c
-@@ -250,6 +250,7 @@ static void smc91c111_writeb(void *opaque, target_phys_addr_t offset,
- {
- smc91c111_state *s = (smc91c111_state *)opaque;
-
-+ offset = offset & 0xf;
- if (offset == 14) {
- s->bank = value;
- return;
-@@ -276,6 +277,8 @@ static void smc91c111_writeb(void *opaque, target_phys_addr_t offset,
- case 10: case 11: /* RPCR */
- /* Ignored */
- return;
-+ case 12: case 13: /* Reserved */
-+ return;
- }
- break;
-
-@@ -421,6 +424,7 @@ static uint32_t smc91c111_readb(void *opaque, target_phys_addr_t offset)
- {
- smc91c111_state *s = (smc91c111_state *)opaque;
-
-+ offset = offset & 0xf;
- if (offset == 14) {
- return s->bank;
- }
-@@ -461,6 +465,8 @@ static uint32_t smc91c111_readb(void *opaque, target_phys_addr_t offset)
- case 10: case 11: /* RPCR */
- /* Not implemented. */
- return 0;
-+ case 12: case 13: /* Reserved */
-+ return 0;
- }
- break;
-
diff --git a/emulators/qemu/files/patch-tapclose b/emulators/qemu/files/patch-tapclose
deleted file mode 100644
index 8da33adb673f..000000000000
--- a/emulators/qemu/files/patch-tapclose
+++ /dev/null
@@ -1,18 +0,0 @@
-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);
- }
-
diff --git a/emulators/qemu/files/patch-x_keymap.c b/emulators/qemu/files/patch-ui_x__keymap.c
index 30b0454208c1..7bb859dfd381 100644
--- a/emulators/qemu/files/patch-x_keymap.c
+++ b/emulators/qemu/files/patch-ui_x__keymap.c
@@ -1,14 +1,15 @@
-Index: qemu/x_keymap.c
-@@ -41,9 +41,9 @@
+--- ui/x_keymap.c.orig 2015-12-16 00:59:05 UTC
++++ ui/x_keymap.c
+@@ -43,9 +43,9 @@ static const uint8_t x_keycode_to_pc_key
0xb5, /* 112 Divide */
0xb8, /* 113 Alt-R */
0xc6, /* 114 Break */
- 0x0, /* 115 */
- 0x0, /* 116 */
- 0x0, /* 117 */
-+ 0xdb, /* 115 left windows key */
-+ 0xdc, /* 116 right windows key */
-+ 0xdd, /* 117 right menu key */
++ 0xdb, /* 115 left windows key */
++ 0xdc, /* 116 right windows key */
++ 0xdd, /* 117 right menu key */
0x0, /* 118 */
0x0, /* 119 */
0x0, /* 120 */
diff --git a/emulators/qemu/files/patch-vl.c b/emulators/qemu/files/patch-vl.c
deleted file mode 100644
index b979a0373046..000000000000
--- a/emulators/qemu/files/patch-vl.c
+++ /dev/null
@@ -1,82 +0,0 @@
-Index: qemu/vl.c
-@@ -57,6 +57,7 @@
- #include <sys/stat.h>
- #if defined(__FreeBSD__) || defined(__DragonFly__)
- #include <libutil.h>
-+#include <sys/param.h>
- #else
- #include <util.h>
- #endif
-@@ -4782,6 +4783,10 @@
-
- #endif
-
-+#if !defined(CONFIG_USER_ONLY)
-+void io_mem_init(void);
-+#endif
-+
- 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;
-
diff --git a/emulators/qemu/files/patch-z-bandaid-usb-current b/emulators/qemu/files/patch-z-bandaid-usb-current
deleted file mode 100644
index ad66da21f543..000000000000
--- a/emulators/qemu/files/patch-z-bandaid-usb-current
+++ /dev/null
@@ -1,14 +0,0 @@
-Index: qemu/usb-bsd.c
-@@ -35,7 +35,12 @@
-
- #include <sys/ioctl.h>
- #ifndef __DragonFly__
-+#include <sys/param.h>
-+#if __FreeBSD_version >= 800064
-+#include <legacy/dev/usb/usb.h>
-+#else
- #include <dev/usb/usb.h>
-+#endif
- #else
- #include <bus/usb/usb.h>
- #endif
diff --git a/emulators/qemu/files/pcap-patch b/emulators/qemu/files/pcap-patch
index 55b51cc66e8a..d31c1c9eda17 100644
--- a/emulators/qemu/files/pcap-patch
+++ b/emulators/qemu/files/pcap-patch
@@ -1,47 +1,33 @@
---- Makefile.target.orig 2010-01-29 14:39:26.000000000 -0500
-+++ Makefile.target 2010-01-29 14:39:28.000000000 -0500
-@@ -616,6 +616,13 @@ ifdef CONFIG_COREAUDIO
- COCOA_LIBS+=-framework CoreAudio
- endif
- endif
-+ifdef CONFIG_PCAP
-+ifdef CONFIG_WIN32
-+LIBS+=-lwpcap
-+else
-+LIBS+=-lpcap
-+endif
-+endif
- ifdef CONFIG_SLIRP
- CPPFLAGS+=-I$(SRC_PATH)/slirp
- endif
---- configure.orig 2010-01-29 14:39:26.000000000 -0500
-+++ configure 2010-01-29 14:39:27.000000000 -0500
-@@ -203,6 +203,9 @@ sdl="yes"
- sdl_x11="no"
- xen="yes"
- pkgversion=""
+--- configure.orig 2015-08-11 19:11:05 UTC
++++ configure
+@@ -338,6 +338,9 @@ libssh2=""
+ vhdx=""
+ numa=""
+ tcmalloc="no"
+pcap="no"
+pcap_create="no"
+bpf="no"
- # OS specific
- if check_define __linux__ ; then
-@@ -428,6 +431,8 @@ for opt do
+ # parse CC options first
+ for opt do
+@@ -896,6 +899,10 @@ for opt do
;;
- --disable-vnc-sasl) vnc_sasl="no"
+ --enable-vnc-png) vnc_png="yes"
;;
+ --enable-pcap) pcap="yes"
+ ;;
++ --disable-pcap) pcap="no"
++ ;;
--disable-slirp) slirp="no"
;;
- --disable-vde) vde="no"
-@@ -925,6 +930,48 @@ EOF
+ --disable-uuid) uuid="no"
+@@ -2354,6 +2361,51 @@ EOF
fi
##########################################
+# pcap probe
+
-+if test "$pcap" = "yes" ; then
++if test "$pcap" = "yes" -a "$pcap" != "no"; then
+ cat > $TMPC << EOF
+#include <pcap.h>
+int main(void) { return (pcap_lib_version() == (char *)0 ? 1 : 0); }
@@ -51,7 +37,9 @@
+ else
+ libpcap=-lwpcap
+ fi
-+ if ! $cc $ARCH_CFLAGS -o $TMPE $libpcap $TMPC 2> /dev/null ; then
++ if compile_prog "" "$libpcap" ; then
++ :
++ else
+ echo
+ echo "Error: Could not find pcap"
+ echo "Make sure to have the pcap libs and headers installed."
@@ -66,7 +54,7 @@
+ return (pcap_create("foo", errbuf) == (pcap_t *)0 ? 1 : 0);
+}
+EOF
-+ if $cc $ARCH_CFLAGS -o $TMPE $libpcap $TMPC 2> /dev/null ; then
++ if compile_prog "" "$libpcap" ; then
+ pcap_create="yes"
+ fi
+ cat > $TMPC << EOF
@@ -75,72 +63,111 @@
+#include <net/bpf.h>
+int main(void) { return (BPF_MAJOR_VERSION); }
+EOF
-+ if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
++ if compile_prog ; then
+ bpf="yes"
+ fi
++ libs_softmmu="$libpcap $libs_softmmu"
+fi # test "$pcap"
+
+##########################################
- # VNC TLS detection
- if test "$vnc_tls" = "yes" ; then
- cat > $TMPC <<EOF
-@@ -1436,6 +1483,7 @@ if test "$vnc_sasl" = "yes" ; then
- echo " SASL CFLAGS $vnc_sasl_cflags"
- echo " SASL LIBS $vnc_sasl_libs"
- fi
+ # VNC TLS/WS detection
+ if test "$vnc" = "yes" -a "$vnc_tls" != "no" ; then
+ cat > $TMPC <<EOF
+@@ -4515,6 +4567,7 @@ echo "Audio drivers $audio_drv_list"
+ echo "Block whitelist (rw) $block_drv_rw_whitelist"
+ echo "Block whitelist (ro) $block_drv_ro_whitelist"
+ echo "VirtFS support $virtfs"
+echo "pcap support $pcap"
- if test -n "$sparc_cpu"; then
- echo "Target Sparc Arch $sparc_cpu"
- fi
-@@ -1589,6 +1637,16 @@ fi
- if test $profiler = "yes" ; then
- echo "#define CONFIG_PROFILER 1" >> $config_host_h
+ echo "VNC support $vnc"
+ if test "$vnc" = "yes" ; then
+ echo "VNC TLS support $vnc_tls"
+@@ -4692,6 +4745,15 @@ fi
+ if test "$profiler" = "yes" ; then
+ echo "CONFIG_PROFILER=y" >> $config_host_mak
fi
+if test "$pcap" = "yes" ; then
-+ echo "CONFIG_PCAP=yes" >> $config_host_mak
-+ echo "#define CONFIG_PCAP 1" >> $config_host_h
++ echo "CONFIG_PCAP=y" >> $config_host_mak
+ if test "$pcap_create" = "yes" ; then
-+ echo "#define HAVE_PCAP_CREATE 1" >> $config_host_h
++ echo "CONFIG_PCAP_CREATE=y" >> $config_host_mak
+ fi
+ if test "$bpf" = "yes" ; then
-+ echo "#define HAVE_BPF 1" >> $config_host_h
++ echo "CONFIG_BPF=y" >> $config_host_mak
+ fi
+fi
if test "$slirp" = "yes" ; then
echo "CONFIG_SLIRP=y" >> $config_host_mak
- echo "#define CONFIG_SLIRP 1" >> $config_host_h
-Index: net.c
-@@ -688,6 +688,201 @@ static void config_error(Monitor *mon, c
- va_end(ap);
+ echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak
+--- net/clients.h.orig 2015-08-11 19:11:09 UTC
++++ net/clients.h
+@@ -49,6 +49,12 @@ int net_init_bridge(const NetClientOptio
+
+ int net_init_l2tpv3(const NetClientOptions *opts, const char *name,
+ NetClientState *peer, Error **errp);
++
++#ifdef CONFIG_PCAP
++int net_init_pcap(const NetClientOptions *opts, const char *name,
++ NetClientState *peer);
++#endif
++
+ #ifdef CONFIG_VDE
+ int net_init_vde(const NetClientOptions *opts, const char *name,
+ NetClientState *peer, Error **errp);
+--- net/hub.c.orig 2015-08-11 19:11:09 UTC
++++ net/hub.c
+@@ -322,6 +322,7 @@ void net_hub_check_clients(void)
+ case NET_CLIENT_OPTIONS_KIND_SOCKET:
+ case NET_CLIENT_OPTIONS_KIND_VDE:
+ case NET_CLIENT_OPTIONS_KIND_VHOST_USER:
++ case NET_CLIENT_OPTIONS_KIND_PCAP:
+ has_host_dev = 1;
+ break;
+ default:
+--- net/net.c.orig 2015-08-11 19:11:09 UTC
++++ net/net.c
+@@ -45,6 +45,11 @@
+ #include "qapi/dealloc-visitor.h"
+ #include "sysemu/sysemu.h"
+
++#include <sys/ioctl.h>
++#ifdef __FreeBSD__
++#include <net/if.h>
++#endif
++
+ /* Net bridge is currently not supported for W32. */
+ #if !defined(_WIN32)
+ # define CONFIG_NET_BRIDGE
+@@ -880,6 +885,221 @@ static int net_init_nic(const NetClientO
+ return idx;
}
+#if defined(CONFIG_PCAP)
-+#if defined(HAVE_BPF)
++#if defined(CONFIG_BPF)
+#define PCAP_DONT_INCLUDE_PCAP_BPF_H
+#include <net/bpf.h>
+#endif
+#include <pcap.h>
+
-+typedef struct PCAPState {
-+ VLANClientState *vc;
-+ pcap_t *handle;
-+ int max_eth_frame_size;
-+} PCAPState;
++struct PCAPState {
++ NetClientState nc;
++ pcap_t *handle;
++ int max_eth_frame_size;
++};
+
-+static ssize_t pcap_receive(VLANClientState *vc, const uint8_t *buf, size_t size)
++static ssize_t pcap_receive(NetClientState *nc, const uint8_t *buf, size_t size)
+{
-+ PCAPState *s = (PCAPState *)vc->opaque;
++ struct PCAPState *s = DO_UPCAST(struct PCAPState, nc, nc);
+
+ return pcap_inject(s->handle, (u_char*)buf, size);
+}
+
-+static void pcap_callback(u_char *user, struct pcap_pkthdr *phdr, u_char *pdata)
++static void pcap_callback(u_char *user, struct pcap_pkthdr *phdr, u_char *pdata
++ )
+{
-+ VLANClientState *vc = (VLANClientState *)user;
++ NetClientState *nc = (NetClientState *)user;
+
+ int len = phdr->len;
+#ifdef __FreeBSD__
-+ PCAPState *s = vc->opaque;
++ struct PCAPState *s = DO_UPCAST(struct PCAPState, nc, nc);
+ int max_eth_frame_size = s->max_eth_frame_size;
+
+ if (len > max_eth_frame_size) {
@@ -150,42 +177,63 @@ Index: net.c
+ len = max_eth_frame_size;
+ }
+#endif
-+ qemu_send_packet(vc, pdata, len);
++ qemu_send_packet(nc, pdata, len);
+}
+
+static void pcap_send(void *opaque)
+{
-+ PCAPState *s = (PCAPState *)opaque;
++ struct PCAPState *s = (struct PCAPState *)opaque;
+
+ for (;;) {
-+ if (pcap_dispatch(s->handle, 0, (pcap_handler)&pcap_callback, (u_char *)s->vc) >= 0)
++ if (pcap_dispatch(s->handle, 0, (pcap_handler)&pcap_callback, (u_char *)&s->nc) >= 0)
+ break;
+ }
+}
+
-+static void pcap_cleanup(VLANClientState *vc)
++static void pcap_cleanup(NetClientState *nc)
+{
-+ PCAPState *s = vc->opaque;
++ struct PCAPState *s = DO_UPCAST(struct PCAPState, nc, nc);
+
++ qemu_purge_queued_packets(nc);
+ pcap_close(s->handle);
-+ qemu_free(s);
+}
+
-+static int net_pcap_init(VLANState *vlan, const char *model, const char *name, char *ifname)
++static NetClientInfo net_pcap_info = {
++ .type = NET_CLIENT_OPTIONS_KIND_PCAP,
++ .size = sizeof(struct PCAPState),
++ .receive = pcap_receive,
++// .receive_raw = pcap_receive_raw,
++// .receive_iov = pcap_receive_iov,
++// .poll = pcap_poll,
++ .cleanup = pcap_cleanup,
++};
++/*
++ * ... -net pcap,ifname="..."
++ */
++
++int net_init_pcap(const NetClientOptions *opts, const char *name, NetClientState *peer)
+{
-+ PCAPState *s = NULL;
++ const NetdevPcapOptions *pcap_opts = opts->pcap;
++ NetClientState *nc;
++ struct PCAPState *s;
++ const char *ifname;
+ char errbuf[PCAP_ERRBUF_SIZE];
+#if defined(_WIN32)
+ HANDLE h;
+#endif
+ int i;
+
-+ s = qemu_mallocz(sizeof(PCAPState));
-+ if (!s)
++ if (!pcap_opts->has_ifname)
+ return -1;
+
++ ifname = pcap_opts->ifname;
++
++ /* create the object */
++ nc = qemu_new_net_client(&net_pcap_info, peer, "pcap", ifname);
++ s = DO_UPCAST(struct PCAPState, nc, nc);
++
+ if (ifname == NULL && (ifname = pcap_lookupdev(errbuf)) == NULL) {
-+ fprintf(stderr, "qemu: pcap_lookupdev: %s\n", errbuf);
++ fprintf(stderr, "qemu: pcap_create: %s\n", errbuf);
+ goto fail;
+ }
+
@@ -208,7 +256,8 @@ Index: net.c
+ close(i);
+ }
+#endif
-+#if defined(HAVE_PCAP_CREATE) || defined(_WIN32)
++
++#if defined(CONFIG_PCAP_CREATE) || defined(_WIN32)
+ /*
+ * Create pcap handle for the device, set promiscuous mode and activate.
+ */
@@ -218,11 +267,11 @@ Index: net.c
+ goto fail;
+ }
+ if (pcap_set_promisc(s->handle, 1) != 0) {
-+ pcap_perror(s->handle, "qemu: pcap_set_promisc:");
++ pcap_perror(s->handle, (char *)"qemu: pcap_set_promisc:");
+ goto fail;
+ }
+ if (pcap_activate(s->handle) != 0) {
-+ pcap_perror(s->handle, "qemu: pcap_activate:");
++ pcap_perror(s->handle, (char *)"qemu: pcap_activate:");
+ goto fail;
+ }
+#else
@@ -249,7 +298,7 @@ Index: net.c
+ goto fail;
+ }
+#else /* !_WIN32 */
-+#if defined(HAVE_BPF)
++#if defined(CONFIG_BPF)
+#if defined(BIOCIMMEDIATE)
+ /*
+ * Tell the kernel that the packet has to be seen immediately.
@@ -262,7 +311,6 @@ Index: net.c
+ }
+ }
+#endif /* BIOCIMMEDIATE */
-+
+#if defined(BIOCFEEDBACK)
+ /*
+ * Tell the kernel that the sent packet has to be fed back.
@@ -276,11 +324,10 @@ Index: net.c
+ }
+ }
+#endif /* BIOCFEEDBACK */
-+#endif /* HAVE_BPF */
++#endif /* CONFIG_BPF */
+#endif /* _WIN32 */
+
-+ 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");
++ snprintf(s->nc.info_str, sizeof(s->nc.info_str), "pcap redirector");
+
+#if defined(_WIN32)
+ if ((h = pcap_getevent(s->handle)) == NULL) {
@@ -302,43 +349,43 @@ Index: net.c
+ if (s) {
+ if (s->handle)
+ pcap_close(s->handle);
-+ qemu_free(s);
+ }
+
+ return -1;
+}
-+#endif /* CONFIG_PCAP */
+
- #if defined(CONFIG_SLIRP)
-
- /* slirp network adapter */
-@@ -2596,6 +2791,16 @@ int net_client_init(Monitor *mon, const
- are wanted */
- ret = 0;
- } else
-+#ifdef CONFIG_PCAP
-+ if (!strcmp(device, "pcap")) {
-+ char ifname[64];
-+ vlan->nb_host_devs++;
-+ if (get_param_value(ifname, sizeof(ifname), "ifname", p) <= 0)
-+ ret = net_pcap_init(vlan, device, name, NULL);
-+ else
-+ ret = net_pcap_init(vlan, device, name, ifname);
-+ } else
+#endif
- #ifdef CONFIG_SLIRP
- if (!strcmp(device, "user")) {
- static const char * const slirp_params[] = {
---- qemu-options.hx.orig 2009-12-02 15:27:02.000000000 -0500
-+++ qemu-options.hx 2010-01-29 14:39:27.000000000 -0500
-@@ -782,6 +782,10 @@ DEF("net", HAS_ARG, QEMU_OPTION_net,
- " connect the user mode network stack to VLAN 'n', configure its\n"
- " DHCP server and enabled optional services\n"
+
+ static int (* const net_client_init_fun[NET_CLIENT_OPTIONS_KIND_MAX])(
+ const NetClientOptions *opts,
+@@ -901,6 +1121,9 @@ static int (* const net_client_init_fun[
+ #ifdef CONFIG_NET_BRIDGE
+ [NET_CLIENT_OPTIONS_KIND_BRIDGE] = net_init_bridge,
#endif
+#ifdef CONFIG_PCAP
-+ "-net pcap[,vlan=n][,name=str][,ifname=name]\n"
-+ " connect the host network interface using PCAP to VLAN 'n'\n"
++ [NET_CLIENT_OPTIONS_KIND_PCAP] = net_init_pcap,
+#endif
- #ifdef _WIN32
- "-net tap[,vlan=n][,name=str],ifname=name\n"
- " connect the host TAP network interface to VLAN 'n'\n"
+ [NET_CLIENT_OPTIONS_KIND_HUBPORT] = net_init_hubport,
+ #ifdef CONFIG_VHOST_NET_USED
+ [NET_CLIENT_OPTIONS_KIND_VHOST_USER] = net_init_vhost_user,
+--- qapi-schema.json.orig 2015-08-11 19:11:09 UTC
++++ qapi-schema.json
+@@ -2423,6 +2423,10 @@
+ '*br': 'str',
+ '*helper': 'str' } }
+
++{ 'struct': 'NetdevPcapOptions',
++ 'data': {
++ '*ifname': 'str' } }
++
+ ##
+ # @NetdevHubPortOptions
+ #
+@@ -2490,6 +2494,7 @@
+ 'user': 'NetdevUserOptions',
+ 'tap': 'NetdevTapOptions',
+ 'l2tpv3': 'NetdevL2TPv3Options',
++ 'pcap': 'NetdevPcapOptions',
+ 'socket': 'NetdevSocketOptions',
+ 'vde': 'NetdevVdeOptions',
+ 'dump': 'NetdevDumpOptions',
diff --git a/emulators/qemu/files/rtl8139-re-patch b/emulators/qemu/files/rtl8139-re-patch
deleted file mode 100644
index dbb301d4057a..000000000000
--- a/emulators/qemu/files/rtl8139-re-patch
+++ /dev/null
@@ -1,10 +0,0 @@
-Index: hw/rtl8139.c
-@@ -58,7 +58,7 @@
- //#define RTL8139_CALCULATE_RXCRC 1
-
- /* Uncomment to enable on-board timer interrupts */
--//#define RTL8139_ONBOARD_TIMER 1
-+#define RTL8139_ONBOARD_TIMER 1
-
- #if defined(RTL8139_CALCULATE_RXCRC)
- /* For crc32 */