# This is a shell archive. Save it in a file, remove anything before # this line, and then unpack it by entering "sh file". Note, it may # create directories; files and directories will be owned by you and # have default permissions. # # This archive contains: # # Makefile # distinfo # pkg-descr # pkg-message # pkg-plist # files/ # files/cdrom-dma-patch # files/patch-0001-qcow2-Bring-synchronous-read-write-back-to-life # files/patch-90_security # files/patch-Makefile # files/patch-aa # files/patch-ac # files/patch-bd # files/patch-bf # files/patch-bg # files/patch-bt # files/patch-configure # files/patch-cpu-exec.c # files/patch-exec-all.h # files/patch-fbsd # files/patch-hw-eepro100.c # files/patch-hw-serial.c # files/patch-hw-vmware_vga.c # files/patch-iopl-workaround # files/patch-libmath # files/patch-libmath2 # files/patch-libmath_FreeBSD-version # files/patch-osdep.c # files/patch-pc-bios-optionrom-multiboot.S # files/patch-qemu-doc.texi # files/patch-tapclose # files/patch-vl.c # files/patch-vl.c-serial # files/patch-x_keymap.c # files/patch-z-bandaid-usb-current # files/pcap-patch # files/phys-cdrom-freebsd-patch # files/qemu-ifdown.sample # files/qemu-ifup.sample # files/rtl8139-re-patch # echo x - Makefile sed 's/^X//' >Makefile << 'b67911656ef5d18c4ae36cb6741b7965' X# New ports collection makefile for: qemu X# Date created: 2004/05/31 X# Whom: Juergen Lock X# X# $FreeBSD: ports/emulators/qemu/Makefile,v 1.106 2009/09/18 19:29:24 nox Exp $ X# X XPORTNAME= qemu XPORTVERSION= 0.11.1 XCATEGORIES= emulators XMASTER_SITES= ${MASTER_SITE_SAVANNAH} \ X http://bellard.org/qemu/ XMASTER_SITE_SUBDIR= qemu XDIST_SUBDIR= qemu X XMAINTAINER= nox@FreeBSD.org XCOMMENT= QEMU CPU Emulator X XHAS_CONFIGURE= yes XUSE_GMAKE= yes XUSE_PERL5= yes XPATCH_STRIP= -p1 XMAKE_ENV+= BSD_MAKE="${MAKE}" LDFLAGS="${LDFLAGS}" XMAN1= qemu.1 qemu-img.1 XONLY_FOR_ARCHS= amd64 i386 XCONFLICTS= qemu-devel-[0-9]* XMAKE_JOBS_SAFE= yes X XOPTIONS= KQEMU "Build with (alpha!) accelerator module" Off \ X RTL8139_TIMER "allow use of re(4) nic with FreeBSD guests" Off \ X SAMBA "samba dependency (for -smb)" Off \ X SDL "SDL/X dependency (graphical output)" On \ X GNUTLS "gnutls dependency (vnc encryption)" On \ X PCAP "pcap dependency (networking with bpf)" On \ X CDROM_DMA "IDE CDROM DMA" On \ X ADD_AUDIO "Emulate more audio hardware (experimental!)" Off \ X ALL_TARGETS "Also build non-x86 targets" On X X.include X X.if defined(WITHOUT_ALL_TARGETS) XCONFIGURE_ARGS+= --target-list=i386-softmmu,x86_64-softmmu XPLIST_SUB+= ALLTARGETS="@comment " X.else XPLIST_SUB+= ALLTARGETS="" X.endif X XWITHOUT_CPU_CFLAGS=yes #to avoid problems with register allocation XCFLAGS:= ${CFLAGS:C/-fno-tree-vrp//} XCONFIGURE_ARGS+= --prefix=${PREFIX} --cc=${CC} X X.if defined(WITHOUT_SDL) XCONFIGURE_ARGS+= --disable-sdl --disable-gfx-check X.else XUSE_SDL= sdl X.endif X X.if defined(WITHOUT_GNUTLS) XCONFIGURE_ARGS+= --disable-vnc-tls X.else XLIB_DEPENDS+= gnutls:${PORTSDIR}/security/gnutls X.endif X X.if defined(WITH_PCAP) XCONFIGURE_ARGS+= --enable-pcap X.endif X X.if defined(WITH_ADD_AUDIO) XCONFIGURE_ARGS+= --audio-card-list=ac97,es1370,sb16,cs4231a,adlib,gus X.endif X X# XXX XCONFIGURE_ARGS+= --disable-bsd-user X X.if defined(WITH_SAMBA) XRUN_DEPENDS+= ${LOCALBASE}/sbin/smbd:${PORTSDIR}/net/samba3 X.endif X X.if defined(WITH_KQEMU) XBUILD_DEPENDS+= kqemu-kmod-devel>=1.4.0pre1:${PORTSDIR}/emulators/kqemu-kmod-devel X.else XCONFIGURE_ARGS+= --disable-kqemu X.endif X X.if defined(NOPORTDOCS) XMAKE_ARGS+= NOPORTDOCS=${NOPORTDOCS} X.else XBUILD_DEPENDS+= texi2html:${PORTSDIR}/textproc/texi2html X.endif X X.if ${ARCH} == "amd64" XMAKE_ARGS+= ARCH=x86_64 X.endif X Xpost-extract: X @${MKDIR} ${WRKSRC}/kqemu X @${TOUCH} ${WRKSRC}/kqemu/Makefile X @${ECHO} all: > ${WRKSRC}/kqemu/Makefile.freebsd X Xpre-patch: X @for A in ${ONLY_FOR_ARCHS}; do \ X ${MKDIR} ${WRKSRC}/bsd/$$A; \ X done X Xpost-patch: X.if defined(WITH_RTL8139_TIMER) X @cd ${WRKSRC} && ${PATCH} --quiet < ${FILESDIR}/rtl8139-re-patch X.endif X.if defined(WITH_PCAP) X @cd ${WRKSRC} && ${PATCH} --quiet < ${FILESDIR}/pcap-patch X.endif X.if defined(WITHOUT_CDROM_DMA) X @cd ${WRKSRC} && ${PATCH} --quiet < ${FILESDIR}/cdrom-dma-patch X.endif X @${REINPLACE_CMD} -E \ X -e "s|^(CFLAGS=).*|\1${CFLAGS} -fno-strict-aliasing|" \ X -e "s|^(LDFLAGS=).*|\1${LDFLAGS}|" \ X ${WRKSRC}/Makefile.target X @${REINPLACE_CMD} -E \ X -e "s|^(CFLAGS=).*|\1${CFLAGS} -fno-strict-aliasing -I.|" \ X -e "s|^(LDFLAGS=).*|\1${LDFLAGS}|" \ X ${WRKSRC}/Makefile X @${REINPLACE_CMD} -E \ X -e "1s|^(#! )/usr/bin/perl|\1${PERL}|" \ X ${WRKSRC}/texi2pod.pl X X.if ${OSVERSION} >= 800091 X# XXX need to disable usb host code on head while it's not ported to the X# new usb stack yet Xpost-configure: X @${REINPLACE_CMD} -E \ X -e "s|^(HOST_USB=)bsd|\1stub|" \ X ${WRKSRC}/config-host.mak X.endif X Xpost-install: X @${INSTALL_SCRIPT} ${FILESDIR}/qemu-ifup.sample ${PREFIX}/etc X @${INSTALL_SCRIPT} ${FILESDIR}/qemu-ifdown.sample ${PREFIX}/etc X @if [ ! -f ${PREFIX}/etc/qemu-ifup ]; then \ X ${CP} -p ${PREFIX}/etc/qemu-ifup.sample ${PREFIX}/etc/qemu-ifup ; \ X fi X @if [ ! -f ${PREFIX}/etc/qemu-ifdown ]; then \ X ${CP} -p ${PREFIX}/etc/qemu-ifdown.sample ${PREFIX}/etc/qemu-ifdown ; \ X fi X @${CAT} ${PKGMESSAGE} X X.include b67911656ef5d18c4ae36cb6741b7965 echo x - distinfo sed 's/^X//' >distinfo << '57677d168a5ec21bdf22c9501f075a8f' XMD5 (qemu/qemu-0.11.1.tar.gz) = 193285b0bcf655a7f7577d05ffcb82b1 XSHA256 (qemu/qemu-0.11.1.tar.gz) = 2ecd2fc0af2ce5d96067ae82cc98a08275c596de53fc929484bedee1d6e7893a XSIZE (qemu/qemu-0.11.1.tar.gz) = 3830070 57677d168a5ec21bdf22c9501f075a8f echo x - pkg-descr sed 's/^X//' >pkg-descr << '7f9555c3c1089940396b503dd37f3979' XQEMU is a FAST! processor emulator using dynamic translation to achieve Xgood emulation speed. XQEMU has two operating modes: X X * Full system emulation. In this mode, QEMU emulates a full system X(for example a PC), including a processor and various peripherials. XIt can be used to launch different Operating Systems without rebooting Xthe PC or to debug system code. X * User mode emulation (Linux host only). In this mode, QEMU can launch XLinux processes compiled for one CPU on another CPU. It can be used to Xlaunch the Wine Windows API emulator or to ease cross-compilation and Xcross-debugging. X XAs QEMU requires no host kernel patches to run, it is very safe and easy to use. X(but kqemu is now also supported for the i386 on i386 and amd64 case) X XSee also the preconfigured system images on http://oszoo.org/ XMany live cd isos also work. X XWWW: http://www.nongnu.org/qemu/ 7f9555c3c1089940396b503dd37f3979 echo x - pkg-message sed 's/^X//' >pkg-message << '90c81c06929c43140502a9f17b449376' X==== XFreeBSD host notes: X- needs to run as root in order to use /dev/tap* networking (why?) X(actually RELENG_6 and above now has a sysctl net.link.tap.user_open Xto allow users to use it too. don't forget to adjust device node Xpermissions in /etc/devfs.rules.) X- slirp (usermode networking) is fixed now in cvs, on FreeSBIE 1.0 guests Xyou still have to manually do: X echo nameserver 10.0.2.3 >/etc/resolv.conf Xbut i've been told that that's normal. (fixed on FreeSBIE 1.1.) Xand you have to wait a bit for dhclient to do its thing; traffic to Xaddress 10.0.2.2 is routed to 127.1 on the host. X- expect timer problems when guest kernel HZ is > hosts, Xfor example time sleep 1 takes 49 seconds and booting sleeps for Xminutes at the acd0 probe with a FreeSBIE 1.0 guest, thats because Xits kernel is built with HZ=5000, and FreeBSD's default is 100... X(no longer a problem with FreeSBIE 1.1.) The linux 2.6 kernel uses X1000 by default btw. (changed to 250 later, and recent linux kernels now Xno longer have a fixed HZ, aka `tickless kernel'...) Enabling /dev/rtc Xdoesn't seem to help either (not included since it needs a patch to Xemulators/rtc.) X- update: the above problem has gotten worse with FreeBSD guests Xsomewhere before 8.0, mainly since the kernel now usually wants Xdouble or even quadruple number of timer irqs compared to HZ if it Xdetects an apic (and at least early versions of FreeBSD 8 had a bug that Xessentially halved qemu's clock rate too); the only reason you usually Xdon't see symptoms of this with FreeBSD 8 guests is they automatically Xreduce their HZ to 100 when running in a VM while the default for the Xhost kernel is still HZ=1000. workarounds: for i386 guests you can Xdisable the apic in the guest by setting X hint.apic.0.disabled=1 Xin loader.conf(5) (or manually at the loader prompt), otherwise the Xonly thing you can do is either reduce the guest's HZ to, say, 100 Xby setting e.g. X kern.hz="100" Xfrom the loader as above (which usually is a good idea in a VM anyway Xand FreeBSD 8 now does by itself as mentioned), or if that's not Xpossible increase the host's HZ to 2000 or even 4000 from the loader Xin the same way. X- the -smb option (smb-export local dir to guest) needs the net/samba3 Xport/package installed in addition to qemu. X- if you want to use usb devices connected to the host in the guest X(usb_add host:... monitor command; this doesn't work on FreeBSD 8 and X-current atm because of the new usb stack - help updating the usb-bsd.c Xcode is more than welcome here!) you need to make sure the host isn't Xclaiming them, e.g. for umass devices (like memory sticks or external Xharddrives) make sure umass isn't in the kernel (you can then still Xload it as a kld when needed), also unless you are running qemu as Xroot you then need to fix permissions for /dev/ugen* device nodes: Xif you are on 5.x or later (devfs) put a rule in /etc/devfs.rules, Xactivate it in /etc/rc.conf and run /etc/rc.d/devfs restart. Xexample devfs.rules: X [ugen_ruleset=20] X add path 'ugen*' mode 660 group operator Xcorresponding rc.conf line: X devfs_system_ruleset="ugen_ruleset" X- still usb: since the hub is no longer attached to the uchi controller Xand the wakeup mechanism, resume interrupt is not implemented yet linux Xguests will suspend the bus, i.e. they wont see devices usb_add'ed after Xits (linux') uhci module got loaded. workaround: either add devices Xbefore linux loads the module or rmmod and modprobe it afterwards. X- to avoid panics or non-working re(4) nics with FreeBSD guests if you Xuse qemu -net nic,model=rtl8139 -net user or tap ... enable the emulated Xrtl8139 timer by building the port with RTL8139_TIMER enabled. X(the rtl8139c+ that model=rtl8139 emulates needs less cpu than qemu's Xdefault ne2k nic which is driven by ed(4), it has not been made default Xonly because it may not work with all guests yet. btw qemu now also can Xemulate a few intel eepro100 and e1000 nics which seem to be a tad more Xefficient even, and at least i82557b and e1000 work without tweaks for XFreeBSD guests - driven by fxp(4) and em(4) repectively - and Linux Xguests too.) X- if you get repeated `atapi_poll called!' console messages with FreeBSD Xguests or other weird cdrom problems then thats probably because the guest Xhas atapicam loaded, which for reasons still to be determined has problems Xwith qemu's now by default enabled cdrom dma. You can build the port with XCDROM_DMA disabled to disable it. X- if you build qemu wihout SDL and then get crashes running it try Xpassing it -nographic. This should probably be default in that case... X- perhaps it should be noted that if you want to use qemu with -m 512 Xor larger on 6.x/i386 hosts you need to increase the kern.maxdsiz tunable Xin loader.conf(5) since the default is 512 MB, and qemu needs memory for Xitself also. (7.0 and up now use jemalloc which uses mmap(2) and Xisn't affected by kern.maxdsiz anymore.) X- if you use kqemu make sure your kqemu.ko is always in sync with your Xkernel (like with any kld installed outside of base), i.e. rebuild its Xport whenever you update the kernel - especially if you are switching Xbranches or are following a -stable or even -current branch! X- you can enable autoloading of kqemu at boot by adding a line X kqemu_enable=YES Xto /etc/rc.conf X- kqemu liked to panic the host on amd64 SMP until before 1.3.0.p11_6 X(revision 1.25 of /usr/ports/emulators/kqemu-kmod/Makefile), so if your Xhost is such you might want to make sure your kqemu-kmod port is new enough. X(and don't forget to reload it...) X- qemu's network boot roms (-boot n) have a bug when bootfiles sizes are a Xmultiple of blksize, if this affects you (like with FreeBSD's /boot/pxeboot) Xyou can do like X cp /boot/pxeboot pxeboot-qemu && chmod +w pxeboot-qemu && echo >>pxeboot-qemu Xand then use pxeboot-qemu. Actually you need latest -stable or -current Xbtx code (from after 7.0 was released) because of the real mode boot problem, Xso use at least pxeboot from there. And I just did that for the pxeboot Xextracted out of X ftp://ftp.freebsd.org/pub/FreeBSD/snapshots/200805/7.0-STABLE-200805-i386-bootonly.iso Xand placed it here: X http://people.freebsd.org/~nox/qemu/pxeboot-qemu X- if you use slirp (usernet, the default) and want to mount nfs into the Xguest and you are not running qemu as root, then mountd(8) on the exporting Xbox needs to be run with -n in order to accept requests from ports >= 1024. X- unfortunately there can still be guests that don't run correctly with Xkqemu and -kernel-kqemu especially on amd64 - not much you can do about that Xother than help debugging (k)qemu... (well or falling back to unaccellerated Xqemu/using only -enable-kqemu if its that what's causing the problems. Xnote however that kqemu now can also be used with the 32 bit qemu even Xon amd64 hosts as of the 20080620 update.) X- the new (optional) pcap code cannot talk to the host on 6.x because Xthe necessary bpf feature (BIOCFEEDBACK) hasn't (yet?) been merged there. X- kqemu passes the host tsc to the guest as-is so depending on your cpu and Xguest you _may_ need to tell the guest to avoid relying on the tsc (notsc Xkernel parameter with linux), or if that doesn't work force qemu onto Xa single cpu by doing e.g. `cpuset -l 0 qemu ..' (see the cpuset(1) manpage Xfor details; cpuset isn't avalable before 7.1. This can only be a problem Xon smp hosts.) X- (not FreeBSD-specific:) there have been reports of qcow2 corruption with X(at least) win2k guests on recent kvm (which uses similar qcow2 code than Xqemu now, see this thread: X http://lists.gnu.org/archive/html/qemu-devel/2009-02/msg00713.html - Xthe consensus on that thread seems to be that qcow(2) code has always Xbeen experimental and you should use raw images if you want reliability; Xraw is also usually faster.) You should be able to migrate existing images Xto raw using qemu-img(1)'s convert function; raw doesn't support advanced Xfeatures like snapshots tho. X[a few important qcow2 bugfixed have been committed in the meantime so Xthis _might_ be less of an issue now.] X- (also not FreeBSD-specific:) It is recommended to pass raw images using Xthe new -drive syntax, specifying format=raw explicitly in order to avoid Xmalicious guests being able to exploit the format autodetection thats Xotherwise getting used. (Not that you should run malicious guests anyway, Xbut this eleminates at least a known attack vector.) X- qemu now has improved physical cdrom support, but still there still Xis at least one known problem: you need to have the guest eject the disc Xif you want to change it/take it out, or otherwise the guest may continue Xusing state (like size) of the old disc. (You can also do like X`change ide1-cd0 /dev/acd0' in the monitor after taking out the disc Xif a guest cannot eject it itself.) X- The default configuration location (qemu-ifup script etc.) has been Xchanged from /etc to PREFIX/etc (usually /usr/local/etc). Move your Xfiles accordingly. X- kqemu still works in the 0.11 branch, but is disabled by default now Xso you'll have to pass -enable-kqemu (or -kernel-kqemu as with the Xprevious versions) if you want to use it. X==== 90c81c06929c43140502a9f17b449376 echo x - pkg-plist sed 's/^X//' >pkg-plist << '842cde48cf18b70a11b15515ca566742' Xbin/qemu Xbin/qemu-img X%%ALLTARGETS%%bin/qemu-system-arm X%%ALLTARGETS%%bin/qemu-system-cris X%%ALLTARGETS%%bin/qemu-system-m68k X%%ALLTARGETS%%bin/qemu-system-microblaze X%%ALLTARGETS%%bin/qemu-system-mips X%%ALLTARGETS%%bin/qemu-system-mips64 X%%ALLTARGETS%%bin/qemu-system-mips64el X%%ALLTARGETS%%bin/qemu-system-mipsel X%%ALLTARGETS%%bin/qemu-system-ppc X%%ALLTARGETS%%bin/qemu-system-ppc64 X%%ALLTARGETS%%bin/qemu-system-ppcemb X%%ALLTARGETS%%bin/qemu-system-sh4 X%%ALLTARGETS%%bin/qemu-system-sh4eb X%%ALLTARGETS%%bin/qemu-system-sparc X%%ALLTARGETS%%bin/qemu-system-sparc64 Xbin/qemu-system-x86_64 X@unexec if cmp -s %D/etc/qemu-ifup.sample %D/etc/qemu-ifup; then rm -f %D/etc/qemu-ifup; fi Xetc/qemu-ifup.sample X@exec if [ ! -f %D/etc/qemu-ifup ] ; then cp -p %D/%F %B/qemu-ifup; fi X@unexec if cmp -s %D/etc/qemu-ifdown.sample %D/etc/qemu-ifdown; then rm -f %D/etc/qemu-ifdown; fi Xetc/qemu-ifdown.sample X@exec if [ ! -f %D/etc/qemu-ifdown ] ; then cp -p %D/%F %B/qemu-ifdown; fi X%%PORTDOCS%%%%DOCSDIR%%/qemu-doc.html X%%PORTDOCS%%%%DOCSDIR%%/qemu-tech.html X%%PORTDOCS%%@dirrm %%DOCSDIR%% X%%DATADIR%%/bios.bin X%%DATADIR%%/vgabios.bin X%%DATADIR%%/vgabios-cirrus.bin X%%DATADIR%%/ppc_rom.bin X%%DATADIR%%/openbios-ppc X%%DATADIR%%/openbios-sparc32 X%%DATADIR%%/openbios-sparc64 X%%DATADIR%%/video.x X%%DATADIR%%/pxe-e1000.bin X%%DATADIR%%/pxe-ne2k_pci.bin X%%DATADIR%%/pxe-rtl8139.bin X%%DATADIR%%/pxe-pcnet.bin X%%DATADIR%%/multiboot.bin X%%DATADIR%%/petalogix-s3adsp1800.dtb X%%DATADIR%%/bamboo.dtb X%%DATADIR%%/keymaps/ar X%%DATADIR%%/keymaps/common X%%DATADIR%%/keymaps/da X%%DATADIR%%/keymaps/de X%%DATADIR%%/keymaps/de-ch X%%DATADIR%%/keymaps/en-gb X%%DATADIR%%/keymaps/en-us X%%DATADIR%%/keymaps/es X%%DATADIR%%/keymaps/et X%%DATADIR%%/keymaps/fi X%%DATADIR%%/keymaps/fo X%%DATADIR%%/keymaps/fr X%%DATADIR%%/keymaps/fr-be X%%DATADIR%%/keymaps/fr-ca X%%DATADIR%%/keymaps/fr-ch X%%DATADIR%%/keymaps/hr X%%DATADIR%%/keymaps/hu X%%DATADIR%%/keymaps/is X%%DATADIR%%/keymaps/it X%%DATADIR%%/keymaps/ja X%%DATADIR%%/keymaps/lt X%%DATADIR%%/keymaps/lv X%%DATADIR%%/keymaps/mk X%%DATADIR%%/keymaps/modifiers X%%DATADIR%%/keymaps/nl X%%DATADIR%%/keymaps/nl-be X%%DATADIR%%/keymaps/no X%%DATADIR%%/keymaps/pl X%%DATADIR%%/keymaps/pt X%%DATADIR%%/keymaps/pt-br X%%DATADIR%%/keymaps/ru X%%DATADIR%%/keymaps/sl X%%DATADIR%%/keymaps/sv X%%DATADIR%%/keymaps/th X%%DATADIR%%/keymaps/tr X@dirrm %%DATADIR%%/keymaps X@dirrm %%DATADIR%% 842cde48cf18b70a11b15515ca566742 echo c - files/ mkdir -p files/ > /dev/null 2>&1 echo x - files/cdrom-dma-patch sed 's/^X//' >files/cdrom-dma-patch << '0d7773fda2e4f1de66038e692fe436ee' XIndex: hw/ide.c X@@ -27,7 +27,7 @@ X //#define DEBUG_IDE X //#define DEBUG_IDE_ATAPI X //#define DEBUG_AIO X-#define USE_DMA_CDROM X+// #define USE_DMA_CDROM X X /* Bits of HD_STATUS */ X #define ERR_STAT 0x01 0d7773fda2e4f1de66038e692fe436ee echo x - files/patch-0001-qcow2-Bring-synchronous-read-write-back-to-life sed 's/^X//' >files/patch-0001-qcow2-Bring-synchronous-read-write-back-to-life << '18d35d246ce545a91f532cbf9fe9b3b2' XFrom 08fd2f30bd3ee5d04596da8293689af4d4f7eb6c Mon Sep 17 00:00:00 2001 XFrom: Kevin Wolf XDate: Thu, 3 Dec 2009 10:28:44 +0100 XSubject: [PATCH] qcow2: Bring synchronous read/write back to life X XWhen the synchronous read and write functions were dropped, they were replaced Xby generic emulation functions. Unfortunately, these emulation functions don't Xprovide the same semantics as the original functions did. X XThe original bdrv_read would mean that we read some data synchronously and that Xwe won't be interrupted during this read. The latter assumption is no longer Xtrue with the emulation function which needs to use qemu_aio_poll and therefore Xallows the callback of any other concurrent AIO request to be run during the Xread. Which in turn means that (meta)data read earlier could have changed and Xbe invalid now. qcow2 is not prepared to work in this way and it's just scary Xhow many places there are where other requests could run. X XI'm not sure yet where exactly it breaks, but you'll see breakage with virtio Xon qcow2 with a backing file. Providing synchronous functions again fixes the Xproblem for me. X XPatchworks-ID: 35437 XSigned-off-by: Kevin Wolf XSigned-off-by: Anthony Liguori X(cherry picked from commit ef845c3bf421290153154635dc18eaa677cecb43) X XSigned-off-by: Kevin Wolf XSigned-off-by: Aurelien Jarno X--- X block/qcow2-cluster.c | 6 ++-- X block/qcow2.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++- X block/qcow2.h | 3 ++ X 3 files changed, 55 insertions(+), 5 deletions(-) X Xdiff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c Xindex d4631c3..4d0ce16 100644 X--- a/block/qcow2-cluster.c X+++ b/block/qcow2-cluster.c X@@ -306,8 +306,8 @@ void qcow2_encrypt_sectors(BDRVQcowState *s, int64_t sector_num, X } X X X-static int qcow_read(BlockDriverState *bs, int64_t sector_num, X- uint8_t *buf, int nb_sectors) X+int qcow2_read(BlockDriverState *bs, int64_t sector_num, uint8_t *buf, X+ int nb_sectors) X { X BDRVQcowState *s = bs->opaque; X int ret, index_in_cluster, n, n1; X@@ -358,7 +358,7 @@ static int copy_sectors(BlockDriverState *bs, uint64_t start_sect, X n = n_end - n_start; X if (n <= 0) X return 0; X- ret = qcow_read(bs, start_sect + n_start, s->cluster_data, n); X+ ret = qcow2_read(bs, start_sect + n_start, s->cluster_data, n); X if (ret < 0) X return ret; X if (s->crypt_method) { Xdiff --git a/block/qcow2.c b/block/qcow2.c Xindex dd32ea2..ced257e 100644 X--- a/block/qcow2.c X+++ b/block/qcow2.c X@@ -855,6 +855,51 @@ static int qcow_make_empty(BlockDriverState *bs) X return 0; X } X X+static int qcow2_write(BlockDriverState *bs, int64_t sector_num, X+ const uint8_t *buf, int nb_sectors) X+{ X+ BDRVQcowState *s = bs->opaque; X+ int ret, index_in_cluster, n; X+ uint64_t cluster_offset; X+ int n_end; X+ QCowL2Meta l2meta; X+ X+ while (nb_sectors > 0) { X+ memset(&l2meta, 0, sizeof(l2meta)); X+ X+ index_in_cluster = sector_num & (s->cluster_sectors - 1); X+ n_end = index_in_cluster + nb_sectors; X+ if (s->crypt_method && X+ n_end > QCOW_MAX_CRYPT_CLUSTERS * s->cluster_sectors) X+ n_end = QCOW_MAX_CRYPT_CLUSTERS * s->cluster_sectors; X+ cluster_offset = qcow2_alloc_cluster_offset(bs, sector_num << 9, X+ index_in_cluster, X+ n_end, &n, &l2meta); X+ if (!cluster_offset) X+ return -1; X+ if (s->crypt_method) { X+ qcow2_encrypt_sectors(s, sector_num, s->cluster_data, buf, n, 1, X+ &s->aes_encrypt_key); X+ ret = bdrv_pwrite(s->hd, cluster_offset + index_in_cluster * 512, X+ s->cluster_data, n * 512); X+ } else { X+ ret = bdrv_pwrite(s->hd, cluster_offset + index_in_cluster * 512, buf, n * 512); X+ } X+ if (ret != n * 512 || qcow2_alloc_cluster_link_l2(bs, cluster_offset, &l2meta) < 0) { X+ qcow2_free_any_clusters(bs, cluster_offset, l2meta.nb_clusters); X+ return -1; X+ } X+ nb_sectors -= n; X+ sector_num += n; X+ buf += n * 512; X+ if (l2meta.nb_clusters != 0) { X+ LIST_REMOVE(&l2meta, next_in_flight); X+ } X+ } X+ s->cluster_cache_offset = -1; /* disable compressed cache */ X+ return 0; X+} X+ X /* XXX: put compressed sectors first, then all the cluster aligned X tables to avoid losing bytes in alignment */ X static int qcow_write_compressed(BlockDriverState *bs, int64_t sector_num, X@@ -1037,8 +1082,10 @@ static BlockDriver bdrv_qcow2 = { X .bdrv_set_key = qcow_set_key, X .bdrv_make_empty = qcow_make_empty, X X- .bdrv_aio_readv = qcow_aio_readv, X- .bdrv_aio_writev = qcow_aio_writev, X+ .bdrv_read = qcow2_read, X+ .bdrv_write = qcow2_write, X+ .bdrv_aio_readv = qcow_aio_readv, X+ .bdrv_aio_writev = qcow_aio_writev, X .bdrv_write_compressed = qcow_write_compressed, X X .bdrv_snapshot_create = qcow2_snapshot_create, Xdiff --git a/block/qcow2.h b/block/qcow2.h Xindex 965a2f4..b41aa63 100644 X--- a/block/qcow2.h X+++ b/block/qcow2.h X@@ -202,6 +202,9 @@ uint64_t qcow2_alloc_compressed_cluster_offset(BlockDriverState *bs, X int qcow2_alloc_cluster_link_l2(BlockDriverState *bs, uint64_t cluster_offset, X QCowL2Meta *m); X X+int qcow2_read(BlockDriverState *bs, int64_t sector_num, uint8_t *buf, X+ int nb_sectors); X+ X /* qcow2-snapshot.c functions */ X int qcow2_snapshot_create(BlockDriverState *bs, QEMUSnapshotInfo *sn_info); X int qcow2_snapshot_goto(BlockDriverState *bs, const char *snapshot_id); X-- X1.6.5.2 X 18d35d246ce545a91f532cbf9fe9b3b2 echo x - files/patch-90_security sed 's/^X//' >files/patch-90_security << '94eb8569679fd16e3ab97f012a304a14' XIndex: qemu-0.8.2/hw/dma.c X=================================================================== X--- qemu-0.8.2.orig/hw/dma.c 2006-07-22 20:23:34.000000000 +0300 X+++ qemu-0.8.2/hw/dma.c 2007-04-20 06:05:59.000000000 +0300 X@@ -340,9 +340,11 @@ static void channel_run (int ncont, int X #endif X X r = dma_controllers[ncont].regs + ichan; X- n = r->transfer_handler (r->opaque, ichan + (ncont << 2), X- r->now[COUNT], (r->base[COUNT] + 1) << ncont); X- r->now[COUNT] = n; X+ if (r->transfer_handler) { X+ n = r->transfer_handler (r->opaque, ichan + (ncont << 2), X+ r->now[COUNT], (r->base[COUNT] + 1) << ncont); X+ r->now[COUNT] = n; X+ } X ldebug ("dma_pos %d size %d\n", n, (r->base[COUNT] + 1) << ncont); X } X XIndex: qemu/hw/fdc.c X@@ -1322,7 +1322,8 @@ X fd_sector(cur_drv)); X return 0; X } X- if (bdrv_read(cur_drv->bs, fd_sector(cur_drv), fdctrl->fifo, 1) < 0) { X+ if (cur_drv->bs == NULL || X+ bdrv_read(cur_drv->bs, fd_sector(cur_drv), fdctrl->fifo, 1) < 0) { X FLOPPY_DPRINTF("error getting sector %d\n", X fd_sector(cur_drv)); X /* Sure, image size is too small... */ X@@ -1776,7 +1777,8 @@ X if (pos == FD_SECTOR_LEN - 1 || X fdctrl->data_pos == fdctrl->data_len) { X cur_drv = get_cur_drv(fdctrl); X- if (bdrv_write(cur_drv->bs, fd_sector(cur_drv), fdctrl->fifo, 1) < 0) { X+ if (cur_drv->bs == NULL || X+ bdrv_write(cur_drv->bs, fd_sector(cur_drv), fdctrl->fifo, 1) < 0) { X FLOPPY_ERROR("writing sector %d\n", fd_sector(cur_drv)); X return; X } XIndex: qemu-0.8.2/hw/pc.c X=================================================================== X--- qemu-0.8.2.orig/hw/pc.c 2007-04-20 06:05:58.000000000 +0300 X+++ qemu-0.8.2/hw/pc.c 2007-04-20 06:05:59.000000000 +0300 X@@ -312,7 +312,8 @@ void bochs_bios_write(void *opaque, uint X case 0x400: X case 0x401: X fprintf(stderr, "BIOS panic at rombios.c, line %d\n", val); X- exit(1); X+ /* according to documentation, these can be safely ignored */ X+ break; X case 0x402: X case 0x403: X #ifdef DEBUG_BIOS X@@ -335,8 +336,9 @@ void bochs_bios_write(void *opaque, uint X /* LGPL'ed VGA BIOS messages */ X case 0x501: X case 0x502: X+ /* according to documentation, these can be safely ignored */ X fprintf(stderr, "VGA BIOS panic, line %d\n", val); X- exit(1); X+ break; X case 0x500: X case 0x503: X #ifdef DEBUG_BIOS XIndex: qemu-0.8.2/hw/sb16.c X=================================================================== X--- qemu-0.8.2.orig/hw/sb16.c 2006-07-22 20:23:34.000000000 +0300 X+++ qemu-0.8.2/hw/sb16.c 2007-04-20 06:05:59.000000000 +0300 X@@ -1235,8 +1235,10 @@ static int SB_read_DMA (void *opaque, in X s->block_size); X #endif X X- while (s->left_till_irq <= 0) { X- s->left_till_irq = s->block_size + s->left_till_irq; X+ if (s->block_size) { X+ while (s->left_till_irq <= 0) { X+ s->left_till_irq = s->block_size + s->left_till_irq; X+ } X } X X return dma_pos; XIndex: qemu/hw/i8259.c X@@ -302,7 +302,8 @@ X s->init4 = val & 1; X s->single_mode = val & 2; X if (val & 0x08) X- hw_error("level sensitive irq not supported"); X+ /* hw_error("level sensitive irq not supported"); */ X+ return; X } else if (val & 0x08) { X if (val & 0x04) X s->poll = 1; 94eb8569679fd16e3ab97f012a304a14 echo x - files/patch-Makefile sed 's/^X//' >files/patch-Makefile << 'c0d7d903b7c552bc0b03b62518f82f5d' XIndex: qemu/Makefile X@@ -25,7 +25,11 @@ X LDFLAGS += -static X endif X ifdef BUILD_DOCS X+ifdef NOPORTDOCS X+DOCS=qemu.1 qemu-img.1 qemu-nbd.8 X+else X DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1 qemu-nbd.8 X+endif X else X DOCS= X endif X@@ -260,13 +264,13 @@ X endif X X install-doc: $(DOCS) X+ifndef NOPORTDOCS X $(INSTALL_DIR) "$(DESTDIR)$(docdir)" X $(INSTALL_DATA) qemu-doc.html qemu-tech.html "$(DESTDIR)$(docdir)" X+endif X ifndef CONFIG_WIN32 X $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1" X $(INSTALL_DATA) qemu.1 qemu-img.1 "$(DESTDIR)$(mandir)/man1" X- $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man8" X- $(INSTALL_DATA) qemu-nbd.8 "$(DESTDIR)$(mandir)/man8" X endif X X install: all $(if $(BUILD_DOCS),install-doc) c0d7d903b7c552bc0b03b62518f82f5d echo x - files/patch-aa sed 's/^X//' >files/patch-aa << '775773eb197d81c12333449c5c760b68' 775773eb197d81c12333449c5c760b68 echo x - files/patch-ac sed 's/^X//' >files/patch-ac << '53dec248caab71aee2be4d96a20a518a' XIndex: qemu/configure X@@ -868,7 +868,7 @@ X sdl_too_old=no X X if test "$sdl" = "yes" ; then X- sdl_config="sdl-config" X+ sdl_config="${SDL_CONFIG}" X sdl=no X sdl_static=no X 53dec248caab71aee2be4d96a20a518a echo x - files/patch-bd sed 's/^X//' >files/patch-bd << 'f0858239178b75a82e3cb8ac2f3721a5' XIndex: qemu/configure X@@ -570,7 +570,7 @@ X if test -z "$prefix" ; then X prefix="/usr/local" X fi X- mansuffix="/share/man" X+ mansuffix="/man" X datasuffix="/share/qemu" X docsuffix="/share/doc/qemu" X binsuffix="/bin" f0858239178b75a82e3cb8ac2f3721a5 echo x - files/patch-bf sed 's/^X//' >files/patch-bf << 'b14ab52fe0e3ff13ec8fa9c3734c62fd' XIndex: qemu/slirp/slirp_config.h X@@ -86,7 +86,7 @@ X #undef BAD_SPRINTF X X /* Define if you have readv */ X-#undef HAVE_READV X+#define HAVE_READV X X /* Define if iovec needs to be declared */ X #undef DECLARE_IOVEC X@@ -95,7 +95,7 @@ X #undef DECLARE_SPRINTF X X /* Define if you have a POSIX.1 sys/wait.h */ X-#undef HAVE_SYS_WAIT_H X+#define HAVE_SYS_WAIT_H X X /* Define if you have sys/select.h */ X #define HAVE_SYS_SELECT_H X@@ -107,7 +107,7 @@ X #define HAVE_ARPA_INET_H X X /* Define if you have sys/signal.h */ X-#undef HAVE_SYS_SIGNAL_H X+#define HAVE_SYS_SIGNAL_H X X /* Define if you have sys/stropts.h */ X #undef HAVE_SYS_STROPTS_H X@@ -180,7 +180,7 @@ X #undef HAVE_GRANTPT X X /* Define if you have fchmod */ X-#undef HAVE_FCHMOD X+#define HAVE_FCHMOD X X /* Define if you have */ X #undef HAVE_SYS_TYPES32_H b14ab52fe0e3ff13ec8fa9c3734c62fd echo x - files/patch-bg sed 's/^X//' >files/patch-bg << '257aa9645130d124ee5f185a2dfb425c' XIndex: qemu/Makefile X@@ -19,6 +19,7 @@ X CPPFLAGS += -I. -I$(SRC_PATH) -MMD -MP -MT $@ X CPPFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE X CPPFLAGS += -U_FORTIFY_SOURCE X+CPPFLAGS += -DSMBD_COMMAND=\"${LOCALBASE}/sbin/smbd\" -I${LOCALBASE}/include -DPREFIX=\"${PREFIX}\" X LIBS= X ifdef CONFIG_STATIC X LDFLAGS += -static XIndex: qemu/Makefile.target X@@ -54,6 +54,7 @@ X X CPPFLAGS+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE X CPPFLAGS+=-U_FORTIFY_SOURCE X+CPPFLAGS+=-DSMBD_COMMAND=\"${LOCALBASE}/sbin/smbd\" -I${LOCALBASE}/include -DPREFIX=\"${PREFIX}\" X LIBS+=-lm X ifdef CONFIG_WIN32 X LIBS+=-lwinmm -lws2_32 -liphlpapi XIndex: qemu/net.h X@@ -99,12 +99,14 @@ X int slirp_is_inited(void); X void net_client_check(void); X X-#define DEFAULT_NETWORK_SCRIPT "/etc/qemu-ifup" X-#define DEFAULT_NETWORK_DOWN_SCRIPT "/etc/qemu-ifdown" X+#define DEFAULT_NETWORK_SCRIPT PREFIX "/etc/qemu-ifup" X+#define DEFAULT_NETWORK_DOWN_SCRIPT PREFIX "/etc/qemu-ifdown" X+#ifndef SMBD_COMMAND X #ifdef __sun__ X #define SMBD_COMMAND "/usr/sfw/sbin/smbd" X #else X #define SMBD_COMMAND "/usr/sbin/smbd" X #endif X+#endif X X #endif 257aa9645130d124ee5f185a2dfb425c echo x - files/patch-bt sed 's/^X//' >files/patch-bt << '60b3fb67a49f3ca4f238ca630c886aed' XIndex: qemu/net.c X@@ -76,6 +76,11 @@ X #endif X #endif X #endif X+#ifdef __FreeBSD__ X+#include X+#include X+#include X+#endif X X #if defined(CONFIG_SLIRP) X #include "libslirp.h" X@@ -3407,6 +3410,34 @@ X X #endif /* CONFIG_SLIRP */ X X+#ifdef __FreeBSD__ X+#define LOAD_QUIETLY 1 X+#define LOAD_VERBOSLY 2 X+ X+static int X+loadmodules(int how, const char *module, ...) X+{ X+ int loaded = 0; X+ va_list ap; X+ X+ va_start(ap, module); X+#ifndef NO_MODULES X+ while (module != NULL) { X+ if (modfind(module) == -1) { X+ if (kldload(module) == -1) { X+ if (how == LOAD_VERBOSLY) X+ fprintf(stderr, "%s: Cannot load module\n", module); X+ } else X+ loaded++; X+ } X+ module = va_arg(ap, const char *); X+ } X+ va_end(ap); X+#endif X+ return loaded; X+} X+#endif X+ X #if !defined(_WIN32) X X typedef struct TAPState { X@@ -3470,11 +3501,59 @@ X char *dev; X struct stat s; X X+#ifdef __FreeBSD__ X+ int i, kldtried = 0, enoentcount = 0, err = 0; X+ char dname[100]; X+#ifdef USE_DEVTAP X+ /* X+ * 5.x has /dev/tap, but that seems to just blindly increase its X+ * couter on every open() for some people(??), i.e. on every qemu run. X+ */ X+ i = -1; X+#else X+ i = 0; X+#endif X+ for (; i < 10; i++) { X+ if (*ifname) X+ snprintf(dname, sizeof dname, "/dev/%s", ifname); X+ else if (i == -1) X+ strcpy(dname, "/dev/tap"); X+ else X+ snprintf(dname, sizeof dname, "%s%d", X+ "/dev/tap", i); X+ TFR(fd = open(dname, O_RDWR)); X+ if (fd >= 0) X+ break; X+ else if (errno == ENXIO || errno == ENOENT) { X+ if (i == 0 && !kldtried++) { X+ /* X+ * Attempt to load the tunnel interface KLD if it isn't loaded X+ * already. X+ */ X+ if (loadmodules(LOAD_VERBOSLY, "if_tap", NULL)) X+ i = -1; X+ continue; X+ } X+ if (errno != ENOENT || ++enoentcount > 3) { X+ err = errno; X+ break; X+ } X+ } else X+ err = errno; X+ if (*ifname) X+ break; X+ } X+ if (fd < 0) { X+ fprintf(stderr, "warning: could not open %s (%s): no virtual network emulation\n", dname, strerror(err)); X+ return -1; X+ } X+#else X TFR(fd = open("/dev/tap", O_RDWR)); X if (fd < 0) { X- fprintf(stderr, "warning: could not open /dev/tap: no virtual network emulation\n"); X+ fprintf(stderr, "warning: could not open /dev/tap (%s): no virtual network emulation\n", strerror(errno)); X return -1; X } X+#endif X X fstat(fd, &s); X dev = devname(s.st_rdev, S_IFCHR); 60b3fb67a49f3ca4f238ca630c886aed echo x - files/patch-configure sed 's/^X//' >files/patch-configure << '5cae8e2426c154e1c1a4408c02b2ed73' XIndex: qemu/configure X@@ -1348,7 +1348,7 @@ X fi X X # Check if tools are available to build documentation. X-if test "$build_docs" = "yes" -a \( ! -x "`which texi2html 2>/dev/null`" -o ! -x "`which pod2man 2>/dev/null`" \) ; then X+if test "$build_docs" = "yes" -a \( "x$NOPORTDOCS" != "x" -o ! -x "`which texi2html 2>/dev/null`" -o ! -x "`which pod2man 2>/dev/null`" \) ; then X build_docs="no" X fi X 5cae8e2426c154e1c1a4408c02b2ed73 echo x - files/patch-cpu-exec.c sed 's/^X//' >files/patch-cpu-exec.c << '070ab41523e9d3bc6975c39f45217a3c' 070ab41523e9d3bc6975c39f45217a3c echo x - files/patch-exec-all.h sed 's/^X//' >files/patch-exec-all.h << 'ffa5f5bf3f915e2b0a28c37d1696b84c' ffa5f5bf3f915e2b0a28c37d1696b84c echo x - files/patch-fbsd sed 's/^X//' >files/patch-fbsd << '419e824d1c2046ae3aafdf57a2052a2a' XIndex: qemu/Makefile X@@ -45,7 +45,10 @@ X LIBS+=-lwinmm -lws2_32 -liphlpapi X endif X X-build-all: $(TOOLS) $(DOCS) recurse-all X+build-all: bsd/libmath.a $(TOOLS) $(DOCS) recurse-all X+ X+bsd/libmath.a: X+ ( cd bsd ; unset MAKEFLAGS ; $(BSD_MAKE) CC=$(CC) ) X X config-host.mak: configure X ifneq ($(wildcard config-host.mak),) X@@ -242,6 +245,7 @@ X X clean: X # avoid old build problems by removing potentially incorrect old files X+ ( cd bsd ; $(BSD_MAKE) clean ) X 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 X rm -f *.o *.d *.a $(TOOLS) TAGS cscope.* *.pod *~ */*~ X rm -f slirp/*.o slirp/*.d audio/*.o audio/*.d block/*.o block/*.d XIndex: qemu/Makefile.target X@@ -339,7 +339,7 @@ X # WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object X # that the kernel ELF loader considers as an executable. I think this X # is the simplest way to make it self virtualizable! X-LDFLAGS+=-Wl,-shared X+#LDFLAGS+=-Wl,-shared X endif X endif X X@@ -408,7 +408,7 @@ X # cpu_signal_handler() in cpu-exec.c. X signal.o: CFLAGS += $(HELPER_CFLAGS) X X-ARLIBS=libqemu.a ../libqemu_user.a X+ARLIBS=libqemu.a ../libqemu_user.a ../bsd/libmath.a X X endif #CONFIG_BSD_USER X X@@ -658,7 +658,7 @@ X monitor.o: qemu-monitor.h X X LIBS += $(SDL_LIBS) $(COCOA_LIBS) $(CURSES_LIBS) $(BRLAPI_LIBS) $(VDE_LIBS) $(CURL_LIBS) X-ARLIBS=../libqemu_common.a libqemu.a $(HWLIB) X+ARLIBS=../libqemu_common.a libqemu.a $(HWLIB) ../bsd/libmath.a X X endif # !CONFIG_USER_ONLY X XIndex: qemu/fpu/softfloat-native.c X@@ -6,10 +6,15 @@ X #include X #endif X X+#if defined(__FreeBSD__) && __FreeBSD_version < 500000 X+#include X+#endif X+ X void set_float_rounding_mode(int val STATUS_PARAM) X { X STATUS(float_rounding_mode) = val; X-#if defined(HOST_BSD) && !defined(__APPLE__) || \ X+#if defined(HOST_BSD) && !defined(__APPLE__) && !defined(__FreeBSD__) || \ X+ (defined(__FreeBSD__) && __FreeBSD_version < 500000) || \ X (defined(HOST_SOLARIS) && HOST_SOLARIS < 10) X fpsetround(val); X #elif defined(__arm__) X@@ -26,7 +31,7 @@ X } X #endif X X-#if defined(HOST_BSD) || (defined(HOST_SOLARIS) && HOST_SOLARIS < 10) X+#if (defined(HOST_BSD) && !defined(__FreeBSD__)) || (defined(HOST_SOLARIS) && HOST_SOLARIS < 10) X #define lrint(d) ((int32_t)rint(d)) X #define llrint(d) ((int64_t)rint(d)) X #define lrintf(f) ((int32_t)rint(f)) XIndex: qemu/fpu/softfloat-native.h X@@ -1,8 +1,28 @@ X /* Native implementation of soft float functions */ X #include X X-#if (defined(HOST_BSD) && !defined(__APPLE__)) || defined(HOST_SOLARIS) X+#ifdef __FreeBSD__ X+#include X+long double fabsl(long double x); X+long double remainderl(long double x, long double y); X+long double sqrtl(long double x); X+long double rintl(long double x); X+long lrintl(long double x); X+long long llrintl(long double x); X+#endif X+ X+#if (defined(HOST_BSD) && !defined(__APPLE__) && \ X+ (!defined(__FreeBSD__) || __FreeBSD_version < 500000)) || \ X+ defined(HOST_SOLARIS) X #include X+#if defined(__FreeBSD__) X+#define isgreater(x, y) __builtin_isgreater((x), (y)) X+#define isgreaterequal(x, y) __builtin_isgreaterequal((x), (y)) X+#define isless(x, y) __builtin_isless((x), (y)) X+#define islessequal(x, y) __builtin_islessequal((x), (y)) X+#define islessgreater(x, y) __builtin_islessgreater((x), (y)) X+#define isunordered(x, y) __builtin_isunordered((x), (y)) X+#endif X #define fabsf(f) ((float)fabs(f)) X #else X #include X@@ -109,6 +109,8 @@ X | Software IEC/IEEE floating-point rounding mode. X *----------------------------------------------------------------------------*/ X-#if (defined(HOST_BSD) && !defined(__APPLE__)) || defined(HOST_SOLARIS) X+#if (defined(HOST_BSD) && !defined(__APPLE__) && \ X+ (!defined(__FreeBSD__) || __FreeBSD_version < 500000)) || \ X+ defined(HOST_SOLARIS) X #if defined(__OpenBSD__) X #define FE_RM FP_RM X #define FE_RP FP_RP XIndex: qemu/fpu/softfloat.h X@@ -84,7 +84,8 @@ X #define FLOAT128 X #else X /* native float support */ X-#if (defined(__i386__) || defined(__x86_64__)) && !defined(HOST_BSD) X+#if (defined(__i386__) || defined(__x86_64__)) && \ X+ (!defined(HOST_BSD) || defined(__FreeBSD__)) X #define FLOATX80 X #endif X #endif /* !CONFIG_SOFTFLOAT */ XIndex: qemu/target-ppc/op_helper.c X@@ -293,6 +293,13 @@ X uint32_t exp = (u.ll >> 52) & 0x7FF; X return ((0 < exp) && (exp < 0x7FF)); X } X+#else X+#ifndef isnormal X+#define isnormal(x) \ X+ ((sizeof (x) == sizeof (float)) ? __isnormalf(x) \ X+ : (sizeof (x) == sizeof (double)) ? __isnormal(x) \ X+ : __isnormall(x)) X+#endif X #endif X X uint32_t helper_compute_fprf (uint64_t arg, uint32_t set_fprf) XIndex: qemu/x86_64.ld X@@ -2,7 +2,7 @@ X OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64") X OUTPUT_ARCH(i386:x86-64) X ENTRY(_start) X-SEARCH_DIR("/lib64"); SEARCH_DIR("/usr/lib64"); SEARCH_DIR("/usr/local/lib64"); X+SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib"); SEARCH_DIR("/usr/local/lib"); X SECTIONS X { X /* Read-only sections, merged into text segment: */ X@@ -59,8 +59,6 @@ X .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } X .rodata1 : { *(.rodata1) } X .eh_frame_hdr : { *(.eh_frame_hdr) } X- .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) } X- .gcc_except_table : ONLY_IF_RO { *(.gcc_except_table) } X /* Adjust the address for the data segment. We want to adjust up to X the same address within the page on the next page up. */ X . = ALIGN (0x100000) - ((0x100000 - .) & (0x100000 - 1)); . = DATA_SEGMENT_ALIGN (0x100000, 0x1000); X@@ -86,8 +84,8 @@ X .data1 : { *(.data1) } X .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) } X .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } X- .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) } X- .gcc_except_table : ONLY_IF_RW { *(.gcc_except_table) } X+ .eh_frame : { KEEP (*(.eh_frame)) } X+ .gcc_except_table : { *(.gcc_except_table) } X .dynamic : { *(.dynamic) } X .ctors : X { 419e824d1c2046ae3aafdf57a2052a2a echo x - files/patch-hw-eepro100.c sed 's/^X//' >files/patch-hw-eepro100.c << '50b9658f353683696c51a512be294793' XIndex: qemu/hw/eepro100.c X@@ -729,6 +729,7 @@ X logout X ("TBD (simplified mode): buffer address 0x%08x, size 0x%04x\n", X tx_buffer_address, tx_buffer_size); X+ assert(size + tx_buffer_size <= sizeof(buf)); X cpu_physical_memory_read(tx_buffer_address, &buf[size], X tx_buffer_size); X size += tx_buffer_size; X@@ -749,9 +750,13 @@ X logout X ("TBD (extended mode): buffer address 0x%08x, size 0x%04x\n", X tx_buffer_address, tx_buffer_size); X- cpu_physical_memory_read(tx_buffer_address, &buf[size], X- tx_buffer_size); X- size += tx_buffer_size; X+ if (size + tx_buffer_size > sizeof(buf)) { X+ logout("bad extended TCB with size 0x%04x\n", tx_buffer_size); X+ } else { X+ cpu_physical_memory_read(tx_buffer_address, &buf[size], X+ tx_buffer_size); X+ size += tx_buffer_size; X+ } X if (tx_buffer_el & 1) { X break; X } X@@ -766,14 +771,20 @@ X logout X ("TBD (flexible mode): buffer address 0x%08x, size 0x%04x\n", X tx_buffer_address, tx_buffer_size); X- cpu_physical_memory_read(tx_buffer_address, &buf[size], X- tx_buffer_size); X- size += tx_buffer_size; X+ if (size + tx_buffer_size > sizeof(buf)) { X+ logout("bad flexible TCB with size 0x%04x\n", tx_buffer_size); X+ } else { X+ cpu_physical_memory_read(tx_buffer_address, &buf[size], X+ tx_buffer_size); X+ size += tx_buffer_size; X+ } X if (tx_buffer_el & 1) { X break; X } X } X } X+ logout("%p sending frame, len=%d,%s\n", s, size, nic_dump(buf, size)); X+ assert(size <= sizeof(buf)); X qemu_send_packet(s->vc, buf, size); X s->statistics.tx_good_frames++; X /* Transmit with bad status would raise an CX/TNO interrupt. 50b9658f353683696c51a512be294793 echo x - files/patch-hw-serial.c sed 's/^X//' >files/patch-hw-serial.c << '61ad5f9e8a295b113e2f37a550ca5150' 61ad5f9e8a295b113e2f37a550ca5150 echo x - files/patch-hw-vmware_vga.c sed 's/^X//' >files/patch-hw-vmware_vga.c << '4c1373a526b2bbc50950f3acad985664' XIndex: qemu/hw/vmware_vga.c X@@ -28,9 +28,9 @@ X #define VERBOSE X #define EMBED_STDVGA X #undef DIRECT_VRAM X-#define HW_RECT_ACCEL X-#define HW_FILL_ACCEL X-#define HW_MOUSE_ACCEL X+/* #define HW_RECT_ACCEL */ X+/* #define HW_FILL_ACCEL */ X+/* #define HW_MOUSE_ACCEL */ X X #ifdef EMBED_STDVGA X # include "vga_int.h" X@@ -76,6 +76,7 @@ X uint32_t wblue; X int syncing; X int fb_size; X+ int empty; X X union { X uint32_t *fifo; X@@ -487,7 +488,7 @@ X X static inline int vmsvga_fifo_empty(struct vmsvga_state_s *s) X { X- if (!s->config || !s->enable) X+ if (!s->config || !s->enable || s->empty) X return 1; X return (s->cmd->next_cmd == s->cmd->stop); X } X@@ -495,6 +496,10 @@ X static inline uint32_t vmsvga_fifo_read_raw(struct vmsvga_state_s *s) X { X uint32_t cmd = s->fifo[CMD(stop) >> 2]; X+ if (s->cmd->next_cmd == s->cmd->stop) { X+ s->empty = 1; X+ return 0; X+ } X s->cmd->stop = cpu_to_le32(CMD(stop) + 4); X if (CMD(stop) >= CMD(max)) X s->cmd->stop = s->cmd->min; X@@ -512,6 +517,7 @@ X int args = 0; X int x, y, dx, dy, width, height; X struct vmsvga_cursor_definition_s cursor; X+ s->empty = 0; X while (!vmsvga_fifo_empty(s)) X switch (cmd = vmsvga_fifo_read(s)) { X case SVGA_CMD_UPDATE: X@@ -533,6 +539,7 @@ X vmsvga_fill_rect(s, colour, x, y, width, height); X break; X #else X+ args = 0; X goto badcmd; X #endif X X@@ -547,6 +554,7 @@ X vmsvga_copy_rect(s, x, y, dx, dy, width, height); X break; X #else X+ args = 0; X goto badcmd; X #endif X X@@ -609,6 +617,7 @@ X break; /* Nop */ X X default: X+ args = 0; X badcmd: X while (args --) X vmsvga_fifo_read(s); 4c1373a526b2bbc50950f3acad985664 echo x - files/patch-iopl-workaround sed 's/^X//' >files/patch-iopl-workaround << 'feb4bb5d931c091285716ec3d2c90c31' XIndex: qemu/target-i386/op_helper.c X@@ -517,6 +517,12 @@ X #endif X } X X+#if 1 X+#define IOPL_WORKAROUND X+#define VMPORT 0x5658 X+int vmware_svga_io_base; X+#endif X+ X /* check if Port I/O is allowed in TSS */ X static inline void check_io(int addr, int size) X { X@@ -527,6 +533,27 @@ X ((env->tr.flags >> DESC_TYPE_SHIFT) & 0xf) != 9 || X env->tr.limit < 103) X goto fail; X+#ifdef IOPL_WORKAROUND X+ if (addr == VMPORT) { X+ static int last_vmport_iopl = -1; X+ int iopl = (env->eflags >> IOPL_SHIFT) & 3; X+ if (iopl != last_vmport_iopl) { X+ printf("check_io: vmport workaround: iopl = %d\n", iopl); X+ last_vmport_iopl = iopl; X+ } X+ return; X+ } X+ if (vmware_svga_io_base && X+ addr >= vmware_svga_io_base && addr < vmware_svga_io_base + 3) { X+ static int last_svga_iopl = -1; X+ int iopl = (env->eflags >> IOPL_SHIFT) & 3; X+ if (iopl != last_svga_iopl) { X+ printf("check_io: vmware svga workaround: iopl = %d\n", iopl); X+ last_svga_iopl = iopl; X+ } X+ return; X+ } X+#endif X io_offset = lduw_kernel(env->tr.base + 0x66); X io_offset += (addr >> 3); X /* Note: the check needs two bytes */ XIndex: qemu/hw/vmware_vga.c X@@ -1175,12 +1175,20 @@ X return 0; X } X X+#if 1 && defined(TARGET_I386) X+#define IOPL_WORKAROUND X+extern int vmware_svga_io_base; X+#endif X+ X static void pci_vmsvga_map_ioport(PCIDevice *pci_dev, int region_num, X uint32_t addr, uint32_t size, int type) X { X struct pci_vmsvga_state_s *d = (struct pci_vmsvga_state_s *) pci_dev; X struct vmsvga_state_s *s = &d->chip; X X+#ifdef IOPL_WORKAROUND X+ vmware_svga_io_base = addr + SVGA_IO_MUL * SVGA_INDEX_PORT; X+#endif X register_ioport_read(addr + SVGA_IO_MUL * SVGA_INDEX_PORT, X 1, 4, vmsvga_index_read, s); X register_ioport_write(addr + SVGA_IO_MUL * SVGA_INDEX_PORT, feb4bb5d931c091285716ec3d2c90c31 echo x - files/patch-libmath sed 's/^X//' >files/patch-libmath << '0b78493df876bf54c2448b065c7ff8b2' Xdiff -Nru qemu-0.7.0/bsd.orig/Makefile qemu-0.7.0/bsd/Makefile X--- qemu-0.7.0/bsd.orig/Makefile Wed Dec 31 19:00:00 1969 X+++ qemu-0.7.0/bsd/Makefile Fri Apr 29 02:11:27 2005 X@@ -0,0 +1,32 @@ X+SRCS= ${MACHINE_ARCH}/e_atan2l.c \ X+ ${MACHINE_ARCH}/e_logl.S \ X+ ${MACHINE_ARCH}/e_powl.S \ X+ ${MACHINE_ARCH}/e_remainderl.S \ X+ ${MACHINE_ARCH}/e_sqrtl.c \ X+ ${MACHINE_ARCH}/s_ceill.S \ X+ ${MACHINE_ARCH}/s_cosl.S \ X+ ${MACHINE_ARCH}/s_floorl.S \ X+ ${MACHINE_ARCH}/s_isnormal.c \ X+ ${MACHINE_ARCH}/s_llrint.S \ X+ ${MACHINE_ARCH}/s_llrintf.S \ X+ ${MACHINE_ARCH}/s_llrintl.S \ X+ ${MACHINE_ARCH}/s_lrint.S \ X+ ${MACHINE_ARCH}/s_lrintf.S \ X+ ${MACHINE_ARCH}/s_lrintl.S \ X+ ${MACHINE_ARCH}/s_rintl.c \ X+ ${MACHINE_ARCH}/s_round.c \ X+ ${MACHINE_ARCH}/s_sinl.S \ X+ ${MACHINE_ARCH}/s_tanl.S X+ X+OBJS= ${SRCS:R:S/$/.o/} X+ X+CFLAGS+= -I. X+ X+all: libmath.a X+ X+libmath.a: ${OBJS} X+ rm -f $@ X+ ${AR} rcs $@ ${OBJS:T} X+ X+clean: X+ rm -f ${OBJS:T} libmath.a Xdiff -Nru qemu-0.7.0/bsd.orig/amd64/e_atan2l.c qemu-0.7.0/bsd/amd64/e_atan2l.c X--- qemu-0.7.0/bsd.orig/amd64/e_atan2l.c Wed Dec 31 19:00:00 1969 X+++ qemu-0.7.0/bsd/amd64/e_atan2l.c Fri Apr 29 02:11:27 2005 X@@ -0,0 +1,20 @@ X+/* X+ * Written by J.T. Conklin . X+ * Public domain. X+ * X+ * Adapted for `long double' by Ulrich Drepper . X+ */ X+ X+#include X+ X+long double X+__ieee754_atan2l (long double y, long double x) X+{ X+ long double res; X+ X+ asm ("fpatan" : "=t" (res) : "u" (y), "0" (x) : "st(1)"); X+ X+ return res; X+} X+ X+weak_alias(__ieee754_atan2l, atan2l) Xdiff -Nru qemu-0.7.0/bsd.orig/amd64/e_logl.S qemu-0.7.0/bsd/amd64/e_logl.S X--- qemu-0.7.0/bsd.orig/amd64/e_logl.S Wed Dec 31 19:00:00 1969 X+++ qemu-0.7.0/bsd/amd64/e_logl.S Fri Apr 29 02:11:27 2005 X@@ -0,0 +1,59 @@ X+/* X+ * Written by J.T. Conklin . X+ * Public domain. X+ * X+ * Adapted for `long double' by Ulrich Drepper . X+ * Adapted for x86-64 by Andreas Jaeger . X+ */ X+ X+#include X+#include X+ X+RCSID("$NetBSD: $") X+ X+ X+#ifdef __ELF__ X+ .section .rodata X+#else X+ .text X+#endif X+ .align ALIGNARG(4) X+ ASM_TYPE_DIRECTIVE(one,@object) X+one: .double 1.0 X+ ASM_SIZE_DIRECTIVE(one) X+ /* It is not important that this constant is precise. It is only X+ a value which is known to be on the safe side for using the X+ fyl2xp1 instruction. */ X+ ASM_TYPE_DIRECTIVE(limit,@object) X+limit: .double 0.29 X+ ASM_SIZE_DIRECTIVE(limit) X+ X+ X+#ifdef PIC X+#define MO(op) op##(%rip) X+#else X+#define MO(op) op X+#endif X+ X+ .text X+ENTRY(__ieee754_logl) X+ fldln2 // log(2) X+ fldt 8(%rsp) // x : log(2) X+ fld %st // x : x : log(2) X+ fsubl MO(one) // x-1 : x : log(2) X+ fld %st // x-1 : x-1 : x : log(2) X+ fabs // |x-1| : x-1 : x : log(2) X+ fcompl MO(limit) // x-1 : x : log(2) X+ fnstsw // x-1 : x : log(2) X+ andb $0x45, %ah X+ jz 2f X+ fstp %st(1) // x-1 : log(2) X+ fyl2xp1 // log(x) X+ ret X+ X+2: fstp %st(0) // x : log(2) X+ fyl2x // log(x) X+ ret X+END (__ieee754_logl) X+ X+weak_alias(__ieee754_logl,logl) Xdiff -Nru qemu-0.7.0/bsd.orig/amd64/e_powl.S qemu-0.7.0/bsd/amd64/e_powl.S X--- qemu-0.7.0/bsd.orig/amd64/e_powl.S Wed Dec 31 19:00:00 1969 X+++ qemu-0.7.0/bsd/amd64/e_powl.S Fri Apr 29 02:11:27 2005 X@@ -0,0 +1,341 @@ X+/* ix87 specific implementation of pow function. X+ Copyright (C) 1996, 1997, 1998, 1999, 2001, 2004 Free Software Foundation, Inc. X+ This file is part of the GNU C Library. X+ Contributed by Ulrich Drepper , 1996. X+ X+ The GNU C Library is free software; you can redistribute it and/or X+ modify it under the terms of the GNU Lesser General Public X+ License as published by the Free Software Foundation; either X+ version 2.1 of the License, or (at your option) any later version. X+ X+ The GNU C Library is distributed in the hope that it will be useful, X+ but WITHOUT ANY WARRANTY; without even the implied warranty of X+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU X+ Lesser General Public License for more details. X+ X+ You should have received a copy of the GNU Lesser General Public X+ License along with the GNU C Library; if not, write to the Free X+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA X+ 02111-1307 USA. */ X+ X+#include X+#include X+ X+#ifdef __ELF__ X+ .section .rodata X+#else X+ .text X+#endif X+ X+ .align ALIGNARG(4) X+ ASM_TYPE_DIRECTIVE(infinity,@object) X+inf_zero: X+infinity: X+ .byte 0, 0, 0, 0, 0, 0, 0xf0, 0x7f X+ ASM_SIZE_DIRECTIVE(infinity) X+ ASM_TYPE_DIRECTIVE(zero,@object) X+zero: .double 0.0 X+ ASM_SIZE_DIRECTIVE(zero) X+ ASM_TYPE_DIRECTIVE(minf_mzero,@object) X+minf_mzero: X+minfinity: X+ .byte 0, 0, 0, 0, 0, 0, 0xf0, 0xff X+mzero: X+ .byte 0, 0, 0, 0, 0, 0, 0, 0x80 X+ ASM_SIZE_DIRECTIVE(minf_mzero) X+ ASM_TYPE_DIRECTIVE(one,@object) X+one: .double 1.0 X+ ASM_SIZE_DIRECTIVE(one) X+ ASM_TYPE_DIRECTIVE(limit,@object) X+limit: .double 0.29 X+ ASM_SIZE_DIRECTIVE(limit) X+ ASM_TYPE_DIRECTIVE(p63,@object) X+p63: X+ .byte 0, 0, 0, 0, 0, 0, 0xe0, 0x43 X+ ASM_SIZE_DIRECTIVE(p63) X+ X+#ifdef PIC X+#define MO(op) op##(%rip) X+#else X+#define MO(op) op X+#endif X+ X+ .text X+ENTRY(__ieee754_powl) X+ fldt 24(%rsp) // y X+ fxam X+ X+ X+ fnstsw X+ movb %ah, %dl X+ andb $0x45, %ah X+ cmpb $0x40, %ah // is y == 0 ? X+ je 11f X+ X+ cmpb $0x05, %ah // is y == ±inf ? X+ je 12f X+ X+ cmpb $0x01, %ah // is y == NaN ? X+ je 30f X+ X+ fldt 8(%rsp) // x : y X+ X+ fxam X+ fnstsw X+ movb %ah, %dh X+ andb $0x45, %ah X+ cmpb $0x40, %ah X+ je 20f // x is ±0 X+ X+ cmpb $0x05, %ah X+ je 15f // x is ±inf X+ X+ fxch // y : x X+ X+ /* fistpll raises invalid exception for |y| >= 1L<<63. */ X+ fldl MO(p63) // 1L<<63 : y : x X+ fld %st(1) // y : 1L<<63 : y : x X+ fabs // |y| : 1L<<63 : y : x X+ fcomip %st(1), %st // 1L<<63 : y : x X+ fstp %st(0) // y : x X+ jnc 2f X+ X+ /* First see whether `y' is a natural number. In this case we X+ can use a more precise algorithm. */ X+ fld %st // y : y : x X+ fistpll -8(%rsp) // y : x X+ fildll -8(%rsp) // int(y) : y : x X+ fucomip %st(1),%st // y : x X+ jne 2f X+ X+ /* OK, we have an integer value for y. */ X+ mov -8(%rsp),%eax X+ mov -4(%rsp),%edx X+ orl $0, %edx X+ fstp %st(0) // x X+ jns 4f // y >= 0, jump X+ fdivrl MO(one) // 1/x (now referred to as x) X+ negl %eax X+ adcl $0, %edx X+ negl %edx X+4: fldl MO(one) // 1 : x X+ fxch X+ X+6: shrdl $1, %edx, %eax X+ jnc 5f X+ fxch X+ fmul %st(1) // x : ST*x X+ fxch X+5: fmul %st(0), %st // x*x : ST*x X+ shrl $1, %edx X+ movl %eax, %ecx X+ orl %edx, %ecx X+ jnz 6b X+ fstp %st(0) // ST*x X+ ret X+ X+ /* y is ±NAN */ X+30: fldt 8(%rsp) // x : y X+ fldl MO(one) // 1.0 : x : y X+ fucomip %st(1),%st // x : y X+ je 31f X+ fxch // y : x X+31: fstp %st(1) X+ ret X+ X+ .align ALIGNARG(4) X+2: /* y is a real number. */ X+ fxch // x : y X+ fldl MO(one) // 1.0 : x : y X+ fld %st(1) // x : 1.0 : x : y X+ fsub %st(1) // x-1 : 1.0 : x : y X+ fabs // |x-1| : 1.0 : x : y X+ fcompl MO(limit) // 1.0 : x : y X+ fnstsw X+ fxch // x : 1.0 : y X+ test $4500,%eax X+ jz 7f X+ fsub %st(1) // x-1 : 1.0 : y X+ fyl2xp1 // log2(x) : y X+ jmp 8f X+ X+7: fyl2x // log2(x) : y X+8: fmul %st(1) // y*log2(x) : y X+ fxam X+ fnstsw X+ andb $0x45, %ah X+ cmpb $0x05, %ah // is y*log2(x) == ±inf ? X+ je 28f X+ fst %st(1) // y*log2(x) : y*log2(x) X+ frndint // int(y*log2(x)) : y*log2(x) X+ fsubr %st, %st(1) // int(y*log2(x)) : fract(y*log2(x)) X+ fxch // fract(y*log2(x)) : int(y*log2(x)) X+ f2xm1 // 2^fract(y*log2(x))-1 : int(y*log2(x)) X+ faddl MO(one) // 2^fract(y*log2(x)) : int(y*log2(x)) X+ fscale // 2^fract(y*log2(x))*2^int(y*log2(x)) : int(y*log2(x)) X+ fstp %st(1) // 2^fract(y*log2(x))*2^int(y*log2(x)) X+ ret X+ X+28: fstp %st(1) // y*log2(x) X+ fldl MO(one) // 1 : y*log2(x) X+ fscale // 2^(y*log2(x)) : y*log2(x) X+ fstp %st(1) // 2^(y*log2(x)) X+ ret X+ X+ // pow(x,±0) = 1 X+ .align ALIGNARG(4) X+11: fstp %st(0) // pop y X+ fldl MO(one) X+ ret X+ X+ // y == ±inf X+ .align ALIGNARG(4) X+12: fstp %st(0) // pop y X+ fldt 8(%rsp) // x X+ fabs X+ fcompl MO(one) // < 1, == 1, or > 1 X+ fnstsw X+ andb $0x45, %ah X+ cmpb $0x45, %ah X+ je 13f // jump if x is NaN X+ X+ cmpb $0x40, %ah X+ je 14f // jump if |x| == 1 X+ X+ shlb $1, %ah X+ xorb %ah, %dl X+ andl $2, %edx X+#ifdef PIC X+ lea inf_zero(%rip),%rcx X+ fldl (%rcx, %rdx, 4) X+#else X+ fldl inf_zero(,%rdx, 4) X+#endif X+ ret X+ X+ .align ALIGNARG(4) X+14: fldl MO(one) X+ ret X+ X+ .align ALIGNARG(4) X+13: fldt 8(%rsp) // load x == NaN X+ ret X+ X+ .align ALIGNARG(4) X+ // x is ±inf X+15: fstp %st(0) // y X+ testb $2, %dh X+ jz 16f // jump if x == +inf X+ X+ // We must find out whether y is an odd integer. X+ fld %st // y : y X+ fistpll -8(%rsp) // y X+ fildll -8(%rsp) // int(y) : y X+ fucomip %st(1),%st X+ ffreep %st // X+ jne 17f X+ X+ // OK, the value is an integer, but is it odd? X+ mov -8(%rsp), %eax X+ mov -4(%rsp), %edx X+ andb $1, %al X+ jz 18f // jump if not odd X+ // It's an odd integer. X+ shrl $31, %edx X+#ifdef PIC X+ lea minf_mzero(%rip),%rcx X+ fldl (%rcx, %rdx, 8) X+#else X+ fldl minf_mzero(,%rdx, 8) X+#endif X+ ret X+ X+ .align ALIGNARG(4) X+16: fcompl MO(zero) X+ fnstsw X+ shrl $5, %eax X+ andl $8, %eax X+#ifdef PIC X+ lea inf_zero(%rip),%rcx X+ fldl (%rcx, %rax, 1) X+#else X+ fldl inf_zero(,%rax, 1) X+#endif X+ ret X+ X+ .align ALIGNARG(4) X+17: shll $30, %edx // sign bit for y in right position X+18: shrl $31, %edx X+#ifdef PIC X+ lea inf_zero(%rip),%rcx X+ fldl (%rcx, %rdx, 8) X+#else X+ fldl inf_zero(,%rdx, 8) X+#endif X+ ret X+ X+ .align ALIGNARG(4) X+ // x is ±0 X+20: fstp %st(0) // y X+ testb $2, %dl X+ jz 21f // y > 0 X+ X+ // x is ±0 and y is < 0. We must find out whether y is an odd integer. X+ testb $2, %dh X+ jz 25f X+ X+ fld %st // y : y X+ fistpll -8(%rsp) // y X+ fildll -8(%rsp) // int(y) : y X+ fucomip %st(1),%st X+ ffreep %st // X+ jne 26f X+ X+ // OK, the value is an integer, but is it odd? X+ mov -8(%rsp),%eax X+ mov -4(%rsp),%edx X+ andb $1, %al X+ jz 27f // jump if not odd X+ // It's an odd integer. X+ // Raise divide-by-zero exception and get minus infinity value. X+ fldl MO(one) X+ fdivl MO(zero) X+ fchs X+ ret X+ X+25: fstp %st(0) X+26: X+27: // Raise divide-by-zero exception and get infinity value. X+ fldl MO(one) X+ fdivl MO(zero) X+ ret X+ X+ .align ALIGNARG(4) X+ // x is ±0 and y is > 0. We must find out whether y is an odd integer. X+21: testb $2, %dh X+ jz 22f X+ X+ fld %st // y : y X+ fistpll -8(%rsp) // y X+ fildll -8(%rsp) // int(y) : y X+ fucomip %st(1),%st X+ ffreep %st // X+ jne 23f X+ X+ // OK, the value is an integer, but is it odd? X+ mov -8(%rsp),%eax X+ mov -4(%rsp),%edx X+ andb $1, %al X+ jz 24f // jump if not odd X+ // It's an odd integer. X+ fldl MO(mzero) X+ ret X+ X+22: fstp %st(0) X+23: X+24: fldl MO(zero) X+ ret X+ X+END(__ieee754_powl) X+ X+weak_alias(__ieee754_powl,powl) Xdiff -Nru qemu-0.7.0/bsd.orig/amd64/e_remainderl.S qemu-0.7.0/bsd/amd64/e_remainderl.S X--- qemu-0.7.0/bsd.orig/amd64/e_remainderl.S Wed Dec 31 19:00:00 1969 X+++ qemu-0.7.0/bsd/amd64/e_remainderl.S Fri Apr 29 02:11:27 2005 X@@ -0,0 +1,23 @@ X+/* X+ * Written by J.T. Conklin . X+ * Public domain. X+ * X+ * Adapted for `long double' by Ulrich Drepper . X+ * Adapted for x86-64 by Andreas Jaeger . X+ */ X+ X+#include X+#include X+ X+ENTRY(__ieee754_remainderl) X+ fldt 24(%rsp) X+ fldt 8(%rsp) X+1: fprem1 X+ fstsw %ax X+ testl $0x400,%eax X+ jnz 1b X+ fstp %st(1) X+ ret X+END (__ieee754_remainderl) X+ X+weak_alias(__ieee754_remainderl,remainderl) Xdiff -Nru qemu-0.7.0/bsd.orig/amd64/e_sqrtl.c qemu-0.7.0/bsd/amd64/e_sqrtl.c X--- qemu-0.7.0/bsd.orig/amd64/e_sqrtl.c Wed Dec 31 19:00:00 1969 X+++ qemu-0.7.0/bsd/amd64/e_sqrtl.c Fri Apr 29 02:11:27 2005 X@@ -0,0 +1,20 @@ X+/* X+ * Written by J.T. Conklin . X+ * Public domain. X+ * X+ * Adapted for `long double' by Ulrich Drepper . X+ */ X+ X+#include X+ X+long double X+__ieee754_sqrtl (long double x) X+{ X+ long double res; X+ X+ asm ("fsqrt" : "=t" (res) : "0" (x)); X+ X+ return res; X+} X+ X+weak_alias(__ieee754_sqrtl,sqrtl) Xdiff -Nru qemu-0.7.0/bsd.orig/amd64/s_ceill.S qemu-0.7.0/bsd/amd64/s_ceill.S X--- qemu-0.7.0/bsd.orig/amd64/s_ceill.S Wed Dec 31 19:00:00 1969 X+++ qemu-0.7.0/bsd/amd64/s_ceill.S Fri Apr 29 02:22:18 2005 X@@ -0,0 +1,246 @@ X+/* X+ * ==================================================== X+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. X+ * X+ * Developed at SunPro, a Sun Microsystems, Inc. business. X+ * Permission to use, copy, modify, and distribute this X+ * software is freely granted, provided that this notice X+ * is preserved. X+ * ==================================================== X+ * X+ * From: @(#)s_ceil.c 5.1 93/09/24 X+ */ X+/* XXX: generated from src/lib/msun/src/s_ceill.c */ X+ X+#include X+ X+__FBSDID("$FreeBSD: ports/emulators/qemu/files/patch-libmath,v 1.3 2006/08/21 23:02:01 shaun Exp $") X+ X+ .file "s_ceill.c" X+ .section .rodata.cst8,"aM",@progbits,8 X+ .p2align 3 X+.LC0: X+ .long 2281731484 X+ .long 2117592124 X+ .text X+ .p2align 4,,15 X+.globl ceill X+ .type ceill, @function X+ceill: X+.LFB17: X+ pushq %rbp X+.LCFI0: X+ pushq %rbx X+.LCFI1: X+ fldt 24(%rsp) X+ movq $0, -16(%rsp) X+ fld %st(0) X+ fstpt -40(%rsp) X+ movl -32(%rsp), %edi X+ movq -40(%rsp), %rsi X+ movl %edi, -16(%rsp) X+ movl -16(%rsp), %r11d X+ movq %rsi, -24(%rsp) X+ movl %r11d, %r10d X+ andl $32767, %r10d X+ leal -16383(%r10), %r8d X+ cmpl $30, %r8d X+ jg .L2 X+ testl %r8d, %r8d X+ js .L38 X+ movl -20(%rsp), %r9d X+ leal 1(%r8), %ecx X+ mov -24(%rsp), %eax X+ movl $4294967295, %ebp X+ movq %rsi, -40(%rsp) X+ movl %edi, -32(%rsp) X+ shrq %cl, %rbp X+ mov %r9d, %ebx X+ movq %rbx, %rdx X+ andq %rbp, %rdx X+ orq %rax, %rdx X+ fldt -40(%rsp) X+ je .L42 X+ ffreep %st(0) X+ testb $-128, -15(%rsp) X+ jne .L12 X+ movl $31, %ecx X+ movl $1, %eax X+ subl %r8d, %ecx X+ salq %cl, %rax X+ addl %eax, %r9d X+ mov %r9d, %eax X+ cmpq %rbx, %rax X+ jae .L32 X+ leal 1(%r10), %edx X+ movl %r11d, %eax X+ orl $-2147483648, %r9d X+ andw $-32768, %ax X+ andw $32767, %dx X+ orl %edx, %eax X+ movw %ax, -16(%rsp) X+.L32: X+ movl %r9d, -20(%rsp) X+.L12: X+ faddl .LC0(%rip) X+ fldz X+ fxch %st(1) X+ fucomip %st(1), %st X+ fstp %st(0) X+ jbe .L31 X+ movl %ebp, %eax X+ movl $0, -24(%rsp) X+ notl %eax X+ andl %eax, %r9d X+ movl %r9d, -20(%rsp) X+ .p2align 4,,7 X+.L31: X+ movq -24(%rsp), %rsi X+ movl -16(%rsp), %edi X+ movq %rsi, -40(%rsp) X+ movl %edi, -32(%rsp) X+ fldt -40(%rsp) X+ popq %rbx X+ popq %rbp X+ ret X+ .p2align 4,,7 X+.L2: X+ cmpl $62, %r8d X+ jle .L45 X+.L44: X+ ffreep %st(0) X+.L17: X+ movq %rsi, -40(%rsp) X+ movl %edi, -32(%rsp) X+ fldt -40(%rsp) X+ popq %rbx X+ popq %rbp X+ ret X+ .p2align 4,,7 X+.L45: X+ movl -24(%rsp), %edx X+ leal 1(%r8), %ecx X+ movq $-1, %rbx X+ movq %rsi, -40(%rsp) X+ movl %edi, -32(%rsp) X+ shrq %cl, %rbx X+ mov %edx, %r9d X+ testq %rbx, %r9 X+ fldt -40(%rsp) X+ je .L42 X+ ffreep %st(0) X+ testb $-128, -15(%rsp) X+ jne .L20 X+ cmpl $31, %r8d X+ je .L36 X+ movl $63, %ecx X+ movl $1, %eax X+ subl %r8d, %ecx X+ salq %cl, %rax X+ leal (%rdx,%rax), %eax X+ movl %eax, -24(%rsp) X+ mov %eax, %eax X+ cmpq %r9, %rax X+ jae .L20 X+.L36: X+ movl -20(%rsp), %eax X+ leal 1(%rax), %ecx X+ cmpl %eax, %ecx X+ jae .L34 X+ leal 1(%r10), %edx X+ movl %r11d, %eax X+ orl $-2147483648, %ecx X+ andw $-32768, %ax X+ andw $32767, %dx X+ orl %edx, %eax X+ movw %ax, -16(%rsp) X+.L34: X+ movl %ecx, -20(%rsp) X+ .p2align 4,,7 X+.L20: X+ faddl .LC0(%rip) X+ fldz X+ fxch %st(1) X+ fucomip %st(1), %st X+ fstp %st(0) X+ jbe .L31 X+ movl %ebx, %eax X+ notl %eax X+ andl %eax, -24(%rsp) X+ jmp .L31 X+ .p2align 4,,7 X+.L42: X+ fstp %st(1) X+ popq %rbx X+ popq %rbp X+ ret X+ .p2align 4,,7 X+.L38: X+ fldl .LC0(%rip) X+ faddp %st, %st(1) X+ fldz X+ fxch %st(1) X+ fucomip %st(1), %st X+ jbe .L44 X+ testl %r10d, %r10d X+ jle .L39 X+.L7: X+ movabsq $-9223372036854775808, %rsi X+ movl $16383, %edi X+ testb $-128, -15(%rsp) X+ movq %rsi, -40(%rsp) X+ movl %edi, -32(%rsp) X+ fldt -40(%rsp) X+ fcmovne %st(1), %st X+ fstp %st(1) X+ fstpt -40(%rsp) X+ movq -40(%rsp), %rsi X+ movl -32(%rsp), %edi X+ movq %rsi, -24(%rsp) X+ movl %edi, -16(%rsp) X+ jmp .L17 X+.L39: X+ movl -24(%rsp), %eax X+ orl -20(%rsp), %eax X+ je .L44 X+ jmp .L7 X+.LFE17: X+ .size ceill, .-ceill X+ .section .eh_frame,"a",@progbits X+.Lframe1: X+ .long .LECIE1-.LSCIE1 X+.LSCIE1: X+ .long 0x0 X+ .byte 0x1 X+ .string "" X+ .uleb128 0x1 X+ .sleb128 -8 X+ .byte 0x10 X+ .byte 0xc X+ .uleb128 0x7 X+ .uleb128 0x8 X+ .byte 0x90 X+ .uleb128 0x1 X+ .p2align 3 X+.LECIE1: X+.LSFDE1: X+ .long .LEFDE1-.LASFDE1 X+.LASFDE1: X+ .long .LASFDE1-.Lframe1 X+ .quad .LFB17 X+ .quad .LFE17-.LFB17 X+ .byte 0x4 X+ .long .LCFI0-.LFB17 X+ .byte 0xe X+ .uleb128 0x10 X+ .byte 0x4 X+ .long .LCFI1-.LCFI0 X+ .byte 0xe X+ .uleb128 0x18 X+ .byte 0x83 X+ .uleb128 0x3 X+ .byte 0x86 X+ .uleb128 0x2 X+ .p2align 3 X+.LEFDE1: X+ .ident "GCC: (GNU) 3.4.4 [FreeBSD] 20050421" Xdiff -Nru qemu-0.7.0/bsd.orig/amd64/s_cosl.S qemu-0.7.0/bsd/amd64/s_cosl.S X--- qemu-0.7.0/bsd.orig/amd64/s_cosl.S Wed Dec 31 19:00:00 1969 X+++ qemu-0.7.0/bsd/amd64/s_cosl.S Fri Apr 29 02:11:27 2005 X@@ -0,0 +1,33 @@ X+/* X+ * Written by J.T. Conklin . X+ * Public domain. X+ * X+ * Adapted for `long double' by Ulrich Drepper . X+ * Adapted for x86-64 by Andreas Jaeger . X+ */ X+ X+#include X+#include X+ X+RCSID("$NetBSD: $") X+ X+ENTRY(__cosl) X+ fldt 8(%rsp) X+ fcos X+ fnstsw %ax X+ testl $0x400,%eax X+ jnz 1f X+ ret X+ .align ALIGNARG(4) X+1: fldpi X+ fadd %st(0) X+ fxch %st(1) X+2: fprem1 X+ fnstsw %ax X+ testl $0x400,%eax X+ jnz 2b X+ fstp %st(1) X+ fcos X+ ret X+END (__cosl) X+weak_alias (__cosl, cosl) Xdiff -Nru qemu-0.7.0/bsd.orig/amd64/s_floorl.S qemu-0.7.0/bsd/amd64/s_floorl.S X--- qemu-0.7.0/bsd.orig/amd64/s_floorl.S Wed Dec 31 19:00:00 1969 X+++ qemu-0.7.0/bsd/amd64/s_floorl.S Fri Apr 29 02:24:32 2005 X@@ -0,0 +1,247 @@ X+/* X+ * ==================================================== X+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. X+ * X+ * Developed at SunPro, a Sun Microsystems, Inc. business. X+ * Permission to use, copy, modify, and distribute this X+ * software is freely granted, provided that this notice X+ * is preserved. X+ * ==================================================== X+ * X+ * From: @(#)s_floor.c 5.1 93/09/24 X+ */ X+/* XXX: generated from src/lib/msun/src/s_floorl.c */ X+ X+#include X+ X+__FBSDID("$FreeBSD: ports/emulators/qemu/files/patch-libmath,v 1.3 2006/08/21 23:02:01 shaun Exp $") X+ X+ .file "s_floorl.c" X+ .section .rodata.cst8,"aM",@progbits,8 X+ .p2align 3 X+.LC0: X+ .long 2281731484 X+ .long 2117592124 X+ .section .rodata.cst4,"aM",@progbits,4 X+ .p2align 2 X+.LC2: X+ .long 3212836864 X+ .text X+ .p2align 4,,15 X+.globl floorl X+ .type floorl, @function X+floorl: X+.LFB17: X+ pushq %rbp X+.LCFI0: X+ pushq %rbx X+.LCFI1: X+ fldt 24(%rsp) X+ movq $0, -16(%rsp) X+ fld %st(0) X+ fstpt -40(%rsp) X+ movl -32(%rsp), %edi X+ movq -40(%rsp), %rsi X+ movl %edi, -16(%rsp) X+ movl -16(%rsp), %r11d X+ movq %rsi, -24(%rsp) X+ movl %r11d, %r10d X+ andl $32767, %r10d X+ leal -16383(%r10), %r8d X+ cmpl $30, %r8d X+ jg .L2 X+ testl %r8d, %r8d X+ js .L38 X+ movl -20(%rsp), %r9d X+ leal 1(%r8), %ecx X+ mov -24(%rsp), %eax X+ movl $4294967295, %ebp X+ movq %rsi, -40(%rsp) X+ movl %edi, -32(%rsp) X+ shrq %cl, %rbp X+ mov %r9d, %ebx X+ movq %rbx, %rdx X+ andq %rbp, %rdx X+ orq %rax, %rdx X+ fldt -40(%rsp) X+ je .L42 X+ ffreep %st(0) X+ testb $-128, -15(%rsp) X+ je .L12 X+ movl $31, %ecx X+ movl $1, %eax X+ subl %r8d, %ecx X+ salq %cl, %rax X+ addl %eax, %r9d X+ mov %r9d, %eax X+ cmpq %rbx, %rax X+ jae .L32 X+ leal 1(%r10), %edx X+ movl %r11d, %eax X+ orl $-2147483648, %r9d X+ andw $-32768, %ax X+ andw $32767, %dx X+ orl %edx, %eax X+ movw %ax, -16(%rsp) X+.L32: X+ movl %r9d, -20(%rsp) X+.L12: X+ faddl .LC0(%rip) X+ fldz X+ fxch %st(1) X+ fucomip %st(1), %st X+ fstp %st(0) X+ jbe .L31 X+ movl %ebp, %eax X+ movl $0, -24(%rsp) X+ notl %eax X+ andl %eax, %r9d X+ movl %r9d, -20(%rsp) X+ .p2align 4,,7 X+.L31: X+ movq -24(%rsp), %rsi X+ movl -16(%rsp), %edi X+ movq %rsi, -40(%rsp) X+ movl %edi, -32(%rsp) X+ fldt -40(%rsp) X+ popq %rbx X+ popq %rbp X+ ret X+ .p2align 4,,7 X+.L2: X+ cmpl $62, %r8d X+ jle .L45 X+.L44: X+ ffreep %st(0) X+.L17: X+ movq %rsi, -40(%rsp) X+ movl %edi, -32(%rsp) X+ fldt -40(%rsp) X+ popq %rbx X+ popq %rbp X+ ret X+ .p2align 4,,7 X+.L45: X+ movl -24(%rsp), %edx X+ leal 1(%r8), %ecx X+ movq $-1, %rbx X+ movq %rsi, -40(%rsp) X+ movl %edi, -32(%rsp) X+ shrq %cl, %rbx X+ mov %edx, %r9d X+ testq %rbx, %r9 X+ fldt -40(%rsp) X+ je .L42 X+ ffreep %st(0) X+ testb $-128, -15(%rsp) X+ je .L20 X+ cmpl $31, %r8d X+ je .L36 X+ movl $63, %ecx X+ movl $1, %eax X+ subl %r8d, %ecx X+ salq %cl, %rax X+ leal (%rdx,%rax), %eax X+ movl %eax, -24(%rsp) X+ mov %eax, %eax X+ cmpq %r9, %rax X+ jae .L20 X+.L36: X+ movl -20(%rsp), %eax X+ leal 1(%rax), %ecx X+ cmpl %eax, %ecx X+ jae .L34 X+ leal 1(%r10), %edx X+ movl %r11d, %eax X+ orl $-2147483648, %ecx X+ andw $-32768, %ax X+ andw $32767, %dx X+ orl %edx, %eax X+ movw %ax, -16(%rsp) X+.L34: X+ movl %ecx, -20(%rsp) X+ .p2align 4,,7 X+.L20: X+ faddl .LC0(%rip) X+ fldz X+ fxch %st(1) X+ fucomip %st(1), %st X+ fstp %st(0) X+ jbe .L31 X+ movl %ebx, %eax X+ notl %eax X+ andl %eax, -24(%rsp) X+ jmp .L31 X+ .p2align 4,,7 X+.L42: X+ fstp %st(1) X+ popq %rbx X+ popq %rbp X+ ret X+ .p2align 4,,7 X+.L38: X+ fldl .LC0(%rip) X+ faddp %st, %st(1) X+ fldz X+ fxch %st(1) X+ fucomip %st(1), %st X+ jbe .L44 X+ testl %r10d, %r10d X+ jle .L39 X+.L7: X+ testb $-128, -15(%rsp) X+ je .L9 X+ ffreep %st(0) X+ flds .LC2(%rip) X+.L9: X+ fstpt -40(%rsp) X+ movq -40(%rsp), %rsi X+ movl -32(%rsp), %edi X+ movq %rsi, -24(%rsp) X+ movl %edi, -16(%rsp) X+ jmp .L17 X+.L39: X+ movl -24(%rsp), %eax X+ orl -20(%rsp), %eax X+ je .L44 X+ jmp .L7 X+.LFE17: X+ .size floorl, .-floorl X+ .section .eh_frame,"a",@progbits X+.Lframe1: X+ .long .LECIE1-.LSCIE1 X+.LSCIE1: X+ .long 0x0 X+ .byte 0x1 X+ .string "" X+ .uleb128 0x1 X+ .sleb128 -8 X+ .byte 0x10 X+ .byte 0xc X+ .uleb128 0x7 X+ .uleb128 0x8 X+ .byte 0x90 X+ .uleb128 0x1 X+ .p2align 3 X+.LECIE1: X+.LSFDE1: X+ .long .LEFDE1-.LASFDE1 X+.LASFDE1: X+ .long .LASFDE1-.Lframe1 X+ .quad .LFB17 X+ .quad .LFE17-.LFB17 X+ .byte 0x4 X+ .long .LCFI0-.LFB17 X+ .byte 0xe X+ .uleb128 0x10 X+ .byte 0x4 X+ .long .LCFI1-.LCFI0 X+ .byte 0xe X+ .uleb128 0x18 X+ .byte 0x83 X+ .uleb128 0x3 X+ .byte 0x86 X+ .uleb128 0x2 X+ .p2align 3 X+.LEFDE1: X+ .ident "GCC: (GNU) 3.4.4 [FreeBSD] 20050421" Xdiff -Nru qemu-0.7.0/bsd.orig/amd64/s_isnormal.c qemu-0.7.0/bsd/amd64/s_isnormal.c X--- qemu-0.7.0/bsd.orig/amd64/s_isnormal.c Wed Dec 31 19:00:00 1969 X+++ qemu-0.7.0/bsd/amd64/s_isnormal.c Fri Apr 29 02:11:27 2005 X@@ -0,0 +1,85 @@ X+/*- X+ * Copyright (c) 2003 Mike Barcroft X+ * Copyright (c) 2002-2004 David Schultz X+ * All rights reserved. X+ * X+ * Redistribution and use in source and binary forms, with or without X+ * modification, are permitted provided that the following conditions X+ * are met: X+ * 1. Redistributions of source code must retain the above copyright X+ * notice, this list of conditions and the following disclaimer. X+ * 2. Redistributions in binary form must reproduce the above copyright X+ * notice, this list of conditions and the following disclaimer in the X+ * documentation and/or other materials provided with the distribution. X+ * X+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND X+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE X+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE X+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE X+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL X+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS X+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) X+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT X+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY X+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF X+ * SUCH DAMAGE. X+ * X+ * $FreeBSD: ports/emulators/qemu/files/patch-libmath,v 1.3 2006/08/21 23:02:01 shaun Exp $ X+ */ X+ X+union IEEEf2bits { X+ float f; X+ struct { X+ unsigned int man :23; X+ unsigned int exp :8; X+ unsigned int sign :1; X+ } bits; X+}; X+ X+union IEEEd2bits { X+ double d; X+ struct { X+ unsigned int manl :32; X+ unsigned int manh :20; X+ unsigned int exp :11; X+ unsigned int sign :1; X+ } bits; X+}; X+ X+union IEEEl2bits { X+ long double e; X+ struct { X+ unsigned int manl :32; X+ unsigned int manh :32; X+ unsigned int exp :15; X+ unsigned int sign :1; X+ unsigned int junk :16; X+ } bits; X+}; X+ X+int X+__isnormal(double d) X+{ X+ union IEEEd2bits u; X+ X+ u.d = d; X+ return (u.bits.exp != 0 && u.bits.exp != 2047); X+} X+ X+int X+__isnormalf(float f) X+{ X+ union IEEEf2bits u; X+ X+ u.f = f; X+ return (u.bits.exp != 0 && u.bits.exp != 255); X+} X+ X+int X+__isnormall(long double e) X+{ X+ union IEEEl2bits u; X+ X+ u.e = e; X+ return (u.bits.exp != 0 && u.bits.exp != 32767); X+} Xdiff -Nru qemu-0.7.0/bsd.orig/amd64/s_llrint.S qemu-0.7.0/bsd/amd64/s_llrint.S X--- qemu-0.7.0/bsd.orig/amd64/s_llrint.S Wed Dec 31 19:00:00 1969 X+++ qemu-0.7.0/bsd/amd64/s_llrint.S Fri Apr 29 02:11:27 2005 X@@ -0,0 +1,6 @@ X+#include X+__FBSDID("$FreeBSD: ports/emulators/qemu/files/patch-libmath,v 1.3 2006/08/21 23:02:01 shaun Exp $") X+ X+/* sizeof(long) == sizeof(long long) */ X+#define fn llrint X+#include "s_lrint.S" Xdiff -Nru qemu-0.7.0/bsd.orig/amd64/s_llrintf.S qemu-0.7.0/bsd/amd64/s_llrintf.S X--- qemu-0.7.0/bsd.orig/amd64/s_llrintf.S Wed Dec 31 19:00:00 1969 X+++ qemu-0.7.0/bsd/amd64/s_llrintf.S Fri Apr 29 02:11:27 2005 X@@ -0,0 +1,6 @@ X+#include X+__FBSDID("$FreeBSD: ports/emulators/qemu/files/patch-libmath,v 1.3 2006/08/21 23:02:01 shaun Exp $") X+ X+/* sizeof(long) == sizeof(long long) */ X+#define fn llrintf X+#include "s_lrintf.S" Xdiff -Nru qemu-0.7.0/bsd.orig/amd64/s_llrintl.S qemu-0.7.0/bsd/amd64/s_llrintl.S X--- qemu-0.7.0/bsd.orig/amd64/s_llrintl.S Wed Dec 31 19:00:00 1969 X+++ qemu-0.7.0/bsd/amd64/s_llrintl.S Fri Apr 29 02:11:27 2005 X@@ -0,0 +1,35 @@ X+/* Round argument to nearest integral value according to current rounding X+ direction. X+ Copyright (C) 1997, 2002 Free Software Foundation, Inc. X+ This file is part of the GNU C Library. X+ X+ The GNU C Library is free software; you can redistribute it and/or X+ modify it under the terms of the GNU Lesser General Public X+ License as published by the Free Software Foundation; either X+ version 2.1 of the License, or (at your option) any later version. X+ X+ The GNU C Library is distributed in the hope that it will be useful, X+ but WITHOUT ANY WARRANTY; without even the implied warranty of X+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU X+ Lesser General Public License for more details. X+ X+ You should have received a copy of the GNU Lesser General Public X+ License along with the GNU C Library; if not, write to the Free X+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA X+ 02111-1307 USA. */ X+ X+#include X+#include X+ X+ .text X+ENTRY(__llrintl) X+ fldt 8(%rsp) X+ fistpll -8(%rsp) X+ fwait X+ movq -8(%rsp),%rax X+ ret X+END(__llrintl) X+weak_alias (__llrintl, llrintl) X+strong_alias (__llrintl, __lrintl) X+weak_alias (__llrintl, lrintl) X+ Xdiff -Nru qemu-0.7.0/bsd.orig/amd64/s_lrint.S qemu-0.7.0/bsd/amd64/s_lrint.S X--- qemu-0.7.0/bsd.orig/amd64/s_lrint.S Wed Dec 31 19:00:00 1969 X+++ qemu-0.7.0/bsd/amd64/s_lrint.S Fri Apr 29 02:11:27 2005 X@@ -0,0 +1,36 @@ X+/*- X+ * Copyright (c) 2005 David Schultz X+ * All rights reserved. X+ * X+ * Redistribution and use in source and binary forms, with or without X+ * modification, are permitted provided that the following conditions X+ * are met: X+ * 1. Redistributions of source code must retain the above copyright X+ * notice, this list of conditions and the following disclaimer. X+ * 2. Redistributions in binary form must reproduce the above copyright X+ * notice, this list of conditions and the following disclaimer in the X+ * documentation and/or other materials provided with the distribution. X+ * X+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND X+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE X+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE X+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE X+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL X+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS X+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) X+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT X+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY X+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF X+ * SUCH DAMAGE. X+ */ X+ X+#include X+ X+#ifndef fn X+__FBSDID("$FreeBSD: ports/emulators/qemu/files/patch-libmath,v 1.3 2006/08/21 23:02:01 shaun Exp $") X+#define fn lrint X+#endif X+ X+ENTRY(fn) X+ cvtsd2si %xmm0, %rax X+ ret Xdiff -Nru qemu-0.7.0/bsd.orig/amd64/s_lrintf.S qemu-0.7.0/bsd/amd64/s_lrintf.S X--- qemu-0.7.0/bsd.orig/amd64/s_lrintf.S Wed Dec 31 19:00:00 1969 X+++ qemu-0.7.0/bsd/amd64/s_lrintf.S Fri Apr 29 02:11:27 2005 X@@ -0,0 +1,36 @@ X+/*- X+ * Copyright (c) 2005 David Schultz X+ * All rights reserved. X+ * X+ * Redistribution and use in source and binary forms, with or without X+ * modification, are permitted provided that the following conditions X+ * are met: X+ * 1. Redistributions of source code must retain the above copyright X+ * notice, this list of conditions and the following disclaimer. X+ * 2. Redistributions in binary form must reproduce the above copyright X+ * notice, this list of conditions and the following disclaimer in the X+ * documentation and/or other materials provided with the distribution. X+ * X+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND X+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE X+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE X+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE X+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL X+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS X+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) X+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT X+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY X+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF X+ * SUCH DAMAGE. X+ */ X+ X+#include X+ X+#ifndef fn X+__FBSDID("$FreeBSD: ports/emulators/qemu/files/patch-libmath,v 1.3 2006/08/21 23:02:01 shaun Exp $") X+#define fn lrintf X+#endif X+ X+ENTRY(fn) X+ cvtss2si %xmm0, %rax X+ ret Xdiff -Nru qemu-0.7.0/bsd.orig/amd64/s_lrintl.S qemu-0.7.0/bsd/amd64/s_lrintl.S X--- qemu-0.7.0/bsd.orig/amd64/s_lrintl.S Wed Dec 31 19:00:00 1969 X+++ qemu-0.7.0/bsd/amd64/s_lrintl.S Fri Apr 29 02:11:27 2005 X@@ -0,0 +1 @@ X+/* Not needed, see s_llrintl.S. */ Xdiff -Nru qemu-0.7.0/bsd.orig/amd64/s_rintl.c qemu-0.7.0/bsd/amd64/s_rintl.c X--- qemu-0.7.0/bsd.orig/amd64/s_rintl.c Wed Dec 31 19:00:00 1969 X+++ qemu-0.7.0/bsd/amd64/s_rintl.c Fri Apr 29 02:11:27 2005 X@@ -0,0 +1,18 @@ X+/* X+ * Written by J.T. Conklin . X+ * Changes for long double by Ulrich Drepper X+ * Public domain. X+ */ X+ X+#include X+ X+long double X+__rintl (long double x) X+{ X+ long double res; X+ X+ asm ("frndint" : "=t" (res) : "0" (x)); X+ return res; X+} X+ X+weak_alias (__rintl, rintl) Xdiff -Nru qemu-0.7.0/bsd.orig/amd64/s_round.c qemu-0.7.0/bsd/amd64/s_round.c X--- qemu-0.7.0/bsd.orig/amd64/s_round.c Wed Dec 31 19:00:00 1969 X+++ qemu-0.7.0/bsd/amd64/s_round.c Fri Apr 29 02:11:27 2005 X@@ -0,0 +1,51 @@ X+/*- X+ * Copyright (c) 2003, Steven G. Kargl X+ * All rights reserved. X+ * X+ * Redistribution and use in source and binary forms, with or without X+ * modification, are permitted provided that the following conditions X+ * are met: X+ * 1. Redistributions of source code must retain the above copyright X+ * notice unmodified, this list of conditions, and the following X+ * disclaimer. X+ * 2. Redistributions in binary form must reproduce the above copyright X+ * notice, this list of conditions and the following disclaimer in the X+ * documentation and/or other materials provided with the distribution. X+ * X+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR X+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES X+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. X+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, X+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT X+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, X+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY X+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT X+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF X+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. X+ */ X+ X+#include X+__FBSDID("$FreeBSD: ports/emulators/qemu/files/patch-libmath,v 1.3 2006/08/21 23:02:01 shaun Exp $"); X+ X+#include X+ X+double X+round(double x) X+{ X+ double t; X+ X+ if (!isfinite(x)) X+ return (x); X+ X+ if (x >= 0.0) { X+ t = floor(x); X+ if (t - x <= -0.5) X+ t += 1.0; X+ return (t); X+ } else { X+ t = floor(-x); X+ if (t + x <= -0.5) X+ t += 1.0; X+ return (-t); X+ } X+} Xdiff -Nru qemu-0.7.0/bsd.orig/amd64/s_sinl.S qemu-0.7.0/bsd/amd64/s_sinl.S X--- qemu-0.7.0/bsd.orig/amd64/s_sinl.S Wed Dec 31 19:00:00 1969 X+++ qemu-0.7.0/bsd/amd64/s_sinl.S Fri Apr 29 02:11:27 2005 X@@ -0,0 +1,31 @@ X+/* X+ * Written by J.T. Conklin . X+ * Public domain. X+ * X+ * Adapted for `long double' by Ulrich Drepper . X+ * Adapted for x86-64 by Andreas Jaeger . X+ */ X+ X+#include X+#include X+ X+ENTRY(__sinl) X+ fldt 8(%rsp) X+ fsin X+ fnstsw %ax X+ testl $0x400,%eax X+ jnz 1f X+ ret X+ .align ALIGNARG(4) X+1: fldpi X+ fadd %st(0) X+ fxch %st(1) X+2: fprem1 X+ fnstsw %ax X+ testl $0x400,%eax X+ jnz 2b X+ fstp %st(1) X+ fsin X+ ret X+END (__sinl) X+weak_alias (__sinl, sinl) Xdiff -Nru qemu-0.7.0/bsd.orig/amd64/s_tanl.S qemu-0.7.0/bsd/amd64/s_tanl.S X--- qemu-0.7.0/bsd.orig/amd64/s_tanl.S Wed Dec 31 19:00:00 1969 X+++ qemu-0.7.0/bsd/amd64/s_tanl.S Fri Apr 29 02:11:27 2005 X@@ -0,0 +1,34 @@ X+/* X+ * Written by J.T. Conklin . X+ * Public domain. X+ * X+ * Adapted for `long double' by Ulrich Drepper . X+ * Adapted for x86-64 by Andreas Jaeger . X+ */ X+ X+#include X+#include X+ X+RCSID("$NetBSD: $") X+ X+ENTRY(__tanl) X+ fldt 8(%rsp) X+ fptan X+ fnstsw %ax X+ testl $0x400,%eax X+ jnz 1f X+ fstp %st(0) X+ ret X+1: fldpi X+ fadd %st(0) X+ fxch %st(1) X+2: fprem1 X+ fstsw %ax X+ testl $0x400,%eax X+ jnz 2b X+ fstp %st(1) X+ fptan X+ fstp %st(0) X+ ret X+END (__tanl) X+weak_alias (__tanl, tanl) Xdiff -Nru qemu-0.7.0/bsd.orig/i386/e_atan2l.c qemu-0.7.0/bsd/i386/e_atan2l.c X--- qemu-0.7.0/bsd.orig/i386/e_atan2l.c Wed Dec 31 19:00:00 1969 X+++ qemu-0.7.0/bsd/i386/e_atan2l.c Fri Apr 29 02:11:27 2005 X@@ -0,0 +1,20 @@ X+/* X+ * Written by J.T. Conklin . X+ * Public domain. X+ * X+ * Adapted for `long double' by Ulrich Drepper . X+ */ X+ X+#include X+ X+long double X+__ieee754_atan2l (long double y, long double x) X+{ X+ long double res; X+ X+ asm ("fpatan" : "=t" (res) : "u" (y), "0" (x) : "st(1)"); X+ X+ return res; X+} X+ X+weak_alias(__ieee754_atan2l, atan2l) Xdiff -Nru qemu-0.7.0/bsd.orig/i386/e_logl.S qemu-0.7.0/bsd/i386/e_logl.S X--- qemu-0.7.0/bsd.orig/i386/e_logl.S Wed Dec 31 19:00:00 1969 X+++ qemu-0.7.0/bsd/i386/e_logl.S Fri Apr 29 02:11:27 2005 X@@ -0,0 +1,63 @@ X+/* X+ * Written by J.T. Conklin . X+ * Public domain. X+ * X+ * Adapted for `long double' by Ulrich Drepper . X+ */ X+ X+#include X+#include X+ X+RCSID("$NetBSD: $") X+ X+ X+#ifdef __ELF__ X+ .section .rodata X+#else X+ .text X+#endif X+ .align ALIGNARG(4) X+ ASM_TYPE_DIRECTIVE(one,@object) X+one: .double 1.0 X+ ASM_SIZE_DIRECTIVE(one) X+ /* It is not important that this constant is precise. It is only X+ a value which is known to be on the safe side for using the X+ fyl2xp1 instruction. */ X+ ASM_TYPE_DIRECTIVE(limit,@object) X+limit: .double 0.29 X+ ASM_SIZE_DIRECTIVE(limit) X+ X+ X+#ifdef PIC X+#define MO(op) op##@GOTOFF(%edx) X+#else X+#define MO(op) op X+#endif X+ X+ .text X+ENTRY(__ieee754_logl) X+ fldln2 // log(2) X+ fldt 4(%esp) // x : log(2) X+#ifdef PIC X+ call 1f X+1: popl %edx X+ addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx X+#endif X+ fld %st // x : x : log(2) X+ fsubl MO(one) // x-1 : x : log(2) X+ fld %st // x-1 : x-1 : x : log(2) X+ fabs // |x-1| : x-1 : x : log(2) X+ fcompl MO(limit) // x-1 : x : log(2) X+ fnstsw // x-1 : x : log(2) X+ andb $0x45, %ah X+ jz 2f X+ fstp %st(1) // x-1 : log(2) X+ fyl2xp1 // log(x) X+ ret X+ X+2: fstp %st(0) // x : log(2) X+ fyl2x // log(x) X+ ret X+END (__ieee754_logl) X+ X+weak_alias(__ieee754_logl,logl) Xdiff -Nru qemu-0.7.0/bsd.orig/i386/e_powl.S qemu-0.7.0/bsd/i386/e_powl.S X--- qemu-0.7.0/bsd.orig/i386/e_powl.S Wed Dec 31 19:00:00 1969 X+++ qemu-0.7.0/bsd/i386/e_powl.S Fri Apr 29 02:11:27 2005 X@@ -0,0 +1,341 @@ X+/* ix87 specific implementation of pow function. X+ Copyright (C) 1996, 1997, 1998, 1999, 2001, 2004 X+ Free Software Foundation, Inc. X+ This file is part of the GNU C Library. X+ Contributed by Ulrich Drepper , 1996. X+ X+ The GNU C Library is free software; you can redistribute it and/or X+ modify it under the terms of the GNU Lesser General Public X+ License as published by the Free Software Foundation; either X+ version 2.1 of the License, or (at your option) any later version. X+ X+ The GNU C Library is distributed in the hope that it will be useful, X+ but WITHOUT ANY WARRANTY; without even the implied warranty of X+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU X+ Lesser General Public License for more details. X+ X+ You should have received a copy of the GNU Lesser General Public X+ License along with the GNU C Library; if not, write to the Free X+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA X+ 02111-1307 USA. */ X+ X+#include X+#include X+ X+#ifdef __ELF__ X+ .section .rodata X+#else X+ .text X+#endif X+ X+ .align ALIGNARG(4) X+ ASM_TYPE_DIRECTIVE(infinity,@object) X+inf_zero: X+infinity: X+ .byte 0, 0, 0, 0, 0, 0, 0xf0, 0x7f X+ ASM_SIZE_DIRECTIVE(infinity) X+ ASM_TYPE_DIRECTIVE(zero,@object) X+zero: .double 0.0 X+ ASM_SIZE_DIRECTIVE(zero) X+ ASM_TYPE_DIRECTIVE(minf_mzero,@object) X+minf_mzero: X+minfinity: X+ .byte 0, 0, 0, 0, 0, 0, 0xf0, 0xff X+mzero: X+ .byte 0, 0, 0, 0, 0, 0, 0, 0x80 X+ ASM_SIZE_DIRECTIVE(minf_mzero) X+ ASM_TYPE_DIRECTIVE(one,@object) X+one: .double 1.0 X+ ASM_SIZE_DIRECTIVE(one) X+ ASM_TYPE_DIRECTIVE(limit,@object) X+limit: .double 0.29 X+ ASM_SIZE_DIRECTIVE(limit) X+ ASM_TYPE_DIRECTIVE(p63,@object) X+p63: .byte 0, 0, 0, 0, 0, 0, 0xe0, 0x43 X+ ASM_SIZE_DIRECTIVE(p63) X+ X+#ifdef PIC X+#define MO(op) op##@GOTOFF(%ecx) X+#define MOX(op,x,f) op##@GOTOFF(%ecx,x,f) X+#else X+#define MO(op) op X+#define MOX(op,x,f) op(,x,f) X+#endif X+ X+ .text X+ENTRY(__ieee754_powl) X+ fldt 16(%esp) // y X+ fxam X+ X+#ifdef PIC X+ call 1f X+1: popl %ecx X+ addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ecx X+#endif X+ X+ fnstsw X+ movb %ah, %dl X+ andb $0x45, %ah X+ cmpb $0x40, %ah // is y == 0 ? X+ je 11f X+ X+ cmpb $0x05, %ah // is y == ±inf ? X+ je 12f X+ X+ cmpb $0x01, %ah // is y == NaN ? X+ je 30f X+ X+ fldt 4(%esp) // x : y X+ X+ subl $8,%esp X+ X+ fxam X+ fnstsw X+ movb %ah, %dh X+ andb $0x45, %ah X+ cmpb $0x40, %ah X+ je 20f // x is ±0 X+ X+ cmpb $0x05, %ah X+ je 15f // x is ±inf X+ X+ fxch // y : x X+ X+ /* fistpll raises invalid exception for |y| >= 1L<<63. */ X+ fld %st // y : y : x X+ fabs // |y| : y : x X+ fcompl MO(p63) // y : x X+ fnstsw X+ sahf X+ jnc 2f X+ X+ /* First see whether `y' is a natural number. In this case we X+ can use a more precise algorithm. */ X+ fld %st // y : y : x X+ fistpll (%esp) // y : x X+ fildll (%esp) // int(y) : y : x X+ fucomp %st(1) // y : x X+ fnstsw X+ sahf X+ jne 2f X+ X+ /* OK, we have an integer value for y. */ X+ popl %eax X+ popl %edx X+ orl $0, %edx X+ fstp %st(0) // x X+ jns 4f // y >= 0, jump X+ fdivrl MO(one) // 1/x (now referred to as x) X+ negl %eax X+ adcl $0, %edx X+ negl %edx X+4: fldl MO(one) // 1 : x X+ fxch X+ X+6: shrdl $1, %edx, %eax X+ jnc 5f X+ fxch X+ fmul %st(1) // x : ST*x X+ fxch X+5: fmul %st(0), %st // x*x : ST*x X+ shrl $1, %edx X+ movl %eax, %ecx X+ orl %edx, %ecx X+ jnz 6b X+ fstp %st(0) // ST*x X+ ret X+ X+ /* y is ±NAN */ X+30: fldt 4(%esp) // x : y X+ fldl MO(one) // 1.0 : x : y X+ fucomp %st(1) // x : y X+ fnstsw X+ sahf X+ je 31f X+ fxch // y : x X+31: fstp %st(1) X+ ret X+ X+ .align ALIGNARG(4) X+2: /* y is a real number. */ X+ fxch // x : y X+ fldl MO(one) // 1.0 : x : y X+ fld %st(1) // x : 1.0 : x : y X+ fsub %st(1) // x-1 : 1.0 : x : y X+ fabs // |x-1| : 1.0 : x : y X+ fcompl MO(limit) // 1.0 : x : y X+ fnstsw X+ fxch // x : 1.0 : y X+ sahf X+ ja 7f X+ fsub %st(1) // x-1 : 1.0 : y X+ fyl2xp1 // log2(x) : y X+ jmp 8f X+ X+7: fyl2x // log2(x) : y X+8: fmul %st(1) // y*log2(x) : y X+ fxam X+ fnstsw X+ andb $0x45, %ah X+ cmpb $0x05, %ah // is y*log2(x) == ±inf ? X+ je 28f X+ fst %st(1) // y*log2(x) : y*log2(x) X+ frndint // int(y*log2(x)) : y*log2(x) X+ fsubr %st, %st(1) // int(y*log2(x)) : fract(y*log2(x)) X+ fxch // fract(y*log2(x)) : int(y*log2(x)) X+ f2xm1 // 2^fract(y*log2(x))-1 : int(y*log2(x)) X+ faddl MO(one) // 2^fract(y*log2(x)) : int(y*log2(x)) X+ fscale // 2^fract(y*log2(x))*2^int(y*log2(x)) : int(y*log2(x)) X+ addl $8, %esp X+ fstp %st(1) // 2^fract(y*log2(x))*2^int(y*log2(x)) X+ ret X+ X+28: fstp %st(1) // y*log2(x) X+ fldl MO(one) // 1 : y*log2(x) X+ fscale // 2^(y*log2(x)) : y*log2(x) X+ addl $8, %esp X+ fstp %st(1) // 2^(y*log2(x)) X+ ret X+ X+ // pow(x,±0) = 1 X+ .align ALIGNARG(4) X+11: fstp %st(0) // pop y X+ fldl MO(one) X+ ret X+ X+ // y == ±inf X+ .align ALIGNARG(4) X+12: fstp %st(0) // pop y X+ fldt 4(%esp) // x X+ fabs X+ fcompl MO(one) // < 1, == 1, or > 1 X+ fnstsw X+ andb $0x45, %ah X+ cmpb $0x45, %ah X+ je 13f // jump if x is NaN X+ X+ cmpb $0x40, %ah X+ je 14f // jump if |x| == 1 X+ X+ shlb $1, %ah X+ xorb %ah, %dl X+ andl $2, %edx X+ fldl MOX(inf_zero, %edx, 4) X+ ret X+ X+ .align ALIGNARG(4) X+14: fldl MO(one) X+ ret X+ X+ .align ALIGNARG(4) X+13: fldt 4(%esp) // load x == NaN X+ ret X+ X+ .align ALIGNARG(4) X+ // x is ±inf X+15: fstp %st(0) // y X+ testb $2, %dh X+ jz 16f // jump if x == +inf X+ X+ // We must find out whether y is an odd integer. X+ fld %st // y : y X+ fistpll (%esp) // y X+ fildll (%esp) // int(y) : y X+ fucompp // X+ fnstsw X+ sahf X+ jne 17f X+ X+ // OK, the value is an integer, but is it odd? X+ popl %eax X+ popl %edx X+ andb $1, %al X+ jz 18f // jump if not odd X+ // It's an odd integer. X+ shrl $31, %edx X+ fldl MOX(minf_mzero, %edx, 8) X+ ret X+ X+ .align ALIGNARG(4) X+16: fcompl MO(zero) X+ addl $8, %esp X+ fnstsw X+ shrl $5, %eax X+ andl $8, %eax X+ fldl MOX(inf_zero, %eax, 1) X+ ret X+ X+ .align ALIGNARG(4) X+17: shll $30, %edx // sign bit for y in right position X+ addl $8, %esp X+18: shrl $31, %edx X+ fldl MOX(inf_zero, %edx, 8) X+ ret X+ X+ .align ALIGNARG(4) X+ // x is ±0 X+20: fstp %st(0) // y X+ testb $2, %dl X+ jz 21f // y > 0 X+ X+ // x is ±0 and y is < 0. We must find out whether y is an odd integer. X+ testb $2, %dh X+ jz 25f X+ X+ fld %st // y : y X+ fistpll (%esp) // y X+ fildll (%esp) // int(y) : y X+ fucompp // X+ fnstsw X+ sahf X+ jne 26f X+ X+ // OK, the value is an integer, but is it odd? X+ popl %eax X+ popl %edx X+ andb $1, %al X+ jz 27f // jump if not odd X+ // It's an odd integer. X+ // Raise divide-by-zero exception and get minus infinity value. X+ fldl MO(one) X+ fdivl MO(zero) X+ fchs X+ ret X+ X+25: fstp %st(0) X+26: addl $8, %esp X+27: // Raise divide-by-zero exception and get infinity value. X+ fldl MO(one) X+ fdivl MO(zero) X+ ret X+ X+ .align ALIGNARG(4) X+ // x is ±0 and y is > 0. We must find out whether y is an odd integer. X+21: testb $2, %dh X+ jz 22f X+ X+ fld %st // y : y X+ fistpll (%esp) // y X+ fildll (%esp) // int(y) : y X+ fucompp // X+ fnstsw X+ sahf X+ jne 23f X+ X+ // OK, the value is an integer, but is it odd? X+ popl %eax X+ popl %edx X+ andb $1, %al X+ jz 24f // jump if not odd X+ // It's an odd integer. X+ fldl MO(mzero) X+ ret X+ X+22: fstp %st(0) X+23: addl $8, %esp // Don't use 2 x pop X+24: fldl MO(zero) X+ ret X+ X+END(__ieee754_powl) X+ X+weak_alias(__ieee754_powl,powl) Xdiff -Nru qemu-0.7.0/bsd.orig/i386/e_remainderl.S qemu-0.7.0/bsd/i386/e_remainderl.S X--- qemu-0.7.0/bsd.orig/i386/e_remainderl.S Wed Dec 31 19:00:00 1969 X+++ qemu-0.7.0/bsd/i386/e_remainderl.S Fri Apr 29 02:11:27 2005 X@@ -0,0 +1,24 @@ X+/* X+ * Written by J.T. Conklin . X+ * Public domain. X+ * X+ * Adapted for `long double' by Ulrich Drepper . X+ */ X+ X+#include X+#include X+ X+RCSID("$NetBSD: $") X+ X+ENTRY(__ieee754_remainderl) X+ fldt 16(%esp) X+ fldt 4(%esp) X+1: fprem1 X+ fstsw %ax X+ sahf X+ jp 1b X+ fstp %st(1) X+ ret X+END (__ieee754_remainderl) X+ X+weak_alias(__ieee754_remainderl,remainderl) Xdiff -Nru qemu-0.7.0/bsd.orig/i386/e_sqrtl.c qemu-0.7.0/bsd/i386/e_sqrtl.c X--- qemu-0.7.0/bsd.orig/i386/e_sqrtl.c Wed Dec 31 19:00:00 1969 X+++ qemu-0.7.0/bsd/i386/e_sqrtl.c Fri Apr 29 02:11:27 2005 X@@ -0,0 +1,20 @@ X+/* X+ * Written by J.T. Conklin . X+ * Public domain. X+ * X+ * Adapted for `long double' by Ulrich Drepper . X+ */ X+ X+#include X+ X+long double X+__ieee754_sqrtl (long double x) X+{ X+ long double res; X+ X+ asm ("fsqrt" : "=t" (res) : "0" (x)); X+ X+ return res; X+} X+ X+weak_alias(__ieee754_sqrtl,sqrtl) Xdiff -Nru qemu-0.7.0/bsd.orig/i386/s_ceill.S qemu-0.7.0/bsd/i386/s_ceill.S X--- qemu-0.7.0/bsd.orig/i386/s_ceill.S Wed Dec 31 19:00:00 1969 X+++ qemu-0.7.0/bsd/i386/s_ceill.S Fri Apr 29 02:11:27 2005 X@@ -0,0 +1,27 @@ X+/* X+ * Based on code written by J.T. Conklin . X+ * Public domain. X+ */ X+ X+#include X+RCSID("$FreeBSD: ports/emulators/qemu/files/patch-libmath,v 1.3 2006/08/21 23:02:01 shaun Exp $") X+ X+ENTRY(ceill) X+ pushl %ebp X+ movl %esp,%ebp X+ subl $8,%esp X+ X+ fstcw -4(%ebp) /* store fpu control word */ X+ movw -4(%ebp),%dx X+ orw $0x0800,%dx /* round towards +oo */ X+ andw $0xfbff,%dx X+ movw %dx,-8(%ebp) X+ fldcw -8(%ebp) /* load modfied control word */ X+ X+ fldt 8(%ebp) /* round */ X+ frndint X+ X+ fldcw -4(%ebp) /* restore original control word */ X+ X+ leave X+ ret Xdiff -Nru qemu-0.7.0/bsd.orig/i386/s_cosl.S qemu-0.7.0/bsd/i386/s_cosl.S X--- qemu-0.7.0/bsd.orig/i386/s_cosl.S Wed Dec 31 19:00:00 1969 X+++ qemu-0.7.0/bsd/i386/s_cosl.S Fri Apr 29 02:11:27 2005 X@@ -0,0 +1,32 @@ X+/* X+ * Written by J.T. Conklin . X+ * Public domain. X+ * X+ * Adapted for `long double' by Ulrich Drepper . X+ */ X+ X+#include X+#include X+ X+RCSID("$NetBSD: $") X+ X+ENTRY(__cosl) X+ fldt 4(%esp) X+ fcos X+ fnstsw %ax X+ testl $0x400,%eax X+ jnz 1f X+ ret X+ .align ALIGNARG(4) X+1: fldpi X+ fadd %st(0) X+ fxch %st(1) X+2: fprem1 X+ fnstsw %ax X+ testl $0x400,%eax X+ jnz 2b X+ fstp %st(1) X+ fcos X+ ret X+END (__cosl) X+weak_alias (__cosl, cosl) Xdiff -Nru qemu-0.7.0/bsd.orig/i386/s_floorl.S qemu-0.7.0/bsd/i386/s_floorl.S X--- qemu-0.7.0/bsd.orig/i386/s_floorl.S Wed Dec 31 19:00:00 1969 X+++ qemu-0.7.0/bsd/i386/s_floorl.S Fri Apr 29 02:11:27 2005 X@@ -0,0 +1,27 @@ X+/* X+ * Based on code written by J.T. Conklin . X+ * Public domain. X+ */ X+ X+#include X+RCSID("$FreeBSD: ports/emulators/qemu/files/patch-libmath,v 1.3 2006/08/21 23:02:01 shaun Exp $") X+ X+ENTRY(floorl) X+ pushl %ebp X+ movl %esp,%ebp X+ subl $8,%esp X+ X+ fstcw -4(%ebp) /* store fpu control word */ X+ movw -4(%ebp),%dx X+ orw $0x0400,%dx /* round towards -oo */ X+ andw $0xf7ff,%dx X+ movw %dx,-8(%ebp) X+ fldcw -8(%ebp) /* load modfied control word */ X+ X+ fldt 8(%ebp) /* round */ X+ frndint X+ X+ fldcw -4(%ebp) /* restore original control word */ X+ X+ leave X+ ret Xdiff -Nru qemu-0.7.0/bsd.orig/i386/s_isnormal.c qemu-0.7.0/bsd/i386/s_isnormal.c X--- qemu-0.7.0/bsd.orig/i386/s_isnormal.c Wed Dec 31 19:00:00 1969 X+++ qemu-0.7.0/bsd/i386/s_isnormal.c Fri Apr 29 02:11:27 2005 X@@ -0,0 +1,85 @@ X+/*- X+ * Copyright (c) 2003 Mike Barcroft X+ * Copyright (c) 2002-2004 David Schultz X+ * All rights reserved. X+ * X+ * Redistribution and use in source and binary forms, with or without X+ * modification, are permitted provided that the following conditions X+ * are met: X+ * 1. Redistributions of source code must retain the above copyright X+ * notice, this list of conditions and the following disclaimer. X+ * 2. Redistributions in binary form must reproduce the above copyright X+ * notice, this list of conditions and the following disclaimer in the X+ * documentation and/or other materials provided with the distribution. X+ * X+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND X+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE X+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE X+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE X+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL X+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS X+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) X+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT X+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY X+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF X+ * SUCH DAMAGE. X+ * X+ * $FreeBSD: ports/emulators/qemu/files/patch-libmath,v 1.3 2006/08/21 23:02:01 shaun Exp $ X+ */ X+ X+union IEEEf2bits { X+ float f; X+ struct { X+ unsigned int man :23; X+ unsigned int exp :8; X+ unsigned int sign :1; X+ } bits; X+}; X+ X+union IEEEd2bits { X+ double d; X+ struct { X+ unsigned int manl :32; X+ unsigned int manh :20; X+ unsigned int exp :11; X+ unsigned int sign :1; X+ } bits; X+}; X+ X+union IEEEl2bits { X+ long double e; X+ struct { X+ unsigned int manl :32; X+ unsigned int manh :32; X+ unsigned int exp :15; X+ unsigned int sign :1; X+ unsigned int junk :16; X+ } bits; X+}; X+ X+int X+__isnormal(double d) X+{ X+ union IEEEd2bits u; X+ X+ u.d = d; X+ return (u.bits.exp != 0 && u.bits.exp != 2047); X+} X+ X+int X+__isnormalf(float f) X+{ X+ union IEEEf2bits u; X+ X+ u.f = f; X+ return (u.bits.exp != 0 && u.bits.exp != 255); X+} X+ X+int X+__isnormall(long double e) X+{ X+ union IEEEl2bits u; X+ X+ u.e = e; X+ return (u.bits.exp != 0 && u.bits.exp != 32767); X+} Xdiff -Nru qemu-0.7.0/bsd.orig/i386/s_llrint.S qemu-0.7.0/bsd/i386/s_llrint.S X--- qemu-0.7.0/bsd.orig/i386/s_llrint.S Wed Dec 31 19:00:00 1969 X+++ qemu-0.7.0/bsd/i386/s_llrint.S Fri Apr 29 02:11:27 2005 X@@ -0,0 +1,36 @@ X+/*- X+ * Copyright (c) 2005 David Schultz X+ * All rights reserved. X+ * X+ * Redistribution and use in source and binary forms, with or without X+ * modification, are permitted provided that the following conditions X+ * are met: X+ * 1. Redistributions of source code must retain the above copyright X+ * notice, this list of conditions and the following disclaimer. X+ * 2. Redistributions in binary form must reproduce the above copyright X+ * notice, this list of conditions and the following disclaimer in the X+ * documentation and/or other materials provided with the distribution. X+ * X+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND X+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE X+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE X+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE X+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL X+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS X+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) X+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT X+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY X+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF X+ * SUCH DAMAGE. X+ */ X+ X+#include X+RCSID("$FreeBSD: ports/emulators/qemu/files/patch-libmath,v 1.3 2006/08/21 23:02:01 shaun Exp $"); X+ X+ENTRY(llrint) X+ fldl 4(%esp) X+ subl $8,%esp X+ fistpll (%esp) X+ popl %eax X+ popl %edx X+ ret Xdiff -Nru qemu-0.7.0/bsd.orig/i386/s_llrintf.S qemu-0.7.0/bsd/i386/s_llrintf.S X--- qemu-0.7.0/bsd.orig/i386/s_llrintf.S Wed Dec 31 19:00:00 1969 X+++ qemu-0.7.0/bsd/i386/s_llrintf.S Fri Apr 29 02:11:27 2005 X@@ -0,0 +1,36 @@ X+/*- X+ * Copyright (c) 2005 David Schultz X+ * All rights reserved. X+ * X+ * Redistribution and use in source and binary forms, with or without X+ * modification, are permitted provided that the following conditions X+ * are met: X+ * 1. Redistributions of source code must retain the above copyright X+ * notice, this list of conditions and the following disclaimer. X+ * 2. Redistributions in binary form must reproduce the above copyright X+ * notice, this list of conditions and the following disclaimer in the X+ * documentation and/or other materials provided with the distribution. X+ * X+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND X+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE X+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE X+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE X+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL X+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS X+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) X+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT X+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY X+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF X+ * SUCH DAMAGE. X+ */ X+ X+#include X+RCSID("$FreeBSD: ports/emulators/qemu/files/patch-libmath,v 1.3 2006/08/21 23:02:01 shaun Exp $") X+ X+ENTRY(llrintf) X+ flds 4(%esp) X+ subl $8,%esp X+ fistpll (%esp) X+ popl %eax X+ popl %edx X+ ret Xdiff -Nru qemu-0.7.0/bsd.orig/i386/s_llrintl.S qemu-0.7.0/bsd/i386/s_llrintl.S X--- qemu-0.7.0/bsd.orig/i386/s_llrintl.S Wed Dec 31 19:00:00 1969 X+++ qemu-0.7.0/bsd/i386/s_llrintl.S Fri Apr 29 02:11:27 2005 X@@ -0,0 +1,35 @@ X+/* Round argument to nearest integral value according to current rounding X+ direction. X+ Copyright (C) 1997 Free Software Foundation, Inc. X+ This file is part of the GNU C Library. X+ Contributed by Ulrich Drepper , 1997. X+ X+ The GNU C Library is free software; you can redistribute it and/or X+ modify it under the terms of the GNU Lesser General Public X+ License as published by the Free Software Foundation; either X+ version 2.1 of the License, or (at your option) any later version. X+ X+ The GNU C Library is distributed in the hope that it will be useful, X+ but WITHOUT ANY WARRANTY; without even the implied warranty of X+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU X+ Lesser General Public License for more details. X+ X+ You should have received a copy of the GNU Lesser General Public X+ License along with the GNU C Library; if not, write to the Free X+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA X+ 02111-1307 USA. */ X+ X+#include X+#include X+ X+ .text X+ENTRY(__llrintl) X+ fldt 4(%esp) X+ subl $8, %esp X+ fistpll (%esp) X+ fwait X+ popl %eax X+ popl %edx X+ ret X+END(__llrintl) X+weak_alias (__llrintl, llrintl) Xdiff -Nru qemu-0.7.0/bsd.orig/i386/s_lrint.S qemu-0.7.0/bsd/i386/s_lrint.S X--- qemu-0.7.0/bsd.orig/i386/s_lrint.S Wed Dec 31 19:00:00 1969 X+++ qemu-0.7.0/bsd/i386/s_lrint.S Fri Apr 29 02:11:27 2005 X@@ -0,0 +1,35 @@ X+/*- X+ * Copyright (c) 2005 David Schultz X+ * All rights reserved. X+ * X+ * Redistribution and use in source and binary forms, with or without X+ * modification, are permitted provided that the following conditions X+ * are met: X+ * 1. Redistributions of source code must retain the above copyright X+ * notice, this list of conditions and the following disclaimer. X+ * 2. Redistributions in binary form must reproduce the above copyright X+ * notice, this list of conditions and the following disclaimer in the X+ * documentation and/or other materials provided with the distribution. X+ * X+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND X+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE X+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE X+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE X+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL X+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS X+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) X+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT X+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY X+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF X+ * SUCH DAMAGE. X+ */ X+ X+#include X+RCSID("$FreeBSD: ports/emulators/qemu/files/patch-libmath,v 1.3 2006/08/21 23:02:01 shaun Exp $"); X+ X+ENTRY(lrint) X+ fldl 4(%esp) X+ subl $4,%esp X+ fistpl (%esp) X+ popl %eax X+ ret Xdiff -Nru qemu-0.7.0/bsd.orig/i386/s_lrintf.S qemu-0.7.0/bsd/i386/s_lrintf.S X--- qemu-0.7.0/bsd.orig/i386/s_lrintf.S Wed Dec 31 19:00:00 1969 X+++ qemu-0.7.0/bsd/i386/s_lrintf.S Fri Apr 29 02:11:27 2005 X@@ -0,0 +1,35 @@ X+/*- X+ * Copyright (c) 2005 David Schultz X+ * All rights reserved. X+ * X+ * Redistribution and use in source and binary forms, with or without X+ * modification, are permitted provided that the following conditions X+ * are met: X+ * 1. Redistributions of source code must retain the above copyright X+ * notice, this list of conditions and the following disclaimer. X+ * 2. Redistributions in binary form must reproduce the above copyright X+ * notice, this list of conditions and the following disclaimer in the X+ * documentation and/or other materials provided with the distribution. X+ * X+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND X+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE X+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE X+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE X+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL X+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS X+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) X+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT X+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY X+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF X+ * SUCH DAMAGE. X+ */ X+ X+#include X+RCSID("$FreeBSD: ports/emulators/qemu/files/patch-libmath,v 1.3 2006/08/21 23:02:01 shaun Exp $") X+ X+ENTRY(lrintf) X+ flds 4(%esp) X+ subl $4,%esp X+ fistpl (%esp) X+ popl %eax X+ ret Xdiff -Nru qemu-0.7.0/bsd.orig/i386/s_lrintl.S qemu-0.7.0/bsd/i386/s_lrintl.S X--- qemu-0.7.0/bsd.orig/i386/s_lrintl.S Wed Dec 31 19:00:00 1969 X+++ qemu-0.7.0/bsd/i386/s_lrintl.S Fri Apr 29 02:11:27 2005 X@@ -0,0 +1,34 @@ X+/* Round argument to nearest integral value according to current rounding X+ direction. X+ Copyright (C) 1997 Free Software Foundation, Inc. X+ This file is part of the GNU C Library. X+ Contributed by Ulrich Drepper , 1997. X+ X+ The GNU C Library is free software; you can redistribute it and/or X+ modify it under the terms of the GNU Lesser General Public X+ License as published by the Free Software Foundation; either X+ version 2.1 of the License, or (at your option) any later version. X+ X+ The GNU C Library is distributed in the hope that it will be useful, X+ but WITHOUT ANY WARRANTY; without even the implied warranty of X+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU X+ Lesser General Public License for more details. X+ X+ You should have received a copy of the GNU Lesser General Public X+ License along with the GNU C Library; if not, write to the Free X+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA X+ 02111-1307 USA. */ X+ X+#include X+#include X+ X+ .text X+ENTRY(__lrintl) X+ fldt 4(%esp) X+ subl $4, %esp X+ fistpl (%esp) X+ fwait X+ popl %eax X+ ret X+END(__lrintl) X+weak_alias (__lrintl, lrintl) Xdiff -Nru qemu-0.7.0/bsd.orig/i386/s_rintl.c qemu-0.7.0/bsd/i386/s_rintl.c X--- qemu-0.7.0/bsd.orig/i386/s_rintl.c Wed Dec 31 19:00:00 1969 X+++ qemu-0.7.0/bsd/i386/s_rintl.c Fri Apr 29 02:11:27 2005 X@@ -0,0 +1,18 @@ X+/* X+ * Written by J.T. Conklin . X+ * Changes for long double by Ulrich Drepper X+ * Public domain. X+ */ X+ X+#include X+ X+long double X+__rintl (long double x) X+{ X+ long double res; X+ X+ asm ("frndint" : "=t" (res) : "0" (x)); X+ return res; X+} X+ X+weak_alias (__rintl, rintl) Xdiff -Nru qemu-0.7.0/bsd.orig/i386/s_round.c qemu-0.7.0/bsd/i386/s_round.c X--- qemu-0.7.0/bsd.orig/i386/s_round.c Wed Dec 31 19:00:00 1969 X+++ qemu-0.7.0/bsd/i386/s_round.c Fri Apr 29 02:11:27 2005 X@@ -0,0 +1,51 @@ X+/*- X+ * Copyright (c) 2003, Steven G. Kargl X+ * All rights reserved. X+ * X+ * Redistribution and use in source and binary forms, with or without X+ * modification, are permitted provided that the following conditions X+ * are met: X+ * 1. Redistributions of source code must retain the above copyright X+ * notice unmodified, this list of conditions, and the following X+ * disclaimer. X+ * 2. Redistributions in binary form must reproduce the above copyright X+ * notice, this list of conditions and the following disclaimer in the X+ * documentation and/or other materials provided with the distribution. X+ * X+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR X+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES X+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. X+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, X+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT X+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, X+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY X+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT X+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF X+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. X+ */ X+ X+#include X+__FBSDID("$FreeBSD: ports/emulators/qemu/files/patch-libmath,v 1.3 2006/08/21 23:02:01 shaun Exp $"); X+ X+#include X+ X+double X+round(double x) X+{ X+ double t; X+ X+ if (!isfinite(x)) X+ return (x); X+ X+ if (x >= 0.0) { X+ t = floor(x); X+ if (t - x <= -0.5) X+ t += 1.0; X+ return (t); X+ } else { X+ t = floor(-x); X+ if (t + x <= -0.5) X+ t += 1.0; X+ return (-t); X+ } X+} Xdiff -Nru qemu-0.7.0/bsd.orig/i386/s_sinl.S qemu-0.7.0/bsd/i386/s_sinl.S X--- qemu-0.7.0/bsd.orig/i386/s_sinl.S Wed Dec 31 19:00:00 1969 X+++ qemu-0.7.0/bsd/i386/s_sinl.S Fri Apr 29 02:11:27 2005 X@@ -0,0 +1,32 @@ X+/* X+ * Written by J.T. Conklin . X+ * Public domain. X+ * X+ * Adapted for `long double' by Ulrich Drepper . X+ */ X+ X+#include X+#include X+ X+RCSID("$NetBSD: $") X+ X+ENTRY(__sinl) X+ fldt 4(%esp) X+ fsin X+ fnstsw %ax X+ testl $0x400,%eax X+ jnz 1f X+ ret X+ .align ALIGNARG(4) X+1: fldpi X+ fadd %st(0) X+ fxch %st(1) X+2: fprem1 X+ fnstsw %ax X+ testl $0x400,%eax X+ jnz 2b X+ fstp %st(1) X+ fsin X+ ret X+END (__sinl) X+weak_alias (__sinl, sinl) Xdiff -Nru qemu-0.7.0/bsd.orig/i386/s_tanl.S qemu-0.7.0/bsd/i386/s_tanl.S X--- qemu-0.7.0/bsd.orig/i386/s_tanl.S Wed Dec 31 19:00:00 1969 X+++ qemu-0.7.0/bsd/i386/s_tanl.S Fri Apr 29 02:11:27 2005 X@@ -0,0 +1,33 @@ X+/* X+ * Written by J.T. Conklin . X+ * Public domain. X+ * X+ * Adapted for `long double' by Ulrich Drepper . X+ */ X+ X+#include X+#include X+ X+RCSID("$NetBSD: $") X+ X+ENTRY(__tanl) X+ fldt 4(%esp) X+ fptan X+ fnstsw %ax X+ testl $0x400,%eax X+ jnz 1f X+ fstp %st(0) X+ ret X+1: fldpi X+ fadd %st(0) X+ fxch %st(1) X+2: fprem1 X+ fstsw %ax X+ testl $0x400,%eax X+ jnz 2b X+ fstp %st(1) X+ fptan X+ fstp %st(0) X+ ret X+END (__tanl) X+weak_alias (__tanl, tanl) Xdiff -Nru qemu-0.7.0/bsd.orig/sysdep.h qemu-0.7.0/bsd/sysdep.h X--- qemu-0.7.0/bsd.orig/sysdep.h Wed Dec 31 19:00:00 1969 X+++ qemu-0.7.0/bsd/sysdep.h Fri Apr 29 02:11:27 2005 X@@ -0,0 +1,20 @@ X+#ifndef _QEMU_BSD_SYSDEP_H_ X+#define _QEMU_BSD_SYSDEP_H_ X+ X+#include X+ X+#define HAVE_ELF X+ X+#ifdef __ASSEMBLER__ X+#define ALIGNARG(log2) 1<files/patch-libmath2 << 'ee713b2eeba4c1fbfcbfcfac4cbfa106' XIndex: qemu/bsd/Makefile X@@ -16,7 +16,8 @@ X ${MACHINE_ARCH}/s_rintl.c \ X ${MACHINE_ARCH}/s_round.c \ X ${MACHINE_ARCH}/s_sinl.S \ X- ${MACHINE_ARCH}/s_tanl.S X+ ${MACHINE_ARCH}/s_tanl.S \ X+ ${MACHINE_ARCH}/s_ldexpl.c X X OBJS= ${SRCS:R:S/$/.o/} X XIndex: qemu/bsd/i386/s_ldexpl.c X@@ -0,0 +1,21 @@ X+#include X+#include X+#include X+ X+long double __ldexpl(long double x, int expn) X+{ X+ long double res; X+ if (!isfinite (x) || x == 0.0L) X+ return x; X+ X+ __asm__ ("fscale" X+ : "=t" (res) X+ : "0" (x), "u" ((long double) expn)); X+ X+ if (!isfinite (res) || res == 0.0L) X+ errno = ERANGE; X+ X+ return res; X+} X+ X+weak_alias(__ldexpl,ldexpl) XIndex: qemu/bsd/amd64/s_ldexpl.c X@@ -0,0 +1,21 @@ X+#include X+#include X+#include X+ X+long double __ldexpl(long double x, int expn) X+{ X+ long double res; X+ if (!isfinite (x) || x == 0.0L) X+ return x; X+ X+ __asm__ ("fscale" X+ : "=t" (res) X+ : "0" (x), "u" ((long double) expn)); X+ X+ if (!isfinite (res) || res == 0.0L) X+ errno = ERANGE; X+ X+ return res; X+} X+ X+weak_alias(__ldexpl,ldexpl) ee713b2eeba4c1fbfcbfcfac4cbfa106 echo x - files/patch-libmath_FreeBSD-version sed 's/^X//' >files/patch-libmath_FreeBSD-version << '08b6474b666e19635782092417c7706c' Xdiff -ru qemu.orig/bsd/Makefile qemu/bsd/Makefile X--- qemu.orig/bsd/Makefile 2009-01-19 23:30:09.124413041 -0600 X+++ qemu/bsd/Makefile 2009-01-19 23:40:20.180704580 -0600 X@@ -1,23 +1,90 @@ X-SRCS= ${MACHINE_ARCH}/e_atan2l.c \ X- ${MACHINE_ARCH}/e_logl.S \ X- ${MACHINE_ARCH}/e_powl.S \ X- ${MACHINE_ARCH}/e_remainderl.S \ X- ${MACHINE_ARCH}/e_sqrtl.c \ X- ${MACHINE_ARCH}/s_ceill.S \ X- ${MACHINE_ARCH}/s_cosl.S \ X- ${MACHINE_ARCH}/s_floorl.S \ X- ${MACHINE_ARCH}/s_isnormal.c \ X- ${MACHINE_ARCH}/s_llrint.S \ X- ${MACHINE_ARCH}/s_llrintf.S \ X- ${MACHINE_ARCH}/s_llrintl.S \ X- ${MACHINE_ARCH}/s_lrint.S \ X- ${MACHINE_ARCH}/s_lrintf.S \ X- ${MACHINE_ARCH}/s_lrintl.S \ X- ${MACHINE_ARCH}/s_rintl.c \ X- ${MACHINE_ARCH}/s_round.c \ X- ${MACHINE_ARCH}/s_sinl.S \ X- ${MACHINE_ARCH}/s_tanl.S \ X- ${MACHINE_ARCH}/s_ldexpl.c X+AWK= /usr/bin/awk X+SYSCTL= /sbin/sysctl X+ X+.if !defined(OSVERSION) X+.if exists(/usr/include/sys/param.h) X+OSVERSION!= ${AWK} '/^\#define[[:blank:]]__FreeBSD_version/ {print $$3}' < /usr/include/sys/param.h X+.elif exists(/usr/src/sys/sys/param.h) X+OSVERSION!= ${AWK} '/^\#define[[:blank::]]__FreeBSD_version/ {print $$3}' < /usr/src/sys/sys/param.h X+.else X+OSVERSION!= ${SYSCTL} -n kern.osreldate X+.endif X+.endif X+ X+# Need to be implemented X+_logl= ${MACHINE_ARCH}/e_logl.S X+_powl= ${MACHINE_ARCH}/e_powl.S X+ X+# Implemented in -CURRENT X+.if ${OSVERSION} < 800042 X+_atan2l= ${MACHINE_ARCH}/e_atan2l.c X+.endif X+ X+.if ${OSVERSION} < 800030 X+_remainderl= ${MACHINE_ARCH}/e_remainderl.S X+.endif X+ X+.if ${OSVERSION} < 800025 X+_sqrtl= ${MACHINE_ARCH}/e_sqrtl.c X+.endif X+ X+.if ${OSVERSION} < 800022 X+_cosl= ${MACHINE_ARCH}/s_cosl.S X+_sinl= ${MACHINE_ARCH}/s_sinl.S X+_tanl= ${MACHINE_ARCH}/s_tanl.S X+.endif X+ X+.if ${OSVERSION} < 800012 X+_lrintl= ${MACHINE_ARCH}/s_lrintl.S X+_llrintl= ${MACHINE_ARCH}/s_llrintl.S X+_rintl= ${MACHINE_ARCH}/s_rintl.c X+.endif X+ X+.if ${OSVERSION} < 600020 X+_ldexpl= ${MACHINE_ARCH}/s_ldexpl.c X+.endif X+ X+.if ${OSVERSION} < 600008 X+_ceill= ${MACHINE_ARCH}/s_ceill.S X+_floorl= ${MACHINE_ARCH}/s_floorl.S X+_llrint= ${MACHINE_ARCH}/s_llrint.S X+_llrintf= ${MACHINE_ARCH}/s_llrintf.S X+_lrint= ${MACHINE_ARCH}/s_lrint.S X+_lrintf= ${MACHINE_ARCH}/s_lrintf.S X+.endif X+ X+.if ${OSVERSION} < 502121 X+_isnormal= ${MACHINE_ARCH}/s_isnormal.c X+.endif X+ X+.if ${OSVERSION} < 502114 X+_round= ${MACHINE_ARCH}/s_round.c X+.endif X+ X+#.if ${OSVERSION} < 501113 X+#_fabsl= ${MACHINE_ARCH}/e_fabsl.c X+#.endif X+ X+SRCS= ${_atan2l} \ X+ ${_logl} \ X+ ${_powl} \ X+ ${_remainderl} \ X+ ${_sqrtl} \ X+ ${_ceill} \ X+ ${_cosl} \ X+ ${_floorl} \ X+ ${_isnormal} \ X+ ${_llrint} \ X+ ${_llrintf} \ X+ ${_llrintl} \ X+ ${_lrint} \ X+ ${_lrintf} \ X+ ${_lrintl} \ X+ ${_rintl} \ X+ ${_round} \ X+ ${_sinl} \ X+ ${_tanl} \ X+ ${_ldexpl} X X OBJS= ${SRCS:R:S/$/.o/} X Xdiff -ru qemu.orig/fpu/softfloat-native.h qemu/fpu/softfloat-native.h X--- qemu.orig/fpu/softfloat-native.h 2009-01-19 23:30:08.833416100 -0600 X+++ qemu/fpu/softfloat-native.h 2009-01-19 23:28:08.682949000 -0600 X@@ -1,15 +1,26 @@ X+#ifndef SOFTFLOAT_NATIVE_H X+#define SOFTFLOAT_NATIVE_H X+ X /* Native implementation of soft float functions */ X #include X X #ifdef __FreeBSD__ X #include X+#if __FreeBSD_version < 501113 X long double fabsl(long double x); X+#endif X+#if __FreeBSD_version < 800030 X long double remainderl(long double x, long double y); X+#endif X+#if __FreeBSD_version < 800025 X long double sqrtl(long double x); X+#endif X+#if __FreeBSD_version < 800012 X long double rintl(long double x); X long lrintl(long double x); X long long llrintl(long double x); X #endif X+#endif X X #if (defined(_BSD) && !defined(__APPLE__) && \ X (!defined(__FreeBSD__) || __FreeBSD_version < 500000)) || \ X@@ -516,3 +527,5 @@ X } X X #endif X+ X+#endif /* SOFTFLOAT_NATIVE_H */ 08b6474b666e19635782092417c7706c echo x - files/patch-osdep.c sed 's/^X//' >files/patch-osdep.c << 'a742a6ed47436048d6601d910285d23f' XIndex: qemu/osdep.c X@@ -179,7 +179,9 @@ X } X unlink(phys_ram_file); X } X+#endif /* !(__OpenBSD__ || __FreeBSD__ || __DragonFly__) */ X size = (size + 4095) & ~4095; X+#if !defined(__OpenBSD__) && !defined(__FreeBSD__) && !defined(__DragonFly__) X ftruncate(phys_ram_fd, phys_ram_size + size); X #endif /* !(__OpenBSD__ || __FreeBSD__ || __DragonFly__) */ X ptr = mmap(NULL, a742a6ed47436048d6601d910285d23f echo x - files/patch-pc-bios-optionrom-multiboot.S sed 's/^X//' >files/patch-pc-bios-optionrom-multiboot.S << '9bb5ec3a1f8384a484bbc9ae26ca951a' X--- a/pc-bios/optionrom/multiboot.S X+++ b/pc-bios/optionrom/multiboot.S X@@ -113,7 +113,10 @@ mmap_loop: X /* entry size (mmap struct) & max buffer size (int15) */ X movl $20, %ecx X /* store entry size */ X+ /* old as(1) doesn't like this insn so emit the bytes instead: X movl %ecx, %es:-4(%edi) X+ */ X+ .dc.b 0x26,0x67,0x66,0x89,0x4f,0xfc X /* e820 */ X movl $0x0000e820, %eax X /* 'SMAP' magic */ X-- X1.6.5.2 X 9bb5ec3a1f8384a484bbc9ae26ca951a echo x - files/patch-qemu-doc.texi sed 's/^X//' >files/patch-qemu-doc.texi << 'e08814d04bc99d58bde202d25539d509' XIndex: qemu/qemu-doc.texi X@@ -985,7 +985,8 @@ X X @c man begin SEEALSO X The HTML documentation of QEMU for more precise information and Linux X-user mode emulator invocation. X+user mode emulator invocation, as well as the FreeBSD host notes in X+@file{pkg-message} in the relevant qemu port directory. X @c man end X X @c man begin AUTHOR e08814d04bc99d58bde202d25539d509 echo x - files/patch-tapclose sed 's/^X//' >files/patch-tapclose << 'caecfd3e92868a1c1ba2d28cb0885865' XIndex: qemu/net.c X@@ -1643,12 +1643,13 @@ static void tap_cleanup(VLANClientState X X qemu_purge_queued_packets(vc); X X- if (s->down_script[0]) X- launch_script(s->down_script, s->down_script_arg, s->fd); X- X tap_read_poll(s, 0); X tap_write_poll(s, 0); X close(s->fd); X+ X+ if (s->down_script[0]) X+ launch_script(s->down_script, s->down_script_arg, -1); X+ X qemu_free(s); X } X caecfd3e92868a1c1ba2d28cb0885865 echo x - files/patch-vl.c sed 's/^X//' >files/patch-vl.c << 'f69c3f76d51c4024d0b81177709e3839' XIndex: qemu/vl.c X@@ -57,6 +57,7 @@ X #include X #if defined(__FreeBSD__) || defined(__DragonFly__) X #include X+#include X #else X #include X #endif X@@ -4782,6 +4783,10 @@ X X #endif X X+#if !defined(CONFIG_USER_ONLY) X+void io_mem_init(void); X+#endif X+ X int main(int argc, char **argv, char **envp) X { X #ifdef CONFIG_GDBSTUB X@@ -5621,6 +5626,10 @@ X #ifdef CONFIG_KQEMU X if (smp_cpus > 1) X kqemu_allowed = 0; X+ if (kqemu_allowed && ram_size > (1536 << 20)) { X+ fprintf(stderr, "qemu: at most 1536 MB RAM can be simulated with kqemu\n"); X+ exit(1); X+ } X #endif X if (qemu_init_main_loop()) { X fprintf(stderr, "qemu_init_main_loop failed\n"); X@@ -5715,6 +5724,9 @@ X if (ram_size == 0) X ram_size = DEFAULT_RAM_SIZE * 1024 * 1024; X X+ /* init the dynamic translator */ X+ cpu_exec_init_all(tb_size * 1024 * 1024); X+ X #ifdef CONFIG_KQEMU X /* FIXME: This is a nasty hack because kqemu can't cope with dynamic X guest ram allocation. It needs to go away. */ X@@ -5727,9 +5739,9 @@ X } X } X #endif X- X- /* init the dynamic translator */ X- cpu_exec_init_all(tb_size * 1024 * 1024); X+#if !defined(CONFIG_USER_ONLY) X+ io_mem_init(); X+#endif X X bdrv_init(); X dma_helper_init(); XIndex: qemu/exec.c X@@ -179,7 +179,7 @@ X static PhysPageDesc **l1_phys_map; X X #if !defined(CONFIG_USER_ONLY) X-static void io_mem_init(void); X+void io_mem_init(void); X X /* io memory support */ X CPUWriteMemoryFunc *io_mem_write[IO_MEM_NB_ENTRIES][4]; X@@ -503,7 +503,7 @@ X code_gen_alloc(tb_size); X code_gen_ptr = code_gen_buffer; X page_init(); X-#if !defined(CONFIG_USER_ONLY) X+#if 0 && !defined(CONFIG_USER_ONLY) X io_mem_init(); X #endif X } X@@ -2993,7 +2993,7 @@ X return -1; X } X X-static void io_mem_init(void) X+void io_mem_init(void) X { X int i; X f69c3f76d51c4024d0b81177709e3839 echo x - files/patch-vl.c-serial sed 's/^X//' >files/patch-vl.c-serial << '26d7f2fa45552542acf2f04ee88cee92' XIndex: qemu/qemu-char.c X@@ -1606,10 +1606,13 @@ X cfsetospeed(&tty, spd); X X tty.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP X- |INLCR|IGNCR|ICRNL|IXON); X- tty.c_oflag |= OPOST; X+ |INLCR|IGNCR|ICRNL|IXON|IMAXBEL); X+ tty.c_oflag &= ~OPOST; /* Don't do any output processing! */ X tty.c_lflag &= ~(ECHO|ECHONL|ICANON|IEXTEN|ISIG); X tty.c_cflag &= ~(CSIZE|PARENB|PARODD|CRTSCTS|CSTOPB); X+#ifdef __FreeBSD__ X+ cfmakeraw(&tty); X+#endif X switch(data_bits) { X default: X case 8: 26d7f2fa45552542acf2f04ee88cee92 echo x - files/patch-x_keymap.c sed 's/^X//' >files/patch-x_keymap.c << '5607de0eb104ec19ea4340141e2bea89' XIndex: qemu/x_keymap.c X@@ -41,9 +41,9 @@ X 0xb5, /* 112 Divide */ X 0xb8, /* 113 Alt-R */ X 0xc6, /* 114 Break */ X- 0x0, /* 115 */ X- 0x0, /* 116 */ X- 0x0, /* 117 */ X+ 0xdb, /* 115 left windows key */ X+ 0xdc, /* 116 right windows key */ X+ 0xdd, /* 117 right menu key */ X 0x0, /* 118 */ X 0x0, /* 119 */ X 0x0, /* 120 */ 5607de0eb104ec19ea4340141e2bea89 echo x - files/patch-z-bandaid-usb-current sed 's/^X//' >files/patch-z-bandaid-usb-current << '3de123c75bf96595f80e386577e05162' XIndex: qemu/usb-bsd.c X@@ -35,7 +35,12 @@ X X #include X #ifndef __DragonFly__ X+#include X+#if __FreeBSD_version >= 800064 X+#include X+#else X #include X+#endif X #else X #include X #endif 3de123c75bf96595f80e386577e05162 echo x - files/pcap-patch sed 's/^X//' >files/pcap-patch << '4237dd24acb3dbc16c0489859e73cd79' X--- Makefile.target.orig 2008-07-18 15:18:11.000000000 -0400 X+++ Makefile.target 2008-07-18 15:23:11.000000000 -0400 X@@ -619,6 +619,13 @@ X COCOA_LIBS+=-framework CoreAudio X endif X endif X+ifdef CONFIG_PCAP X+ifdef CONFIG_WIN32 X+LIBS+=-lwpcap X+else X+LIBS+=-lpcap X+endif X+endif X ifdef CONFIG_SLIRP X CPPFLAGS+=-I$(SRC_PATH)/slirp X endif XIndex: configure X@@ -203,6 +203,9 @@ X sdl_x11="no" X xen="yes" X pkgversion="" X+pcap="no" X+pcap_create="no" X+bpf="no" X X # OS specific X if check_define __linux__ ; then X@@ -428,6 +431,8 @@ X ;; X --disable-vnc-sasl) vnc_sasl="no" X ;; X+ --enable-pcap) pcap="yes" X+ ;; X --disable-slirp) slirp="no" X ;; X --disable-vde) vde="no" X@@ -925,6 +930,48 @@ X fi X X ########################################## X+# pcap probe X+ X+if test "$pcap" = "yes" ; then X+ cat > $TMPC << EOF X+#include X+int main(void) { return (pcap_lib_version() == (char *)0 ? 1 : 0); } X+EOF X+ if test "$mingw32" = "no" ; then X+ libpcap=-lpcap X+ else X+ libpcap=-lwpcap X+ fi X+ if ! $cc $ARCH_CFLAGS -o $TMPE $libpcap $TMPC 2> /dev/null ; then X+ echo X+ echo "Error: Could not find pcap" X+ echo "Make sure to have the pcap libs and headers installed." X+ echo X+ exit 1 X+ fi X+ cat > $TMPC << EOF X+#include X+int main(void) X+{ X+ char errbuf[PCAP_ERRBUF_SIZE]; X+ return (pcap_create("foo", errbuf) == (pcap_t *)0 ? 1 : 0); X+} X+EOF X+ if $cc $ARCH_CFLAGS -o $TMPE $libpcap $TMPC 2> /dev/null ; then X+ pcap_create="yes" X+ fi X+ cat > $TMPC << EOF X+#define PCAP_DONT_INCLUDE_PCAP_BPF_H X+#include X+#include X+int main(void) { return (BPF_MAJOR_VERSION); } X+EOF X+ if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then X+ bpf="yes" X+ fi X+fi # test "$pcap" X+ X+########################################## X # VNC TLS detection X if test "$vnc_tls" = "yes" ; then X cat > $TMPC <> $config_host_h X fi X+if test "$pcap" = "yes" ; then X+ echo "CONFIG_PCAP=yes" >> $config_host_mak X+ echo "#define CONFIG_PCAP 1" >> $config_host_h X+ if test "$pcap_create" = "yes" ; then X+ echo "#define HAVE_PCAP_CREATE 1" >> $config_host_h X+ fi X+ if test "$bpf" = "yes" ; then X+ echo "#define HAVE_BPF 1" >> $config_host_h X+ fi X+fi X if test "$slirp" = "yes" ; then X echo "CONFIG_SLIRP=y" >> $config_host_mak X echo "#define CONFIG_SLIRP 1" >> $config_host_h XIndex: net.c X@@ -688,6 +688,166 @@ X va_end(ap); X } X X+#if defined(CONFIG_PCAP) X+#if defined(HAVE_BPF) X+#define PCAP_DONT_INCLUDE_PCAP_BPF_H X+#include X+#endif X+#include X+ X+typedef struct PCAPState { X+ VLANClientState *vc; X+ pcap_t *handle; X+} PCAPState; X+ X+static ssize_t pcap_receive(VLANClientState *vc, const uint8_t *buf, size_t size) X+{ X+ PCAPState *s = (PCAPState *)vc->opaque; X+ X+ return pcap_inject(s->handle, (u_char*)buf, size); X+} X+ X+static void pcap_callback(u_char *user, struct pcap_pkthdr *phdr, u_char *pdata) X+{ X+ VLANClientState *vc = (VLANClientState *)user; X+ X+ qemu_send_packet(vc, pdata, phdr->len); X+} X+ X+static void pcap_send(void *opaque) X+{ X+ PCAPState *s = (PCAPState *)opaque; X+ X+ pcap_dispatch(s->handle, 1, (pcap_handler)&pcap_callback, (u_char *)s->vc); X+} X+ X+static void pcap_cleanup(VLANClientState *vc) X+{ X+ PCAPState *s = vc->opaque; X+ X+ pcap_close(s->handle); X+ qemu_free(s); X+} X+ X+static int net_pcap_init(VLANState *vlan, const char *model, const char *name, char *ifname) X+{ X+ PCAPState *s = NULL; X+ char errbuf[PCAP_ERRBUF_SIZE]; X+#if defined(_WIN32) X+ HANDLE h; X+#endif X+ int i; X+ X+ s = qemu_mallocz(sizeof(PCAPState)); X+ if (!s) X+ return -1; X+ X+ if (ifname == NULL && (ifname = pcap_lookupdev(errbuf)) == NULL) { X+ fprintf(stderr, "qemu: pcap_lookupdev: %s\n", errbuf); X+ goto fail; X+ } X+ X+#if defined(HAVE_PCAP_CREATE) || defined(_WIN32) X+ /* X+ * Create pcap handle for the device, set promiscuous mode and activate. X+ */ X+ s->handle = (void *)pcap_create(ifname, errbuf); X+ if (!s->handle) { X+ fprintf(stderr, "qemu: pcap_create: %s\n", errbuf); X+ goto fail; X+ } X+ if (pcap_set_promisc(s->handle, 1) != 0) { X+ pcap_perror(s->handle, "qemu: pcap_set_promisc:"); X+ goto fail; X+ } X+ if (pcap_activate(s->handle) != 0) { X+ pcap_perror(s->handle, "qemu: pcap_activate:"); X+ goto fail; X+ } X+#else X+ /* Attempt to connect device. */ X+ s->handle = (void *)pcap_open_live(ifname, 65535, 1, 0, errbuf); X+ if (!s->handle) { X+ fprintf(stderr, "qemu: pcap_open_live: %s\n", errbuf); X+ goto fail; X+ } X+#endif X+ X+ /* Set non-blocking mode. */ X+ if (pcap_setnonblock(s->handle, 1, errbuf) < 0) { X+ fprintf(stderr, "qemu: pcap_setnonblock: %s\n", errbuf); X+ goto fail; X+ } X+ X+#if defined(_WIN32) X+ /* X+ * Tell the kernel that the packet has to be seen immediately. X+ */ X+ if (pcap_setmintocopy(s->handle, 0) < 0) { X+ fprintf(stderr, "qemu: pcap failed to set immediate mode\n"); X+ goto fail; X+ } X+#else /* !_WIN32 */ X+#if defined(HAVE_BPF) X+#if defined(BIOCIMMEDIATE) X+ /* X+ * Tell the kernel that the packet has to be seen immediately. X+ */ X+ { X+ unsigned int one = 1; X+ if (ioctl(pcap_fileno(s->handle), BIOCIMMEDIATE, &one) < 0) { X+ fprintf(stderr, "qemu: pcap failed to set immediate mode\n"); X+ goto fail; X+ } X+ } X+#endif /* BIOCIMMEDIATE */ X+ X+#if defined(BIOCFEEDBACK) X+ /* X+ * Tell the kernel that the sent packet has to be fed back. X+ * This is necessary to connect host and guest. X+ */ X+ { X+ unsigned int one = 1; X+ if (ioctl(pcap_fileno(s->handle), BIOCFEEDBACK, &one) < 0) { X+ fprintf(stderr, "qemu: pcap failed to set feedback mode\n"); X+ goto fail; X+ } X+ } X+#endif /* BIOCFEEDBACK */ X+#endif /* HAVE_BPF */ X+#endif /* _WIN32 */ X+ X+ s->vc = qemu_new_vlan_client(vlan, model, name, NULL, pcap_receive, NULL, pcap_cleanup, s); X+ snprintf(s->vc->info_str, sizeof(s->vc->info_str), "pcap redirector"); X+ X+#if defined(_WIN32) X+ if ((h = pcap_getevent(s->handle)) == NULL) { X+ fprintf(stderr, "qemu: pcap_getevent failed\n"); X+ goto fail; X+ } X+ qemu_add_wait_object(h, pcap_send, s); X+#else /* !_WIN32 */ X+ if ((i = pcap_get_selectable_fd(s->handle)) < 0) { X+ fprintf(stderr, "qemu: pcap_get_selectable_fd failed\n"); X+ goto fail; X+ } X+ qemu_set_fd_handler(i, pcap_send, NULL, s); X+#endif /* _WIN32 */ X+ X+ return 0; X+ X+fail: X+ if (s) { X+ if (s->handle) X+ pcap_close(s->handle); X+ qemu_free(s); X+ } X+ X+ return -1; X+} X+#endif /* CONFIG_PCAP */ X+ X #if defined(CONFIG_SLIRP) X X /* slirp network adapter */ X@@ -2598,6 +2758,16 @@ X are wanted */ X ret = 0; X } else X+#ifdef CONFIG_PCAP X+ if (!strcmp(device, "pcap")) { X+ char ifname[64]; X+ vlan->nb_host_devs++; X+ if (get_param_value(ifname, sizeof(ifname), "ifname", p) <= 0) X+ ret = net_pcap_init(vlan, device, name, NULL); X+ else X+ ret = net_pcap_init(vlan, device, name, ifname); X+ } else X+#endif X #ifdef CONFIG_SLIRP X if (!strcmp(device, "user")) { X static const char * const slirp_params[] = { XIndex: qemu-options.hx X@@ -782,6 +782,10 @@ X " connect the user mode network stack to VLAN 'n', configure its\n" X " DHCP server and enabled optional services\n" X #endif X+#ifdef CONFIG_PCAP X+ "-net pcap[,vlan=n][,name=str][,ifname=name]\n" X+ " connect the host network interface using PCAP to VLAN 'n'\n" X+#endif X #ifdef _WIN32 X "-net tap[,vlan=n][,name=str],ifname=name\n" X " connect the host TAP network interface to VLAN 'n'\n" 4237dd24acb3dbc16c0489859e73cd79 echo x - files/phys-cdrom-freebsd-patch sed 's/^X//' >files/phys-cdrom-freebsd-patch << '3f293a2d49b5916368816b125303257a' 3f293a2d49b5916368816b125303257a echo x - files/qemu-ifdown.sample sed 's/^X//' >files/qemu-ifdown.sample << '7fde95a579acc4300f3bc24efd8ec281' X#!/bin/sh Xexec true 7fde95a579acc4300f3bc24efd8ec281 echo x - files/qemu-ifup.sample sed 's/^X//' >files/qemu-ifup.sample << '25b20c8855d3d69d465c30ed54613d64' X#!/bin/sh Xexec true 25b20c8855d3d69d465c30ed54613d64 echo x - files/rtl8139-re-patch sed 's/^X//' >files/rtl8139-re-patch << 'ef19f92d3d50db459283f53ecb2e7fa6' XIndex: hw/rtl8139.c X@@ -58,7 +58,7 @@ X //#define RTL8139_CALCULATE_RXCRC 1 X X /* Uncomment to enable on-board timer interrupts */ X-//#define RTL8139_ONBOARD_TIMER 1 X+#define RTL8139_ONBOARD_TIMER 1 X X #if defined(RTL8139_CALCULATE_RXCRC) X /* For crc32 */ ef19f92d3d50db459283f53ecb2e7fa6 exit