# 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-90_security # files/patch-CVE-2008-0928 # files/patch-CVE-2008-4539 # files/patch-Makefile # files/patch-aa # files/patch-ac # files/patch-audio-4 # files/patch-bc # files/patch-bd # files/patch-be # files/patch-bf # files/patch-bg # files/patch-block.c # files/patch-bsd-user-ld # files/patch-bsdusb.patch # files/patch-bt # files/patch-configure # files/patch-cpu-exec.c # files/patch-exec-all.h # files/patch-exec.c # files/patch-fbsd # files/patch-fpu-softfloat-native.c # files/patch-hw-eepro100.c # files/patch-hw-vmware_vga.c # files/patch-libmath # files/patch-libmath2 # files/patch-libmath4 # files/patch-libmath_FreeBSD-version # files/patch-osdep.c # files/patch-pc-bios-optionrom-optionrom.h # files/patch-qemu-doc.texi # files/patch-tapclose # files/patch-taperr # files/patch-target-i386-translate.c # files/patch-target-mips-cpu.h # files/patch-tcg-i386-tcg-target.c # files/patch-usb-stub.c # files/patch-vl.c # files/patch-vl.c-ppbus # files/patch-vl.c-serial # files/patch-x_keymap.c # files/patch-z-bandaid-usb-current # files/pcap-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-devel/Makefile,v 1.104 2009/09/20 20:43:08 nox Exp $ X# X XPORTNAME= qemu XPORTVERSION= 0.11.50s.20091120 XCATEGORIES= emulators XMASTER_SITES= ${MASTER_SITE_SAVANNAH}:release \ X ${MASTER_SITE_LOCAL}:snapshot \ X http://people.freebsd.org/~nox/qemu/:snapshot XMASTER_SITE_SUBDIR= qemu/:release nox/:snapshot XPKGNAMESUFFIX= -devel XDISTNAME= ${PORTNAME}-snapshot-20091120_20 XDISTFILES= ${DISTNAME}${EXTRACT_SUFX}:snapshot XDIST_SUBDIR= qemu X XMAINTAINER= nox@FreeBSD.org XCOMMENT= QEMU CPU Emulator - development snapshot X XHAS_CONFIGURE= yes XUSE_BZIP2= 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-[0-9]* XMAKE_JOBS_SAFE= yes X XOPTIONS= 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 and user 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 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.if defined(WITH_SAMBA) XRUN_DEPENDS+= ${LOCALBASE}/sbin/smbd:${PORTSDIR}/net/samba3 X.endif X X.if defined(NOPORTDOCS) XMAKE_ARGS+= NOPORTDOCS=${NOPORTDOCS} XCONFIGURE_ARGS+= --disable-docs X.else XBUILD_DEPENDS+= texi2html:${PORTSDIR}/textproc/texi2html X.endif X X.if ${ARCH} == "amd64" XMAKE_ARGS+= ARCH=x86_64 X.endif 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-snapshot-20091120_20.tar.bz2) = a0409a9d7ecc504dd4446ac4651a0ccd XSHA256 (qemu/qemu-snapshot-20091120_20.tar.bz2) = 5d8b09465eebfc885b940d70c85015aff0f2ce3f72fa424eb66a837bb336b117 XSIZE (qemu/qemu-snapshot-20091120_20.tar.bz2) = 3556637 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://bellard.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 it 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- 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- 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- (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 is no longer supported in qemu git head. (and in this snapshot.) 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 X%%ALLTARGETS%%bin/qemu-i386 X%%ALLTARGETS%%bin/qemu-sparc X%%ALLTARGETS%%bin/qemu-sparc64 X%%ALLTARGETS%%bin/qemu-x86_64 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-i82559er.bin X%%DATADIR%%/pxe-ne2k_pci.bin X%%DATADIR%%/pxe-rtl8139.bin X%%DATADIR%%/pxe-pcnet.bin X%%DATADIR%%/pxe-virtio.bin X%%DATADIR%%/linuxboot.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/internal.h 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-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-CVE-2008-0928 sed 's/^X//' >files/patch-CVE-2008-0928 << '48faf5542573a5009ba98e525d746e35' 48faf5542573a5009ba98e525d746e35 echo x - files/patch-CVE-2008-4539 sed 's/^X//' >files/patch-CVE-2008-4539 << '5e5666432d31f93a1a7fe0931a5a215e' 5e5666432d31f93a1a7fe0931a5a215e echo x - files/patch-Makefile sed 's/^X//' >files/patch-Makefile << 'c0d7d903b7c552bc0b03b62518f82f5d' XIndex: qemu/Makefile X@@ -19,7 +19,11 @@ X LIBS+=-lz $(LIBS_TOOLS) X 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@@ -213,13 +217,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 ifdef CONFIG_POSIX 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' 53dec248caab71aee2be4d96a20a518a echo x - files/patch-audio-4 sed 's/^X//' >files/patch-audio-4 << '2ecc57a830aa6da877e268a9069862f8' 2ecc57a830aa6da877e268a9069862f8 echo x - files/patch-bc sed 's/^X//' >files/patch-bc << '0bd1cf514f0096b049923504d5a166bd' 0bd1cf514f0096b049923504d5a166bd 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-be sed 's/^X//' >files/patch-be << '8e385621fadfb1b3ee5ffabc8ece7ce9' 8e385621fadfb1b3ee5ffabc8ece7ce9 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@@ -16,6 +16,8 @@ X X VPATH=$(SRC_PATH):$(SRC_PATH)/hw X X+QEMU_CFLAGS+= -DSMBD_COMMAND=\"${LOCALBASE}/sbin/smbd\" -I${LOCALBASE}/include -DPREFIX=\"${PREFIX}\" X+ X LIBS+=-lz $(LIBS_TOOLS) X X ifdef BUILD_DOCS XIndex: qemu/Makefile.target X@@ -6,6 +6,7 @@ X TARGET_PATH=$(SRC_PATH)/target-$(TARGET_BASE_ARCH) X VPATH=$(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw X QEMU_CFLAGS+= -I.. -I$(TARGET_PATH) -DNEED_CPU_H X+QEMU_CFLAGS+= -DSMBD_COMMAND=\"${LOCALBASE}/sbin/smbd\" -I${LOCALBASE}/include -DPREFIX=\"${PREFIX}\" X X ifdef CONFIG_USER_ONLY X # user emulator name 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 XIndex: qemu/net/tap.h X@@ -29,8 +29,8 @@ X #include "qemu-common.h" X #include "qemu-option.h" 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 X int net_init_tap(QemuOpts *opts, Monitor *mon, const char *name, VLANState *vlan); X 257aa9645130d124ee5f185a2dfb425c echo x - files/patch-block.c sed 's/^X//' >files/patch-block.c << '6945e9679ec6b7b328cfa9c65b86c79a' 6945e9679ec6b7b328cfa9c65b86c79a echo x - files/patch-bsd-user-ld sed 's/^X//' >files/patch-bsd-user-ld << 'c4f3b5ac0d5a16751629606127e1aeec' X--- a/x86_64.ld X+++ b/x86_64.ld 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 { X--- a/i386.ld X+++ b/i386.ld X@@ -1,57 +1,76 @@ X-/* ld script to make i386 Linux kernel X- * Written by Martin Mares ; X- */ X-OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") X+OUTPUT_FORMAT("elf32-i386-freebsd", "elf32-i386-freebsd", X+ "elf32-i386-freebsd") X OUTPUT_ARCH(i386) X ENTRY(_start) X SECTIONS X { X /* Read-only sections, merged into text segment: */ X- . = 0x60000000 + SIZEOF_HEADERS; X- .interp : { *(.interp) } X- .hash : { *(.hash) } X- .dynsym : { *(.dynsym) } X- .dynstr : { *(.dynstr) } X- .gnu.version : { *(.gnu.version) } X- .gnu.version_d : { *(.gnu.version_d) } X- .gnu.version_r : { *(.gnu.version_r) } X- .rel.text : X- { *(.rel.text) *(.rel.gnu.linkonce.t*) } X- .rela.text : X- { *(.rela.text) *(.rela.gnu.linkonce.t*) } X- .rel.data : X- { *(.rel.data) *(.rel.gnu.linkonce.d*) } X- .rela.data : X- { *(.rela.data) *(.rela.gnu.linkonce.d*) } X- .rel.rodata : X- { *(.rel.rodata) *(.rel.gnu.linkonce.r*) } X- .rela.rodata : X- { *(.rela.rodata) *(.rela.gnu.linkonce.r*) } X- .rel.got : { *(.rel.got) } X- .rela.got : { *(.rela.got) } X- .rel.ctors : { *(.rel.ctors) } X- .rela.ctors : { *(.rela.ctors) } X- .rel.dtors : { *(.rel.dtors) } X- .rela.dtors : { *(.rela.dtors) } X- .rel.init : { *(.rel.init) } X- .rela.init : { *(.rela.init) } X- .rel.fini : { *(.rel.fini) } X- .rela.fini : { *(.rela.fini) } X- .rel.bss : { *(.rel.bss) } X- .rela.bss : { *(.rela.bss) } X- .rel.plt : { *(.rel.plt) } X- .rela.plt : { *(.rela.plt) } X- .init : { *(.init) } =0x47ff041f X- .text : X+ PROVIDE (__executable_start = 0x60000000); . = 0x60000000 + SIZEOF_HEADERS; X+ .interp : { *(.interp) } X+ .hash : { *(.hash) } X+ .dynsym : { *(.dynsym) } X+ .dynstr : { *(.dynstr) } X+ .gnu.version : { *(.gnu.version) } X+ .gnu.version_d : { *(.gnu.version_d) } X+ .gnu.version_r : { *(.gnu.version_r) } X+ .rel.dyn : X+ { X+ *(.rel.init) X+ *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) X+ *(.rel.fini) X+ *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) X+ *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) X+ *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) X+ *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) X+ *(.rel.ctors) X+ *(.rel.dtors) X+ *(.rel.got) X+ *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) X+ } X+ .rela.dyn : X+ { X+ *(.rela.init) X+ *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) X+ *(.rela.fini) X+ *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) X+ *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) X+ *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) X+ *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) X+ *(.rela.ctors) X+ *(.rela.dtors) X+ *(.rela.got) X+ *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) X+ } X+ .rel.plt : { *(.rel.plt) } X+ .rela.plt : { *(.rela.plt) } X+ .init : X { X- *(.text) X+ KEEP (*(.init)) X+ } =0x90909090 X+ .plt : { *(.plt) } X+ .text : X+ { X+ *(.text .stub .text.* .gnu.linkonce.t.*) X /* .gnu.warning sections are handled specially by elf32.em. */ X *(.gnu.warning) X- *(.gnu.linkonce.t*) X- } =0x47ff041f X- _etext = .; X+ } =0x90909090 X+ .fini : X+ { X+ KEEP (*(.fini)) X+ } =0x90909090 X+ PROVIDE (__etext = .); X+ PROVIDE (_etext = .); X PROVIDE (etext = .); X- .fini : { *(.fini) } =0x47ff041f X+ .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } X+ .rodata1 : { *(.rodata1) } X+ .eh_frame_hdr : { *(.eh_frame_hdr) } 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 (0x1000) - ((0x1000 - .) & (0x1000 - 1)); . = DATA_SEGMENT_ALIGN (0x1000, 0x1000); X+ /* Ensure the __preinit_array_start label is properly aligned. We X+ could instead move the label definition inside the section, but X+ the linker would then create the section even if it turns out to X+ be empty, which isn't pretty. */ X . = ALIGN(32 / 8); X PROVIDE (__preinit_array_start = .); X .preinit_array : { *(.preinit_array) } X@@ -62,56 +81,71 @@ X PROVIDE (__fini_array_start = .); X .fini_array : { *(.fini_array) } X PROVIDE (__fini_array_end = .); X- .rodata : { *(.rodata) *(.gnu.linkonce.r*) } X- .rodata1 : { *(.rodata1) } X- .reginfo : { *(.reginfo) } 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 - 1)); X- .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) } X- .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } X- .data : X+ .data : X { X- *(.data) X- *(.gnu.linkonce.d*) X- CONSTRUCTORS X+ *(.data .data.* .gnu.linkonce.d.*) X+ SORT(CONSTRUCTORS) X } X- .data1 : { *(.data1) } X- .ctors : X+ .data1 : { *(.data1) } X+ .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) } X+ .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } X+ .eh_frame : { KEEP (*(.eh_frame)) } X+ .gcc_except_table : { *(.gcc_except_table) } X+ .dynamic : { *(.dynamic) } X+ .ctors : X { X- *(.ctors) X+ /* gcc uses crtbegin.o to find the start of X+ the constructors, so we make sure it is X+ first. Because this is a wildcard, it X+ doesn't matter if the user does not X+ actually link against crtbegin.o; the X+ linker won't look for a file to match a X+ wildcard. The wildcard also means that it X+ doesn't matter which directory crtbegin.o X+ is in. */ X+ KEEP (*crtbegin*.o(.ctors)) X+ /* We don't want to include the .ctor section from X+ from the crtend.o file until after the sorted ctors. X+ The .ctor section from the crtend file contains the X+ end of ctors marker and it must be last */ X+ KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors)) X+ KEEP (*(SORT(.ctors.*))) X+ KEEP (*(.ctors)) X } X- .dtors : X+ .dtors : X { X- *(.dtors) X+ KEEP (*crtbegin*.o(.dtors)) X+ KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors)) X+ KEEP (*(SORT(.dtors.*))) X+ KEEP (*(.dtors)) X } X- .plt : { *(.plt) } X- .got : { *(.got.plt) *(.got) } X- .dynamic : { *(.dynamic) } X- /* We want the small data sections together, so single-instruction offsets X- can access them all, and initialized data all before uninitialized, so X- we can shorten the on-disk segment size. */ X- .sdata : { *(.sdata) } X- _edata = .; X+ .jcr : { KEEP (*(.jcr)) } X+ .got : { *(.got.plt) *(.got) } X+ _edata = .; X PROVIDE (edata = .); X __bss_start = .; X- .sbss : { *(.sbss) *(.scommon) } X- .bss : X+ .bss : X { X *(.dynbss) X- *(.bss) X+ *(.bss .bss.* .gnu.linkonce.b.*) X *(COMMON) X+ /* Align here to ensure that the .bss section occupies space up to X+ _end. Align after .bss to ensure correct alignment even if the X+ .bss section disappears because there are no input sections. */ X+ . = ALIGN(32 / 8); X } X- _end = . ; X+ . = ALIGN(32 / 8); X+ _end = .; X PROVIDE (end = .); X+ . = DATA_SEGMENT_END (.); X /* Stabs debugging sections. */ X- .stab 0 : { *(.stab) } X- .stabstr 0 : { *(.stabstr) } X- .stab.excl 0 : { *(.stab.excl) } X- .stab.exclstr 0 : { *(.stab.exclstr) } X- .stab.index 0 : { *(.stab.index) } X+ .stab 0 : { *(.stab) } X+ .stabstr 0 : { *(.stabstr) } X+ .stab.excl 0 : { *(.stab.excl) } X+ .stab.exclstr 0 : { *(.stab.exclstr) } X+ .stab.index 0 : { *(.stab.index) } X .stab.indexstr 0 : { *(.stab.indexstr) } X- .comment 0 : { *(.comment) } X+ .comment 0 : { *(.comment) } X /* DWARF debug sections. X Symbols in the DWARF debugging sections are relative to the beginning X of the section so we begin them at 0. */ X@@ -125,7 +159,7 @@ X .debug_aranges 0 : { *(.debug_aranges) } X .debug_pubnames 0 : { *(.debug_pubnames) } X /* DWARF 2 */ X- .debug_info 0 : { *(.debug_info) } X+ .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } X .debug_abbrev 0 : { *(.debug_abbrev) } X .debug_line 0 : { *(.debug_line) } X .debug_frame 0 : { *(.debug_frame) } X@@ -137,5 +171,5 @@ X .debug_funcnames 0 : { *(.debug_funcnames) } X .debug_typenames 0 : { *(.debug_typenames) } X .debug_varnames 0 : { *(.debug_varnames) } X- /* These must appear regardless of . */ X+ /DISCARD/ : { *(.note.GNU-stack) } X } c4f3b5ac0d5a16751629606127e1aeec echo x - files/patch-bsdusb.patch sed 's/^X//' >files/patch-bsdusb.patch << 'd31d8a017d4c5332072b98858306cd20' d31d8a017d4c5332072b98858306cd20 echo x - files/patch-bt sed 's/^X//' >files/patch-bt << '60b3fb67a49f3ca4f238ca630c886aed' XIndex: qemu/net/tap-bsd.c X@@ -49,16 +49,55 @@ int tap_open(char *ifname, int ifname_si X char *dev; X struct stat s; X X+#ifdef __FreeBSD__ X+ /* if no ifname is given, always start the search from tap0. */ X+ int i; X+ char dname[100]; X+ X+ for (i = 0; i < 10; i++) { X+ if (*ifname) { X+ snprintf(dname, sizeof dname, "/dev/%s", ifname); X+ } else { X+ snprintf(dname, sizeof dname, "/dev/tap%d", i); X+ } X+ TFR(fd = open(dname, O_RDWR)); X+ if (fd >= 0) { X+ break; X+ } X+ else if (errno == ENXIO || errno == ENOENT) { X+ break; X+ } X+ if (*ifname) { X+ break; X+ } X+ } X+ if (fd < 0) { X+ qemu_error("warning: could not open %s (%s): no virtual network emulation\n", dname, strerror(errno)); 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 return -1; X } X+#endif X X fstat(fd, &s); X dev = devname(s.st_rdev, S_IFCHR); X pstrcpy(ifname, ifname_size, dev); X X+ if (*vnet_hdr) { X+ /* BSD doesn't have IFF_VNET_HDR */ X+ *vnet_hdr = 0; X+ X+ if (vnet_hdr_required && !*vnet_hdr) { X+ qemu_error("vnet_hdr=1 requested, but no kernel " X+ "support for IFF_VNET_HDR available"); X+ close(fd); X+ return -1; X+ } X+ } X fcntl(fd, F_SETFL, O_NONBLOCK); X return fd; X } 60b3fb67a49f3ca4f238ca630c886aed echo x - files/patch-configure sed 's/^X//' >files/patch-configure << '5cae8e2426c154e1c1a4408c02b2ed73' 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-exec.c sed 's/^X//' >files/patch-exec.c << 'de49c8f204db3e855465fcdc0426f40e' de49c8f204db3e855465fcdc0426f40e echo x - files/patch-fbsd sed 's/^X//' >files/patch-fbsd << '419e824d1c2046ae3aafdf57a2052a2a' XIndex: qemu/Makefile X@@ -49,7 +49,10 @@ X X -include config-all-devices.mak X X-build-all: $(DOCS) $(TOOLS) recurse-all X+build-all: $(DOCS) $(TOOLS) bsd/libmath.a recurse-all X+ X+bsd/libmath.a: X+ ( cd bsd ; unset MAKEFLAGS ; $(BSD_MAKE) CC=$(CC) ) X X config-host.h: config-host.h-timestamp X config-host.h-timestamp: config-host.mak X@@ -237,6 +240,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 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 net/*.o net/*.d XIndex: qemu/Makefile.target X@@ -137,7 +137,7 @@ X X obj-i386-y += ioport-user.o X X-ARLIBS=../libuser/libuser.a libqemu.a X+ARLIBS=../libuser/libuser.a libqemu.a ../bsd/libmath.a X X endif #CONFIG_BSD_USER X X@@ -293,7 +293,7 @@ X X monitor.o: qemu-monitor.h X X-ARLIBS=../libqemu_common.a libqemu.a $(HWLIB) X+ARLIBS=../libqemu_common.a libqemu.a $(HWLIB) ../bsd/libmath.a X X endif # CONFIG_SOFTMMU X XIndex: qemu/fpu/softfloat-native.c X@@ -9,7 +9,7 @@ X void set_float_rounding_mode(int val STATUS_PARAM) X { X STATUS(float_rounding_mode) = val; X-#if defined(CONFIG_BSD) && !defined(__APPLE__) || \ X+#if defined(CONFIG_BSD) && !defined(__APPLE__) && !defined(__FreeBSD__) || \ X (defined(CONFIG_SOLARIS) && CONFIG_SOLARIS_VERSION < 10) X fpsetround(val); X #elif defined(__arm__) X@@ -26,7 +26,7 @@ X } X #endif X X-#if defined(CONFIG_BSD) || \ X+#if (defined(CONFIG_BSD) && !defined(__FreeBSD__)) || \ X (defined(CONFIG_SOLARIS) && CONFIG_SOLARIS_VERSION < 10) X #define lrint(d) ((int32_t)rint(d)) X #define llrint(d) ((int64_t)rint(d)) XIndex: qemu/fpu/softfloat-native.h X@@ -2,7 +2,28 @@ X #include X X #if (defined(CONFIG_BSD) && !defined(__APPLE__)) || defined(CONFIG_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(CONFIG_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@@ -112,7 +134,9 @@ X /*---------------------------------------------------------------------------- X | Software IEC/IEEE floating-point rounding mode. X *----------------------------------------------------------------------------*/ X-#if (defined(CONFIG_BSD) && !defined(__APPLE__)) || defined(CONFIG_SOLARIS) X+#if (defined(CONFIG_BSD) && !defined(__APPLE__) && \ X+ (!defined(__FreeBSD__) || __FreeBSD_version < 500000)) || \ X+ defined(CONFIG_SOLARIS) X #if defined(__OpenBSD__) X #define FE_RM FP_RM X #define FE_RP FP_RP XIndex: qemu/fpu/softfloat.h X@@ -90,7 +90,8 @@ X #define FLOAT128 X #else X /* native float support */ X-#if (defined(__i386__) || defined(__x86_64__)) && !defined(CONFIG_BSD) X+#if (defined(__i386__) || defined(__x86_64__)) && \ X+ (!defined(CONFIG_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) 419e824d1c2046ae3aafdf57a2052a2a echo x - files/patch-fpu-softfloat-native.c sed 's/^X//' >files/patch-fpu-softfloat-native.c << '844710d8b6e6c4e7d58ae74e91b2192b' 844710d8b6e6c4e7d58ae74e91b2192b echo x - files/patch-hw-eepro100.c sed 's/^X//' >files/patch-hw-eepro100.c << '50b9658f353683696c51a512be294793' 50b9658f353683696c51a512be294793 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); X@@ -914,7 +914,7 @@ X s->width = -1; X s->height = -1; X s->svgaid = SVGA_ID; X- s->depth = 24; X+ s->depth = 32; X s->bypp = (s->depth + 7) >> 3; X s->cursor.on = 0; X s->redraw_fifo_first = 0; X 4c1373a526b2bbc50950f3acad985664 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-devel/files/patch-libmath,v 1.4 2007/03/10 17:03:05 nox 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-devel/files/patch-libmath,v 1.4 2007/03/10 17:03:05 nox 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-devel/files/patch-libmath,v 1.4 2007/03/10 17:03:05 nox 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-devel/files/patch-libmath,v 1.4 2007/03/10 17:03:05 nox 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-devel/files/patch-libmath,v 1.4 2007/03/10 17:03:05 nox 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-devel/files/patch-libmath,v 1.4 2007/03/10 17:03:05 nox 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-devel/files/patch-libmath,v 1.4 2007/03/10 17:03:05 nox 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-devel/files/patch-libmath,v 1.4 2007/03/10 17:03:05 nox 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-devel/files/patch-libmath,v 1.4 2007/03/10 17:03:05 nox 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-devel/files/patch-libmath,v 1.4 2007/03/10 17:03:05 nox 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-devel/files/patch-libmath,v 1.4 2007/03/10 17:03:05 nox 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-devel/files/patch-libmath,v 1.4 2007/03/10 17:03:05 nox 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-devel/files/patch-libmath,v 1.4 2007/03/10 17:03:05 nox 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-devel/files/patch-libmath,v 1.4 2007/03/10 17:03:05 nox 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-devel/files/patch-libmath,v 1.4 2007/03/10 17:03:05 nox 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-devel/files/patch-libmath,v 1.4 2007/03/10 17:03:05 nox 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-libmath4 sed 's/^X//' >files/patch-libmath4 << '5d3be045930ab9049590b0759240cc4f' 5d3be045930ab9049590b0759240cc4f 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 XIndex: qemu/fpu/softfloat-native.h X@@ -1,16 +1,28 @@ X+#ifndef SOFTFLOAT_NATIVE_H X+#define SOFTFLOAT_NATIVE_H X+ X /* Native implementation of soft float functions */ X #include X X #if (defined(CONFIG_BSD) && !defined(__APPLE__)) || defined(CONFIG_SOLARIS) 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+#endif X X #if (defined(CONFIG_BSD) && !defined(__APPLE__) && \ X (!defined(__FreeBSD__) || __FreeBSD_version < 500000)) || \ X@@ -518,3 +529,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' a742a6ed47436048d6601d910285d23f echo x - files/patch-pc-bios-optionrom-optionrom.h sed 's/^X//' >files/patch-pc-bios-optionrom-optionrom.h << '17dd5760a7b64caa5440903137a92984' X--- a/pc-bios/optionrom/optionrom.h X+++ b/pc-bios/optionrom/optionrom.h X@@ -66,7 +66,10 @@ X outw %ax, (%dx); \ X mov $BIOS_CFG_IOPORT_DATA, %dx; \ X cld; \ X- rep insb (%dx), %es:(%edi); X+ /* old as(1) doesn't like this insn so emit the bytes instead: \ X+ rep insb (%dx), %es:(%edi); \ X+ */ \ X+ .dc.b 0x67,0xf3,0x6c X X #define OPTION_ROM_START \ X .code16; \ 17dd5760a7b64caa5440903137a92984 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/tap.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-taperr sed 's/^X//' >files/patch-taperr << 'e125fec7d6bf1531f200ea3545256f0e' X--- a/net/tap.c X+++ b/net/tap.c X@@ -400,6 +400,9 @@ int net_init_tap(QemuOpts *opts, Monitor X } X X fd = net_tap_init(opts, &vnet_hdr); X+ if (fd == -1) { X+ return -1; X+ } X } X X s = net_tap_fd_init(vlan, "tap", name, fd, vnet_hdr); e125fec7d6bf1531f200ea3545256f0e echo x - files/patch-target-i386-translate.c sed 's/^X//' >files/patch-target-i386-translate.c << 'c9ab8a0dc1158d935c8825048533ae84' c9ab8a0dc1158d935c8825048533ae84 echo x - files/patch-target-mips-cpu.h sed 's/^X//' >files/patch-target-mips-cpu.h << 'e962c245af271860623f0b384167e611' e962c245af271860623f0b384167e611 echo x - files/patch-tcg-i386-tcg-target.c sed 's/^X//' >files/patch-tcg-i386-tcg-target.c << 'aaa77090cb9c54a8e5a8ab57a8f06be2' aaa77090cb9c54a8e5a8ab57a8f06be2 echo x - files/patch-usb-stub.c sed 's/^X//' >files/patch-usb-stub.c << '31e9be701a404c0c790c4554af12dfc9' 31e9be701a404c0c790c4554af12dfc9 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 f69c3f76d51c4024d0b81177709e3839 echo x - files/patch-vl.c-ppbus sed 's/^X//' >files/patch-vl.c-ppbus << '86d1763dbe5763d191d2025e2c136179' 86d1763dbe5763d191d2025e2c136179 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' XIndex: configure X@@ -224,6 +224,9 @@ X pkgversion="" X check_utests="no" X user_pie="no" X+pcap="no" X+pcap_create="no" X+bpf="no" X X # OS specific X if check_define __linux__ ; then X@@ -451,6 +454,8 @@ X ;; X --enable-vnc-sasl) vnc_sasl="yes" X ;; X+ --enable-pcap) pcap="yes" X+ ;; X --disable-slirp) slirp="no" X ;; X --disable-uuid) uuid="no" X@@ -998,6 +1003,49 @@ 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+ libs_softmmu="$libpcap $libs_softmmu" X+fi # test "$pcap" X+ X+########################################## X # VNC TLS detection X if test "$vnc_tls" != "no" ; then X cat > $TMPC <> $config_host_mak X fi X+if test "$pcap" = "yes" ; then X+ echo "CONFIG_PCAP=y" >> $config_host_mak X+ if test "$pcap_create" = "yes" ; then X+ echo "CONFIG_PCAP_CREATE=y" >> $config_host_mak X+ fi X+ if test "$bpf" = "yes" ; then X+ echo "CONFIG_BPF=y" >> $config_host_mak X+ fi X+fi X if test "$slirp" = "yes" ; then X echo "CONFIG_SLIRP=y" >> $config_host_mak X QEMU_CFLAGS="-I\$(SRC_PATH)/slirp $QEMU_CFLAGS" XIndex: net.h X@@ -33,7 +33,8 @@ typedef enum { X NET_CLIENT_TYPE_TAP, X NET_CLIENT_TYPE_SOCKET, X NET_CLIENT_TYPE_VDE, X- NET_CLIENT_TYPE_DUMP X+ NET_CLIENT_TYPE_DUMP, X+ NET_CLIENT_TYPE_PCAP X } net_client_type; X X typedef int (NetCanReceive)(VLANClientState *); XIndex: net.c X@@ -725,6 +725,187 @@ qemu_sendv_packet(VLANClientState *vc, c X return qemu_sendv_packet_async(vc, iov, iovcnt, NULL); X } X X+#if defined(CONFIG_PCAP) X+#if defined(CONFIG_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, const 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_create: %s\n", errbuf); X+ goto fail; X+ } X+ X+#if defined(CONFIG_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(CONFIG_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 /* CONFIG_BPF */ X+#endif /* _WIN32 */ X+ X+ s->vc = qemu_new_vlan_client(NET_CLIENT_TYPE_PCAP, X+ vlan, NULL, model, name, NULL, X+ pcap_receive, NULL, NULL, X+ 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+ X+static int net_init_pcap(QemuOpts *opts, X+ Monitor *mon, X+ const char *name, X+ VLANState *vlan) X+{ X+ const char *ifname; X+ X+ ifname = qemu_opt_get(opts, "ifname"); X+ X+ if (net_pcap_init(vlan, "pcap", name, ifname) == -1) { X+ return -1; X+ } X+ X+ vlan->nb_host_devs++; X+ X+ return 0; X+} X+#endif /* CONFIG_PCAP */ X+ X #if defined(CONFIG_SLIRP) X X /* slirp network adapter */ X@@ -2502,6 +2683,20 @@ static struct { X #endif /* _WIN32 */ X { /* end of list */ } X }, X+#ifdef CONFIG_PCAP X+ }, { X+ .type = "pcap", X+ .init = net_init_pcap, X+ .desc = { X+ NET_COMMON_PARAMS_DESC, X+ { X+ .name = "ifname", X+ .type = QEMU_OPT_STRING, X+ .help = "interface name", X+ }, X+ { /* end of list */ } X+ }, X+#endif X }, { X .type = "socket", X .init = net_init_socket, X--- qemu-options.hx.orig 2009-08-28 16:46:21.000000000 -0400 X+++ qemu-options.hx 2009-09-02 16:20:14.000000000 -0400 X@@ -783,6 +783,10 @@ X DEF("net", HAS_ARG, QEMU_OPTION_net, X "-net nic[,vlan=n][,macaddr=mac][,model=type][,name=str][,addr=str][,vectors=v]\n" X " create a new Network Interface Card and connect it to VLAN 'n'\n" 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 CONFIG_SLIRP X "-net user[,vlan=n][,name=str][,net=addr[/mask]][,host=addr][,restrict=y|n]\n" X " [,hostname=host][,dhcpstart=addr][,dns=addr][,tftp=dir][,bootfile=f]\n" 4237dd24acb3dbc16c0489859e73cd79 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