# 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-Makefile # files/patch-audio-ossaudio.c # files/patch-bd # files/patch-bf # files/patch-bg # files/patch-bsd-user-ld # files/patch-bsd-user-linproc # files/patch-bsd-user-mmap.c # files/patch-cache-utils.c # files/patch-configure # files/patch-cpu-exec.c # files/patch-exec.c # files/patch-fbsd # files/patch-hw-vmware_vga.c # files/patch-libmath # files/patch-libmath2 # files/patch-libmath_FreeBSD-version # files/patch-ppc.ld # files/patch-qemu-char.c # files/patch-qemu-doc.texi # files/patch-qemu-timer.c # files/patch-tapclose # files/patch-tcg-ppc-tcg_target.h # files/patch-vl.c # 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/revert-fbsd-libmath-patch # 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.108 2010/02/08 22:19:28 nox Exp $ X# X XPORTNAME= qemu XPORTVERSION= 0.12.50s.20100323 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-20100323_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 XMAN8= qemu-nbd.8 XONLY_FOR_ARCHS= amd64 i386 powerpc XCONFLICTS= qemu-[0-9]* XMAKE_JOBS_SAFE= yes X XOPTIONS= 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} --enable-docs 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 X.if ${ARCH} == "powerpc" XMAKE_ARGS+= ARCH=ppc 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 ${ARCH} == "powerpc" X.if ${OSVERSION} < 800030 X# These OSVERSION don't have all the needed long double fns in their X# libc so just disable 80 bit floats completely. X @cd ${WRKSRC} && ${PATCH} --quiet -R ${PATCH_STRIP} < ${FILESDIR}/patch-libmath_FreeBSD-version X @cd ${WRKSRC} && ${PATCH} --quiet -R ${PATCH_STRIP} < ${FILESDIR}/patch-fbsd X.else X# ...else we only need to disable the libmath build. (since its X# x86-specific.) X @cd ${WRKSRC} && ${PATCH} --quiet < ${FILESDIR}/revert-fbsd-libmath-patch X.endif X.endif X 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-20100323_20.tar.bz2) = b3999f97d241e8b3d00e4037294697ac XSHA256 (qemu/qemu-snapshot-20100323_20.tar.bz2) = a45d41b8e332903d6b7a6e1d583d5a3ad14db22948f01cf92fabac9934dbd4d0 XSIZE (qemu/qemu-snapshot-20100323_20.tar.bz2) = 3669121 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 XSee also the preconfigured system images on http://oszoo.org/ XMany live cd isos also work. X XWWW: http://www.nongnu.org/qemu/ 7f9555c3c1089940396b503dd37f3979 echo x - pkg-message sed 's/^X//' >pkg-message << '90c81c06929c43140502a9f17b449376' XFreeBSD host notes X================== X X- Needs to run as root in order to use /dev/tap* networking (why?) (actually X RELENG_6 and above now has a sysctl net.link.tap.user_open to allow users to X use it too. Don't forget to adjust device node permissions in X /etc/devfs.rules.) X X- slirp (usermode networking) is fixed now in cvs, on FreeSBIE 1.0 guests you X still have to manually do: echo nameserver 10.0.2.3 >/etc/resolv.conf but X i've been told that that's normal. (fixed on FreeSBIE 1.1.) And you have X to wait a bit for dhclient to do its thing; traffic to address 10.0.2.2 is X routed to 127.1 on the host. X X- Expect timer problems when guest kernel HZ is > hosts, for example time X sleep 1 takes 49 seconds and booting sleeps for minutes at the acd0 probe X with a FreeSBIE 1.0 guest, thats because its kernel is built with HZ=5000, X and FreeBSD's default is 100... (no longer a problem with FreeSBIE 1.1.) X The linux 2.6 kernel uses 1000 by default btw. (changed to 250 later, and X recent linux kernels now no longer have a fixed HZ, aka `tickless X kernel'...) Enabling /dev/rtc doesn't seem to help either (not included X since it needs a patch to emulators/rtc.) X X- update: the above problem has gotten worse with FreeBSD guests somewhere X before 8.0, mainly since the kernel now usually wants double or even X quadruple number of timer irqs compared to HZ if it detects an apic (and at X least early versions of FreeBSD 8 had a bug that essentially halved qemu's X clock rate too); the only reason you usually don't see symptoms of this with X FreeBSD 8 guests is they automatically reduce their HZ to 100 when running X in a VM while the default for the host kernel is still HZ=1000. X workarounds: for i386 guests you can disable the apic in the guest by X setting X X hint.apic.0.disabled=1 X X in loader.conf(5) (or manually at the loader prompt), otherwise the only thing X you can do is either reduce the guest's HZ to, say, 100 by setting e.g. X X kern.hz="100" X X from the loader as above (which usually is a good idea in a VM anyway and X FreeBSD 8 now does by itself as mentioned), or if that's not possible X increase the host's HZ to 2000 or even 4000 from the loader in the same way. X X- The -smb option (smb-export local dir to guest) needs the net/samba3 X port/package installed in addition to qemu. X 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 code X is more than welcome here!) you need to make sure the host isn't claiming X them, e.g. for umass devices (like memory sticks or external harddrives) X make sure umass isn't in the kernel (you can then still load it as a kld X when needed), also unless you are running qemu as root you then need to fix X permissions for /dev/ugen* device nodes: if you are on 5.x or later (devfs) X put a rule in /etc/devfs.rules, activate it in /etc/rc.conf and run X /etc/rc.d/devfs restart. Example devfs.rules: X X [ugen_ruleset=20] X add path 'ugen*' mode 660 group operator X X corresponding rc.conf line: X X devfs_system_ruleset="ugen_ruleset" X X- Still usb: since the hub is no longer attached to the uchi controller and X the wakeup mechanism, resume interrupt is not implemented yet linux guests X will suspend the bus, i.e. they wont see devices usb_add'ed after its X (linux') uhci module got loaded. Workaround: either add devices before X linux loads the module or rmmod and modprobe it afterwards. X X- If you get repeated `atapi_poll called!' console messages with FreeBSD X guests or other weird cdrom problems then thats probably because the guest X has atapicam loaded, which for reasons still to be determined has problems X with qemu's now by default enabled cdrom dma. You can build the port with X CDROM_DMA disabled to disable it. X X- If you build qemu wihout SDL and then get crashes running it try passing it X -nographic. This should probably be default in that case... X X- Perhaps it should be noted that if you want to use qemu with -m 512 or X larger on 6.x/i386 hosts you need to increase the kern.maxdsiz tunable in X loader.conf(5) since the default is 512 MB, and qemu needs memory for itself X also. (7.0 and up now use jemalloc which uses mmap(2) and isn't affected by X kern.maxdsiz anymore.) X X- qemu's network boot roms (-boot n) have a bug when bootfiles sizes are a X multiple of blksize, if this affects you (like with FreeBSD's /boot/pxeboot) X you can do like X X cp /boot/pxeboot pxeboot-qemu && chmod +w pxeboot-qemu && echo >>pxeboot-qemu X X and then use pxeboot-qemu. Actually you need latest -stable or -current btx X code (from after 7.0 was released) because of the real mode boot problem, so X use at least pxeboot from there. And I just did that for the pxeboot X extracted out of X X ftp://ftp.freebsd.org/pub/FreeBSD/snapshots/200805/7.0-STABLE-200805-i386-bootonly.iso X X and placed it here: X X http://people.freebsd.org/~nox/qemu/pxeboot-qemu X X- If you use slirp (usernet, the default) and want to mount nfs into the guest X and you are not running qemu as root, then mountd(8) on the exporting box X needs to be run with -n in order to accept requests from ports >= 1024. X X- The new (optional) pcap code cannot talk to the host on 6.x because the X necessary bpf feature (BIOCFEEDBACK) hasn't (yet?) been merged there. X X- (not FreeBSD-specific:) There have been reports of qcow2 corruption with (at X least) win2k guests on recent kvm (which uses similar qcow2 code than qemu X now, see this thread: X X http://lists.gnu.org/archive/html/qemu-devel/2009-02/msg00713.html - X X the consensus on that thread seems to be that qcow(2) code has always been X experimental and you should use raw images if you want reliability; raw is X also usually faster.) You should be able to migrate existing images to raw X using qemu-img(1)'s convert function; raw doesn't support advanced features X like snapshots tho. [a few important qcow2 bugfixed have been committed in X the meantime so this _might_ be less of an issue now.] X X- (also not FreeBSD-specific:) It is recommended to pass raw images using the X new -drive syntax, specifying format=raw explicitly in order to avoid X malicious guests being able to exploit the format autodetection thats X otherwise getting used. (Not that you should run malicious guests anyway, X but this eleminates at least a known attack vector.) X X- qemu now has improved physical cdrom support, but still there still is at X least one known problem: you need to have the guest eject the disc if you X want to change it/take it out, or otherwise the guest may continue using X state (like size) of the old disc. (You can also do like `change ide1-cd0 X /dev/acd0' in the monitor after taking out the disc if a guest cannot eject X it itself.) X X- The default configuration location (qemu-ifup script etc.) has been changed X from /etc to PREFIX/etc (usually /usr/local/etc). Move your files X accordingly. X X- The pcap code (-net nic... -net pcap,ifname=...) should work properly now, X with only one exception: Advanced features like TSO used on the host X interface can cause oversize packets which now do get truncated to avoid X confusing/panicing guests but of course still will cause retransmissions. X So if you see slow throughput and `pcap_send: packet size > ..., truncating' X messages on qemu's tty try disabling TSO etc on the host interface at least X while using pcap. X X- kqemu is no longer supported in qemu upstream after the 0.11 branch X was created, which means also not in this version. (Linux has moved X on to kvm now for qemu(-like) virtualization needs, so if you want qemu X to go faster and don't want to switch to virtualbox or stick to the older X emulators/qemu port which is at 0.11.1 atm and as such still supports X kqemu you should help getting the FreeBSD kvm port updated and X completed: X X http://wiki.freebsd.org/FabioChecconi/PortingLinuxKVMToFreeBSD X X ) 90c81c06929c43140502a9f17b449376 echo x - pkg-plist sed 's/^X//' >pkg-plist << '842cde48cf18b70a11b15515ca566742' Xbin/qemu Xbin/qemu-img Xbin/qemu-io Xbin/qemu-nbd 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@unexec if cmp -s %D/etc/qemu/target-x86_64.conf.sample %D/etc/qemu/target-x86_64.conf; then rm -f %D/etc/qemu/target-x86_64.conf; fi Xetc/qemu/target-x86_64.conf.sample X@exec if [ ! -f %D/etc/qemu/target-x86_64.conf ] ; then cp -p %D/%F %B/etc/qemu/target-x86_64.conf; fi X@dirrmtry etc/qemu X%%PORTDOCS%%%%DOCSDIR%%/qemu-doc.html X%%PORTDOCS%%%%DOCSDIR%%/qemu-tech.html X%%PORTDOCS%%@dirrm %%DOCSDIR%% X%%DATADIR%%/bios.bin X%%DATADIR%%/vgabios.bin X%%DATADIR%%/vgabios-cirrus.bin X%%DATADIR%%/ppc_rom.bin X%%DATADIR%%/openbios-ppc X%%DATADIR%%/openbios-sparc32 X%%DATADIR%%/openbios-sparc64 X%%DATADIR%%/video.x X%%DATADIR%%/pxe-e1000.bin X%%DATADIR%%/pxe-ne2k_pci.bin X%%DATADIR%%/pxe-rtl8139.bin X%%DATADIR%%/pxe-pcnet.bin X%%DATADIR%%/pxe-virtio.bin X%%DATADIR%%/gpxe-eepro100-80861209.rom X%%DATADIR%%/gpxe-eepro100-80861229.rom 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/hw/dma.c X@@ -344,9 +344,11 @@ static void channel_run (int ncont, int X } X #endif X X- n = r->transfer_handler (r->opaque, ichan + (ncont << 2), X- r->now[COUNT], (r->base[COUNT] + 1) << ncont); X- r->now[COUNT] = n; X+ if (r->transfer_handler) { X+ n = r->transfer_handler (r->opaque, ichan + (ncont << 2), X+ r->now[COUNT], (r->base[COUNT] + 1) << ncont); X+ r->now[COUNT] = n; X+ } X ldebug ("dma_pos %d size %d\n", n, (r->base[COUNT] + 1) << ncont); X } X XIndex: qemu/hw/fdc.c X@@ -1322,7 +1322,8 @@ X fd_sector(cur_drv)); X return 0; X } X- if (bdrv_read(cur_drv->bs, fd_sector(cur_drv), fdctrl->fifo, 1) < 0) { X+ if (cur_drv->bs == NULL || X+ bdrv_read(cur_drv->bs, fd_sector(cur_drv), fdctrl->fifo, 1) < 0) { X FLOPPY_DPRINTF("error getting sector %d\n", X fd_sector(cur_drv)); X /* Sure, image size is too small... */ X@@ -1776,7 +1777,8 @@ X if (pos == FD_SECTOR_LEN - 1 || X fdctrl->data_pos == fdctrl->data_len) { X cur_drv = get_cur_drv(fdctrl); X- if (bdrv_write(cur_drv->bs, fd_sector(cur_drv), fdctrl->fifo, 1) < 0) { X+ if (cur_drv->bs == NULL || X+ bdrv_write(cur_drv->bs, fd_sector(cur_drv), fdctrl->fifo, 1) < 0) { X FLOPPY_ERROR("writing sector %d\n", fd_sector(cur_drv)); X return; X } XIndex: qemu-0.8.2/hw/pc.c X=================================================================== X--- qemu-0.8.2.orig/hw/pc.c 2007-04-20 06:05:58.000000000 +0300 X+++ qemu-0.8.2/hw/pc.c 2007-04-20 06:05:59.000000000 +0300 X@@ -312,7 +312,8 @@ void bochs_bios_write(void *opaque, uint X case 0x400: X case 0x401: X fprintf(stderr, "BIOS panic at rombios.c, line %d\n", val); X- exit(1); X+ /* according to documentation, these can be safely ignored */ X+ break; X case 0x402: X case 0x403: X #ifdef DEBUG_BIOS X@@ -335,8 +336,9 @@ void bochs_bios_write(void *opaque, uint X /* LGPL'ed VGA BIOS messages */ X case 0x501: X case 0x502: X+ /* according to documentation, these can be safely ignored */ X fprintf(stderr, "VGA BIOS panic, line %d\n", val); X- exit(1); X+ break; X case 0x500: X case 0x503: X #ifdef DEBUG_BIOS XIndex: qemu-0.8.2/hw/sb16.c X=================================================================== X--- qemu-0.8.2.orig/hw/sb16.c 2006-07-22 20:23:34.000000000 +0300 X+++ qemu-0.8.2/hw/sb16.c 2007-04-20 06:05:59.000000000 +0300 X@@ -1235,8 +1235,10 @@ static int SB_read_DMA (void *opaque, in X s->block_size); X #endif X X- while (s->left_till_irq <= 0) { X- s->left_till_irq = s->block_size + s->left_till_irq; X+ if (s->block_size) { X+ while (s->left_till_irq <= 0) { X+ s->left_till_irq = s->block_size + s->left_till_irq; X+ } X } X X return dma_pos; XIndex: qemu/hw/i8259.c X@@ -302,7 +302,8 @@ X s->init4 = val & 1; X s->single_mode = val & 2; X if (val & 0x08) X- hw_error("level sensitive irq not supported"); X+ /* hw_error("level sensitive irq not supported"); */ X+ return; X } else if (val & 0x08) { X if (val & 0x04) X s->poll = 1; 94eb8569679fd16e3ab97f012a304a14 echo x - files/patch-Makefile sed 's/^X//' >files/patch-Makefile << 'c0d7d903b7c552bc0b03b62518f82f5d' XIndex: qemu/Makefile X@@ -29,7 +29,11 @@ $(call set-vpath, $(SRC_PATH):$(SRC_PATH 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@@ -184,8 +188,10 @@ BLOBS= 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@@ -195,7 +201,10 @@ endif X X install-sysconfig: X $(INSTALL_DIR) "$(DESTDIR)$(sysconfdir)/qemu" X- $(INSTALL_DATA) $(SRC_PATH)/sysconfigs/target/target-x86_64.conf "$(DESTDIR)$(sysconfdir)/qemu" X+ $(INSTALL_DATA) $(SRC_PATH)/sysconfigs/target/target-x86_64.conf "$(DESTDIR)$(sysconfdir)/qemu/target-x86_64.conf.sample" X+ if [ ! -f "$(sysconfdir)/qemu/target-x86_64.conf" ]; then \ X+ $(INSTALL_DATA) $(SRC_PATH)/sysconfigs/target/target-x86_64.conf "$(sysconfdir)/qemu"; \ X+ fi X X install: all $(if $(BUILD_DOCS),install-doc) install-sysconfig X $(INSTALL_DIR) "$(DESTDIR)$(bindir)" c0d7d903b7c552bc0b03b62518f82f5d echo x - files/patch-audio-ossaudio.c sed 's/^X//' >files/patch-audio-ossaudio.c << '84f796fb10979fbb2a8f15318c954adf' 84f796fb10979fbb2a8f15318c954adf echo x - files/patch-bd sed 's/^X//' >files/patch-bd << 'f0858239178b75a82e3cb8ac2f3721a5' XIndex: qemu/configure X@@ -570,7 +570,7 @@ X if test -z "$prefix" ; then X prefix="/usr/local" X fi X- mansuffix="/share/man" X+ mansuffix="/man" X datasuffix="/share/qemu" X docsuffix="/share/doc/qemu" X binsuffix="/bin" f0858239178b75a82e3cb8ac2f3721a5 echo x - files/patch-bf sed 's/^X//' >files/patch-bf << 'b14ab52fe0e3ff13ec8fa9c3734c62fd' XIndex: qemu/slirp/slirp_config.h X@@ -86,7 +86,7 @@ X #undef BAD_SPRINTF X X /* Define if you have readv */ X-#undef HAVE_READV X+#define HAVE_READV X X /* Define if iovec needs to be declared */ X #undef DECLARE_IOVEC X@@ -95,7 +95,7 @@ X #undef DECLARE_SPRINTF X X /* Define if you have a POSIX.1 sys/wait.h */ X-#undef HAVE_SYS_WAIT_H X+#define HAVE_SYS_WAIT_H X X /* Define if you have sys/select.h */ X #define HAVE_SYS_SELECT_H X@@ -107,7 +107,7 @@ X #define HAVE_ARPA_INET_H X X /* Define if you have sys/signal.h */ X-#undef HAVE_SYS_SIGNAL_H X+#define HAVE_SYS_SIGNAL_H X X /* Define if you have sys/stropts.h */ X #undef HAVE_SYS_STROPTS_H X@@ -180,7 +180,7 @@ X #undef HAVE_GRANTPT X X /* Define if you have fchmod */ X-#undef HAVE_FCHMOD X+#define HAVE_FCHMOD X X /* Define if you have */ X #undef HAVE_SYS_TYPES32_H b14ab52fe0e3ff13ec8fa9c3734c62fd echo x - files/patch-bg sed 's/^X//' >files/patch-bg << '257aa9645130d124ee5f185a2dfb425c' XIndex: qemu/Makefile X@@ -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-bsd-user-ld sed 's/^X//' >files/patch-bsd-user-ld << 'c4f3b5ac0d5a16751629606127e1aeec' X--- a/x86_64.ld X+++ b/x86_64.ld X@@ -35,20 +35,8 @@ SECTIONS X .rela.got : { *(.rela.got) } X .rel.bss : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) } X .rela.bss : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) } X- .rel.plt : X- { X- *(.rel.plt) X- PROVIDE_HIDDEN (__rel_iplt_start = .); X- *(.rel.iplt) X- PROVIDE_HIDDEN (__rel_iplt_end = .); X- } X- .rela.plt : X- { X- *(.rela.plt) X- PROVIDE_HIDDEN (__rela_iplt_start = .); X- *(.rela.iplt) X- PROVIDE_HIDDEN (__rela_iplt_end = .); X- } X+ .rel.plt : { *(.rel.plt) } X+ .rela.plt : { *(.rela.plt) } X .init : X { X KEEP (*(.init)) X@@ -70,8 +58,6 @@ SECTIONS 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@@ -97,8 +83,8 @@ SECTIONS 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,69 +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 : X- { X- *(.rel.plt) X- PROVIDE_HIDDEN (__rel_iplt_start = .); X- *(.rel.iplt) X- PROVIDE_HIDDEN (__rel_iplt_end = .); X- } X- .rela.plt : X- { X- *(.rela.plt) X- PROVIDE_HIDDEN (__rela_iplt_start = .); X- *(.rela.iplt) X- PROVIDE_HIDDEN (__rela_iplt_end = .); X- } 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+ KEEP (*(.init)) X+ } =0x90909090 X+ .plt : { *(.plt) } X+ .text : X { X- *(.text) 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) } c4f3b5ac0d5a16751629606127e1aeec echo x - files/patch-bsd-user-linproc sed 's/^X//' >files/patch-bsd-user-linproc << '3a338ddb06728440def2150b6ac0026b' X--- a/configure X+++ b/configure X@@ -335,6 +335,8 @@ FreeBSD) X make="gmake" X audio_drv_list="oss" X audio_possible_drivers="oss sdl esd pa" X+ # needed for kinfo_getvmmap(3) in libutil.h X+ LIBS="-lutil $LIBS" X ;; X DragonFly) X bsd="yes" X--- a/exec.c X+++ b/exec.c X@@ -41,6 +41,21 @@ X #if defined(CONFIG_USER_ONLY) X #include X #include X+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) X+#include X+#if __FreeBSD_version >= 700104 X+#define HAVE_KINFO_GETVMMAP X+#define sigqueue sigqueue_freebsd /* avoid redefinition */ X+#include X+#include X+#include X+#define _KERNEL X+#include X+#undef _KERNEL X+#undef sigqueue X+#include X+#endif X+#endif X #endif X X //#define DEBUG_TB_INVALIDATE X@@ -274,11 +289,45 @@ static void page_init(void) X X #if !defined(_WIN32) && defined(CONFIG_USER_ONLY) X { X+#ifdef HAVE_KINFO_GETVMMAP X+ struct kinfo_vmentry *freep; X+ int i, cnt; X+ X+ freep = kinfo_getvmmap(getpid(), &cnt); X+ if (freep) { X+ mmap_lock(); X+ for (i = 0; i < cnt; i++) { X+ unsigned long startaddr, endaddr; X+ X+ startaddr = freep[i].kve_start; X+ endaddr = freep[i].kve_end; X+ if (h2g_valid(startaddr)) { X+ startaddr = h2g(startaddr) & TARGET_PAGE_MASK; X+ X+ if (h2g_valid(endaddr)) { X+ endaddr = h2g(endaddr); X+ page_set_flags(startaddr, endaddr, PAGE_RESERVED); X+ } else { X+#if TARGET_ABI_BITS <= L1_MAP_ADDR_SPACE_BITS X+ endaddr = ~0ul; X+ page_set_flags(startaddr, endaddr, PAGE_RESERVED); X+#endif X+ } X+ } X+ } X+ free(freep); X+ mmap_unlock(); X+ } X+#else X FILE *f; X X last_brk = (unsigned long)sbrk(0); X X+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) X+ f = fopen("/compat/linux/proc/self/maps", "r"); X+#else X f = fopen("/proc/self/maps", "r"); X+#endif X if (f) { X mmap_lock(); X X@@ -303,6 +352,7 @@ static void page_init(void) X fclose(f); X mmap_unlock(); X } X+#endif X } X #endif X } 3a338ddb06728440def2150b6ac0026b echo x - files/patch-bsd-user-mmap.c sed 's/^X//' >files/patch-bsd-user-mmap.c << 'a9baf4fbabd2bdc8ed168e720526d505' X--- a/bsd-user/mmap.c X+++ b/bsd-user/mmap.c X@@ -77,16 +77,15 @@ void mmap_unlock(void) X void *qemu_vmalloc(size_t size) X { X void *p; X- unsigned long addr; X mmap_lock(); X /* Use map and mark the pages as used. */ X p = mmap(NULL, size, PROT_READ | PROT_WRITE, X MAP_PRIVATE | MAP_ANON, -1, 0); X X- addr = (unsigned long)p; X- if (addr == (target_ulong) addr) { X+ if (h2g_valid(p)) { X /* Allocated region overlaps guest address space. X This may recurse. */ X+ abi_ulong addr = h2g(p); X page_set_flags(addr & TARGET_PAGE_MASK, TARGET_PAGE_ALIGN(addr + size), X PAGE_RESERVED); X } a9baf4fbabd2bdc8ed168e720526d505 echo x - files/patch-cache-utils.c sed 's/^X//' >files/patch-cache-utils.c << 'd9922954c756d82a737e02e5d1a41a42' d9922954c756d82a737e02e5d1a41a42 echo x - files/patch-configure sed 's/^X//' >files/patch-configure << '5cae8e2426c154e1c1a4408c02b2ed73' XIndex: qemu/configure X@@ -1749,16 +1749,16 @@ if compile_prog "" "" ; then X fi X X # Check if tools are available to build documentation. X-if test "$docs" != "no" ; then X- if has makeinfo && has pod2man; then X- docs=yes X- else X- if test "$docs" = "yes" ; then X- feature_not_found "docs" X- fi X- docs=no X- fi X-fi X+#if test "$docs" != "no" ; then X+# if has makeinfo && has pod2man; then X+# docs=yes X+# else X+# if test "$docs" = "yes" ; then X+# feature_not_found "docs" X+# fi X+# docs=no X+# fi X+#fi X X # Search for bswap_32 function X byteswap_h=no 5cae8e2426c154e1c1a4408c02b2ed73 echo x - files/patch-cpu-exec.c sed 's/^X//' >files/patch-cpu-exec.c << '070ab41523e9d3bc6975c39f45217a3c' 070ab41523e9d3bc6975c39f45217a3c echo x - files/patch-exec.c sed 's/^X//' >files/patch-exec.c << 'de49c8f204db3e855465fcdc0426f40e' X--- a/exec.c X+++ b/exec.c X@@ -293,10 +293,13 @@ static void page_init(void) X X if (h2g_valid(endaddr)) { X endaddr = h2g(endaddr); X+ page_set_flags(startaddr, endaddr, PAGE_RESERVED); X } else { X+#if TARGET_ABI_BITS <= L1_MAP_ADDR_SPACE_BITS X endaddr = ~0ul; X+ page_set_flags(startaddr, endaddr, PAGE_RESERVED); X+#endif X } X- page_set_flags(startaddr, endaddr, PAGE_RESERVED); X } X } while (!feof(f)); X 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@@ -330,8 +330,8 @@ endif # CONFIG_SOFTMMU X X obj-$(CONFIG_GDBSTUB_XML) += gdbstub-xml.o X X-$(QEMU_PROG): $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y) X- $(call LINK,$(obj-y) $(obj-$(TARGET_BASE_ARCH)-y)) X+$(QEMU_PROG): $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y) ../bsd/libmath.a X+ $(call LINK,$(obj-y) $(obj-$(TARGET_BASE_ARCH)-y) ../bsd/libmath.a) X X X gdbstub-xml.c: $(TARGET_XML_FILES) $(SRC_PATH)/feature_to_c.sh XIndex: qemu/fpu/softfloat-native.c X@@ -9,7 +9,8 @@ X void set_float_rounding_mode(int val STATUS_PARAM) X { X STATUS(float_rounding_mode) = val; X-#if (defined(CONFIG_BSD) && !defined(__APPLE__) && !defined(__GLIBC__)) || \ X+#if (defined(CONFIG_BSD) && !defined(__APPLE__) && !defined(__GLIBC__) && \ X+ !defined(__FreeBSD__)) || \ X (defined(CONFIG_SOLARIS) && CONFIG_SOLARIS_VERSION < 10) X fpsetround(val); X #elif defined(__arm__) X@@ -26,7 +27,7 @@ void set_floatx80_rounding_precision(int 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@@ -3,7 +3,28 @@ X X #if (defined(CONFIG_BSD) && !defined(__APPLE__) && !defined(__GLIBC__)) \ X || 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__) && !defined(__GLIBC__) && \ X+ (!defined(__FreeBSD__) || __FreeBSD_version < 500000)) || \ X+ defined(CONFIG_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@@ -113,8 +134,9 @@ typedef union { X /*---------------------------------------------------------------------------- X | Software IEC/IEEE floating-point rounding mode. X *----------------------------------------------------------------------------*/ X-#if (defined(CONFIG_BSD) && !defined(__APPLE__) && !defined(__GLIBC__)) \ X- || defined(CONFIG_SOLARIS) X+#if (defined(CONFIG_BSD) && !defined(__APPLE__) && !defined(__GLIBC__) && \ 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-hw-vmware_vga.c sed 's/^X//' >files/patch-hw-vmware_vga.c << '4c1373a526b2bbc50950f3acad985664' XIndex: qemu/hw/vmware_vga.c X@@ -28,9 +28,9 @@ X #define VERBOSE X #define EMBED_STDVGA X #undef DIRECT_VRAM X-#define HW_RECT_ACCEL X-#define HW_FILL_ACCEL X-#define HW_MOUSE_ACCEL X+/* #define HW_RECT_ACCEL */ X+/* #define HW_FILL_ACCEL */ X+/* #define HW_MOUSE_ACCEL */ X X #ifdef EMBED_STDVGA X # include "vga_int.h" X@@ -76,6 +76,7 @@ X uint32_t wblue; X int syncing; X int fb_size; X+ int empty; X X union { X uint32_t *fifo; X@@ -487,7 +488,7 @@ X X static inline int vmsvga_fifo_empty(struct vmsvga_state_s *s) X { X- if (!s->config || !s->enable) X+ if (!s->config || !s->enable || s->empty) X return 1; X return (s->cmd->next_cmd == s->cmd->stop); X } X@@ -495,6 +496,10 @@ X static inline uint32_t vmsvga_fifo_read_raw(struct vmsvga_state_s *s) X { X uint32_t cmd = s->fifo[CMD(stop) >> 2]; X+ if (s->cmd->next_cmd == s->cmd->stop) { X+ s->empty = 1; X+ return 0; X+ } X s->cmd->stop = cpu_to_le32(CMD(stop) + 4); X if (CMD(stop) >= CMD(max)) X s->cmd->stop = s->cmd->min; X@@ -512,6 +517,7 @@ X int args = 0; X int x, y, dx, dy, width, height; X struct vmsvga_cursor_definition_s cursor; X+ s->empty = 0; X while (!vmsvga_fifo_empty(s)) X switch (cmd = vmsvga_fifo_read(s)) { X case SVGA_CMD_UPDATE: X@@ -533,6 +539,7 @@ X vmsvga_fill_rect(s, colour, x, y, width, height); X break; X #else X+ args = 0; X goto badcmd; X #endif X X@@ -547,6 +554,7 @@ X vmsvga_copy_rect(s, x, y, dx, dy, width, height); X break; X #else X+ args = 0; X goto badcmd; X #endif X X@@ -609,6 +617,7 @@ X break; /* Nop */ X X default: X+ args = 0; X badcmd: X while (args --) X vmsvga_fifo_read(s); 4c1373a526b2bbc50950f3acad985664 echo x - files/patch-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-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,17 +1,29 @@ 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(__GLIBC__)) \ X || 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-ppc.ld sed 's/^X//' >files/patch-ppc.ld << 'b2f1c3713f3dbeb119a1a529920f201e' X--- a/ppc.ld X+++ b/ppc.ld X@@ -79,36 +79,34 @@ X } X .sbss2 : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) } 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 .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 (0x10000) - ((0x10000 - .) & (0x10000 - 1)); . = DATA_SEGMENT_ALIGN (0x10000, 0x1000); X /* Exception handling */ X- .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) } X- .gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) } X+ .eh_frame : { KEEP (*(.eh_frame)) } X+ .gcc_except_table : { *(.gcc_except_table .gcc_except_table.*) } X /* Thread Local Storage sections */ X .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) } X .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } X .preinit_array : X { X- PROVIDE_HIDDEN (__preinit_array_start = .); X+ PROVIDE (__preinit_array_start = .); X KEEP (*(.preinit_array)) X- PROVIDE_HIDDEN (__preinit_array_end = .); X+ PROVIDE (__preinit_array_end = .); X } X .init_array : X { X- PROVIDE_HIDDEN (__init_array_start = .); X+ PROVIDE (__init_array_start = .); X KEEP (*(SORT(.init_array.*))) X KEEP (*(.init_array)) X- PROVIDE_HIDDEN (__init_array_end = .); X+ PROVIDE(__init_array_end = .); X } X .fini_array : X { X- PROVIDE_HIDDEN (__fini_array_start = .); X+ PROVIDE (__fini_array_start = .); X KEEP (*(.fini_array)) X KEEP (*(SORT(.fini_array.*))) X- PROVIDE_HIDDEN (__fini_array_end = .); X+ PROVIDE (__fini_array_end = .); X } X .ctors : X { X@@ -142,9 +140,8 @@ X .got1 : { *(.got1) } X .got2 : { *(.got2) } X .dynamic : { *(.dynamic) } X- .got : SPECIAL { *(.got) } X- . = DATA_SEGMENT_RELRO_END (0, .); X- .plt : SPECIAL { *(.plt) } X+ .got : { *(.got) } X+ .plt : { *(.plt) } X .data : X { X *(.data .data.* .gnu.linkonce.d.*) X@@ -152,7 +149,7 @@ X SORT(CONSTRUCTORS) X } X .data1 : { *(.data1) } X- .got : SPECIAL { *(.got) } X+ .got : { *(.got) } 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@@ -171,7 +168,7 @@ X *(.scommon) X PROVIDE (__sbss_end = .); PROVIDE (___sbss_end = .); X } X- .plt : SPECIAL { *(.plt) } X+ .plt : { *(.plt) } X .bss : X { X *(.dynbss) b2f1c3713f3dbeb119a1a529920f201e echo x - files/patch-qemu-char.c sed 's/^X//' >files/patch-qemu-char.c << 'ab3cdd3f6707606e5c415861cd4fbb39' X--- a/qemu-char.c X+++ b/qemu-char.c X@@ -1372,7 +1372,7 @@ static CharDriverState *qemu_chr_open_pp X #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) X static int pp_ioctl(CharDriverState *chr, int cmd, void *arg) X { X- int fd = (int)chr->opaque; X+ int fd = (int)(long)chr->opaque; X uint8_t b; X X switch(cmd) { X@@ -1418,7 +1418,7 @@ static CharDriverState *qemu_chr_open_pp X return NULL; X X chr = qemu_mallocz(sizeof(CharDriverState)); X- chr->opaque = (void *)fd; X+ chr->opaque = (void *)(long)fd; X chr->chr_write = null_chr_write; X chr->chr_ioctl = pp_ioctl; X return chr; ab3cdd3f6707606e5c415861cd4fbb39 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-qemu-timer.c sed 's/^X//' >files/patch-qemu-timer.c << '8086786f4b6728d86bd3c6cd11991a18' X--- a/qemu-timer.c X+++ b/qemu-timer.c X@@ -35,6 +35,9 @@ X #include X #include X #include X+#ifdef __FreeBSD__ X+#include X+#endif X X #ifdef __linux__ X #include 8086786f4b6728d86bd3c6cd11991a18 echo x - files/patch-tapclose sed 's/^X//' >files/patch-tapclose << 'caecfd3e92868a1c1ba2d28cb0885865' XIndex: qemu/net/tap.c X@@ -254,12 +254,12 @@ static void tap_cleanup(VLANClientState X X qemu_purge_queued_packets(nc); 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 X /* fd support */ caecfd3e92868a1c1ba2d28cb0885865 echo x - files/patch-tcg-ppc-tcg_target.h sed 's/^X//' >files/patch-tcg-ppc-tcg_target.h << '299020b1a8c4c1e67778e06ec7047576' 299020b1a8c4c1e67778e06ec7047576 echo x - files/patch-vl.c sed 's/^X//' >files/patch-vl.c << 'f69c3f76d51c4024d0b81177709e3839' X--- a/vl.c X+++ b/vl.c X@@ -52,6 +52,7 @@ X #include X #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) X #include X+#include X #else X #include X #endif X@@ -3368,10 +3369,13 @@ static char *find_datadir(const char *ar X } X #elif defined(__FreeBSD__) X { X- int len; X- len = readlink("/proc/curproc/file", buf, sizeof(buf) - 1); X- if (len > 0) { X- buf[len] = 0; X+ static int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1}; X+ size_t len = sizeof(buf) - 1; X+ X+ *buf = '\0'; X+ if (!sysctl(mib, sizeof(mib)/sizeof(*mib), buf, &len, NULL, 0) && X+ *buf) { X+ buf[sizeof(buf) - 1] = '\0'; X p = buf; X } X } f69c3f76d51c4024d0b81177709e3839 echo x - files/patch-vl.c-serial sed 's/^X//' >files/patch-vl.c-serial << '26d7f2fa45552542acf2f04ee88cee92' XIndex: qemu/qemu-char.c X@@ -1606,10 +1606,13 @@ X cfsetospeed(&tty, spd); X X tty.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP X- |INLCR|IGNCR|ICRNL|IXON); X- tty.c_oflag |= OPOST; X+ |INLCR|IGNCR|ICRNL|IXON|IMAXBEL); X+ tty.c_oflag &= ~OPOST; /* Don't do any output processing! */ X tty.c_lflag &= ~(ECHO|ECHONL|ICANON|IEXTEN|ISIG); X tty.c_cflag &= ~(CSIZE|PARENB|PARODD|CRTSCTS|CSTOPB); X+#ifdef __FreeBSD__ X+ cfmakeraw(&tty); X+#endif X switch(data_bits) { X default: X case 8: 26d7f2fa45552542acf2f04ee88cee92 echo x - files/patch-x_keymap.c sed 's/^X//' >files/patch-x_keymap.c << '5607de0eb104ec19ea4340141e2bea89' XIndex: qemu/x_keymap.c X@@ -41,9 +41,9 @@ X 0xb5, /* 112 Divide */ X 0xb8, /* 113 Alt-R */ X 0xc6, /* 114 Break */ X- 0x0, /* 115 */ X- 0x0, /* 116 */ X- 0x0, /* 117 */ X+ 0xdb, /* 115 left windows key */ X+ 0xdc, /* 116 right windows key */ X+ 0xdd, /* 117 right menu key */ X 0x0, /* 118 */ X 0x0, /* 119 */ X 0x0, /* 120 */ 5607de0eb104ec19ea4340141e2bea89 echo x - files/patch-z-bandaid-usb-current sed 's/^X//' >files/patch-z-bandaid-usb-current << '3de123c75bf96595f80e386577e05162' XIndex: qemu/usb-bsd.c X@@ -35,7 +35,12 @@ X X #include X #ifndef __DragonFly__ X+#include X+#if __FreeBSD_version >= 800064 X+#include X+#else X #include X+#endif X #else X #include X #endif 3de123c75bf96595f80e386577e05162 echo x - files/pcap-patch sed 's/^X//' >files/pcap-patch << '4237dd24acb3dbc16c0489859e73cd79' X--- configure.orig 2010-01-29 14:36:00.000000000 -0500 X+++ configure 2010-01-29 14:36:00.000000000 -0500 X@@ -257,6 +257,9 @@ pkgversion="" X check_utests="no" X user_pie="no" X zero_malloc="" X+pcap="no" X+pcap_create="no" X+bpf="no" X X # OS specific X if check_define __linux__ ; then X@@ -492,6 +495,8 @@ for opt do 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@@ -1041,6 +1046,49 @@ EOF 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" X--- net.h.orig 2010-01-29 14:36:00.000000000 -0500 X+++ net.h 2010-01-29 14:36:00.000000000 -0500 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@@ -36,6 +36,11 @@ X #include "qemu-common.h" X #include "qemu_socket.h" X X+#include X+#ifdef __FreeBSD__ X+#include X+#endif X+ X static QTAILQ_HEAD(, VLANState) vlans; X static QTAILQ_HEAD(, VLANClientState) non_vlan_clients; X X@@ -817,6 +822,226 @@ static int net_init_nic(QemuOpts *opts, X return idx; 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 nc; X+ pcap_t *handle; X+ int max_eth_frame_size; X+} PCAPState; X+ X+static ssize_t pcap_receive(VLANClientState *nc, const uint8_t *buf, size_t size) X+{ X+ PCAPState *s = DO_UPCAST(PCAPState, nc, nc); 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 *nc = (VLANClientState *)user; X+ X+ int len = phdr->len; X+#ifdef __FreeBSD__ X+ PCAPState *s = DO_UPCAST(PCAPState, nc, nc); X+ int max_eth_frame_size = s->max_eth_frame_size; X+ X+ if (len > max_eth_frame_size) { X+ fprintf(stderr, X+ "pcap_send: packet size > %d (%d), truncating\n", X+ max_eth_frame_size, len); X+ len = max_eth_frame_size; X+ } X+#endif X+ qemu_send_packet(nc, pdata, len); X+} X+ X+static void pcap_send(void *opaque) X+{ X+ PCAPState *s = (PCAPState *)opaque; X+ X+ for (;;) { X+ if (pcap_dispatch(s->handle, 0, (pcap_handler)&pcap_callback, (u_char *)&s->nc) >= 0) X+ break; X+ } X+} X+ X+static void pcap_cleanup(VLANClientState *nc) X+{ X+ PCAPState *s = DO_UPCAST(PCAPState, nc, nc); X+ X+ pcap_close(s->handle); X+} X+ X+static NetClientInfo net_pcap_info = { X+ .type = NET_CLIENT_TYPE_PCAP, X+ .size = sizeof(PCAPState), X+ .receive = pcap_receive, X+ .cleanup = pcap_cleanup, X+}; X+ X+static int net_pcap_init(VLANState *vlan, const char *model, const char *name, const char *ifname) X+{ X+ VLANClientState *nc; 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+ nc = qemu_new_net_client(&net_pcap_info, vlan, NULL, model, name); X+ X+ s = DO_UPCAST(PCAPState, nc, nc); 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+#ifdef __FreeBSD__ X+ /* X+ * We want to avoid passing oversize packets to the guest, which X+ * at least on FreeBSD can happen if the host interface uses tso X+ * (seen with an em(4) in this case) - so find out the host X+ * interface's mtu and assume the guest is configured the same. X+ */ X+ s->max_eth_frame_size = 1514; X+ i = socket(AF_INET, SOCK_DGRAM, 0); X+ if (i >= 0) { X+ struct ifreq ifr; X+ X+ (void) memset(&ifr, 0, sizeof(ifr)); X+ strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); X+ if (ioctl(i, SIOCGIFMTU, &ifr) != -1) X+ s->max_eth_frame_size = ifr.ifr_mtu + 14; X+ close(i); X+ } X+#endif 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+ snprintf(s->nc.info_str, sizeof(s->nc.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+ return 0; X+} X+#endif /* CONFIG_PCAP */ X+ X #define NET_COMMON_PARAMS_DESC \ X { \ X .name = "type", \ X@@ -977,6 +1202,20 @@ static const 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@@ -1296,6 +1535,7 @@ void net_check_clients(void) X case NET_CLIENT_TYPE_TAP: X case NET_CLIENT_TYPE_SOCKET: X case NET_CLIENT_TYPE_VDE: X+ case NET_CLIENT_TYPE_PCAP: X has_host_dev = 1; X break; X default: ; X--- qemu-options.hx.orig 2010-01-14 17:18:00.000000000 -0500 X+++ qemu-options.hx 2010-01-29 14:36:00.000000000 -0500 X@@ -799,6 +799,10 @@ DEF("smb", HAS_ARG, QEMU_OPTION_smb, "") 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/revert-fbsd-libmath-patch sed 's/^X//' >files/revert-fbsd-libmath-patch << 'de7a5de9a38244112241fb6afca87db4' X--- Makefile.orig 2010-02-06 20:59:24.000000000 +0100 X+++ Makefile 2010-02-06 21:00:17.000000000 +0100 X@@ -62,10 +62,7 @@ X X -include config-all-devices.mak X 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+build-all: $(DOCS) $(TOOLS) recurse-all X X config-host.h: config-host.h-timestamp X config-host.h-timestamp: config-host.mak de7a5de9a38244112241fb6afca87db4 echo x - files/rtl8139-re-patch sed 's/^X//' >files/rtl8139-re-patch << 'ef19f92d3d50db459283f53ecb2e7fa6' ef19f92d3d50db459283f53ecb2e7fa6 exit