# 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-cache-utils.c # files/patch-configure # files/patch-cpu-exec.c # files/patch-fbsd # files/patch-hw-vmware_vga.c # files/patch-libmath # files/patch-libmath2 # files/patch-libmath_FreeBSD-version # files/patch-luvalley # files/patch-ppc.ld # files/patch-qemu-doc.texi # files/patch-sleep # 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/patch-z-kvm-bsd # 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-kvm-luvalley X# Date created: Fri Apr 16 19:34:01 CEST 2010 X# Whom: Juergen Lock X# X# $FreeBSD: $ X# X XPORTNAME= qemu_kvm_luvalley XPORTVERSION= 0.12.3 XCATEGORIES= emulators XMASTER_SITES= SF:release \ X ${MASTER_SITE_LOCAL}:snapshot XMASTER_SITE_SUBDIR= kvm/qemu-kvm/${PORTVERSION}/:release nox/:snapshot XDISTNAME= qemu-kvm-${PORTVERSION} XDISTFILES= ${DISTNAME}${EXTRACT_SUFX}:release \ X luvalley-build-qemu-headers-83.tbz2:snapshot XDIST_SUBDIR= qemu-kvm X XMAINTAINER= nox@FreeBSD.org XCOMMENT= qemu-kvm CPU Emulator adapted for Luvalley - experimental X XHAS_CONFIGURE= yes XUSE_GMAKE= yes XUSE_PERL5= yes XPATCH_STRIP= -p1 XMAKE_ENV+= BSD_MAKE="${MAKE}" LDFLAGS="${LDFLAGS}" COMPILER_PATH="${WRKDIR}/bin" XMAN1= qemu.1 qemu-img.1 XONLY_FOR_ARCHS= amd64 i386 XCONFLICTS= qemu-[0-9]* XMAKE_JOBS_SAFE= yes XDATADIR= ${PREFIX}/share/qemu XDOCSDIR= ${PREFIX}/share/doc/qemu X XOPTIONS= RTL8139_TIMER "allow use of re(4) nic with FreeBSD guests" Off \ X SAMBA "samba dependency (for -smb)" Off \ X SDL "SDL/X dependency (graphical output)" On \ X GNUTLS "gnutls dependency (vnc encryption)" On \ X CURL "libcurl dependency (remote images)" 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" Off 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 XBUILD_DEPENDS+= ${LOCALBASE}/bin/as:${PORTSDIR}/devel/binutils XWITHOUT_CPU_CFLAGS=yes #to avoid problems with register allocation XCFLAGS:= ${CFLAGS:C/-fno-tree-vrp//} XCONFIGURE_ARGS+= --prefix=${PREFIX} --cc=${CC} --extra-cflags=-I${WRKDIR}/build-qemu --disable-kvm-cap-pit 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(WITHOUT_CURL) XCONFIGURE_ARGS+= --disable-curl X.else XLIB_DEPENDS+= curl:${PORTSDIR}/ftp/curl 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 ${MKDIR} ${WRKDIR}/bin X ${LN} -s ${LOCALBASE}/bin/as ${WRKDIR}/bin 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_RTL8139_TIMER) X @cd ${WRKSRC} && ${PATCH} --quiet < ${FILESDIR}/rtl8139-re-patch X.endif X.if defined(WITH_PCAP) X @cd ${WRKSRC} && ${PATCH} --quiet < ${FILESDIR}/pcap-patch X.endif X.if defined(WITHOUT_CDROM_DMA) X @cd ${WRKSRC} && ${PATCH} --quiet < ${FILESDIR}/cdrom-dma-patch X.endif X @${REINPLACE_CMD} -E \ X -e "s|^(CFLAGS=).*|\1${CFLAGS} -fno-strict-aliasing|" \ X -e "s|^(LDFLAGS=).*|\1${LDFLAGS}|" \ X ${WRKSRC}/Makefile.target X @${REINPLACE_CMD} -E \ X -e "s|^(CFLAGS=).*|\1${CFLAGS} -fno-strict-aliasing -I.|" \ X -e "s|^(LDFLAGS=).*|\1${LDFLAGS}|" \ X ${WRKSRC}/Makefile X @${REINPLACE_CMD} -E \ X -e "1s|^(#! )/usr/bin/perl|\1${PERL}|" \ X ${WRKSRC}/texi2pod.pl X X.if ${OSVERSION} >= 800091 X# XXX need to disable usb host code on head while it's not ported to the X# new usb stack yet Xpost-configure: X @${REINPLACE_CMD} -E \ X -e "s|^(HOST_USB=)bsd|\1stub|" \ X ${WRKSRC}/config-host.mak X.endif X Xpost-install: X @${INSTALL_SCRIPT} ${FILESDIR}/qemu-ifup.sample ${PREFIX}/etc X @${INSTALL_SCRIPT} ${FILESDIR}/qemu-ifdown.sample ${PREFIX}/etc X @if [ ! -f ${PREFIX}/etc/qemu-ifup ]; then \ X ${CP} -p ${PREFIX}/etc/qemu-ifup.sample ${PREFIX}/etc/qemu-ifup ; \ X fi X @if [ ! -f ${PREFIX}/etc/qemu-ifdown ]; then \ X ${CP} -p ${PREFIX}/etc/qemu-ifdown.sample ${PREFIX}/etc/qemu-ifdown ; \ X fi X @${CAT} ${PKGMESSAGE} X X.include b67911656ef5d18c4ae36cb6741b7965 echo x - distinfo sed 's/^X//' >distinfo << '57677d168a5ec21bdf22c9501f075a8f' XMD5 (qemu-kvm/qemu-kvm-0.12.3.tar.gz) = ab484975004f66fb48cb5589bd9b9dcb XSHA256 (qemu-kvm/qemu-kvm-0.12.3.tar.gz) = 77cccdc8938b33f3ed74763d01deaad58918c85f04a06afd10f00857b504c2b2 XSIZE (qemu-kvm/qemu-kvm-0.12.3.tar.gz) = 4718791 XMD5 (qemu-kvm/luvalley-build-qemu-headers-83.tbz2) = b4b15b9a9d5534b558f83d5288f49c6f XSHA256 (qemu-kvm/luvalley-build-qemu-headers-83.tbz2) = 326a0fe03ecc9c53df5860e0f8de7e7cbd521d44d4953f244f4495875b626174 XSIZE (qemu-kvm/luvalley-build-qemu-headers-83.tbz2) = 14740 57677d168a5ec21bdf22c9501f075a8f echo x - pkg-descr sed 's/^X//' >pkg-descr << '7f9555c3c1089940396b503dd37f3979' XLuvalley is a lightweight type-1 Virtual Machine Monitor (VMM) with Xnovel architecture, to enable any OS to run virtual machines by utilizing Xhardware virtualization extensions such as Intel VT and AMD-V. X XThis is an experimental port of qemu-kvm adapted to Luvalley by XXiaodong Yi (Luvalley author - files/patch-luvalley) and preliminary Xpatched for FreeBSD my me (nox, files/patch-z-kvm-bsd) so that FreeBSD Xcan run domU (guests) using Luvalley. Luvalley still has many limitations Xand is definitely far from being production-ready, but it already seems Xto be able to run domUs partway faster than kqemu with -kernel-kqemu. :) X(and also works better than kqemu for amd64 domUs.) X XNote: You need grub to boot the Luvalley `kernel', X X http://sourceforge.net/projects/luvalley/files/luvalley/luvalley-7/luvalley/download X Xwhich (hopefully) will then boot the first disk again from which you X_then_ select the FreeBSD slice for booting the FreeBSD loader and Xkernel to run as Luvalley dom0 if you want to test this port. More info Xis here: X X http://sunet.dl.sourceforge.net/project/luvalley/luvalley/luvalley-7/README X XSince FreeBSD users rarely have a grub installed I've made a grub iso Xwith a menu.lst configured to boot the Luvalley `kernel' from /boot/luvally Xon the root of the first FreeBSD slice on the first disk (if your FreeBSD Xinstall is elsewhere you have to either edit the grub menu entry on the fly Xusing grub's `e'dit command or unpack the iso using e.g. bsdtar, edit the Xmenu.lst, and then make a new iso, see the README.txt within the iso.) X X http://people.freebsd.org/~nox/qemu/luvalley/grub-luvalley.iso X XIf you have a working serial port (`COM1' aka /dev/tty[du]0) you can try Xto catch Luvalley's debug messages (115200bps, 8N1), this is especially Xuseful should Luvally crash, otherwise there's probably no chance to Xfix the bug. One known crash at the moment happens when Luvalley runs Xout of ioctl object slots of which by default there are only 32 X("IOCTL_SIZE" in the Luvalley source, I haven't tried to build that on XFreeBSD yet) and atm they never get released so in practice for the moment Xyou should reboot your dom0 (FreeBSD) after running a few domUs to avoid Xthat crash. Another known problem is atm when a domU shuts down the Xluvally qemu will hang and you have to manually kill it. X XWWW: http://sourceforge.net/projects/luvalley/files/ 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- To avoid panics or non-working re(4) nics with FreeBSD guests if you use X qemu -net nic,model=rtl8139 -net user or tap ... enable the emulated rtl8139 X timer by building the port with RTL8139_TIMER enabled. (The rtl8139c+ that X model=rtl8139 emulates needs less cpu than qemu's default ne2k nic which is X driven by ed(4), it has not been made default only because it may not work X with all guests yet. Btw qemu now also can emulate a few intel eepro100 and X e1000 nics which seem to be a tad more efficient even, and at least i82557b X and e1000 work without tweaks for FreeBSD guests - driven by fxp(4) and X em(4) repectively - and Linux guests too.) 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 X%%ALLTARGETS%%bin/qemu-system-arm X%%ALLTARGETS%%bin/qemu-system-cris X%%ALLTARGETS%%bin/qemu-system-m68k X%%ALLTARGETS%%bin/qemu-system-microblaze X%%ALLTARGETS%%bin/qemu-system-mips X%%ALLTARGETS%%bin/qemu-system-mips64 X%%ALLTARGETS%%bin/qemu-system-mips64el X%%ALLTARGETS%%bin/qemu-system-mipsel X%%ALLTARGETS%%bin/qemu-system-ppc X%%ALLTARGETS%%bin/qemu-system-ppc64 X%%ALLTARGETS%%bin/qemu-system-ppcemb X%%ALLTARGETS%%bin/qemu-system-sh4 X%%ALLTARGETS%%bin/qemu-system-sh4eb X%%ALLTARGETS%%bin/qemu-system-sparc X%%ALLTARGETS%%bin/qemu-system-sparc64 X%%ALLTARGETS%%bin/qemu-i386 X%%ALLTARGETS%%bin/qemu-sparc X%%ALLTARGETS%%bin/qemu-sparc64 X%%ALLTARGETS%%bin/qemu-x86_64 Xbin/qemu-system-x86_64 X@unexec if cmp -s %D/etc/qemu-ifup.sample %D/etc/qemu-ifup; then rm -f %D/etc/qemu-ifup; fi Xetc/qemu-ifup.sample X@exec if [ ! -f %D/etc/qemu-ifup ] ; then cp -p %D/%F %B/qemu-ifup; fi X@unexec if cmp -s %D/etc/qemu-ifdown.sample %D/etc/qemu-ifdown; then rm -f %D/etc/qemu-ifdown; fi Xetc/qemu-ifdown.sample X@exec if [ ! -f %D/etc/qemu-ifdown ] ; then cp -p %D/%F %B/qemu-ifdown; fi X%%PORTDOCS%%%%DOCSDIR%%/qemu-doc.html X%%PORTDOCS%%%%DOCSDIR%%/qemu-tech.html X%%PORTDOCS%%@dirrm %%DOCSDIR%% X%%DATADIR%%/bios.bin X%%DATADIR%%/vgabios.bin X%%DATADIR%%/vgabios-cirrus.bin X%%DATADIR%%/ppc_rom.bin X%%DATADIR%%/openbios-ppc X%%DATADIR%%/openbios-sparc32 X%%DATADIR%%/openbios-sparc64 X%%DATADIR%%/video.x X%%DATADIR%%/pxe-e1000.bin X%%DATADIR%%/pxe-i82559er.bin X%%DATADIR%%/pxe-ne2k_pci.bin X%%DATADIR%%/pxe-rtl8139.bin X%%DATADIR%%/pxe-pcnet.bin X%%DATADIR%%/pxe-virtio.bin X%%DATADIR%%/extboot.bin X%%DATADIR%%/linuxboot.bin X%%DATADIR%%/multiboot.bin X%%DATADIR%%/vapic.bin X%%DATADIR%%/petalogix-s3adsp1800.dtb X%%DATADIR%%/bamboo.dtb X%%DATADIR%%/keymaps/ar X%%DATADIR%%/keymaps/common X%%DATADIR%%/keymaps/da X%%DATADIR%%/keymaps/de X%%DATADIR%%/keymaps/de-ch X%%DATADIR%%/keymaps/en-gb X%%DATADIR%%/keymaps/en-us X%%DATADIR%%/keymaps/es X%%DATADIR%%/keymaps/et X%%DATADIR%%/keymaps/fi X%%DATADIR%%/keymaps/fo X%%DATADIR%%/keymaps/fr X%%DATADIR%%/keymaps/fr-be X%%DATADIR%%/keymaps/fr-ca X%%DATADIR%%/keymaps/fr-ch X%%DATADIR%%/keymaps/hr X%%DATADIR%%/keymaps/hu X%%DATADIR%%/keymaps/is X%%DATADIR%%/keymaps/it X%%DATADIR%%/keymaps/ja X%%DATADIR%%/keymaps/lt X%%DATADIR%%/keymaps/lv X%%DATADIR%%/keymaps/mk X%%DATADIR%%/keymaps/modifiers X%%DATADIR%%/keymaps/nl X%%DATADIR%%/keymaps/nl-be X%%DATADIR%%/keymaps/no X%%DATADIR%%/keymaps/pl X%%DATADIR%%/keymaps/pt X%%DATADIR%%/keymaps/pt-br X%%DATADIR%%/keymaps/ru X%%DATADIR%%/keymaps/sl X%%DATADIR%%/keymaps/sv X%%DATADIR%%/keymaps/th X%%DATADIR%%/keymaps/tr X@dirrm %%DATADIR%%/keymaps X@dirrm %%DATADIR%% 842cde48cf18b70a11b15515ca566742 echo c - files/ mkdir -p files/ > /dev/null 2>&1 echo x - files/cdrom-dma-patch sed 's/^X//' >files/cdrom-dma-patch << '0d7773fda2e4f1de66038e692fe436ee' XIndex: hw/ide/internal.h X@@ -27,7 +27,7 @@ X //#define DEBUG_IDE X //#define DEBUG_IDE_ATAPI X //#define DEBUG_AIO X-#define USE_DMA_CDROM X+// #define USE_DMA_CDROM X X /* Bits of HD_STATUS */ X #define ERR_STAT 0x01 0d7773fda2e4f1de66038e692fe436ee echo x - files/patch-90_security sed 's/^X//' >files/patch-90_security << '94eb8569679fd16e3ab97f012a304a14' XIndex: qemu-0.8.2/hw/dma.c X=================================================================== X--- qemu-0.8.2.orig/hw/dma.c 2006-07-22 20:23:34.000000000 +0300 X+++ qemu-0.8.2/hw/dma.c 2007-04-20 06:05:59.000000000 +0300 X@@ -340,9 +340,11 @@ static void channel_run (int ncont, int X #endif X X r = dma_controllers[ncont].regs + ichan; X- n = r->transfer_handler (r->opaque, ichan + (ncont << 2), X- r->now[COUNT], (r->base[COUNT] + 1) << ncont); X- r->now[COUNT] = n; X+ if (r->transfer_handler) { X+ n = r->transfer_handler (r->opaque, ichan + (ncont << 2), X+ r->now[COUNT], (r->base[COUNT] + 1) << ncont); X+ r->now[COUNT] = n; X+ } X ldebug ("dma_pos %d size %d\n", n, (r->base[COUNT] + 1) << ncont); X } X XIndex: qemu/hw/fdc.c X@@ -1322,7 +1322,8 @@ X fd_sector(cur_drv)); X return 0; X } X- if (bdrv_read(cur_drv->bs, fd_sector(cur_drv), fdctrl->fifo, 1) < 0) { X+ if (cur_drv->bs == NULL || X+ bdrv_read(cur_drv->bs, fd_sector(cur_drv), fdctrl->fifo, 1) < 0) { X FLOPPY_DPRINTF("error getting sector %d\n", X fd_sector(cur_drv)); X /* Sure, image size is too small... */ X@@ -1776,7 +1777,8 @@ X if (pos == FD_SECTOR_LEN - 1 || X fdctrl->data_pos == fdctrl->data_len) { X cur_drv = get_cur_drv(fdctrl); X- if (bdrv_write(cur_drv->bs, fd_sector(cur_drv), fdctrl->fifo, 1) < 0) { X+ if (cur_drv->bs == NULL || X+ bdrv_write(cur_drv->bs, fd_sector(cur_drv), fdctrl->fifo, 1) < 0) { X FLOPPY_ERROR("writing sector %d\n", fd_sector(cur_drv)); X return; X } XIndex: qemu-0.8.2/hw/pc.c X=================================================================== X--- qemu-0.8.2.orig/hw/pc.c 2007-04-20 06:05:58.000000000 +0300 X+++ qemu-0.8.2/hw/pc.c 2007-04-20 06:05:59.000000000 +0300 X@@ -312,7 +312,8 @@ void bochs_bios_write(void *opaque, uint X case 0x400: X case 0x401: X fprintf(stderr, "BIOS panic at rombios.c, line %d\n", val); X- exit(1); X+ /* according to documentation, these can be safely ignored */ X+ break; X case 0x402: X case 0x403: X #ifdef DEBUG_BIOS X@@ -335,8 +336,9 @@ void bochs_bios_write(void *opaque, uint X /* LGPL'ed VGA BIOS messages */ X case 0x501: X case 0x502: X+ /* according to documentation, these can be safely ignored */ X fprintf(stderr, "VGA BIOS panic, line %d\n", val); X- exit(1); X+ break; X case 0x500: X case 0x503: X #ifdef DEBUG_BIOS XIndex: qemu-0.8.2/hw/sb16.c X=================================================================== X--- qemu-0.8.2.orig/hw/sb16.c 2006-07-22 20:23:34.000000000 +0300 X+++ qemu-0.8.2/hw/sb16.c 2007-04-20 06:05:59.000000000 +0300 X@@ -1235,8 +1235,10 @@ static int SB_read_DMA (void *opaque, in X s->block_size); X #endif X X- while (s->left_till_irq <= 0) { X- s->left_till_irq = s->block_size + s->left_till_irq; X+ if (s->block_size) { X+ while (s->left_till_irq <= 0) { X+ s->left_till_irq = s->block_size + s->left_till_irq; X+ } X } X X return dma_pos; XIndex: qemu/hw/i8259.c X@@ -302,7 +302,8 @@ X s->init4 = val & 1; X s->single_mode = val & 2; X if (val & 0x08) X- hw_error("level sensitive irq not supported"); X+ /* hw_error("level sensitive irq not supported"); */ X+ return; X } else if (val & 0x08) { X if (val & 0x04) X s->poll = 1; 94eb8569679fd16e3ab97f012a304a14 echo x - files/patch-Makefile sed 's/^X//' >files/patch-Makefile << 'c0d7d903b7c552bc0b03b62518f82f5d' XIndex: qemu/Makefile X@@ -19,7 +19,11 @@ X LIBS+=-lz $(LIBS_TOOLS) X X ifdef BUILD_DOCS X+ifdef NOPORTDOCS X+DOCS=qemu.1 qemu-img.1 qemu-nbd.8 X+else X DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1 qemu-nbd.8 X+endif X else X DOCS= X endif X@@ -213,13 +217,13 @@ X endif X X install-doc: $(DOCS) X+ifndef NOPORTDOCS X $(INSTALL_DIR) "$(DESTDIR)$(docdir)" X $(INSTALL_DATA) qemu-doc.html qemu-tech.html "$(DESTDIR)$(docdir)" X+endif X ifdef CONFIG_POSIX X $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1" X $(INSTALL_DATA) qemu.1 qemu-img.1 "$(DESTDIR)$(mandir)/man1" X- $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man8" X- $(INSTALL_DATA) qemu-nbd.8 "$(DESTDIR)$(mandir)/man8" X endif X X install: all $(if $(BUILD_DOCS),install-doc) c0d7d903b7c552bc0b03b62518f82f5d echo x - files/patch-audio-ossaudio.c sed 's/^X//' >files/patch-audio-ossaudio.c << '84f796fb10979fbb2a8f15318c954adf' X--- a/audio/ossaudio.c X+++ b/audio/ossaudio.c X@@ -38,6 +38,10 @@ X #define AUDIO_CAP "oss" X #include "audio_int.h" X X+#if defined OSS_GETVERSION && defined SNDCTL_DSP_POLICY X+#define USE_DSP_POLICY X+#endif X+ X typedef struct OSSVoiceOut { X HWVoiceOut hw; X void *pcm_buf; X@@ -236,14 +240,39 @@ static void oss_dump_info (struct oss_pa X } X #endif X X+#ifdef USE_DSP_POLICY X+static int oss_get_version (int fd, int *version, const char *typ) X+{ X+ if (ioctl (fd, OSS_GETVERSION, &version)) { X+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) X+ /* X+ * Looks like atm (20100109) FreeBSD knows OSS_GETVERSION X+ * since 7.x, but currently only on the mixer device (or in X+ * the Linuxolator), and in the native version that part of X+ * the code is in fact never reached so the ioctl fails anyway. X+ * Until this is fixed, just check the errno and if its what X+ * FreeBSD's sound drivers return atm assume they are new enough. X+ */ X+ if (errno == EINVAL) { X+ *version = 0x040000; X+ return 0; X+ } X+#endif X+ oss_logerr2 (errno, typ, "Failed to get OSS version\n"); X+ return -1; X+ } X+ return 0; X+} X+#endif X+ X static int oss_open (int in, struct oss_params *req, X struct oss_params *obt, int *pfd) X { X int fd; X- int version; X int oflags = conf.exclusive ? O_EXCL : 0; X audio_buf_info abinfo; X int fmt, freq, nchannels; X+ int setfragment = 1; X const char *dspname = in ? conf.devpath_in : conf.devpath_out; X const char *typ = in ? "ADC" : "DAC"; X X@@ -281,27 +310,30 @@ static int oss_open (int in, struct oss_ X goto err; X } X X- if (ioctl (fd, OSS_GETVERSION, &version)) { X- oss_logerr2 (errno, typ, "Failed to get OSS version\n"); X- version = 0; X- } X+#ifdef USE_DSP_POLICY X+ if (conf.policy >= 0) { X+ int version; X X- if (conf.debug) { X- dolog ("OSS version = %#x\n", version); X- } X+ if (!oss_get_version (fd, &version, typ)) { X+ if (conf.debug) { X+ dolog ("OSS version = %#x\n", version); X+ } X X-#ifdef SNDCTL_DSP_POLICY X- if (conf.policy >= 0 && version >= 0x040000) { X- int policy = conf.policy; X- if (ioctl (fd, SNDCTL_DSP_POLICY, &policy)) { X- oss_logerr2 (errno, typ, "Failed to set timing policy to %d\n", X- conf.policy); X- goto err; X+ if (version >= 0x040000) { X+ int policy = conf.policy; X+ if (ioctl (fd, SNDCTL_DSP_POLICY, &policy)) { X+ oss_logerr2 (errno, typ, X+ "Failed to set timing policy to %d\n", X+ conf.policy); X+ goto err; X+ } X+ setfragment = 0; X+ } X } X } X- else X #endif X- { X+ X+ if (setfragment) { X int mmmmssss = (req->nfrags << 16) | ctz32 (req->fragsize); X if (ioctl (fd, SNDCTL_DSP_SETFRAGMENT, &mmmmssss)) { X oss_logerr2 (errno, typ, "Failed to set buffer length (%d, %d)\n", X@@ -857,7 +889,7 @@ static struct audio_option oss_options[] X .valp = &conf.exclusive, X .descr = "Open device in exclusive mode (vmix wont work)" X }, X-#ifdef SNDCTL_DSP_POLICY X+#ifdef USE_DSP_POLICY X { X .name = "POLICY", X .tag = AUD_OPT_INT, 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@@ -59,8 +59,6 @@ X .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } X .rodata1 : { *(.rodata1) } X .eh_frame_hdr : { *(.eh_frame_hdr) } X- .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) } X- .gcc_except_table : ONLY_IF_RO { *(.gcc_except_table) } X /* Adjust the address for the data segment. We want to adjust up to X the same address within the page on the next page up. */ X . = ALIGN (0x100000) - ((0x100000 - .) & (0x100000 - 1)); . = DATA_SEGMENT_ALIGN (0x100000, 0x1000); X@@ -86,8 +84,8 @@ X .data1 : { *(.data1) } X .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) } X .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } X- .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) } X- .gcc_except_table : ONLY_IF_RW { *(.gcc_except_table) } X+ .eh_frame : { KEEP (*(.eh_frame)) } X+ .gcc_except_table : { *(.gcc_except_table) } X .dynamic : { *(.dynamic) } X .ctors : X { X--- a/i386.ld X+++ b/i386.ld X@@ -1,57 +1,76 @@ X-/* ld script to make i386 Linux kernel X- * Written by Martin Mares ; X- */ X-OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") X+OUTPUT_FORMAT("elf32-i386-freebsd", "elf32-i386-freebsd", X+ "elf32-i386-freebsd") X OUTPUT_ARCH(i386) X ENTRY(_start) X SECTIONS X { X /* Read-only sections, merged into text segment: */ X- . = 0x60000000 + SIZEOF_HEADERS; X- .interp : { *(.interp) } X- .hash : { *(.hash) } X- .dynsym : { *(.dynsym) } X- .dynstr : { *(.dynstr) } X- .gnu.version : { *(.gnu.version) } X- .gnu.version_d : { *(.gnu.version_d) } X- .gnu.version_r : { *(.gnu.version_r) } X- .rel.text : X- { *(.rel.text) *(.rel.gnu.linkonce.t*) } X- .rela.text : X- { *(.rela.text) *(.rela.gnu.linkonce.t*) } X- .rel.data : X- { *(.rel.data) *(.rel.gnu.linkonce.d*) } X- .rela.data : X- { *(.rela.data) *(.rela.gnu.linkonce.d*) } X- .rel.rodata : X- { *(.rel.rodata) *(.rel.gnu.linkonce.r*) } X- .rela.rodata : X- { *(.rela.rodata) *(.rela.gnu.linkonce.r*) } X- .rel.got : { *(.rel.got) } X- .rela.got : { *(.rela.got) } X- .rel.ctors : { *(.rel.ctors) } X- .rela.ctors : { *(.rela.ctors) } X- .rel.dtors : { *(.rel.dtors) } X- .rela.dtors : { *(.rela.dtors) } X- .rel.init : { *(.rel.init) } X- .rela.init : { *(.rela.init) } X- .rel.fini : { *(.rel.fini) } X- .rela.fini : { *(.rela.fini) } X- .rel.bss : { *(.rel.bss) } X- .rela.bss : { *(.rela.bss) } X- .rel.plt : { *(.rel.plt) } X- .rela.plt : { *(.rela.plt) } X- .init : { *(.init) } =0x47ff041f X- .text : X+ PROVIDE (__executable_start = 0x60000000); . = 0x60000000 + SIZEOF_HEADERS; X+ .interp : { *(.interp) } X+ .hash : { *(.hash) } X+ .dynsym : { *(.dynsym) } X+ .dynstr : { *(.dynstr) } X+ .gnu.version : { *(.gnu.version) } X+ .gnu.version_d : { *(.gnu.version_d) } X+ .gnu.version_r : { *(.gnu.version_r) } X+ .rel.dyn : X+ { X+ *(.rel.init) X+ *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) X+ *(.rel.fini) X+ *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) X+ *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) X+ *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) X+ *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) X+ *(.rel.ctors) X+ *(.rel.dtors) X+ *(.rel.got) X+ *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) X+ } X+ .rela.dyn : X+ { X+ *(.rela.init) X+ *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) X+ *(.rela.fini) X+ *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) X+ *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) X+ *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) X+ *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) X+ *(.rela.ctors) X+ *(.rela.dtors) X+ *(.rela.got) X+ *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) X+ } X+ .rel.plt : { *(.rel.plt) } X+ .rela.plt : { *(.rela.plt) } X+ .init : X { X- *(.text) X+ KEEP (*(.init)) X+ } =0x90909090 X+ .plt : { *(.plt) } X+ .text : X+ { X+ *(.text .stub .text.* .gnu.linkonce.t.*) X /* .gnu.warning sections are handled specially by elf32.em. */ X *(.gnu.warning) X- *(.gnu.linkonce.t*) X- } =0x47ff041f X- _etext = .; X+ } =0x90909090 X+ .fini : X+ { X+ KEEP (*(.fini)) X+ } =0x90909090 X+ PROVIDE (__etext = .); X+ PROVIDE (_etext = .); X PROVIDE (etext = .); X- .fini : { *(.fini) } =0x47ff041f X+ .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } X+ .rodata1 : { *(.rodata1) } X+ .eh_frame_hdr : { *(.eh_frame_hdr) } X+ /* Adjust the address for the data segment. We want to adjust up to X+ the same address within the page on the next page up. */ X+ . = ALIGN (0x1000) - ((0x1000 - .) & (0x1000 - 1)); . = DATA_SEGMENT_ALIGN (0x1000, 0x1000); X+ /* Ensure the __preinit_array_start label is properly aligned. We X+ could instead move the label definition inside the section, but X+ the linker would then create the section even if it turns out to X+ be empty, which isn't pretty. */ X . = ALIGN(32 / 8); X PROVIDE (__preinit_array_start = .); X .preinit_array : { *(.preinit_array) } X@@ -62,56 +81,71 @@ X PROVIDE (__fini_array_start = .); X .fini_array : { *(.fini_array) } X PROVIDE (__fini_array_end = .); X- .rodata : { *(.rodata) *(.gnu.linkonce.r*) } X- .rodata1 : { *(.rodata1) } X- .reginfo : { *(.reginfo) } X- /* Adjust the address for the data segment. We want to adjust up to X- the same address within the page on the next page up. */ X- . = ALIGN(0x100000) + (. & (0x100000 - 1)); X- .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) } X- .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } X- .data : X+ .data : X { X- *(.data) X- *(.gnu.linkonce.d*) X- CONSTRUCTORS X+ *(.data .data.* .gnu.linkonce.d.*) X+ SORT(CONSTRUCTORS) X } X- .data1 : { *(.data1) } X- .ctors : X+ .data1 : { *(.data1) } X+ .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) } X+ .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } X+ .eh_frame : { KEEP (*(.eh_frame)) } X+ .gcc_except_table : { *(.gcc_except_table) } X+ .dynamic : { *(.dynamic) } X+ .ctors : X { X- *(.ctors) X+ /* gcc uses crtbegin.o to find the start of X+ the constructors, so we make sure it is X+ first. Because this is a wildcard, it X+ doesn't matter if the user does not X+ actually link against crtbegin.o; the X+ linker won't look for a file to match a X+ wildcard. The wildcard also means that it X+ doesn't matter which directory crtbegin.o X+ is in. */ X+ KEEP (*crtbegin*.o(.ctors)) X+ /* We don't want to include the .ctor section from X+ from the crtend.o file until after the sorted ctors. X+ The .ctor section from the crtend file contains the X+ end of ctors marker and it must be last */ X+ KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors)) X+ KEEP (*(SORT(.ctors.*))) X+ KEEP (*(.ctors)) X } X- .dtors : X+ .dtors : X { X- *(.dtors) X+ KEEP (*crtbegin*.o(.dtors)) X+ KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors)) X+ KEEP (*(SORT(.dtors.*))) X+ KEEP (*(.dtors)) X } X- .plt : { *(.plt) } X- .got : { *(.got.plt) *(.got) } X- .dynamic : { *(.dynamic) } X- /* We want the small data sections together, so single-instruction offsets X- can access them all, and initialized data all before uninitialized, so X- we can shorten the on-disk segment size. */ X- .sdata : { *(.sdata) } X- _edata = .; X+ .jcr : { KEEP (*(.jcr)) } X+ .got : { *(.got.plt) *(.got) } X+ _edata = .; X PROVIDE (edata = .); X __bss_start = .; X- .sbss : { *(.sbss) *(.scommon) } X- .bss : X+ .bss : X { X *(.dynbss) X- *(.bss) X+ *(.bss .bss.* .gnu.linkonce.b.*) X *(COMMON) X+ /* Align here to ensure that the .bss section occupies space up to X+ _end. Align after .bss to ensure correct alignment even if the X+ .bss section disappears because there are no input sections. */ X+ . = ALIGN(32 / 8); X } X- _end = . ; X+ . = ALIGN(32 / 8); X+ _end = .; X PROVIDE (end = .); X+ . = DATA_SEGMENT_END (.); X /* Stabs debugging sections. */ X- .stab 0 : { *(.stab) } X- .stabstr 0 : { *(.stabstr) } X- .stab.excl 0 : { *(.stab.excl) } X- .stab.exclstr 0 : { *(.stab.exclstr) } X- .stab.index 0 : { *(.stab.index) } X+ .stab 0 : { *(.stab) } X+ .stabstr 0 : { *(.stabstr) } X+ .stab.excl 0 : { *(.stab.excl) } X+ .stab.exclstr 0 : { *(.stab.exclstr) } X+ .stab.index 0 : { *(.stab.index) } X .stab.indexstr 0 : { *(.stab.indexstr) } X- .comment 0 : { *(.comment) } X+ .comment 0 : { *(.comment) } X /* DWARF debug sections. X Symbols in the DWARF debugging sections are relative to the beginning X of the section so we begin them at 0. */ X@@ -125,7 +159,7 @@ X .debug_aranges 0 : { *(.debug_aranges) } X .debug_pubnames 0 : { *(.debug_pubnames) } X /* DWARF 2 */ X- .debug_info 0 : { *(.debug_info) } X+ .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } X .debug_abbrev 0 : { *(.debug_abbrev) } X .debug_line 0 : { *(.debug_line) } X .debug_frame 0 : { *(.debug_frame) } X@@ -137,5 +171,5 @@ X .debug_funcnames 0 : { *(.debug_funcnames) } X .debug_typenames 0 : { *(.debug_typenames) } X .debug_varnames 0 : { *(.debug_varnames) } X- /* These must appear regardless of . */ X+ /DISCARD/ : { *(.note.GNU-stack) } X } c4f3b5ac0d5a16751629606127e1aeec echo x - files/patch-cache-utils.c sed 's/^X//' >files/patch-cache-utils.c << 'd9922954c756d82a737e02e5d1a41a42' X--- a/cache-utils.c X+++ b/cache-utils.c X@@ -57,6 +57,23 @@ X } X #endif X X+#ifdef __FreeBSD__ X+#include X+#include X+#include X+ X+static void ppc_init_cacheline_sizes(void) X+{ X+ size_t len = 4; X+ unsigned cacheline; X+ X+ sysctlbyname ("machdep.cacheline_size", &cacheline, &len, NULL, 0); X+ X+ qemu_cache_conf.dcache_bsize = cacheline; X+ qemu_cache_conf.icache_bsize = cacheline; X+} X+#endif X+ X #ifdef __linux__ X void qemu_cache_utils_init(char **envp) X { d9922954c756d82a737e02e5d1a41a42 echo x - files/patch-configure sed 's/^X//' >files/patch-configure << '5cae8e2426c154e1c1a4408c02b2ed73' XIndex: qemu/configure X@@ -1605,17 +1605,18 @@ X fi X X # Check if tools are available to build documentation. X-if test "$docs" != "no" ; then X- if test -x "`which texi2html 2>/dev/null`" -a \ X- -x "`which pod2man 2>/dev/null`" ; 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 test -x "`which texi2html 2>/dev/null`" -a \ X+# -x "`which pod2man 2>/dev/null`" ; 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+docs=yes 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' X--- a/cpu-exec.c X+++ b/cpu-exec.c X@@ -933,6 +933,20 @@ X # define TRAP_sig(context) REG_sig(trap, context) X #endif /* linux */ X X+#ifdef __FreeBSD__ X+#include X+# define IAR_sig(context) ((context)->uc_mcontext.mc_srr0) X+# define MSR_sig(context) ((context)->uc_mcontext.mc_srr1) X+# define CTR_sig(context) ((context)->uc_mcontext.mc_ctr) X+# define XER_sig(context) ((context)->uc_mcontext.mc_xer) X+# define LR_sig(context) ((context)->uc_mcontext.mc_lr) X+# define CR_sig(context) ((context)->uc_mcontext.mc_cr) X+/* Exception Registers access */ X+# define DAR_sig(context) ((context)->uc_mcontext.mc_dar) X+# define DSISR_sig(context) ((context)->uc_mcontext.mc_dsisr) X+# define TRAP_sig(context) ((context)->uc_mcontext.mc_exc) X+#endif /* __FreeBSD__ */ X+ X #ifdef __APPLE__ X # include X typedef struct ucontext SIGCONTEXT; X@@ -962,7 +976,11 @@ X void *puc) X { X siginfo_t *info = pinfo; X+#if defined (__FreeBSD__) X+ ucontext_t *uc = puc; X+#else X struct ucontext *uc = puc; X+#endif X unsigned long pc; X int is_write; X 070ab41523e9d3bc6975c39f45217a3c echo x - files/patch-fbsd sed 's/^X//' >files/patch-fbsd << '419e824d1c2046ae3aafdf57a2052a2a' XIndex: qemu/Makefile X@@ -49,7 +49,10 @@ X X -include config-all-devices.mak X X-build-all: $(DOCS) $(TOOLS) recurse-all X+build-all: $(DOCS) $(TOOLS) bsd/libmath.a recurse-all X+ X+bsd/libmath.a: X+ ( cd bsd ; unset MAKEFLAGS ; $(BSD_MAKE) CC=$(CC) ) X X config-host.h: config-host.h-timestamp X config-host.h-timestamp: config-host.mak X@@ -237,6 +240,7 @@ X X clean: X # avoid old build problems by removing potentially incorrect old files X+ ( cd bsd ; $(BSD_MAKE) clean ) X rm -f config.mak op-i386.h opc-i386.h gen-op-i386.h op-arm.h opc-arm.h gen-op-arm.h X rm -f *.o *.d *.a $(TOOLS) TAGS cscope.* *.pod *~ */*~ X rm -f slirp/*.o slirp/*.d audio/*.o audio/*.d block/*.o block/*.d net/*.o net/*.d XIndex: qemu/Makefile.target X@@ -137,7 +137,7 @@ X X obj-i386-y += ioport-user.o X X-ARLIBS=../libuser/libuser.a libqemu.a X+ARLIBS=../libuser/libuser.a libqemu.a ../bsd/libmath.a X X endif #CONFIG_BSD_USER X X@@ -293,7 +293,7 @@ X X monitor.o: qemu-monitor.h X X-ARLIBS=../libqemu_common.a libqemu.a $(HWLIB) X+ARLIBS=../libqemu_common.a libqemu.a $(HWLIB) ../bsd/libmath.a X X endif # CONFIG_SOFTMMU X XIndex: qemu/fpu/softfloat-native.c X@@ -9,7 +9,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-luvalley sed 's/^X//' >files/patch-luvalley << 'f127f7da34e99ceee57aa6f05854531e' X--- a/kvm/include/linux/kvm.h X+++ b/kvm/include/linux/kvm.h X@@ -161,6 +161,9 @@ struct kvm_pit_config { X #define KVM_EXIT_NMI 16 X #define KVM_EXIT_INTERNAL_ERROR 17 X X+//YXD X+#define KVM_EXIT_DOMU_INTR 19 X+ X /* For KVM_EXIT_INTERNAL_ERROR */ X #define KVM_INTERNAL_ERROR_EMULATION 1 X #define KVM_INTERNAL_ERROR_SIMUL_EX 2 X@@ -684,6 +687,10 @@ struct kvm_clock_data { X #define KVM_GET_VCPU_EVENTS _IOR(KVMIO, 0x9f, struct kvm_vcpu_events) X #define KVM_SET_VCPU_EVENTS _IOW(KVMIO, 0xa0, struct kvm_vcpu_events) X X+//YXD X+#define KVM_SET_VCPU_MMAP_ADDR _IO(KVMIO, 0xb0) /* in bytes */ X+#define KVM_DESTROY_VM _IO(KVMIO, 0xb1) X+ X #define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0) X X struct kvm_assigned_pci_dev { X--- a/kvm-all.c X+++ b/kvm-all.c X@@ -26,6 +26,54 @@ X #include "gdbstub.h" X #include "kvm.h" X X+#if 0 X+static int luvalley_ioctl(int fd, unsigned int cmd, void* arg, int *errno_p) X+{ X+ static int luvalley_cpu_type = 0; X+ int r = -EINVAL; X+ X+ if (luvalley_cpu_type == 0) { X+ unsigned eax, ebx, ecx, edx; X+ char vendor[16]; X+ asm ("cpuid" : "=a"(eax), "=b"(ebx), "=c"(ecx), "=d"(edx) : "0"(0)); X+ *(unsigned *)&vendor[0] = ebx; X+ *(unsigned *)&vendor[4] = edx; X+ *(unsigned *)&vendor[8] = ecx; X+ *(unsigned *)&vendor[12] = 0; X+ if (!strcmp(vendor, "GenuineIntel")) X+ luvalley_cpu_type = 1; X+ else if (!strcmp(vendor, "AuthenticAMD")) X+ luvalley_cpu_type = 2; X+ else X+ luvalley_cpu_type = 3; X+ } X+ X+ *errno_p = 0; X+ if (luvalley_cpu_type == 1) { X+ asm volatile (".byte 0x0f, 0x01, 0xc1" : "=a"(r) : "0"(fd), "c"(cmd), "d"(arg)); X+ } else if (luvalley_cpu_type == 2) { X+ asm volatile (".byte 0x0f, 0x01, 0xd9" : "=a"(r) : "0"(fd), "c"(cmd), "d"(arg)); X+ } X+ X+ if (r < 0 && r > -4096) { X+ *errno_p = -r; X+ return -1; X+ } X+ return r; X+} X+#else X+static inline int luvalley_ioctl(int fd, int cmd, unsigned long arg) X+{ X+ int r; X+ asm volatile ("vmcall" : "=a"(r) : "0"(fd), "c"(cmd), "d"(arg)); X+ if (r < 0 && r > -4096) { X+ errno = -r; X+ return -1; X+ } X+ return r; X+} X+#endif X+ X #ifdef KVM_UPSTREAM X /* KVM uses PAGE_SIZE in it's definition of COALESCED_MMIO_MAX */ X #define PAGE_SIZE TARGET_PAGE_SIZE X@@ -165,6 +213,7 @@ int kvm_irqchip_in_kernel(void) X } X X #ifdef KVM_UPSTREAM X+ X int kvm_pit_in_kernel(void) X { X return kvm_state->pit_in_kernel; X@@ -600,7 +649,9 @@ int kvm_cpu_exec(CPUState *env) X X kvm_arch_pre_run(env, run); X qemu_mutex_unlock_iothread(); X+ X ret = kvm_vcpu_ioctl(env, KVM_RUN, 0); X+ X qemu_mutex_lock_iothread(); X kvm_arch_post_run(env, run); X X@@ -822,14 +873,14 @@ void kvm_set_phys_mem(target_phys_addr_t X int kvm_ioctl(KVMState *s, int type, ...) X { X int ret; X- void *arg; X+ unsigned long arg; X va_list ap; X X va_start(ap, type); X- arg = va_arg(ap, void *); X+ arg = va_arg(ap, unsigned long); X va_end(ap); X X- ret = ioctl(s->fd, type, arg); X+ ret = luvalley_ioctl(s->fd, type, arg); X if (ret == -1) X ret = -errno; X X@@ -839,14 +890,14 @@ int kvm_ioctl(KVMState *s, int type, ... X int kvm_vm_ioctl(KVMState *s, int type, ...) X { X int ret; X- void *arg; X+ unsigned long arg; X va_list ap; X X va_start(ap, type); X- arg = va_arg(ap, void *); X+ arg = va_arg(ap, unsigned long); X va_end(ap); X X- ret = ioctl(s->vmfd, type, arg); X+ ret = luvalley_ioctl(s->vmfd, type, arg); X if (ret == -1) X ret = -errno; X X@@ -856,14 +907,14 @@ int kvm_vm_ioctl(KVMState *s, int type, X int kvm_vcpu_ioctl(CPUState *env, int type, ...) X { X int ret; X- void *arg; X+ unsigned long arg; X va_list ap; X X va_start(ap, type); X- arg = va_arg(ap, void *); X+ arg = va_arg(ap, unsigned long); X va_end(ap); X X- ret = ioctl(env->kvm_fd, type, arg); X+ ret = luvalley_ioctl(env->kvm_fd, type, arg); X if (ret == -1) X ret = -errno; X X--- a/qemu-kvm.c 2010-02-26 03:34:00.000000000 +0100 X+++ a/qemu-kvm.c 2010-04-09 16:31:47.000000000 +0200 X@@ -96,6 +96,29 @@ static QLIST_HEAD(, ioperm_data) ioperm_ X int kvm_abi = EXPECTED_KVM_API_VERSION; X int kvm_page_size; X X+ X+ X+#define ioctl(x, y, z) luvalley_ioctl((x), (y), (unsigned long)(z)) X+ X+#if 0 X+static inline int luvalley_ioctl(int fd, unsigned int cmd, unsigned long arg) X+{ X+ int r; X+ asm volatile ("vmcall" : "=a"(r) : "0"(fd), "c"(cmd), "d"(arg)); X+ if (r < 0 && r > -4096) { X+ errno = -r; X+ return -1; X+ } X+ return r; X+} X+#endif X+ X+void kvm_destroy_vm() X+{ X+ luvalley_ioctl(kvm_state->vmfd, KVM_DESTROY_VM, 0); X+} X+ X+ X #ifdef KVM_CAP_SET_GUEST_DEBUG X static int kvm_debug(CPUState *env, X struct kvm_debug_exit_arch *arch_info) X@@ -353,12 +376,15 @@ int kvm_init(int smp_cpus) X int fd; X int r, gsi_count; X X- X+#if 0 // YXD X fd = open("/dev/kvm", O_RDWR); X if (fd == -1) { X perror("open /dev/kvm"); X return -1; X } X+#else X+ fd = 0; X+#endif X r = ioctl(fd, KVM_GET_API_VERSION, 0); X if (r == -1) { X fprintf(stderr, X@@ -410,7 +436,7 @@ int kvm_init(int smp_cpus) X return kvm_create_context(); X X out_close: X- close(fd); X+ // close(fd); X return -1; X } X X@@ -455,14 +481,30 @@ static void kvm_create_vcpu(CPUState *en X fprintf(stderr, "get vcpu mmap size: %m\n"); X goto err_fd; X } X+#if 0 // YXD X env->kvm_run = X mmap(NULL, mmap_size, PROT_READ | PROT_WRITE, MAP_SHARED, env->kvm_fd, X 0); X+#else X+ env->kvm_run = X+ mmap(NULL, mmap_size, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS | MAP_LOCKED, -1, X+ 0); X+#endif X if (env->kvm_run == MAP_FAILED) { X fprintf(stderr, "mmap vcpu area: %m\n"); X goto err_fd; X } X X+ // YXD X+ memset(env->kvm_run, 0, mmap_size); X+ r = ioctl(env->kvm_fd, KVM_SET_VCPU_MMAP_ADDR, env->kvm_run); X+ if (r == -1) { X+ env->kvm_fd = -1; X+ r = -errno; X+ fprintf(stderr, "KVM_SET_VCPU_MMAP_ADDR error: %m\n"); X+ return; X+ } X+ X return; X err_fd: X close(env->kvm_fd); X@@ -914,8 +956,22 @@ int kvm_run(CPUState *env) X r = pre_kvm_run(kvm, env); X if (r) X return r; X+ X+//agn: X r = ioctl(fd, KVM_RUN, 0); X X+#if 0 X+ if (r == -1 && errno == EAGAIN) { X+ // YXD X+ extern unsigned long read_memory(unsigned long *addr); X+ unsigned long *pp; X+ pp = *(unsigned long **)&run->padding[200]; X+ // printf("AGAIN: %p, 0x%lx\n", pp, *pp); X+ *pp = read_memory(pp); X+ goto agn; X+ } X+#endif X+ X if (r == -1 && errno != EINTR && errno != EAGAIN) { X r = -errno; X post_kvm_run(kvm, env); X@@ -947,6 +1003,10 @@ int kvm_run(CPUState *env) X #endif X if (1) { X switch (run->exit_reason) { X+ //YXD X+ case KVM_EXIT_DOMU_INTR: X+ r = 0; X+ break; X case KVM_EXIT_UNKNOWN: X r = handle_unhandled(run->hw.hardware_exit_reason); X break; X@@ -2361,6 +2421,14 @@ int kvm_setup_guest_memory(void *area, u X if (ret) X perror("madvise"); X X+ // YXD: touch all memory to let kernel map it and then lock the memory. X+ memset(area, 0, size); X+ if (mlock(area, size) != 0) { X+ printf("Memory lock failed! Please run as the root user.\n"); X+ abort(); X+ return -ENOMEM; X+ } X+ X return ret; X } X X--- a/sdl.c X+++ b/sdl.c X@@ -423,11 +423,11 @@ static void sdl_update_caption(void) X } X X if (qemu_name) { X- snprintf(win_title, sizeof(win_title), "QEMU (%s)%s", qemu_name, status); X- snprintf(icon_title, sizeof(icon_title), "QEMU (%s)", qemu_name); X+ snprintf(win_title, sizeof(win_title), "Luvalley (%s)%s", qemu_name, status); X+ snprintf(icon_title, sizeof(icon_title), "Luvalley (%s)", qemu_name); X } else { X- snprintf(win_title, sizeof(win_title), "QEMU%s", status); X- snprintf(icon_title, sizeof(icon_title), "QEMU"); X+ snprintf(win_title, sizeof(win_title), "Luvalley%s", status); X+ snprintf(icon_title, sizeof(icon_title), "Luvalley"); X } X X SDL_WM_SetCaption(win_title, icon_title); X--- a/vl.c X+++ b/vl.c X@@ -4904,6 +4904,8 @@ static int virtcon_parse(const char *dev X return 0; X } X X+void kvm_destroy_vm(void); X+ X int main(int argc, char **argv, char **envp) X { X const char *gdbstub_dev = NULL; X@@ -6239,5 +6241,12 @@ int main(int argc, char **argv, char **e X quit_timers(); X net_cleanup(); X X+ kvm_destroy_vm(); X+ X return 0; X } X+ X+unsigned long read_memory(unsigned long *addr) X+{ X+ return *addr; X+} X--- a/vnc.c X+++ b/vnc.c X@@ -2034,9 +2034,9 @@ static int protocol_client_init(VncState X pixel_format_message(vs); X X if (qemu_name) X- size = snprintf(buf, sizeof(buf), "QEMU (%s)", qemu_name); X+ size = snprintf(buf, sizeof(buf), "Luvalley (%s)", qemu_name); X else X- size = snprintf(buf, sizeof(buf), "QEMU"); X+ size = snprintf(buf, sizeof(buf), "Luvalley"); X X vnc_write_u32(vs, size); X vnc_write(vs, buf, size); f127f7da34e99ceee57aa6f05854531e 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-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-sleep sed 's/^X//' >files/patch-sleep << '8b5fcb5b1af1e10738471d1cb967b007' X--- a/qemu-kvm.c X+++ b/qemu-kvm.c X@@ -1966,6 +1966,11 @@ static int kvm_main_loop_cpu(CPUState *e X } X if (run_cpu) { X kvm_cpu_exec(env); X+#if 1 X+ if (!kvm_arch_has_work(env)) X+ kvm_main_loop_wait(env, 10); X+ else X+#endif X kvm_main_loop_wait(env, 0); X } else { X kvm_main_loop_wait(env, 1000); 8b5fcb5b1af1e10738471d1cb967b007 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' X--- a/tcg/ppc/tcg-target.h X+++ b/tcg/ppc/tcg-target.h X@@ -69,7 +69,7 @@ X #define TCG_TARGET_CALL_STACK_OFFSET 24 X #elif defined _AIX X #define TCG_TARGET_CALL_STACK_OFFSET 52 X-#elif defined __linux__ X+#elif defined __linux__ || defined __FreeBSD__ X #define TCG_TARGET_CALL_ALIGN_ARGS 1 X #define TCG_TARGET_CALL_STACK_OFFSET 8 X #else 299020b1a8c4c1e67778e06ec7047576 echo x - files/patch-vl.c sed 's/^X//' >files/patch-vl.c << 'f69c3f76d51c4024d0b81177709e3839' XIndex: qemu/vl.c X@@ -57,6 +57,8 @@ X #include X #if defined(__FreeBSD__) || defined(__DragonFly__) X #include 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/patch-z-kvm-bsd sed 's/^X//' >files/patch-z-kvm-bsd << '43c2bd32acb59475f75ef69a867a4ee4' X--- a/qemu-kvm-x86.c X+++ b/qemu-kvm-x86.c X@@ -12,7 +12,9 @@ X #include X #include "hw/hw.h" X #include "gdbstub.h" X+#ifdef __linux__ X #include X+#endif X X #include "qemu-kvm.h" X #include "libkvm.h" X--- a/qemu-kvm.c X+++ b/qemu-kvm.c X@@ -27,7 +27,9 @@ X #include X #include X #include "compatfd.h" X+#ifdef __linux__ X #include X+#endif X X #define false 0 X #define true 1 X@@ -486,9 +488,21 @@ static void kvm_create_vcpu(CPUState *en X mmap(NULL, mmap_size, PROT_READ | PROT_WRITE, MAP_SHARED, env->kvm_fd, X 0); X #else X+#ifdef MAP_LOCKED X env->kvm_run = X mmap(NULL, mmap_size, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS | MAP_LOCKED, -1, X 0); X+#else X+ env->kvm_run = X+ mmap(NULL, mmap_size, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, -1, X+ 0); X+ memset(env->kvm_run, 0, mmap_size); X+ if (mlock(env->kvm_run, mmap_size) != 0) { X+ printf("Memory lock failed! Please run as the root user.\n"); X+ abort(); X+ return -ENOMEM; X+ } X+#endif X #endif X if (env->kvm_run == MAP_FAILED) { X fprintf(stderr, "mmap vcpu area: %m\n"); X@@ -1491,7 +1505,12 @@ int kvm_irqfd(kvm_context_t kvm, int gsi X #endif /* KVM_CAP_IRQFD */ X static inline unsigned long kvm_get_thread_id(void) X { X+#ifdef __linux__ X return syscall(SYS_gettid); X+#elif defined(__FreeBSD__) X+ /* XXX thr_self()? */ X+ return pthread_self(); X+#endif X } X X static void qemu_cond_wait(pthread_cond_t *cond) X@@ -2016,20 +2035,26 @@ int kvm_vcpu_inited(CPUState *env) X #ifdef TARGET_I386 X void kvm_hpet_disable_kpit(void) X { X+#ifdef CONFIG_KVM_PIT X struct kvm_pit_state2 ps2; X X kvm_get_pit2(kvm_context, &ps2); X ps2.flags |= KVM_PIT_FLAGS_HPET_LEGACY; X kvm_set_pit2(kvm_context, &ps2); X+#endif X } X X void kvm_hpet_enable_kpit(void) X { X+#ifdef CONFIG_KVM_PIT X struct kvm_pit_state2 ps2; X X kvm_get_pit2(kvm_context, &ps2); X ps2.flags &= ~KVM_PIT_FLAGS_HPET_LEGACY; X kvm_set_pit2(kvm_context, &ps2); X+#else X+ abort(); X+#endif X } X #endif X X@@ -2045,7 +2070,9 @@ int kvm_init_ap(void) X action.sa_flags = SA_SIGINFO; X action.sa_sigaction = (void (*)(int, siginfo_t*, void*))sigbus_handler; X sigaction(SIGBUS, &action, NULL); X+#ifdef __linux__ X prctl(PR_MCE_KILL, 1, 1); X+#endif X return 0; X } X 43c2bd32acb59475f75ef69a867a4ee4 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 struct { X #endif /* _WIN32 */ X { /* end of list */ } X }, X+#ifdef CONFIG_PCAP X+ }, { X+ .type = "pcap", X+ .init = net_init_pcap, X+ .desc = { X+ NET_COMMON_PARAMS_DESC, X+ { X+ .name = "ifname", X+ .type = QEMU_OPT_STRING, X+ .help = "interface name", X+ }, X+ { /* end of list */ } X+ }, X+#endif X }, { X .type = "socket", X .init = net_init_socket, X--- qemu-options.hx.orig 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' XIndex: hw/rtl8139.c X@@ -58,7 +58,7 @@ X //#define RTL8139_CALCULATE_RXCRC 1 X X /* Uncomment to enable on-board timer interrupts */ X-//#define RTL8139_ONBOARD_TIMER 1 X+#define RTL8139_ONBOARD_TIMER 1 X X #if defined(RTL8139_CALCULATE_RXCRC) X /* For crc32 */ ef19f92d3d50db459283f53ecb2e7fa6 exit