debuggers.hg
changeset 18549:71d3d3ac23b8
Remove internal tools/ioemu tree.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author | Keir Fraser <keir.fraser@citrix.com> |
---|---|
date | Thu Sep 18 10:32:40 2008 +0100 (2008-09-18) |
parents | 694b7daa353c |
children | 104ceb3de263 |
files | Config.mk stubdom/Makefile tools/Makefile tools/ioemu/.CVS/Entries tools/ioemu/.CVS/Repository tools/ioemu/.CVS/Root tools/ioemu/.CVS/Tag tools/ioemu/.cvsignore tools/ioemu/COPYING tools/ioemu/COPYING.LIB tools/ioemu/Changelog tools/ioemu/LICENSE tools/ioemu/Makefile tools/ioemu/Makefile.target tools/ioemu/README tools/ioemu/TODO tools/ioemu/VERSION tools/ioemu/a.out.h tools/ioemu/aes.c tools/ioemu/aes.h tools/ioemu/audio/.CVS/Entries tools/ioemu/audio/.CVS/Repository tools/ioemu/audio/.CVS/Root tools/ioemu/audio/.CVS/Tag tools/ioemu/audio/alsaaudio.c tools/ioemu/audio/audio.c tools/ioemu/audio/audio.h tools/ioemu/audio/audio_int.h tools/ioemu/audio/audio_template.h tools/ioemu/audio/coreaudio.c tools/ioemu/audio/dsound_template.h tools/ioemu/audio/dsoundaudio.c tools/ioemu/audio/fmodaudio.c tools/ioemu/audio/mixeng.c tools/ioemu/audio/mixeng.h tools/ioemu/audio/mixeng_template.h tools/ioemu/audio/noaudio.c tools/ioemu/audio/ossaudio.c tools/ioemu/audio/rate_template.h tools/ioemu/audio/sdlaudio.c tools/ioemu/audio/sys-queue.h tools/ioemu/audio/wavaudio.c tools/ioemu/audio/wavcapture.c tools/ioemu/block-bochs.c tools/ioemu/block-cloop.c tools/ioemu/block-cow.c tools/ioemu/block-dmg.c tools/ioemu/block-qcow.c tools/ioemu/block-qcow2.c tools/ioemu/block-raw.c tools/ioemu/block-vbd.c tools/ioemu/block-vmdk.c tools/ioemu/block-vpc.c tools/ioemu/block-vvfat.c tools/ioemu/block.c tools/ioemu/block_int.h tools/ioemu/bswap.h tools/ioemu/check_ops.sh tools/ioemu/cocoa.m tools/ioemu/configure tools/ioemu/console.c tools/ioemu/cpu-all.h tools/ioemu/cpu-defs.h tools/ioemu/cpu-exec.c tools/ioemu/cutils.c tools/ioemu/d3des.c tools/ioemu/d3des.h tools/ioemu/dis-asm.h tools/ioemu/disas.c tools/ioemu/disas.h tools/ioemu/dyngen-exec.h tools/ioemu/dyngen-op.h tools/ioemu/dyngen.c tools/ioemu/dyngen.h tools/ioemu/elf.h tools/ioemu/elf_ops.h tools/ioemu/exec-all.h tools/ioemu/exec.c tools/ioemu/fpu/.CVS/Entries tools/ioemu/fpu/.CVS/Repository tools/ioemu/fpu/.CVS/Root tools/ioemu/fpu/.CVS/Tag tools/ioemu/fpu/softfloat-macros.h tools/ioemu/fpu/softfloat-native.c tools/ioemu/fpu/softfloat-native.h tools/ioemu/fpu/softfloat-specialize.h tools/ioemu/fpu/softfloat.c tools/ioemu/fpu/softfloat.h tools/ioemu/gdbstub.c tools/ioemu/gdbstub.h tools/ioemu/hostregs_helper.h tools/ioemu/hw/.CVS/Entries tools/ioemu/hw/.CVS/Repository tools/ioemu/hw/.CVS/Root tools/ioemu/hw/.CVS/Tag tools/ioemu/hw/acpi.c tools/ioemu/hw/adb.c tools/ioemu/hw/adlib.c tools/ioemu/hw/apb_pci.c tools/ioemu/hw/apic.c tools/ioemu/hw/arm_boot.c tools/ioemu/hw/arm_gic.c tools/ioemu/hw/arm_pic.c tools/ioemu/hw/arm_pic.h tools/ioemu/hw/arm_sysctl.c tools/ioemu/hw/arm_timer.c tools/ioemu/hw/cdrom.c tools/ioemu/hw/cirrus_vga.c tools/ioemu/hw/cirrus_vga_rop.h tools/ioemu/hw/cirrus_vga_rop2.h tools/ioemu/hw/cs4231.c tools/ioemu/hw/cuda.c tools/ioemu/hw/dma.c tools/ioemu/hw/e100.c tools/ioemu/hw/e1000.c tools/ioemu/hw/e1000_hw.h tools/ioemu/hw/es1370.c tools/ioemu/hw/esp.c tools/ioemu/hw/extboot.c tools/ioemu/hw/fdc.c tools/ioemu/hw/fmopl.c tools/ioemu/hw/fmopl.h tools/ioemu/hw/grackle_pci.c tools/ioemu/hw/gt64xxx.c tools/ioemu/hw/heathrow_pic.c tools/ioemu/hw/i8254.c tools/ioemu/hw/i8259.c tools/ioemu/hw/ide.c tools/ioemu/hw/integratorcp.c tools/ioemu/hw/iommu.c tools/ioemu/hw/isa_mmio.c tools/ioemu/hw/lsi53c895a.c tools/ioemu/hw/m48t59.c tools/ioemu/hw/m48t59.h tools/ioemu/hw/mc146818rtc.c tools/ioemu/hw/mips_int.c tools/ioemu/hw/mips_malta.c tools/ioemu/hw/mips_r4k.c tools/ioemu/hw/mips_timer.c tools/ioemu/hw/ne2000.c tools/ioemu/hw/openpic.c tools/ioemu/hw/parallel.c tools/ioemu/hw/pass-through.c tools/ioemu/hw/pass-through.h tools/ioemu/hw/pc.c tools/ioemu/hw/pci.c tools/ioemu/hw/pci_emulation.c tools/ioemu/hw/pci_emulation.h tools/ioemu/hw/pci_host.h tools/ioemu/hw/pckbd.c tools/ioemu/hw/pcnet.c tools/ioemu/hw/pcspk.c tools/ioemu/hw/pflash_cfi02.c tools/ioemu/hw/piix4acpi.c tools/ioemu/hw/piix_pci.c tools/ioemu/hw/pl011.c tools/ioemu/hw/pl050.c tools/ioemu/hw/pl080.c tools/ioemu/hw/pl110.c tools/ioemu/hw/pl110_template.h tools/ioemu/hw/pl190.c tools/ioemu/hw/ppc.c tools/ioemu/hw/ppc_chrp.c tools/ioemu/hw/ppc_prep.c tools/ioemu/hw/prep_pci.c tools/ioemu/hw/ps2.c tools/ioemu/hw/pt-msi.c tools/ioemu/hw/pt-msi.h tools/ioemu/hw/realview.c tools/ioemu/hw/rtl8139.c tools/ioemu/hw/sb16.c tools/ioemu/hw/scsi-disk.c tools/ioemu/hw/serial.c tools/ioemu/hw/sh7750.c tools/ioemu/hw/sh7750_regnames.c tools/ioemu/hw/sh7750_regnames.h tools/ioemu/hw/sh7750_regs.h tools/ioemu/hw/shix.c tools/ioemu/hw/slavio_intctl.c tools/ioemu/hw/slavio_misc.c tools/ioemu/hw/slavio_serial.c tools/ioemu/hw/slavio_timer.c tools/ioemu/hw/smbus.h tools/ioemu/hw/smbus_eeprom.c tools/ioemu/hw/smc91c111.c tools/ioemu/hw/sparc32_dma.c tools/ioemu/hw/sun4m.c tools/ioemu/hw/sun4u.c tools/ioemu/hw/tc58128.c tools/ioemu/hw/tcx.c tools/ioemu/hw/tpm_tis.c tools/ioemu/hw/unin_pci.c tools/ioemu/hw/usb-hid.c tools/ioemu/hw/usb-hub.c tools/ioemu/hw/usb-msd.c tools/ioemu/hw/usb-ohci.c tools/ioemu/hw/usb-uhci.c tools/ioemu/hw/usb.c tools/ioemu/hw/usb.h tools/ioemu/hw/versatile_pci.c tools/ioemu/hw/versatilepb.c tools/ioemu/hw/vga.c tools/ioemu/hw/vga_int.h tools/ioemu/hw/vga_template.h tools/ioemu/hw/xen_blktap.c tools/ioemu/hw/xen_blktap.h tools/ioemu/hw/xen_console.c tools/ioemu/hw/xen_console.h tools/ioemu/hw/xen_machine_fv.c tools/ioemu/hw/xen_machine_pv.c tools/ioemu/hw/xen_platform.c tools/ioemu/hw/xenfb.c tools/ioemu/hw/xenfb.h tools/ioemu/i386-dis.c tools/ioemu/i386-vl.ld tools/ioemu/i386.ld tools/ioemu/ia64.ld tools/ioemu/keymaps.c tools/ioemu/keymaps/.CVS/Entries tools/ioemu/keymaps/.CVS/Repository tools/ioemu/keymaps/.CVS/Root tools/ioemu/keymaps/.CVS/Tag tools/ioemu/keymaps/ar tools/ioemu/keymaps/common tools/ioemu/keymaps/da tools/ioemu/keymaps/de tools/ioemu/keymaps/de-ch tools/ioemu/keymaps/en-gb tools/ioemu/keymaps/en-us tools/ioemu/keymaps/es tools/ioemu/keymaps/et tools/ioemu/keymaps/fi tools/ioemu/keymaps/fo tools/ioemu/keymaps/fr tools/ioemu/keymaps/fr-be tools/ioemu/keymaps/fr-ca tools/ioemu/keymaps/fr-ch tools/ioemu/keymaps/hr tools/ioemu/keymaps/hu tools/ioemu/keymaps/is tools/ioemu/keymaps/it tools/ioemu/keymaps/ja tools/ioemu/keymaps/lt tools/ioemu/keymaps/lv tools/ioemu/keymaps/mk tools/ioemu/keymaps/modifiers tools/ioemu/keymaps/nl tools/ioemu/keymaps/nl-be tools/ioemu/keymaps/no tools/ioemu/keymaps/pl tools/ioemu/keymaps/pt tools/ioemu/keymaps/pt-br tools/ioemu/keymaps/ru tools/ioemu/keymaps/sl tools/ioemu/keymaps/sv tools/ioemu/keymaps/th tools/ioemu/keymaps/tr tools/ioemu/kqemu.c tools/ioemu/kqemu.h tools/ioemu/loader.c tools/ioemu/monitor.c tools/ioemu/osdep.c tools/ioemu/osdep.h tools/ioemu/patches/acpi-poweroff-support tools/ioemu/patches/acpi-support tools/ioemu/patches/acpi-timer-support tools/ioemu/patches/domain-destroy tools/ioemu/patches/domain-reset tools/ioemu/patches/domain-timeoffset tools/ioemu/patches/fix-interrupt-routing tools/ioemu/patches/fix-vga-scanning-code-overflow tools/ioemu/patches/hypervisor-pit tools/ioemu/patches/hypervisor-rtc tools/ioemu/patches/ide-cd-dma tools/ioemu/patches/ide-error-reporting tools/ioemu/patches/ide-hd-multithread tools/ioemu/patches/ioemu-buffer-pio-ia64 tools/ioemu/patches/ioemu-ia64 tools/ioemu/patches/ioemu-save-restore tools/ioemu/patches/ioemu-save-restore-acpi tools/ioemu/patches/ioemu-save-restore-ide tools/ioemu/patches/ioemu-save-restore-logdirty tools/ioemu/patches/ioemu-save-restore-ne2000 tools/ioemu/patches/ioemu-save-restore-pcnet tools/ioemu/patches/ioemu-save-restore-rtl8139 tools/ioemu/patches/ioemu-save-restore-timer tools/ioemu/patches/ioemu-save-restore-usb tools/ioemu/patches/limit-fdc-sector-size-to-16K tools/ioemu/patches/ne2000-bounds-checks tools/ioemu/patches/nodelay-serial-over-tcp tools/ioemu/patches/qemu-64bit tools/ioemu/patches/qemu-allow-disable-sdl tools/ioemu/patches/qemu-block-device-bounds-checks tools/ioemu/patches/qemu-bootorder tools/ioemu/patches/qemu-bugfixes tools/ioemu/patches/qemu-cirrus-bounds-checks tools/ioemu/patches/qemu-cleanup tools/ioemu/patches/qemu-daemonize tools/ioemu/patches/qemu-dm tools/ioemu/patches/qemu-dma-null-pointer-check tools/ioemu/patches/qemu-fix-memset-args tools/ioemu/patches/qemu-hvm-banner tools/ioemu/patches/qemu-init-vgabios tools/ioemu/patches/qemu-logging tools/ioemu/patches/qemu-no-apic tools/ioemu/patches/qemu-nobios tools/ioemu/patches/qemu-pci tools/ioemu/patches/qemu-pci-vendor-ids tools/ioemu/patches/qemu-serial-fixes tools/ioemu/patches/qemu-smp tools/ioemu/patches/qemu-target-i386-dm tools/ioemu/patches/qemu-timer tools/ioemu/patches/qemu-tunable-ide-write-cache tools/ioemu/patches/remove-pci-bridge-setup tools/ioemu/patches/rtl8139-bound-chaining tools/ioemu/patches/scsi tools/ioemu/patches/sdl-mouse-invisible-wall tools/ioemu/patches/serial-non-block tools/ioemu/patches/serial-port-rate-limit tools/ioemu/patches/series tools/ioemu/patches/shadow-vram tools/ioemu/patches/shared-vram tools/ioemu/patches/support-xm-console tools/ioemu/patches/tpm-tis-device tools/ioemu/patches/usb-mouse-tablet-status-check tools/ioemu/patches/usb-uhci-buffer-size tools/ioemu/patches/vnc-altgr-keysym tools/ioemu/patches/vnc-backoff-screen-scan tools/ioemu/patches/vnc-cleanup tools/ioemu/patches/vnc-display-find-unused tools/ioemu/patches/vnc-fix-signedness tools/ioemu/patches/vnc-fix-text-display-shift-key tools/ioemu/patches/vnc-fix-version-check tools/ioemu/patches/vnc-fixes tools/ioemu/patches/vnc-japan-keymap tools/ioemu/patches/vnc-keypad-handling tools/ioemu/patches/vnc-monitor-shift-key-processing tools/ioemu/patches/vnc-password tools/ioemu/patches/vnc-protocol-fixes tools/ioemu/patches/vnc-start-vncviewer tools/ioemu/patches/vnc-title-domain-name tools/ioemu/patches/xen-build tools/ioemu/patches/xen-domain-name tools/ioemu/patches/xen-domid tools/ioemu/patches/xen-mapcache tools/ioemu/patches/xen-mm tools/ioemu/patches/xen-network tools/ioemu/patches/xen-platform-device tools/ioemu/patches/xen-support-buffered-ioreqs tools/ioemu/patches/xenstore tools/ioemu/patches/xenstore-block-device-config tools/ioemu/patches/xenstore-device-info-functions tools/ioemu/patches/xenstore-write-vnc-port tools/ioemu/pc-bios/.CVS/Entries tools/ioemu/pc-bios/.CVS/Repository tools/ioemu/pc-bios/.CVS/Root tools/ioemu/pc-bios/.CVS/Tag tools/ioemu/pc-bios/Makefile tools/ioemu/pc-bios/README tools/ioemu/pc-bios/bios.diff tools/ioemu/pc-bios/linux_boot.S tools/ioemu/pc-bios/ohw.diff tools/ioemu/pc-bios/pxe-ne2k_pci.bin tools/ioemu/pc-bios/pxe-pcnet.bin tools/ioemu/pc-bios/pxe-rtl8139.bin tools/ioemu/pc-bios/vgabios.diff tools/ioemu/pc-bios/video.x tools/ioemu/qemu-binfmt-conf.sh tools/ioemu/qemu-doc.texi tools/ioemu/qemu-img.c tools/ioemu/qemu-img.texi tools/ioemu/qemu-tech.texi tools/ioemu/qemu_socket.h tools/ioemu/readline.c tools/ioemu/sdl.c tools/ioemu/sdl_keysym.h tools/ioemu/softmmu_exec.h tools/ioemu/softmmu_header.h tools/ioemu/softmmu_template.h tools/ioemu/tap-win32.c tools/ioemu/tapdisk-ioemu.c tools/ioemu/target-i386-dm/cpu.h tools/ioemu/target-i386-dm/exec-dm.c tools/ioemu/target-i386-dm/helper2.c tools/ioemu/target-i386-dm/i8259-dm.c tools/ioemu/target-i386-dm/piix_pci-dm.c tools/ioemu/target-i386-dm/qemu-dm.debug tools/ioemu/target-i386-dm/qemu-ifup tools/ioemu/target-i386-dm/rtc-dm.c tools/ioemu/target-i386/.CVS/Entries tools/ioemu/target-i386/.CVS/Repository tools/ioemu/target-i386/.CVS/Root tools/ioemu/target-i386/.CVS/Tag tools/ioemu/target-i386/cpu.h tools/ioemu/target-i386/exec.h tools/ioemu/target-i386/helper.c tools/ioemu/target-i386/helper2.c tools/ioemu/target-i386/op.c tools/ioemu/target-i386/opreg_template.h tools/ioemu/target-i386/ops_mem.h tools/ioemu/target-i386/ops_sse.h tools/ioemu/target-i386/ops_template.h tools/ioemu/target-i386/ops_template_mem.h tools/ioemu/target-i386/translate-copy.c tools/ioemu/target-i386/translate.c tools/ioemu/tests/.CVS/Entries tools/ioemu/tests/.CVS/Repository tools/ioemu/tests/.CVS/Root tools/ioemu/tests/.CVS/Tag tools/ioemu/tests/.cvsignore tools/ioemu/tests/Makefile tools/ioemu/tests/hello-arm.c tools/ioemu/tests/hello-i386.c tools/ioemu/tests/hello-mips.c tools/ioemu/tests/linux-test.c tools/ioemu/tests/qruncom.c tools/ioemu/tests/runcom.c tools/ioemu/tests/sha1.c tools/ioemu/tests/test-i386-code16.S tools/ioemu/tests/test-i386-muldiv.h tools/ioemu/tests/test-i386-shift.h tools/ioemu/tests/test-i386-vm86.S tools/ioemu/tests/test-i386.c tools/ioemu/tests/test-i386.h tools/ioemu/tests/test_path.c tools/ioemu/tests/testthread.c tools/ioemu/texi2pod.pl tools/ioemu/thunk.c tools/ioemu/thunk.h tools/ioemu/translate-all.c tools/ioemu/translate-op.c tools/ioemu/usb-linux.c tools/ioemu/vgafont.h tools/ioemu/vl.c tools/ioemu/vl.h tools/ioemu/vnc.c tools/ioemu/vnc_keysym.h tools/ioemu/vnchextile.h tools/ioemu/x86_64.ld tools/ioemu/x_keymap.c tools/ioemu/xenfbfront.c tools/ioemu/xenstore.c |
line diff
1.1 --- a/Config.mk Wed Sep 17 14:16:02 2008 +0100 1.2 +++ b/Config.mk Thu Sep 18 10:32:40 2008 +0100 1.3 @@ -100,9 +100,8 @@ QEMU_REMOTE=http://xenbits.xensource.com 1.4 1.5 # Specify which qemu-dm to use. This may be `ioemu' to use the old 1.6 # Mercurial in-tree version, or a local directory, or a git URL. 1.7 -# CONFIG_QEMU ?= ioemu 1.8 -# CONFIG_QEMU ?= ../qemu-xen.git 1.9 -CONFIG_QEMU ?= $(QEMU_REMOTE) 1.10 +# CONFIG_QEMU ?= ../qemu-xen.git 1.11 +CONFIG_QEMU ?= $(QEMU_REMOTE) 1.12 1.13 # Optional components 1.14 XENSTAT_XENTOP ?= y
2.1 --- a/stubdom/Makefile Wed Sep 17 14:16:02 2008 +0100 2.2 +++ b/stubdom/Makefile Thu Sep 18 10:32:40 2008 +0100 2.3 @@ -167,10 +167,6 @@ lwip-$(XEN_TARGET_ARCH): lwip-$(LWIP_VER 2.4 2.5 ioemu/linkfarm.stamp: $(XEN_ROOT)/tools/ioemu-dir 2.6 mkdir -p ioemu 2.7 -ifeq ($(CONFIG_QEMU),ioemu) 2.8 - [ -h ioemu/Makefile ] || ( cd ioemu && \ 2.9 - ln -sf ../$(XEN_ROOT)/tools/ioemu/* .) 2.10 -else 2.11 set -e; \ 2.12 $(absolutify_xen_root); \ 2.13 cd ioemu; \ 2.14 @@ -181,7 +177,6 @@ else 2.15 '*.html' '*.pod' \ 2.16 )) | \ 2.17 while read f; do rm -f "$$f"; ln -s "$$src/$$f" "$$f"; done 2.18 -endif 2.19 touch ioemu/linkfarm.stamp 2.20 2.21 mk-headers-$(XEN_TARGET_ARCH): ioemu/linkfarm.stamp 2.22 @@ -228,18 +223,11 @@ libxc-$(XEN_TARGET_ARCH)/libxenctrl.a li 2.23 2.24 .PHONY: ioemu 2.25 ioemu: cross-zlib cross-libpci libxc 2.26 -ifeq ($(CONFIG_QEMU),ioemu) 2.27 - [ -f ioemu/config-host.mak ] || \ 2.28 - ( cd ioemu ; \ 2.29 - XEN_TARGET_ARCH=$(XEN_TARGET_ARCH) CFLAGS="$(TARGET_CFLAGS)" sh configure --prefix=/usr --enable-stubdom $(IOEMU_OPTIONS)) 2.30 - CPPFLAGS="$(TARGET_CPPFLAGS)" $(MAKE) -C ioemu LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) TOOLS= 2.31 -else 2.32 [ -f ioemu/config-host.mak ] || \ 2.33 ( $(absolutify_xen_root); \ 2.34 cd ioemu ; \ 2.35 CONFIG_STUBDOM=yes XEN_TARGET_ARCH=$(XEN_TARGET_ARCH) CFLAGS="$(TARGET_CFLAGS)" sh ./xen-setup --cc=$(CC) --disable-gcc-check $(IOEMU_OPTIONS)) 2.36 CPPFLAGS= TARGET_CPPFLAGS="$(TARGET_CPPFLAGS)" $(MAKE) -C ioemu LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) TOOLS= CONFIG_STUBDOM=yes 2.37 -endif 2.38 2.39 ###### 2.40 # caml 2.41 @@ -281,11 +269,7 @@ grub: grub-upstream $(CROSS_ROOT) 2.42 ######## 2.43 2.44 .PHONY: ioemu-stubdom 2.45 -ifeq ($(CONFIG_QEMU),ioemu) 2.46 -ioemu-stubdom: APP_OBJS=$(CURDIR)/ioemu/i386-dm-stubdom/qemu.a $(CURDIR)/ioemu/i386-dm-stubdom/libqemu.a 2.47 -else 2.48 ioemu-stubdom: APP_OBJS=$(CURDIR)/ioemu/i386-stubdom/qemu.a $(CURDIR)/ioemu/i386-stubdom/libqemu.a $(CURDIR)/ioemu/libqemu_common.a 2.49 -endif 2.50 ioemu-stubdom: mini-os-$(XEN_TARGET_ARCH)-ioemu lwip-$(XEN_TARGET_ARCH) libxc ioemu 2.51 DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="-DCONFIG_QEMU $(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" $(MAKE) -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$< LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) APP_OBJS="$(APP_OBJS)" 2.52
3.1 --- a/tools/Makefile Wed Sep 17 14:16:02 2008 +0100 3.2 +++ b/tools/Makefile Thu Sep 18 10:32:40 2008 +0100 3.3 @@ -23,12 +23,7 @@ SUBDIRS-y += blktap 3.4 SUBDIRS-y += libfsimage 3.5 SUBDIRS-$(LIBXENAPI_BINDINGS) += libxen 3.6 SUBDIRS-y += fs-back 3.7 - 3.8 -ifeq (ioemu,$(CONFIG_QEMU)) 3.9 -SUBDIRS-$(CONFIG_IOEMU) += ioemu 3.10 -else 3.11 SUBDIRS-$(CONFIG_IOEMU) += ioemu-dir 3.12 -endif 3.13 3.14 # These don't cross-compile 3.15 ifeq ($(XEN_COMPILE_ARCH),$(XEN_TARGET_ARCH))
4.1 --- a/tools/ioemu/.CVS/Entries Wed Sep 17 14:16:02 2008 +0100 4.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 4.3 @@ -1,117 +0,0 @@ 4.4 -D/audio//// 4.5 -D/hw//// 4.6 -D/pc-bios//// 4.7 -D/target-i386//// 4.8 -D/tests//// 4.9 -D/fpu//// 4.10 -D/keymaps//// 4.11 -/.cvsignore/1.16/Thu May 3 17:17:53 2007//Trelease_0_9_0 4.12 -/COPYING/1.1/Thu Jul 13 09:23:22 2006//Trelease_0_9_0 4.13 -/COPYING.LIB/1.2/Thu Jul 13 09:23:22 2006//Trelease_0_9_0 4.14 -/Changelog/1.128/Thu May 3 17:17:53 2007//Trelease_0_9_0 4.15 -/LICENSE/1.3/Thu May 3 17:17:53 2007//Trelease_0_9_0 4.16 -/Makefile/1.112/Thu May 3 17:17:53 2007//Trelease_0_9_0 4.17 -/Makefile.target/1.144/Thu May 3 17:17:53 2007//Trelease_0_9_0 4.18 -/README/1.12/Wed Oct 18 10:11:20 2006//Trelease_0_9_0 4.19 -/TODO/1.39/Fri Jan 5 14:34:35 2007//Trelease_0_9_0 4.20 -/VERSION/1.30/Thu May 3 17:17:53 2007//Trelease_0_9_0 4.21 -/a.out.h/1.2/Wed Oct 18 10:11:20 2006//Trelease_0_9_0 4.22 -/aes.c/1.1/Thu Jul 13 09:23:22 2006//Trelease_0_9_0 4.23 -/aes.h/1.1/Thu Jul 13 09:23:22 2006//Trelease_0_9_0 4.24 -/alpha-dis.c/1.3/Thu May 3 17:17:54 2007//Trelease_0_9_0 4.25 -/alpha.ld/1.1/Thu May 3 17:17:54 2007//Trelease_0_9_0 4.26 -/arm-dis.c/1.3/Thu May 3 17:17:54 2007//Trelease_0_9_0 4.27 -/arm-semi.c/1.2/Sun Jan 28 03:10:55 2007//Trelease_0_9_0 4.28 -/arm.ld/1.2/Thu May 3 17:17:54 2007//Trelease_0_9_0 4.29 -/block-bochs.c/1.3/Thu May 3 17:17:54 2007//Trelease_0_9_0 4.30 -/block-cloop.c/1.4/Thu May 3 17:17:54 2007//Trelease_0_9_0 4.31 -/block-cow.c/1.7/Thu May 3 17:17:54 2007//Trelease_0_9_0 4.32 -/block-dmg.c/1.5/Thu May 3 17:17:54 2007//Trelease_0_9_0 4.33 -/block-qcow.c/1.11/Thu May 3 17:17:54 2007//Trelease_0_9_0 4.34 -/block-qcow2.c/1.4/Mon Aug 7 02:38:06 2006//Trelease_0_9_0 4.35 -/block-raw.c/1.17/Thu Jan 18 00:22:11 2007//Trelease_0_9_0 4.36 -/block-vmdk.c/1.10/Thu May 3 17:17:55 2007//Trelease_0_9_0 4.37 -/block-vpc.c/1.4/Thu May 3 17:17:55 2007//Trelease_0_9_0 4.38 -/block-vvfat.c/1.8/Thu May 3 17:17:55 2007//Trelease_0_9_0 4.39 -/block.c/1.42/Thu May 3 17:17:55 2007//Trelease_0_9_0 4.40 -/block_int.h/1.10/Thu May 3 17:17:55 2007//Trelease_0_9_0 4.41 -/bswap.h/1.5/Thu Jul 13 09:23:22 2006//Trelease_0_9_0 4.42 -/check_ops.sh/1.1/Sun Jan 7 19:38:08 2007//Trelease_0_9_0 4.43 -/cocoa.m/1.10/Fri Jan 5 14:34:35 2007//Trelease_0_9_0 4.44 -/configure/1.120/Thu May 3 17:17:55 2007//Trelease_0_9_0 4.45 -/console.c/1.11/Thu May 3 17:17:55 2007//Trelease_0_9_0 4.46 -/cpu-all.h/1.60/Thu May 3 17:17:55 2007//Trelease_0_9_0 4.47 -/cpu-defs.h/1.17/Thu May 3 17:17:55 2007//Trelease_0_9_0 4.48 -/cpu-exec.c/1.93/Thu May 3 17:17:55 2007//Trelease_0_9_0 4.49 -/cutils.c/1.1/Sun Jan 7 22:04:40 2007//Trelease_0_9_0 4.50 -/dis-asm.h/1.11/Wed Oct 18 10:11:20 2006//Trelease_0_9_0 4.51 -/disas.c/1.34/Thu May 3 17:17:55 2007//Trelease_0_9_0 4.52 -/disas.h/1.7/Thu May 3 17:17:36 2007//Trelease_0_9_0 4.53 -/dyngen-exec.h/1.31/Thu May 3 17:17:55 2007//Trelease_0_9_0 4.54 -/dyngen-op.h/1.1/Wed Oct 18 10:11:20 2006//Trelease_0_9_0 4.55 -/dyngen.c/1.47/Thu May 3 17:17:55 2007//Trelease_0_9_0 4.56 -/dyngen.h/1.12/Thu May 3 17:17:55 2007//Trelease_0_9_0 4.57 -/elf.h/1.8/Thu May 3 17:17:55 2007//Trelease_0_9_0 4.58 -/elf_ops.h/1.5/Thu May 3 17:17:55 2007//Trelease_0_9_0 4.59 -/exec-all.h/1.49/Thu May 3 17:17:55 2007//Trelease_0_9_0 4.60 -/exec.c/1.85/Thu May 3 17:17:55 2007//Trelease_0_9_0 4.61 -/gdbstub.c/1.47/Thu May 3 17:17:55 2007//Trelease_0_9_0 4.62 -/gdbstub.h/1.5/Thu May 3 17:17:55 2007//Trelease_0_9_0 4.63 -/hostregs_helper.h/1.1/Sun Feb 4 13:37:44 2007//Trelease_0_9_0 4.64 -/i386-dis.c/1.5/Wed Oct 18 10:11:21 2006//Trelease_0_9_0 4.65 -/i386-vl.ld/1.3/Wed Oct 18 10:11:21 2006//Trelease_0_9_0 4.66 -/i386.ld/1.2/Wed Oct 18 10:11:21 2006//Trelease_0_9_0 4.67 -/ia64.ld/1.1/Wed Oct 18 10:11:21 2006//Trelease_0_9_0 4.68 -/keymaps.c/1.2/Thu May 3 17:17:34 2007//Trelease_0_9_0 4.69 -/kqemu.c/1.15/Thu May 3 17:17:55 2007//Trelease_0_9_0 4.70 -/kqemu.h/1.1/Wed Oct 18 10:11:21 2006//Trelease_0_9_0 4.71 -/loader.c/1.4/Thu May 3 17:17:55 2007//Trelease_0_9_0 4.72 -/m68k-dis.c/1.1/Thu May 3 17:17:56 2007//Trelease_0_9_0 4.73 -/m68k.ld/1.1/Thu May 3 17:17:56 2007//Trelease_0_9_0 4.74 -/mips-dis.c/1.4/Thu May 3 17:17:57 2007//Trelease_0_9_0 4.75 -/monitor.c/1.64/Thu May 3 17:17:57 2007//Trelease_0_9_0 4.76 -/osdep.c/1.15/Thu May 3 17:17:57 2007//Trelease_0_9_0 4.77 -/osdep.h/1.8/Thu May 3 17:17:57 2007//Trelease_0_9_0 4.78 -/ppc-dis.c/1.7/Thu May 3 17:17:58 2007//Trelease_0_9_0 4.79 -/ppc.ld/1.2/Thu May 3 17:17:58 2007//Trelease_0_9_0 4.80 -/qemu-binfmt-conf.sh/1.4/Wed Oct 18 10:11:21 2006//Trelease_0_9_0 4.81 -/qemu-doc.texi/1.128/Thu May 3 17:17:58 2007//Trelease_0_9_0 4.82 -/qemu-img.c/1.16/Thu May 3 17:17:58 2007//Trelease_0_9_0 4.83 -/qemu-img.texi/1.3/Thu May 3 17:17:58 2007//Trelease_0_9_0 4.84 -/qemu-tech.texi/1.9/Wed Oct 18 10:11:21 2006//Trelease_0_9_0 4.85 -/qemu_socket.h/1.2/Thu May 3 17:17:58 2007//Trelease_0_9_0 4.86 -/readline.c/1.1/Wed Oct 18 10:11:21 2006//Trelease_0_9_0 4.87 -/s390.ld/1.1/Thu May 3 17:17:58 2007//Trelease_0_9_0 4.88 -/sdl.c/1.34/Thu May 3 17:17:58 2007//Trelease_0_9_0 4.89 -/sdl_keysym.h/1.3/Wed Oct 18 10:11:21 2006//Trelease_0_9_0 4.90 -/sh4-dis.c/1.1/Thu May 3 17:17:58 2007//Trelease_0_9_0 4.91 -/softmmu_exec.h/1.1/Wed Oct 18 10:11:21 2006//Trelease_0_9_0 4.92 -/softmmu_header.h/1.13/Wed Oct 18 10:11:21 2006//Trelease_0_9_0 4.93 -/softmmu_template.h/1.16/Wed Oct 18 10:11:21 2006//Trelease_0_9_0 4.94 -/sparc-dis.c/1.3/Thu May 3 17:17:59 2007//Trelease_0_9_0 4.95 -/sparc.ld/1.1/Thu May 3 17:17:59 2007//Trelease_0_9_0 4.96 -/sparc64.ld/1.1/Fri Aug 4 21:55:15 2006//Trelease_0_9_0 4.97 -/tap-win32.c/1.4/Thu May 3 17:17:59 2007//Trelease_0_9_0 4.98 -/texi2pod.pl/1.1/Wed Oct 18 10:11:21 2006//Trelease_0_9_0 4.99 -/thunk.c/1.6/Wed Oct 18 10:11:21 2006//Trelease_0_9_0 4.100 -/thunk.h/1.13/Thu Jul 13 09:23:22 2006//Trelease_0_9_0 4.101 -/translate-all.c/1.15/Thu May 3 17:17:59 2007//Trelease_0_9_0 4.102 -/translate-op.c/1.1/Wed Oct 18 10:11:21 2006//Trelease_0_9_0 4.103 -/usb-linux.c/1.10/Thu May 3 17:17:59 2007//Trelease_0_9_0 4.104 -/vgafont.h/1.1/Thu Jul 13 09:23:22 2006//Trelease_0_9_0 4.105 -/vl.c/1.248/Thu May 3 17:17:59 2007//Trelease_0_9_0 4.106 -/vl.h/1.184/Thu May 3 17:17:59 2007//Trelease_0_9_0 4.107 -/vnc.c/1.12/Thu May 3 17:17:59 2007//Trelease_0_9_0 4.108 -/vnc_keysym.h/1.2/Thu May 3 17:17:59 2007//Trelease_0_9_0 4.109 -/vnchextile.h/1.3/Thu May 3 17:17:59 2007//Trelease_0_9_0 4.110 -/x86_64.ld/1.1/Thu Jul 13 09:23:22 2006//Trelease_0_9_0 4.111 -/x_keymap.c/1.1/Wed Jan 24 21:40:21 2007//Trelease_0_9_0 4.112 -D/darwin-user//// 4.113 -D/linux-user//// 4.114 -D/slirp//// 4.115 -D/target-arm//// 4.116 -D/target-m68k//// 4.117 -D/target-mips//// 4.118 -D/target-ppc//// 4.119 -D/target-sh4//// 4.120 -D/target-sparc////
5.1 --- a/tools/ioemu/.CVS/Repository Wed Sep 17 14:16:02 2008 +0100 5.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 5.3 @@ -1,1 +0,0 @@ 5.4 -qemu
6.1 --- a/tools/ioemu/.CVS/Root Wed Sep 17 14:16:02 2008 +0100 6.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 6.3 @@ -1,1 +0,0 @@ 6.4 -:pserver:anonymous@cvs.savannah.nongnu.org:/sources/qemu
7.1 --- a/tools/ioemu/.CVS/Tag Wed Sep 17 14:16:02 2008 +0100 7.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 7.3 @@ -1,1 +0,0 @@ 7.4 -Nrelease_0_9_0
8.1 --- a/tools/ioemu/.cvsignore Wed Sep 17 14:16:02 2008 +0100 8.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 8.3 @@ -1,45 +0,0 @@ 8.4 -arm-linux-user 8.5 -arm-softmmu 8.6 -armeb-linux-user 8.7 -config-host.* 8.8 -dyngen 8.9 -i386 8.10 -i386-softmmu 8.11 -i386-darwin-user 8.12 -i386-linux-user 8.13 -ppc-softmmu 8.14 -ppc64-softmmu 8.15 -ppc-darwin-user 8.16 -ppc-linux-user 8.17 -qemu-doc.html 8.18 -qemu-tech.html 8.19 -qemu-doc.info 8.20 -qemu-tech.info 8.21 -qemu.1 8.22 -qemu.pod 8.23 -qemu-img.1 8.24 -qemu-img.pod 8.25 -sparc-linux-user 8.26 -qemu-img 8.27 -sparc-softmmu 8.28 -x86_64-softmmu 8.29 -sparc64-linux-user 8.30 -sparc64-softmmu 8.31 -mips-softmmu 8.32 -mipsel-softmmu 8.33 -mips-linux-user 8.34 -mipsel-linux-user 8.35 -m68k-linux-user 8.36 -.gdbinit 8.37 -sh4-linux-user 8.38 -sh4-softmmu 8.39 -*.aux 8.40 -*.cp 8.41 -*.dvi 8.42 -*.fn 8.43 -*.ky 8.44 -*.log 8.45 -*.pg 8.46 -*.toc 8.47 -*.tp 8.48 -*.vr
9.1 --- a/tools/ioemu/COPYING Wed Sep 17 14:16:02 2008 +0100 9.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 9.3 @@ -1,339 +0,0 @@ 9.4 - GNU GENERAL PUBLIC LICENSE 9.5 - Version 2, June 1991 9.6 - 9.7 - Copyright (C) 1989, 1991 Free Software Foundation, Inc. 9.8 - 675 Mass Ave, Cambridge, MA 02139, USA 9.9 - Everyone is permitted to copy and distribute verbatim copies 9.10 - of this license document, but changing it is not allowed. 9.11 - 9.12 - Preamble 9.13 - 9.14 - The licenses for most software are designed to take away your 9.15 -freedom to share and change it. By contrast, the GNU General Public 9.16 -License is intended to guarantee your freedom to share and change free 9.17 -software--to make sure the software is free for all its users. This 9.18 -General Public License applies to most of the Free Software 9.19 -Foundation's software and to any other program whose authors commit to 9.20 -using it. (Some other Free Software Foundation software is covered by 9.21 -the GNU Library General Public License instead.) You can apply it to 9.22 -your programs, too. 9.23 - 9.24 - When we speak of free software, we are referring to freedom, not 9.25 -price. Our General Public Licenses are designed to make sure that you 9.26 -have the freedom to distribute copies of free software (and charge for 9.27 -this service if you wish), that you receive source code or can get it 9.28 -if you want it, that you can change the software or use pieces of it 9.29 -in new free programs; and that you know you can do these things. 9.30 - 9.31 - To protect your rights, we need to make restrictions that forbid 9.32 -anyone to deny you these rights or to ask you to surrender the rights. 9.33 -These restrictions translate to certain responsibilities for you if you 9.34 -distribute copies of the software, or if you modify it. 9.35 - 9.36 - For example, if you distribute copies of such a program, whether 9.37 -gratis or for a fee, you must give the recipients all the rights that 9.38 -you have. You must make sure that they, too, receive or can get the 9.39 -source code. And you must show them these terms so they know their 9.40 -rights. 9.41 - 9.42 - We protect your rights with two steps: (1) copyright the software, and 9.43 -(2) offer you this license which gives you legal permission to copy, 9.44 -distribute and/or modify the software. 9.45 - 9.46 - Also, for each author's protection and ours, we want to make certain 9.47 -that everyone understands that there is no warranty for this free 9.48 -software. If the software is modified by someone else and passed on, we 9.49 -want its recipients to know that what they have is not the original, so 9.50 -that any problems introduced by others will not reflect on the original 9.51 -authors' reputations. 9.52 - 9.53 - Finally, any free program is threatened constantly by software 9.54 -patents. We wish to avoid the danger that redistributors of a free 9.55 -program will individually obtain patent licenses, in effect making the 9.56 -program proprietary. To prevent this, we have made it clear that any 9.57 -patent must be licensed for everyone's free use or not licensed at all. 9.58 - 9.59 - The precise terms and conditions for copying, distribution and 9.60 -modification follow. 9.61 - 9.62 - GNU GENERAL PUBLIC LICENSE 9.63 - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 9.64 - 9.65 - 0. This License applies to any program or other work which contains 9.66 -a notice placed by the copyright holder saying it may be distributed 9.67 -under the terms of this General Public License. The "Program", below, 9.68 -refers to any such program or work, and a "work based on the Program" 9.69 -means either the Program or any derivative work under copyright law: 9.70 -that is to say, a work containing the Program or a portion of it, 9.71 -either verbatim or with modifications and/or translated into another 9.72 -language. (Hereinafter, translation is included without limitation in 9.73 -the term "modification".) Each licensee is addressed as "you". 9.74 - 9.75 -Activities other than copying, distribution and modification are not 9.76 -covered by this License; they are outside its scope. The act of 9.77 -running the Program is not restricted, and the output from the Program 9.78 -is covered only if its contents constitute a work based on the 9.79 -Program (independent of having been made by running the Program). 9.80 -Whether that is true depends on what the Program does. 9.81 - 9.82 - 1. You may copy and distribute verbatim copies of the Program's 9.83 -source code as you receive it, in any medium, provided that you 9.84 -conspicuously and appropriately publish on each copy an appropriate 9.85 -copyright notice and disclaimer of warranty; keep intact all the 9.86 -notices that refer to this License and to the absence of any warranty; 9.87 -and give any other recipients of the Program a copy of this License 9.88 -along with the Program. 9.89 - 9.90 -You may charge a fee for the physical act of transferring a copy, and 9.91 -you may at your option offer warranty protection in exchange for a fee. 9.92 - 9.93 - 2. You may modify your copy or copies of the Program or any portion 9.94 -of it, thus forming a work based on the Program, and copy and 9.95 -distribute such modifications or work under the terms of Section 1 9.96 -above, provided that you also meet all of these conditions: 9.97 - 9.98 - a) You must cause the modified files to carry prominent notices 9.99 - stating that you changed the files and the date of any change. 9.100 - 9.101 - b) You must cause any work that you distribute or publish, that in 9.102 - whole or in part contains or is derived from the Program or any 9.103 - part thereof, to be licensed as a whole at no charge to all third 9.104 - parties under the terms of this License. 9.105 - 9.106 - c) If the modified program normally reads commands interactively 9.107 - when run, you must cause it, when started running for such 9.108 - interactive use in the most ordinary way, to print or display an 9.109 - announcement including an appropriate copyright notice and a 9.110 - notice that there is no warranty (or else, saying that you provide 9.111 - a warranty) and that users may redistribute the program under 9.112 - these conditions, and telling the user how to view a copy of this 9.113 - License. (Exception: if the Program itself is interactive but 9.114 - does not normally print such an announcement, your work based on 9.115 - the Program is not required to print an announcement.) 9.116 - 9.117 -These requirements apply to the modified work as a whole. If 9.118 -identifiable sections of that work are not derived from the Program, 9.119 -and can be reasonably considered independent and separate works in 9.120 -themselves, then this License, and its terms, do not apply to those 9.121 -sections when you distribute them as separate works. But when you 9.122 -distribute the same sections as part of a whole which is a work based 9.123 -on the Program, the distribution of the whole must be on the terms of 9.124 -this License, whose permissions for other licensees extend to the 9.125 -entire whole, and thus to each and every part regardless of who wrote it. 9.126 - 9.127 -Thus, it is not the intent of this section to claim rights or contest 9.128 -your rights to work written entirely by you; rather, the intent is to 9.129 -exercise the right to control the distribution of derivative or 9.130 -collective works based on the Program. 9.131 - 9.132 -In addition, mere aggregation of another work not based on the Program 9.133 -with the Program (or with a work based on the Program) on a volume of 9.134 -a storage or distribution medium does not bring the other work under 9.135 -the scope of this License. 9.136 - 9.137 - 3. You may copy and distribute the Program (or a work based on it, 9.138 -under Section 2) in object code or executable form under the terms of 9.139 -Sections 1 and 2 above provided that you also do one of the following: 9.140 - 9.141 - a) Accompany it with the complete corresponding machine-readable 9.142 - source code, which must be distributed under the terms of Sections 9.143 - 1 and 2 above on a medium customarily used for software interchange; or, 9.144 - 9.145 - b) Accompany it with a written offer, valid for at least three 9.146 - years, to give any third party, for a charge no more than your 9.147 - cost of physically performing source distribution, a complete 9.148 - machine-readable copy of the corresponding source code, to be 9.149 - distributed under the terms of Sections 1 and 2 above on a medium 9.150 - customarily used for software interchange; or, 9.151 - 9.152 - c) Accompany it with the information you received as to the offer 9.153 - to distribute corresponding source code. (This alternative is 9.154 - allowed only for noncommercial distribution and only if you 9.155 - received the program in object code or executable form with such 9.156 - an offer, in accord with Subsection b above.) 9.157 - 9.158 -The source code for a work means the preferred form of the work for 9.159 -making modifications to it. For an executable work, complete source 9.160 -code means all the source code for all modules it contains, plus any 9.161 -associated interface definition files, plus the scripts used to 9.162 -control compilation and installation of the executable. However, as a 9.163 -special exception, the source code distributed need not include 9.164 -anything that is normally distributed (in either source or binary 9.165 -form) with the major components (compiler, kernel, and so on) of the 9.166 -operating system on which the executable runs, unless that component 9.167 -itself accompanies the executable. 9.168 - 9.169 -If distribution of executable or object code is made by offering 9.170 -access to copy from a designated place, then offering equivalent 9.171 -access to copy the source code from the same place counts as 9.172 -distribution of the source code, even though third parties are not 9.173 -compelled to copy the source along with the object code. 9.174 - 9.175 - 4. You may not copy, modify, sublicense, or distribute the Program 9.176 -except as expressly provided under this License. Any attempt 9.177 -otherwise to copy, modify, sublicense or distribute the Program is 9.178 -void, and will automatically terminate your rights under this License. 9.179 -However, parties who have received copies, or rights, from you under 9.180 -this License will not have their licenses terminated so long as such 9.181 -parties remain in full compliance. 9.182 - 9.183 - 5. You are not required to accept this License, since you have not 9.184 -signed it. However, nothing else grants you permission to modify or 9.185 -distribute the Program or its derivative works. These actions are 9.186 -prohibited by law if you do not accept this License. Therefore, by 9.187 -modifying or distributing the Program (or any work based on the 9.188 -Program), you indicate your acceptance of this License to do so, and 9.189 -all its terms and conditions for copying, distributing or modifying 9.190 -the Program or works based on it. 9.191 - 9.192 - 6. Each time you redistribute the Program (or any work based on the 9.193 -Program), the recipient automatically receives a license from the 9.194 -original licensor to copy, distribute or modify the Program subject to 9.195 -these terms and conditions. You may not impose any further 9.196 -restrictions on the recipients' exercise of the rights granted herein. 9.197 -You are not responsible for enforcing compliance by third parties to 9.198 -this License. 9.199 - 9.200 - 7. If, as a consequence of a court judgment or allegation of patent 9.201 -infringement or for any other reason (not limited to patent issues), 9.202 -conditions are imposed on you (whether by court order, agreement or 9.203 -otherwise) that contradict the conditions of this License, they do not 9.204 -excuse you from the conditions of this License. If you cannot 9.205 -distribute so as to satisfy simultaneously your obligations under this 9.206 -License and any other pertinent obligations, then as a consequence you 9.207 -may not distribute the Program at all. For example, if a patent 9.208 -license would not permit royalty-free redistribution of the Program by 9.209 -all those who receive copies directly or indirectly through you, then 9.210 -the only way you could satisfy both it and this License would be to 9.211 -refrain entirely from distribution of the Program. 9.212 - 9.213 -If any portion of this section is held invalid or unenforceable under 9.214 -any particular circumstance, the balance of the section is intended to 9.215 -apply and the section as a whole is intended to apply in other 9.216 -circumstances. 9.217 - 9.218 -It is not the purpose of this section to induce you to infringe any 9.219 -patents or other property right claims or to contest validity of any 9.220 -such claims; this section has the sole purpose of protecting the 9.221 -integrity of the free software distribution system, which is 9.222 -implemented by public license practices. Many people have made 9.223 -generous contributions to the wide range of software distributed 9.224 -through that system in reliance on consistent application of that 9.225 -system; it is up to the author/donor to decide if he or she is willing 9.226 -to distribute software through any other system and a licensee cannot 9.227 -impose that choice. 9.228 - 9.229 -This section is intended to make thoroughly clear what is believed to 9.230 -be a consequence of the rest of this License. 9.231 - 9.232 - 8. If the distribution and/or use of the Program is restricted in 9.233 -certain countries either by patents or by copyrighted interfaces, the 9.234 -original copyright holder who places the Program under this License 9.235 -may add an explicit geographical distribution limitation excluding 9.236 -those countries, so that distribution is permitted only in or among 9.237 -countries not thus excluded. In such case, this License incorporates 9.238 -the limitation as if written in the body of this License. 9.239 - 9.240 - 9. The Free Software Foundation may publish revised and/or new versions 9.241 -of the General Public License from time to time. Such new versions will 9.242 -be similar in spirit to the present version, but may differ in detail to 9.243 -address new problems or concerns. 9.244 - 9.245 -Each version is given a distinguishing version number. If the Program 9.246 -specifies a version number of this License which applies to it and "any 9.247 -later version", you have the option of following the terms and conditions 9.248 -either of that version or of any later version published by the Free 9.249 -Software Foundation. If the Program does not specify a version number of 9.250 -this License, you may choose any version ever published by the Free Software 9.251 -Foundation. 9.252 - 9.253 - 10. If you wish to incorporate parts of the Program into other free 9.254 -programs whose distribution conditions are different, write to the author 9.255 -to ask for permission. For software which is copyrighted by the Free 9.256 -Software Foundation, write to the Free Software Foundation; we sometimes 9.257 -make exceptions for this. Our decision will be guided by the two goals 9.258 -of preserving the free status of all derivatives of our free software and 9.259 -of promoting the sharing and reuse of software generally. 9.260 - 9.261 - NO WARRANTY 9.262 - 9.263 - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 9.264 -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 9.265 -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 9.266 -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 9.267 -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 9.268 -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 9.269 -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 9.270 -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 9.271 -REPAIR OR CORRECTION. 9.272 - 9.273 - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 9.274 -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 9.275 -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 9.276 -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 9.277 -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 9.278 -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 9.279 -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 9.280 -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 9.281 -POSSIBILITY OF SUCH DAMAGES. 9.282 - 9.283 - END OF TERMS AND CONDITIONS 9.284 - 9.285 - How to Apply These Terms to Your New Programs 9.286 - 9.287 - If you develop a new program, and you want it to be of the greatest 9.288 -possible use to the public, the best way to achieve this is to make it 9.289 -free software which everyone can redistribute and change under these terms. 9.290 - 9.291 - To do so, attach the following notices to the program. It is safest 9.292 -to attach them to the start of each source file to most effectively 9.293 -convey the exclusion of warranty; and each file should have at least 9.294 -the "copyright" line and a pointer to where the full notice is found. 9.295 - 9.296 - <one line to give the program's name and a brief idea of what it does.> 9.297 - Copyright (C) 19yy <name of author> 9.298 - 9.299 - This program is free software; you can redistribute it and/or modify 9.300 - it under the terms of the GNU General Public License as published by 9.301 - the Free Software Foundation; either version 2 of the License, or 9.302 - (at your option) any later version. 9.303 - 9.304 - This program is distributed in the hope that it will be useful, 9.305 - but WITHOUT ANY WARRANTY; without even the implied warranty of 9.306 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 9.307 - GNU General Public License for more details. 9.308 - 9.309 - You should have received a copy of the GNU General Public License 9.310 - along with this program; if not, write to the Free Software 9.311 - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 9.312 - 9.313 -Also add information on how to contact you by electronic and paper mail. 9.314 - 9.315 -If the program is interactive, make it output a short notice like this 9.316 -when it starts in an interactive mode: 9.317 - 9.318 - Gnomovision version 69, Copyright (C) 19yy name of author 9.319 - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 9.320 - This is free software, and you are welcome to redistribute it 9.321 - under certain conditions; type `show c' for details. 9.322 - 9.323 -The hypothetical commands `show w' and `show c' should show the appropriate 9.324 -parts of the General Public License. Of course, the commands you use may 9.325 -be called something other than `show w' and `show c'; they could even be 9.326 -mouse-clicks or menu items--whatever suits your program. 9.327 - 9.328 -You should also get your employer (if you work as a programmer) or your 9.329 -school, if any, to sign a "copyright disclaimer" for the program, if 9.330 -necessary. Here is a sample; alter the names: 9.331 - 9.332 - Yoyodyne, Inc., hereby disclaims all copyright interest in the program 9.333 - `Gnomovision' (which makes passes at compilers) written by James Hacker. 9.334 - 9.335 - <signature of Ty Coon>, 1 April 1989 9.336 - Ty Coon, President of Vice 9.337 - 9.338 -This General Public License does not permit incorporating your program into 9.339 -proprietary programs. If your program is a subroutine library, you may 9.340 -consider it more useful to permit linking proprietary applications with the 9.341 -library. If this is what you want to do, use the GNU Library General 9.342 -Public License instead of this License.
10.1 --- a/tools/ioemu/COPYING.LIB Wed Sep 17 14:16:02 2008 +0100 10.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 10.3 @@ -1,504 +0,0 @@ 10.4 - GNU LESSER GENERAL PUBLIC LICENSE 10.5 - Version 2.1, February 1999 10.6 - 10.7 - Copyright (C) 1991, 1999 Free Software Foundation, Inc. 10.8 - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 10.9 - Everyone is permitted to copy and distribute verbatim copies 10.10 - of this license document, but changing it is not allowed. 10.11 - 10.12 -[This is the first released version of the Lesser GPL. It also counts 10.13 - as the successor of the GNU Library Public License, version 2, hence 10.14 - the version number 2.1.] 10.15 - 10.16 - Preamble 10.17 - 10.18 - The licenses for most software are designed to take away your 10.19 -freedom to share and change it. By contrast, the GNU General Public 10.20 -Licenses are intended to guarantee your freedom to share and change 10.21 -free software--to make sure the software is free for all its users. 10.22 - 10.23 - This license, the Lesser General Public License, applies to some 10.24 -specially designated software packages--typically libraries--of the 10.25 -Free Software Foundation and other authors who decide to use it. You 10.26 -can use it too, but we suggest you first think carefully about whether 10.27 -this license or the ordinary General Public License is the better 10.28 -strategy to use in any particular case, based on the explanations below. 10.29 - 10.30 - When we speak of free software, we are referring to freedom of use, 10.31 -not price. Our General Public Licenses are designed to make sure that 10.32 -you have the freedom to distribute copies of free software (and charge 10.33 -for this service if you wish); that you receive source code or can get 10.34 -it if you want it; that you can change the software and use pieces of 10.35 -it in new free programs; and that you are informed that you can do 10.36 -these things. 10.37 - 10.38 - To protect your rights, we need to make restrictions that forbid 10.39 -distributors to deny you these rights or to ask you to surrender these 10.40 -rights. These restrictions translate to certain responsibilities for 10.41 -you if you distribute copies of the library or if you modify it. 10.42 - 10.43 - For example, if you distribute copies of the library, whether gratis 10.44 -or for a fee, you must give the recipients all the rights that we gave 10.45 -you. You must make sure that they, too, receive or can get the source 10.46 -code. If you link other code with the library, you must provide 10.47 -complete object files to the recipients, so that they can relink them 10.48 -with the library after making changes to the library and recompiling 10.49 -it. And you must show them these terms so they know their rights. 10.50 - 10.51 - We protect your rights with a two-step method: (1) we copyright the 10.52 -library, and (2) we offer you this license, which gives you legal 10.53 -permission to copy, distribute and/or modify the library. 10.54 - 10.55 - To protect each distributor, we want to make it very clear that 10.56 -there is no warranty for the free library. Also, if the library is 10.57 -modified by someone else and passed on, the recipients should know 10.58 -that what they have is not the original version, so that the original 10.59 -author's reputation will not be affected by problems that might be 10.60 -introduced by others. 10.61 - 10.62 - Finally, software patents pose a constant threat to the existence of 10.63 -any free program. We wish to make sure that a company cannot 10.64 -effectively restrict the users of a free program by obtaining a 10.65 -restrictive license from a patent holder. Therefore, we insist that 10.66 -any patent license obtained for a version of the library must be 10.67 -consistent with the full freedom of use specified in this license. 10.68 - 10.69 - Most GNU software, including some libraries, is covered by the 10.70 -ordinary GNU General Public License. This license, the GNU Lesser 10.71 -General Public License, applies to certain designated libraries, and 10.72 -is quite different from the ordinary General Public License. We use 10.73 -this license for certain libraries in order to permit linking those 10.74 -libraries into non-free programs. 10.75 - 10.76 - When a program is linked with a library, whether statically or using 10.77 -a shared library, the combination of the two is legally speaking a 10.78 -combined work, a derivative of the original library. The ordinary 10.79 -General Public License therefore permits such linking only if the 10.80 -entire combination fits its criteria of freedom. The Lesser General 10.81 -Public License permits more lax criteria for linking other code with 10.82 -the library. 10.83 - 10.84 - We call this license the "Lesser" General Public License because it 10.85 -does Less to protect the user's freedom than the ordinary General 10.86 -Public License. It also provides other free software developers Less 10.87 -of an advantage over competing non-free programs. These disadvantages 10.88 -are the reason we use the ordinary General Public License for many 10.89 -libraries. However, the Lesser license provides advantages in certain 10.90 -special circumstances. 10.91 - 10.92 - For example, on rare occasions, there may be a special need to 10.93 -encourage the widest possible use of a certain library, so that it becomes 10.94 -a de-facto standard. To achieve this, non-free programs must be 10.95 -allowed to use the library. A more frequent case is that a free 10.96 -library does the same job as widely used non-free libraries. In this 10.97 -case, there is little to gain by limiting the free library to free 10.98 -software only, so we use the Lesser General Public License. 10.99 - 10.100 - In other cases, permission to use a particular library in non-free 10.101 -programs enables a greater number of people to use a large body of 10.102 -free software. For example, permission to use the GNU C Library in 10.103 -non-free programs enables many more people to use the whole GNU 10.104 -operating system, as well as its variant, the GNU/Linux operating 10.105 -system. 10.106 - 10.107 - Although the Lesser General Public License is Less protective of the 10.108 -users' freedom, it does ensure that the user of a program that is 10.109 -linked with the Library has the freedom and the wherewithal to run 10.110 -that program using a modified version of the Library. 10.111 - 10.112 - The precise terms and conditions for copying, distribution and 10.113 -modification follow. Pay close attention to the difference between a 10.114 -"work based on the library" and a "work that uses the library". The 10.115 -former contains code derived from the library, whereas the latter must 10.116 -be combined with the library in order to run. 10.117 - 10.118 - GNU LESSER GENERAL PUBLIC LICENSE 10.119 - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 10.120 - 10.121 - 0. This License Agreement applies to any software library or other 10.122 -program which contains a notice placed by the copyright holder or 10.123 -other authorized party saying it may be distributed under the terms of 10.124 -this Lesser General Public License (also called "this License"). 10.125 -Each licensee is addressed as "you". 10.126 - 10.127 - A "library" means a collection of software functions and/or data 10.128 -prepared so as to be conveniently linked with application programs 10.129 -(which use some of those functions and data) to form executables. 10.130 - 10.131 - The "Library", below, refers to any such software library or work 10.132 -which has been distributed under these terms. A "work based on the 10.133 -Library" means either the Library or any derivative work under 10.134 -copyright law: that is to say, a work containing the Library or a 10.135 -portion of it, either verbatim or with modifications and/or translated 10.136 -straightforwardly into another language. (Hereinafter, translation is 10.137 -included without limitation in the term "modification".) 10.138 - 10.139 - "Source code" for a work means the preferred form of the work for 10.140 -making modifications to it. For a library, complete source code means 10.141 -all the source code for all modules it contains, plus any associated 10.142 -interface definition files, plus the scripts used to control compilation 10.143 -and installation of the library. 10.144 - 10.145 - Activities other than copying, distribution and modification are not 10.146 -covered by this License; they are outside its scope. The act of 10.147 -running a program using the Library is not restricted, and output from 10.148 -such a program is covered only if its contents constitute a work based 10.149 -on the Library (independent of the use of the Library in a tool for 10.150 -writing it). Whether that is true depends on what the Library does 10.151 -and what the program that uses the Library does. 10.152 - 10.153 - 1. You may copy and distribute verbatim copies of the Library's 10.154 -complete source code as you receive it, in any medium, provided that 10.155 -you conspicuously and appropriately publish on each copy an 10.156 -appropriate copyright notice and disclaimer of warranty; keep intact 10.157 -all the notices that refer to this License and to the absence of any 10.158 -warranty; and distribute a copy of this License along with the 10.159 -Library. 10.160 - 10.161 - You may charge a fee for the physical act of transferring a copy, 10.162 -and you may at your option offer warranty protection in exchange for a 10.163 -fee. 10.164 - 10.165 - 2. You may modify your copy or copies of the Library or any portion 10.166 -of it, thus forming a work based on the Library, and copy and 10.167 -distribute such modifications or work under the terms of Section 1 10.168 -above, provided that you also meet all of these conditions: 10.169 - 10.170 - a) The modified work must itself be a software library. 10.171 - 10.172 - b) You must cause the files modified to carry prominent notices 10.173 - stating that you changed the files and the date of any change. 10.174 - 10.175 - c) You must cause the whole of the work to be licensed at no 10.176 - charge to all third parties under the terms of this License. 10.177 - 10.178 - d) If a facility in the modified Library refers to a function or a 10.179 - table of data to be supplied by an application program that uses 10.180 - the facility, other than as an argument passed when the facility 10.181 - is invoked, then you must make a good faith effort to ensure that, 10.182 - in the event an application does not supply such function or 10.183 - table, the facility still operates, and performs whatever part of 10.184 - its purpose remains meaningful. 10.185 - 10.186 - (For example, a function in a library to compute square roots has 10.187 - a purpose that is entirely well-defined independent of the 10.188 - application. Therefore, Subsection 2d requires that any 10.189 - application-supplied function or table used by this function must 10.190 - be optional: if the application does not supply it, the square 10.191 - root function must still compute square roots.) 10.192 - 10.193 -These requirements apply to the modified work as a whole. If 10.194 -identifiable sections of that work are not derived from the Library, 10.195 -and can be reasonably considered independent and separate works in 10.196 -themselves, then this License, and its terms, do not apply to those 10.197 -sections when you distribute them as separate works. But when you 10.198 -distribute the same sections as part of a whole which is a work based 10.199 -on the Library, the distribution of the whole must be on the terms of 10.200 -this License, whose permissions for other licensees extend to the 10.201 -entire whole, and thus to each and every part regardless of who wrote 10.202 -it. 10.203 - 10.204 -Thus, it is not the intent of this section to claim rights or contest 10.205 -your rights to work written entirely by you; rather, the intent is to 10.206 -exercise the right to control the distribution of derivative or 10.207 -collective works based on the Library. 10.208 - 10.209 -In addition, mere aggregation of another work not based on the Library 10.210 -with the Library (or with a work based on the Library) on a volume of 10.211 -a storage or distribution medium does not bring the other work under 10.212 -the scope of this License. 10.213 - 10.214 - 3. You may opt to apply the terms of the ordinary GNU General Public 10.215 -License instead of this License to a given copy of the Library. To do 10.216 -this, you must alter all the notices that refer to this License, so 10.217 -that they refer to the ordinary GNU General Public License, version 2, 10.218 -instead of to this License. (If a newer version than version 2 of the 10.219 -ordinary GNU General Public License has appeared, then you can specify 10.220 -that version instead if you wish.) Do not make any other change in 10.221 -these notices. 10.222 - 10.223 - Once this change is made in a given copy, it is irreversible for 10.224 -that copy, so the ordinary GNU General Public License applies to all 10.225 -subsequent copies and derivative works made from that copy. 10.226 - 10.227 - This option is useful when you wish to copy part of the code of 10.228 -the Library into a program that is not a library. 10.229 - 10.230 - 4. You may copy and distribute the Library (or a portion or 10.231 -derivative of it, under Section 2) in object code or executable form 10.232 -under the terms of Sections 1 and 2 above provided that you accompany 10.233 -it with the complete corresponding machine-readable source code, which 10.234 -must be distributed under the terms of Sections 1 and 2 above on a 10.235 -medium customarily used for software interchange. 10.236 - 10.237 - If distribution of object code is made by offering access to copy 10.238 -from a designated place, then offering equivalent access to copy the 10.239 -source code from the same place satisfies the requirement to 10.240 -distribute the source code, even though third parties are not 10.241 -compelled to copy the source along with the object code. 10.242 - 10.243 - 5. A program that contains no derivative of any portion of the 10.244 -Library, but is designed to work with the Library by being compiled or 10.245 -linked with it, is called a "work that uses the Library". Such a 10.246 -work, in isolation, is not a derivative work of the Library, and 10.247 -therefore falls outside the scope of this License. 10.248 - 10.249 - However, linking a "work that uses the Library" with the Library 10.250 -creates an executable that is a derivative of the Library (because it 10.251 -contains portions of the Library), rather than a "work that uses the 10.252 -library". The executable is therefore covered by this License. 10.253 -Section 6 states terms for distribution of such executables. 10.254 - 10.255 - When a "work that uses the Library" uses material from a header file 10.256 -that is part of the Library, the object code for the work may be a 10.257 -derivative work of the Library even though the source code is not. 10.258 -Whether this is true is especially significant if the work can be 10.259 -linked without the Library, or if the work is itself a library. The 10.260 -threshold for this to be true is not precisely defined by law. 10.261 - 10.262 - If such an object file uses only numerical parameters, data 10.263 -structure layouts and accessors, and small macros and small inline 10.264 -functions (ten lines or less in length), then the use of the object 10.265 -file is unrestricted, regardless of whether it is legally a derivative 10.266 -work. (Executables containing this object code plus portions of the 10.267 -Library will still fall under Section 6.) 10.268 - 10.269 - Otherwise, if the work is a derivative of the Library, you may 10.270 -distribute the object code for the work under the terms of Section 6. 10.271 -Any executables containing that work also fall under Section 6, 10.272 -whether or not they are linked directly with the Library itself. 10.273 - 10.274 - 6. As an exception to the Sections above, you may also combine or 10.275 -link a "work that uses the Library" with the Library to produce a 10.276 -work containing portions of the Library, and distribute that work 10.277 -under terms of your choice, provided that the terms permit 10.278 -modification of the work for the customer's own use and reverse 10.279 -engineering for debugging such modifications. 10.280 - 10.281 - You must give prominent notice with each copy of the work that the 10.282 -Library is used in it and that the Library and its use are covered by 10.283 -this License. You must supply a copy of this License. If the work 10.284 -during execution displays copyright notices, you must include the 10.285 -copyright notice for the Library among them, as well as a reference 10.286 -directing the user to the copy of this License. Also, you must do one 10.287 -of these things: 10.288 - 10.289 - a) Accompany the work with the complete corresponding 10.290 - machine-readable source code for the Library including whatever 10.291 - changes were used in the work (which must be distributed under 10.292 - Sections 1 and 2 above); and, if the work is an executable linked 10.293 - with the Library, with the complete machine-readable "work that 10.294 - uses the Library", as object code and/or source code, so that the 10.295 - user can modify the Library and then relink to produce a modified 10.296 - executable containing the modified Library. (It is understood 10.297 - that the user who changes the contents of definitions files in the 10.298 - Library will not necessarily be able to recompile the application 10.299 - to use the modified definitions.) 10.300 - 10.301 - b) Use a suitable shared library mechanism for linking with the 10.302 - Library. A suitable mechanism is one that (1) uses at run time a 10.303 - copy of the library already present on the user's computer system, 10.304 - rather than copying library functions into the executable, and (2) 10.305 - will operate properly with a modified version of the library, if 10.306 - the user installs one, as long as the modified version is 10.307 - interface-compatible with the version that the work was made with. 10.308 - 10.309 - c) Accompany the work with a written offer, valid for at 10.310 - least three years, to give the same user the materials 10.311 - specified in Subsection 6a, above, for a charge no more 10.312 - than the cost of performing this distribution. 10.313 - 10.314 - d) If distribution of the work is made by offering access to copy 10.315 - from a designated place, offer equivalent access to copy the above 10.316 - specified materials from the same place. 10.317 - 10.318 - e) Verify that the user has already received a copy of these 10.319 - materials or that you have already sent this user a copy. 10.320 - 10.321 - For an executable, the required form of the "work that uses the 10.322 -Library" must include any data and utility programs needed for 10.323 -reproducing the executable from it. However, as a special exception, 10.324 -the materials to be distributed need not include anything that is 10.325 -normally distributed (in either source or binary form) with the major 10.326 -components (compiler, kernel, and so on) of the operating system on 10.327 -which the executable runs, unless that component itself accompanies 10.328 -the executable. 10.329 - 10.330 - It may happen that this requirement contradicts the license 10.331 -restrictions of other proprietary libraries that do not normally 10.332 -accompany the operating system. Such a contradiction means you cannot 10.333 -use both them and the Library together in an executable that you 10.334 -distribute. 10.335 - 10.336 - 7. You may place library facilities that are a work based on the 10.337 -Library side-by-side in a single library together with other library 10.338 -facilities not covered by this License, and distribute such a combined 10.339 -library, provided that the separate distribution of the work based on 10.340 -the Library and of the other library facilities is otherwise 10.341 -permitted, and provided that you do these two things: 10.342 - 10.343 - a) Accompany the combined library with a copy of the same work 10.344 - based on the Library, uncombined with any other library 10.345 - facilities. This must be distributed under the terms of the 10.346 - Sections above. 10.347 - 10.348 - b) Give prominent notice with the combined library of the fact 10.349 - that part of it is a work based on the Library, and explaining 10.350 - where to find the accompanying uncombined form of the same work. 10.351 - 10.352 - 8. You may not copy, modify, sublicense, link with, or distribute 10.353 -the Library except as expressly provided under this License. Any 10.354 -attempt otherwise to copy, modify, sublicense, link with, or 10.355 -distribute the Library is void, and will automatically terminate your 10.356 -rights under this License. However, parties who have received copies, 10.357 -or rights, from you under this License will not have their licenses 10.358 -terminated so long as such parties remain in full compliance. 10.359 - 10.360 - 9. You are not required to accept this License, since you have not 10.361 -signed it. However, nothing else grants you permission to modify or 10.362 -distribute the Library or its derivative works. These actions are 10.363 -prohibited by law if you do not accept this License. Therefore, by 10.364 -modifying or distributing the Library (or any work based on the 10.365 -Library), you indicate your acceptance of this License to do so, and 10.366 -all its terms and conditions for copying, distributing or modifying 10.367 -the Library or works based on it. 10.368 - 10.369 - 10. Each time you redistribute the Library (or any work based on the 10.370 -Library), the recipient automatically receives a license from the 10.371 -original licensor to copy, distribute, link with or modify the Library 10.372 -subject to these terms and conditions. You may not impose any further 10.373 -restrictions on the recipients' exercise of the rights granted herein. 10.374 -You are not responsible for enforcing compliance by third parties with 10.375 -this License. 10.376 - 10.377 - 11. If, as a consequence of a court judgment or allegation of patent 10.378 -infringement or for any other reason (not limited to patent issues), 10.379 -conditions are imposed on you (whether by court order, agreement or 10.380 -otherwise) that contradict the conditions of this License, they do not 10.381 -excuse you from the conditions of this License. If you cannot 10.382 -distribute so as to satisfy simultaneously your obligations under this 10.383 -License and any other pertinent obligations, then as a consequence you 10.384 -may not distribute the Library at all. For example, if a patent 10.385 -license would not permit royalty-free redistribution of the Library by 10.386 -all those who receive copies directly or indirectly through you, then 10.387 -the only way you could satisfy both it and this License would be to 10.388 -refrain entirely from distribution of the Library. 10.389 - 10.390 -If any portion of this section is held invalid or unenforceable under any 10.391 -particular circumstance, the balance of the section is intended to apply, 10.392 -and the section as a whole is intended to apply in other circumstances. 10.393 - 10.394 -It is not the purpose of this section to induce you to infringe any 10.395 -patents or other property right claims or to contest validity of any 10.396 -such claims; this section has the sole purpose of protecting the 10.397 -integrity of the free software distribution system which is 10.398 -implemented by public license practices. Many people have made 10.399 -generous contributions to the wide range of software distributed 10.400 -through that system in reliance on consistent application of that 10.401 -system; it is up to the author/donor to decide if he or she is willing 10.402 -to distribute software through any other system and a licensee cannot 10.403 -impose that choice. 10.404 - 10.405 -This section is intended to make thoroughly clear what is believed to 10.406 -be a consequence of the rest of this License. 10.407 - 10.408 - 12. If the distribution and/or use of the Library is restricted in 10.409 -certain countries either by patents or by copyrighted interfaces, the 10.410 -original copyright holder who places the Library under this License may add 10.411 -an explicit geographical distribution limitation excluding those countries, 10.412 -so that distribution is permitted only in or among countries not thus 10.413 -excluded. In such case, this License incorporates the limitation as if 10.414 -written in the body of this License. 10.415 - 10.416 - 13. The Free Software Foundation may publish revised and/or new 10.417 -versions of the Lesser General Public License from time to time. 10.418 -Such new versions will be similar in spirit to the present version, 10.419 -but may differ in detail to address new problems or concerns. 10.420 - 10.421 -Each version is given a distinguishing version number. If the Library 10.422 -specifies a version number of this License which applies to it and 10.423 -"any later version", you have the option of following the terms and 10.424 -conditions either of that version or of any later version published by 10.425 -the Free Software Foundation. If the Library does not specify a 10.426 -license version number, you may choose any version ever published by 10.427 -the Free Software Foundation. 10.428 - 10.429 - 14. If you wish to incorporate parts of the Library into other free 10.430 -programs whose distribution conditions are incompatible with these, 10.431 -write to the author to ask for permission. For software which is 10.432 -copyrighted by the Free Software Foundation, write to the Free 10.433 -Software Foundation; we sometimes make exceptions for this. Our 10.434 -decision will be guided by the two goals of preserving the free status 10.435 -of all derivatives of our free software and of promoting the sharing 10.436 -and reuse of software generally. 10.437 - 10.438 - NO WARRANTY 10.439 - 10.440 - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO 10.441 -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. 10.442 -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR 10.443 -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY 10.444 -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE 10.445 -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 10.446 -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE 10.447 -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME 10.448 -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 10.449 - 10.450 - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN 10.451 -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY 10.452 -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU 10.453 -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR 10.454 -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE 10.455 -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING 10.456 -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A 10.457 -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF 10.458 -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 10.459 -DAMAGES. 10.460 - 10.461 - END OF TERMS AND CONDITIONS 10.462 - 10.463 - How to Apply These Terms to Your New Libraries 10.464 - 10.465 - If you develop a new library, and you want it to be of the greatest 10.466 -possible use to the public, we recommend making it free software that 10.467 -everyone can redistribute and change. You can do so by permitting 10.468 -redistribution under these terms (or, alternatively, under the terms of the 10.469 -ordinary General Public License). 10.470 - 10.471 - To apply these terms, attach the following notices to the library. It is 10.472 -safest to attach them to the start of each source file to most effectively 10.473 -convey the exclusion of warranty; and each file should have at least the 10.474 -"copyright" line and a pointer to where the full notice is found. 10.475 - 10.476 - <one line to give the library's name and a brief idea of what it does.> 10.477 - Copyright (C) <year> <name of author> 10.478 - 10.479 - This library is free software; you can redistribute it and/or 10.480 - modify it under the terms of the GNU Lesser General Public 10.481 - License as published by the Free Software Foundation; either 10.482 - version 2 of the License, or (at your option) any later version. 10.483 - 10.484 - This library is distributed in the hope that it will be useful, 10.485 - but WITHOUT ANY WARRANTY; without even the implied warranty of 10.486 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 10.487 - Lesser General Public License for more details. 10.488 - 10.489 - You should have received a copy of the GNU Lesser General Public 10.490 - License along with this library; if not, write to the Free Software 10.491 - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 10.492 - 10.493 -Also add information on how to contact you by electronic and paper mail. 10.494 - 10.495 -You should also get your employer (if you work as a programmer) or your 10.496 -school, if any, to sign a "copyright disclaimer" for the library, if 10.497 -necessary. Here is a sample; alter the names: 10.498 - 10.499 - Yoyodyne, Inc., hereby disclaims all copyright interest in the 10.500 - library `Frob' (a library for tweaking knobs) written by James Random Hacker. 10.501 - 10.502 - <signature of Ty Coon>, 1 April 1990 10.503 - Ty Coon, President of Vice 10.504 - 10.505 -That's all there is to it! 10.506 - 10.507 -
11.1 --- a/tools/ioemu/Changelog Wed Sep 17 14:16:02 2008 +0100 11.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 11.3 @@ -1,413 +0,0 @@ 11.4 -version 0.9.0: 11.5 - 11.6 - - Support for relative paths in backing files for disk images 11.7 - - Async file I/O API 11.8 - - New qcow2 disk image format 11.9 - - Support of multiple VM snapshots 11.10 - - Linux: specific host CDROM and floppy support 11.11 - - SMM support 11.12 - - Moved PCI init, MP table init and ACPI table init to Bochs BIOS 11.13 - - Support for MIPS32 Release 2 instruction set (Thiemo Seufer) 11.14 - - MIPS Malta system emulation (Aurelien Jarno, Stefan Weil) 11.15 - - Darwin userspace emulation (Pierre d'Herbemont) 11.16 - - m68k user support (Paul Brook) 11.17 - - several x86 and x86_64 emulation fixes 11.18 - - Mouse relative offset VNC extension (Anthony Liguori) 11.19 - - PXE boot support (Anthony Liguori) 11.20 - - '-daemonize' option (Anthony Liguori) 11.21 - 11.22 -version 0.8.2: 11.23 - 11.24 - - ACPI support 11.25 - - PC VGA BIOS fixes 11.26 - - switch to OpenBios for SPARC targets (Blue Swirl) 11.27 - - VNC server fixes 11.28 - - MIPS FPU support (Marius Groeger) 11.29 - - Solaris/SPARC host support (Ben Taylor) 11.30 - - PPC breakpoints and single stepping (Jason Wessel) 11.31 - - USB updates (Paul Brook) 11.32 - - UDP/TCP/telnet character devices (Jason Wessel) 11.33 - - Windows sparse file support (Frediano Ziglio) 11.34 - - RTL8139 NIC TCP segmentation offloading (Igor Kovalenko) 11.35 - - PCNET NIC support (Antony T Curtis) 11.36 - - Support for variable frequency host CPUs 11.37 - - Workaround for win32 SMP hosts 11.38 - - Support for AMD Flash memories (Jocelyn Mayer) 11.39 - - Audio capture to WAV files support (malc) 11.40 - 11.41 -version 0.8.1: 11.42 - 11.43 - - USB tablet support (Brad Campbell, Anthony Liguori) 11.44 - - win32 host serial support (Kazu) 11.45 - - PC speaker support (Joachim Henke) 11.46 - - IDE LBA48 support (Jens Axboe) 11.47 - - SSE3 support 11.48 - - Solaris port (Ben Taylor) 11.49 - - Preliminary SH4 target (Samuel Tardieu) 11.50 - - VNC server (Anthony Liguori) 11.51 - - slirp fixes (Ed Swierk et al.) 11.52 - - USB fixes 11.53 - - ARM Versatile Platform Baseboard emulation (Paul Brook) 11.54 - 11.55 -version 0.8.0: 11.56 - 11.57 - - ARM system emulation: Arm Integrator/CP board with an arm1026ej-s 11.58 - cpu (Paul Brook) 11.59 - - SMP support 11.60 - - Mac OS X cocoa improvements (Mike Kronenberg) 11.61 - - Mac OS X CoreAudio driver (Mike Kronenberg) 11.62 - - DirectSound driver (malc) 11.63 - - ALSA audio driver (malc) 11.64 - - new audio options: '-soundhw' and '-audio-help' (malc) 11.65 - - ES1370 PCI audio device (malc) 11.66 - - Initial USB support 11.67 - - Linux host serial port access 11.68 - - Linux host low level parallel port access 11.69 - - New network emulation code supporting VLANs. 11.70 - - MIPS and MIPSel User Linux emulation 11.71 - - MIPS fixes to boot Linux (Daniel Jacobowitz) 11.72 - - NX bit support 11.73 - - Initial SPARC SMP support (Blue Swirl) 11.74 - - Major overhaul of the virtual FAT driver for read/write support 11.75 - (Johannes Schindelin) 11.76 - 11.77 -version 0.7.2: 11.78 - 11.79 - - x86_64 fixes (Win2000 and Linux 2.6 boot in 32 bit) 11.80 - - merge self modifying code handling in dirty ram page mecanism. 11.81 - - MIPS fixes (Ralf Baechle) 11.82 - - better user net performances 11.83 - 11.84 -version 0.7.1: 11.85 - 11.86 - - read-only Virtual FAT support (Johannes Schindelin) 11.87 - - Windows 2000 install disk full hack (original idea from Vladimir 11.88 - N. Oleynik) 11.89 - - VMDK disk image creation (Filip Navara) 11.90 - - SPARC64 progress (Blue Swirl) 11.91 - - initial MIPS support (Jocelyn mayer) 11.92 - - MIPS improvements (Ralf Baechle) 11.93 - - 64 bit fixes in user networking (initial patch by Gwenole Beauchesne) 11.94 - - IOAPIC support (Filip Navara) 11.95 - 11.96 -version 0.7.0: 11.97 - 11.98 - - better BIOS translation and HDD geometry auto-detection 11.99 - - user mode networking bug fix 11.100 - - undocumented FPU ops support 11.101 - - Cirrus VGA: support for 1280x1024x[8,15,16] modes 11.102 - - 'pidfile' option 11.103 - - .dmg disk image format support (Johannes Schindelin) 11.104 - - keymaps support (initial patch by Johannes Schindelin) 11.105 - - big endian ARM support (Lennert Buytenhek) 11.106 - - added generic 64 bit target support 11.107 - - x86_64 target support 11.108 - - initial APIC support 11.109 - - MMX/SSE/SSE2/PNI support 11.110 - - PC parallel port support (Mark Jonckheere) 11.111 - - initial SPARC64 support (Blue Swirl) 11.112 - - SPARC target boots Linux (Blue Swirl) 11.113 - - armv5te user mode support (Paul Brook) 11.114 - - ARM VFP support (Paul Brook) 11.115 - - ARM "Angel" semihosting syscalls (Paul Brook) 11.116 - - user mode gdb stub support (Paul Brook) 11.117 - - Samba 3 support 11.118 - - initial Cocoa support (Pierre d'Herbemont) 11.119 - - generic FPU emulation code 11.120 - - Virtual PC read-only disk image support (Alex Beregszaszi) 11.121 - 11.122 -version 0.6.1: 11.123 - 11.124 - - Mac OS X port (Pierre d'Herbemont) 11.125 - - Virtual console support 11.126 - - Better monitor line edition 11.127 - - New block device layer 11.128 - - New 'qcow' growable disk image support with AES encryption and 11.129 - transparent decompression 11.130 - - VMware 3 and 4 read-only disk image support (untested) 11.131 - - Support for up to 4 serial ports 11.132 - - TFTP server support (Magnus Damm) 11.133 - - Port redirection support in user mode networking 11.134 - - Support for not executable data sections 11.135 - - Compressed loop disk image support (Johannes Schindelin) 11.136 - - Level triggered IRQ fix (aka NE2000 PCI performance fix) (Steve 11.137 - Wormley) 11.138 - - Fixed Fedora Core 2 problems (now you can run qemu without any 11.139 - LD_ASSUME_KERNEL tricks on FC2) 11.140 - - DHCP fix for Windows (accept DHCPREQUEST alone) 11.141 - - SPARC system emulation (Blue Swirl) 11.142 - - Automatic Samba configuration for host file access from Windows. 11.143 - - '-loadvm' and '-full-screen' options 11.144 - - ne2000 savevm support (Johannes Schindelin) 11.145 - - Ctrl-Alt is now the default grab key. Ctrl-Alt-[0-9] switches to 11.146 - the virtual consoles. 11.147 - - BIOS floppy fix for NT4 (Mike Nordell, Derek Fawcus, Volker Ruppert) 11.148 - - Floppy fixes for NT4 and NT5 (Mike Nordell) 11.149 - - NT4 IDE fixes (Ben Pfaf, Mike Nordell) 11.150 - - SDL Audio support and SB16 fixes (malc) 11.151 - - ENTER instruction bug fix (initial patch by Stefan Kisdaroczi) 11.152 - - VGA font change fix 11.153 - - VGA read-only CRTC register fix 11.154 - 11.155 -version 0.6.0: 11.156 - 11.157 - - minimalist FPU exception support (NetBSD FPU probe fix) 11.158 - - cr0.ET fix (Win95 boot) 11.159 - - *BSD port (Markus Niemisto) 11.160 - - I/O access fix (signaled by Mark Jonckheere) 11.161 - - IDE drives serial number fix (Mike Nordell) 11.162 - - int13 CDROM BIOS fix (aka Solaris x86 install CD fix) 11.163 - - int15, ah=86 BIOS fix (aka Solaris x86 hardware probe hang up fix) 11.164 - - BSR/BSF "undefined behaviour" fix 11.165 - - vmdk2raw: convert VMware disk images to raw images 11.166 - - PCI support 11.167 - - NE2K PCI support 11.168 - - dummy VGA PCI support 11.169 - - VGA font selection fix (Daniel Serpell) 11.170 - - PIC reset fix (Hidemi KAWAI) 11.171 - - PIC spurious irq support (aka Solaris install bug) 11.172 - - added '-localtime' option 11.173 - - Cirrus CL-GD54xx VGA support (initial patch by Makoto Suzuki (suzu)) 11.174 - - APM and system shutdown support 11.175 - - Fixed system reset 11.176 - - Support for other PC BIOSes 11.177 - - Initial PowerMac hardware emulation 11.178 - - PowerMac/PREP OpenFirmware compatible BIOS (Jocelyn Mayer) 11.179 - - initial IDE BMDMA support (needed for Darwin x86) 11.180 - - Set the default memory size for PC emulation to 128 MB 11.181 - 11.182 -version 0.5.5: 11.183 - 11.184 - - SDL full screen support (initial patch by malc) 11.185 - - VGA support on PowerPC PREP 11.186 - - VBE fixes (Matthew Mastracci) 11.187 - - PIT fixes (aka Win98 hardware probe and "VGA slowness" bug) 11.188 - - IDE master only fixes (aka Win98 CD-ROM probe bug) 11.189 - - ARM load/store half word fix (Ulrich Hecht) 11.190 - - FDC fixes for Win98 11.191 - 11.192 -version 0.5.4: 11.193 - 11.194 - - qemu-fast fixes 11.195 - - BIOS area protection fix (aka EMM386.EXE fix) (Mike Nordell) 11.196 - - keyboard/mouse fix (Mike Nordell) 11.197 - - IDE fixes (Linux did not recognized slave drivers) 11.198 - - VM86 EIP masking fix (aka NT5 install fix) (Mike Nordell) 11.199 - - QEMU can now boot a PowerPC Linux kernel (Jocelyn Mayer) 11.200 - - User mode network stack 11.201 - - imul imm8 fix + 0x82 opcode support (Hidemi KAWAI) 11.202 - - precise self modifying code (aka BeOS install bug) 11.203 - 11.204 -version 0.5.3: 11.205 - 11.206 - - added Bochs VESA VBE support 11.207 - - VGA memory map mode 3 access fix (OS/2 install fix) 11.208 - - IDE fixes (Jens Axboe) 11.209 - - CPU interrupt fixes 11.210 - - fixed various TLB invalidation cases (NT install) 11.211 - - fixed cr0.WP semantics (XP install) 11.212 - - direct chaining support for SPARC and PowerPC (faster) 11.213 - - ARM NWFPE support (initial patch by Ulrich Hecht) 11.214 - - added specific x86 to x86 translator (close to native performance 11.215 - in qemu-i386 and qemu-fast) 11.216 - - shm syscalls support (Paul McKerras) 11.217 - - added accurate CR0.MP/ME/TS emulation 11.218 - - fixed DMA memory write access (Win95 boot floppy fix) 11.219 - - graphical x86 linux loader 11.220 - - command line monitor 11.221 - - generic removable device support 11.222 - - support of CD-ROM change 11.223 - - multiple network interface support 11.224 - - initial x86-64 host support (Gwenole Beauchesne) 11.225 - - lret to outer priviledge fix (OS/2 install fix) 11.226 - - task switch fixes (SkyOS boot) 11.227 - - VM save/restore commands 11.228 - - new timer API 11.229 - - more precise RTC emulation (periodic timers + time updates) 11.230 - - Win32 port (initial patch by Kazu) 11.231 - 11.232 -version 0.5.2: 11.233 - 11.234 - - improved soft MMU speed (assembly functions and specializing) 11.235 - - improved multitasking speed by avoiding flushing TBs when 11.236 - switching tasks 11.237 - - improved qemu-fast speed 11.238 - - improved self modifying code handling (big performance gain in 11.239 - softmmu mode). 11.240 - - fixed IO checking 11.241 - - fixed CD-ROM detection (win98 install CD) 11.242 - - fixed addseg real mode bug (GRUB boot fix) 11.243 - - added ROM memory support (win98 boot) 11.244 - - fixed 'call Ev' in case of paging exception 11.245 - - updated the script 'qemu-binfmt-conf.sh' to use QEMU automagically 11.246 - when launching executables for the supported target CPUs. 11.247 - - PowerPC system emulation update (Jocelyn Mayer) 11.248 - - PC floppy emulation and DMA fixes (Jocelyn Mayer) 11.249 - - polled mode for PIC (Jocelyn Mayer) 11.250 - - fixed PTE dirty bit handling 11.251 - - fixed xadd same reg bug 11.252 - - fixed cmpxchg exception safeness 11.253 - - access to virtual memory in gdb stub 11.254 - - task gate and NT flag fixes 11.255 - - eflags optimisation fix for string operations 11.256 - 11.257 -version 0.5.1: 11.258 - 11.259 - - float access fixes when using soft mmu 11.260 - - PC emulation support on PowerPC 11.261 - - A20 support 11.262 - - IDE CD-ROM emulation 11.263 - - ARM fixes (Ulrich Hecht) 11.264 - - SB16 emulation (malc) 11.265 - - IRET and INT fixes in VM86 mode with IOPL=3 11.266 - - Port I/Os use TSS io map 11.267 - - Full task switching/task gate support 11.268 - - added verr, verw, arpl, fcmovxx 11.269 - - PowerPC target support (Jocelyn Mayer) 11.270 - - Major SPARC target fixes (dynamically linked programs begin to work) 11.271 - 11.272 -version 0.5.0: 11.273 - 11.274 - - full hardware level VGA emulation 11.275 - - graphical display with SDL 11.276 - - added PS/2 mouse and keyboard emulation 11.277 - - popw (%esp) fix 11.278 - - mov to/from segment data width fix 11.279 - - added real mode support 11.280 - - added Bochs BIOS and LGPL'ed VGA BIOS loader in qemu 11.281 - - m68k host port (Richard Zidlicky) 11.282 - - partial soft MMU support for memory mapped I/Os 11.283 - - multi-target build 11.284 - - fixed: no error code in hardware interrupts 11.285 - - fixed: pop ss, mov ss, x and sti disable hardware irqs for the next insn 11.286 - - correct single stepping thru string operations 11.287 - - preliminary SPARC target support (Thomas M. Ogrisegg) 11.288 - - tun-fd option (Rusty Russell) 11.289 - - automatic IDE geometry detection 11.290 - - renamed 'vl' to qemu[-fast] and user qemu to qemu-{cpu}. 11.291 - - added man page 11.292 - - added full soft mmu mode to launch unpatched OSes. 11.293 - 11.294 -version 0.4.3: 11.295 - 11.296 - - x86 exception fix in case of nop instruction. 11.297 - - gcc 3.2.2 bug workaround (RedHat 9 fix) 11.298 - - sparc and Alpha host fixes 11.299 - - many ARM target fixes: 'ls' and 'bash' can be launched. 11.300 - 11.301 -version 0.4.2: 11.302 - 11.303 - - many exception handling fixes (can compile a Linux kernel inside vl) 11.304 - - IDE emulation support 11.305 - - initial GDB stub support 11.306 - - deferred update support for disk images (Rusty Russell) 11.307 - - accept User Mode Linux Copy On Write disk images 11.308 - - SMP kernels can at least be booted 11.309 - 11.310 -version 0.4.1: 11.311 - 11.312 - - more accurate timer support in vl. 11.313 - - more reliable NE2000 probe in vl. 11.314 - - added 2.5.66 kernel in vl-test. 11.315 - - added VLTMPDIR environment variable in vl. 11.316 - 11.317 -version 0.4: 11.318 - 11.319 - - initial support for ring 0 x86 processor emulation 11.320 - - fixed signal handling for correct dosemu DPMI emulation 11.321 - - fast x86 MMU emulation with mmap() 11.322 - - fixed popl (%esp) case 11.323 - - Linux kernel can be executed by QEMU with the 'vl' command. 11.324 - 11.325 -version 0.3: 11.326 - 11.327 - - initial support for ARM emulation 11.328 - - added fnsave, frstor, fnstenv, fldenv FPU instructions 11.329 - - added FPU register save in signal emulation 11.330 - - initial ARM port 11.331 - - Sparc and Alpha ports work on the regression test 11.332 - - generic ioctl number conversion 11.333 - - fixed ioctl type conversion 11.334 - 11.335 -version 0.2: 11.336 - 11.337 - - PowerPC disassembly and ELF symbols output (Rusty Russell) 11.338 - - flock support (Rusty Russell) 11.339 - - ugetrlimit support (Rusty Russell) 11.340 - - fstat64 fix (Rusty Russell) 11.341 - - initial Alpha port (Falk Hueffner) 11.342 - - initial IA64 port (Matt Wilson) 11.343 - - initial Sparc and Sparc64 port (David S. Miller) 11.344 - - added HLT instruction 11.345 - - LRET instruction fix. 11.346 - - added GPF generation for I/Os. 11.347 - - added INT3 and TF flag support. 11.348 - - SHL instruction C flag fix. 11.349 - - mmap emulation for host page size > 4KB 11.350 - - self-modifying code support 11.351 - - better VM86 support (dosemu works on non trivial programs) 11.352 - - precise exception support (EIP is computed correctly in most cases) 11.353 - - more precise LDT/GDT/IDT emulation 11.354 - - faster segment load in vm86 mode 11.355 - - direct chaining of basic blocks (faster emulation) 11.356 - 11.357 -version 0.1.6: 11.358 - 11.359 - - automatic library search system. QEMU can now work with unpatched 11.360 - ELF dynamic loader and libc (Rusty Russell). 11.361 - - ISO C warning fixes (Alistair Strachan) 11.362 - - first self-virtualizable version (works only as long as the 11.363 - translation cache is not flushed) 11.364 - - RH9 fixes 11.365 - 11.366 -version 0.1.5: 11.367 - 11.368 - - ppc64 support + personality() patch (Rusty Russell) 11.369 - - first Alpha CPU patches (Falk Hueffner) 11.370 - - removed bfd.h dependancy 11.371 - - fixed shrd, shld, idivl and divl on PowerPC. 11.372 - - fixed buggy glibc PowerPC rint() function (test-i386 passes now on PowerPC). 11.373 - 11.374 -version 0.1.4: 11.375 - 11.376 - - more accurate VM86 emulation (can launch small DOS 16 bit 11.377 - executables in wine). 11.378 - - fixed push/pop fs/gs 11.379 - - added iret instruction. 11.380 - - added times() syscall and SIOCATMARK ioctl. 11.381 - 11.382 -version 0.1.3: 11.383 - 11.384 - - S390 support (Ulrich Weigand) 11.385 - - glibc 2.3.x compile fix (Ulrich Weigand) 11.386 - - socketcall endian fix (Ulrich Weigand) 11.387 - - struct sockaddr endian fix (Ulrich Weigand) 11.388 - - sendmsg/recvmsg endian fix (Ulrich Weigand) 11.389 - - execve endian fix (Ulrich Weigand) 11.390 - - fdset endian fix (Ulrich Weigand) 11.391 - - partial setsockopt syscall support (Ulrich Weigand) 11.392 - - more accurate pushf/popf emulation 11.393 - - first partial vm86() syscall support (can be used with runcom example). 11.394 - - added bound, cmpxchg8b, cpuid instructions 11.395 - - added 16 bit addressing support/override for string operations 11.396 - - poll() fix 11.397 - 11.398 -version 0.1.2: 11.399 - 11.400 - - compile fixes 11.401 - - xlat instruction 11.402 - - xchg instruction memory lock 11.403 - - added simple vm86 example (not working with QEMU yet). The 54 byte 11.404 - DOS executable 'pi_10.com' program was released by Bertram 11.405 - Felgenhauer (more information at http://www.boo.net/~jasonp/pipage.html). 11.406 - 11.407 -version 0.1.1: 11.408 - 11.409 - - glibc 2.2 compilation fixes 11.410 - - added -s and -L options 11.411 - - binary distribution of x86 glibc and wine 11.412 - - big endian fixes in ELF loader and getdents. 11.413 - 11.414 -version 0.1: 11.415 - 11.416 - - initial public release.
12.1 --- a/tools/ioemu/LICENSE Wed Sep 17 14:16:02 2008 +0100 12.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 12.3 @@ -1,15 +0,0 @@ 12.4 -The following points clarify the QEMU license: 12.5 - 12.6 -1) QEMU as a whole is released under the GNU General Public License 12.7 - 12.8 -2) Parts of QEMU have specific licenses which are compatible with the 12.9 -GNU General Public License. Hence each source file contains its own 12.10 -licensing information. 12.11 - 12.12 -In particular, the QEMU virtual CPU core library (libqemu.a) is 12.13 -released under the GNU Lesser General Public License. Many hardware 12.14 -device emulation sources are released under the BSD license. 12.15 - 12.16 -3) QEMU is a trademark of Fabrice Bellard. 12.17 - 12.18 -Fabrice Bellard. 12.19 \ No newline at end of file
13.1 --- a/tools/ioemu/Makefile Wed Sep 17 14:16:02 2008 +0100 13.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 13.3 @@ -1,187 +0,0 @@ 13.4 -# Makefile for QEMU. 13.5 - 13.6 -XEN_ROOT=../.. 13.7 -include $(XEN_ROOT)/tools/Rules.mk 13.8 - 13.9 --include config-host.mak 13.10 - 13.11 -.PHONY: all clean distclean dvi info install install-doc tar tarbin \ 13.12 - speed test test2 html dvi info 13.13 - 13.14 -BASE_CFLAGS= 13.15 -BASE_LDFLAGS= 13.16 - 13.17 -BASE_CFLAGS += $(OS_CFLAGS) 13.18 -ifeq ($(ARCH),sparc) 13.19 -BASE_CFLAGS += -mcpu=ultrasparc 13.20 -endif 13.21 -CPPFLAGS += -I. -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE 13.22 -LIBS= 13.23 -TOOLS=qemu-img$(EXESUF) 13.24 -ifdef CONFIG_STATIC 13.25 -BASE_LDFLAGS += -static 13.26 -endif 13.27 -ifdef BUILD_DOCS 13.28 -DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1 13.29 -else 13.30 -DOCS= 13.31 -endif 13.32 - 13.33 -ifndef CONFIG_DARWIN 13.34 -ifndef CONFIG_WIN32 13.35 -ifndef CONFIG_SOLARIS 13.36 -LIBS+=-lrt 13.37 -endif 13.38 -endif 13.39 -endif 13.40 - 13.41 -TOOLS=tapdisk-ioemu 13.42 - 13.43 -all: $(TOOLS) $(DOCS) recurse-all 13.44 - 13.45 -subdir-%: 13.46 - $(MAKE) -C $(subst subdir-,,$@) all 13.47 - 13.48 -recurse-all: $(patsubst %,subdir-%, $(TARGET_DIRS)) 13.49 - 13.50 -tapdisk-ioemu: CPPFLAGS += -I$(XEN_ROOT)/tools/libxc 13.51 -tapdisk-ioemu: CPPFLAGS += -I$(XEN_ROOT)/tools/blktap/lib 13.52 -tapdisk-ioemu: CPPFLAGS += -I$(XEN_ROOT)/tools/xenstore 13.53 -tapdisk-ioemu: CPPFLAGS += -I$(XEN_ROOT)/tools/include 13.54 -tapdisk-ioemu: tapdisk-ioemu.c cutils.c block.c block-raw.c block-cow.c block-qcow.c aes.c block-vmdk.c block-cloop.c block-dmg.c block-bochs.c block-vpc.c block-vvfat.c block-qcow2.c hw/xen_blktap.c osdep.c 13.55 - $(CC) -DQEMU_TOOL $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) $(LDFLAGS) $(BASE_LDFLAGS) -o $@ $^ -lz $(LIBS) 13.56 - 13.57 -qemu-img$(EXESUF): qemu-img.c cutils.c block.c block-raw.c block-cow.c block-qcow.c aes.c block-vmdk.c block-cloop.c block-dmg.c block-bochs.c block-vpc.c block-vvfat.c block-qcow2.c 13.58 - $(CC) -DQEMU_TOOL $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) $(LDFLAGS) $(BASE_LDFLAGS) -o $@ $^ -lz $(LIBS) 13.59 - 13.60 -dyngen$(EXESUF): dyngen.c 13.61 - $(HOST_CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -o $@ $^ 13.62 - 13.63 -clean: 13.64 -# avoid old build problems by removing potentially incorrect old files 13.65 - rm -f config.mak config.h op-i386.h opc-i386.h gen-op-i386.h op-arm.h opc-arm.h gen-op-arm.h 13.66 - rm -f *.o *.a $(TOOLS) dyngen$(EXESUF) TAGS *.pod *~ */*~ 13.67 - $(MAKE) -C tests clean 13.68 - for d in $(TARGET_DIRS); do \ 13.69 - [ -d $$d ] && $(MAKE) -C $$d $@ || exit 0 ; \ 13.70 - done 13.71 - 13.72 -distclean: clean 13.73 - rm -f config-host.mak config-host.h $(DOCS) 13.74 - rm -f qemu-{doc,tech}.{info,aux,cp,dvi,fn,info,ky,log,pg,toc,tp,vr} 13.75 - for d in $(TARGET_DIRS); do \ 13.76 - rm -rf $$d || exit 1 ; \ 13.77 - done 13.78 - 13.79 -KEYMAPS=da en-gb et fr fr-ch is lt modifiers no pt-br sv \ 13.80 -ar de en-us fi fr-be hr it lv nl pl ru th \ 13.81 -common de-ch es fo fr-ca hu ja mk nl-be pt sl tr 13.82 - 13.83 -install-doc: $(DOCS) 13.84 - mkdir -p "$(DESTDIR)$(docdir)" 13.85 - $(INSTALL_DATA) -m 644 qemu-doc.html qemu-tech.html "$(DESTDIR)$(docdir)" 13.86 -ifndef CONFIG_WIN32 13.87 - mkdir -p "$(DESTDIR)$(mandir)/man1" 13.88 - $(INSTALL_DATA) qemu.1 qemu-img.1 "$(DESTDIR)$(mandir)/man1" 13.89 -endif 13.90 - 13.91 -install: all $(if $(BUILD_DOCS),install-doc) 13.92 - mkdir -p "$(DESTDIR)$(bindir)" 13.93 - $(INSTALL) -m 755 $(TOOLS) "$(DESTDIR)$(SBINDIR)" 13.94 -# mkdir -p "$(DESTDIR)$(datadir)" 13.95 -# for x in bios.bin vgabios.bin vgabios-cirrus.bin ppc_rom.bin \ 13.96 -# video.x openbios-sparc32 linux_boot.bin pxe-ne2k_pci.bin \ 13.97 -# pxe-rtl8139.bin pxe-pcnet.bin; do \ 13.98 -# $(INSTALL) -m 644 $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \ 13.99 -# done 13.100 -ifndef CONFIG_WIN32 13.101 - mkdir -p "$(DESTDIR)$(datadir)/keymaps" 13.102 - set -e; for x in $(KEYMAPS); do \ 13.103 - $(INSTALL_DATA) -m 644 $(SRC_PATH)/keymaps/$$x "$(DESTDIR)$(datadir)/keymaps"; \ 13.104 - done 13.105 -endif 13.106 - for d in $(TARGET_DIRS); do \ 13.107 - $(MAKE) -C $$d $@ || exit 1 ; \ 13.108 - done 13.109 - 13.110 -# various test targets 13.111 -test speed test2: all 13.112 - $(MAKE) -C tests $@ 13.113 - 13.114 -TAGS: 13.115 - etags *.[ch] target-i386-dm/*.[ch] hw/*.[ch] 13.116 - 13.117 -cscope: 13.118 - rm -f ./cscope.* 13.119 - find . -name "*.[ch]" -print > ./cscope.files 13.120 - cscope -b 13.121 - 13.122 -# documentation 13.123 -%.html: %.texi 13.124 - texi2html -monolithic -number $< 13.125 - 13.126 -%.info: %.texi 13.127 - makeinfo $< -o $@ 13.128 - 13.129 -%.dvi: %.texi 13.130 - texi2dvi $< 13.131 - 13.132 -qemu.1: qemu-doc.texi 13.133 - perl -w $(SRC_PATH)/texi2pod.pl $< qemu.pod 13.134 - pod2man --section=1 --center=" " --release=" " qemu.pod > $@ 13.135 - 13.136 -qemu-img.1: qemu-img.texi 13.137 - perl -w $(SRC_PATH)/texi2pod.pl $< qemu-img.pod 13.138 - pod2man --section=1 --center=" " --release=" " qemu-img.pod > $@ 13.139 - 13.140 -info: qemu-doc.info qemu-tech.info 13.141 - 13.142 -dvi: qemu-doc.dvi qemu-tech.dvi 13.143 - 13.144 -html: qemu-doc.html qemu-tech.html 13.145 - 13.146 -VERSION ?= $(shell cat VERSION) 13.147 -FILE = qemu-$(VERSION) 13.148 - 13.149 -# tar release (use 'make -k tar' on a checkouted tree) 13.150 -tar: 13.151 - rm -rf /tmp/$(FILE) 13.152 - cp -r . /tmp/$(FILE) 13.153 - cd /tmp && tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude CVS 13.154 - rm -rf /tmp/$(FILE) 13.155 - 13.156 -# generate a binary distribution 13.157 -tarbin: 13.158 - cd / && tar zcvf ~/qemu-$(VERSION)-i386.tar.gz \ 13.159 - $(bindir)/qemu \ 13.160 - $(bindir)/qemu-system-ppc \ 13.161 - $(bindir)/qemu-system-sparc \ 13.162 - $(bindir)/qemu-system-x86_64 \ 13.163 - $(bindir)/qemu-system-mips \ 13.164 - $(bindir)/qemu-system-mipsel \ 13.165 - $(bindir)/qemu-system-arm \ 13.166 - $(bindir)/qemu-i386 \ 13.167 - $(bindir)/qemu-arm \ 13.168 - $(bindir)/qemu-armeb \ 13.169 - $(bindir)/qemu-sparc \ 13.170 - $(bindir)/qemu-ppc \ 13.171 - $(bindir)/qemu-mips \ 13.172 - $(bindir)/qemu-mipsel \ 13.173 - $(bindir)/qemu-img \ 13.174 - $(datadir)/bios.bin \ 13.175 - $(datadir)/vgabios.bin \ 13.176 - $(datadir)/vgabios-cirrus.bin \ 13.177 - $(datadir)/ppc_rom.bin \ 13.178 - $(datadir)/video.x \ 13.179 - $(datadir)/openbios-sparc32 \ 13.180 - $(datadir)/linux_boot.bin \ 13.181 - $(datadir)/pxe-ne2k_pci.bin \ 13.182 - $(datadir)/pxe-rtl8139.bin \ 13.183 - $(datadir)/pxe-pcnet.bin \ 13.184 - $(docdir)/qemu-doc.html \ 13.185 - $(docdir)/qemu-tech.html \ 13.186 - $(mandir)/man1/qemu.1 $(mandir)/man1/qemu-img.1 13.187 - 13.188 -ifneq ($(wildcard .depend),) 13.189 -include .depend 13.190 -endif
14.1 --- a/tools/ioemu/Makefile.target Wed Sep 17 14:16:02 2008 +0100 14.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 14.3 @@ -1,678 +0,0 @@ 14.4 -include config.mak 14.5 - 14.6 -XEN_ROOT=../../.. 14.7 -include $(XEN_ROOT)/tools/Rules.mk 14.8 - 14.9 -TARGET_BASE_ARCH:=$(TARGET_ARCH) 14.10 -ifeq ($(TARGET_ARCH), x86_64) 14.11 -TARGET_BASE_ARCH:=i386 14.12 -endif 14.13 -ifeq ($(TARGET_ARCH), ppc64) 14.14 -TARGET_BASE_ARCH:=ppc 14.15 -endif 14.16 -ifeq ($(TARGET_ARCH), sparc64) 14.17 -TARGET_BASE_ARCH:=sparc 14.18 -endif 14.19 -TARGET_PATH=$(SRC_PATH)/target-$(TARGET_BASE_ARCH)$(TARGET_SUB) 14.20 -VPATH=$(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw:$(SRC_PATH)/audio 14.21 -CPPFLAGS+=-I. -I.. -I$(TARGET_PATH) -I$(SRC_PATH) 14.22 -CPPFLAGS+= -I$(XEN_ROOT)/tools/libxc 14.23 -CPPFLAGS+= -I$(XEN_ROOT)/tools/blktap/lib 14.24 -CPPFLAGS+= -I$(XEN_ROOT)/tools/xenstore 14.25 -CPPFLAGS+= -I$(XEN_ROOT)/tools/include 14.26 -ifdef CONFIG_DARWIN_USER 14.27 -VPATH+=:$(SRC_PATH)/darwin-user 14.28 -CPPFLAGS+=-I$(SRC_PATH)/darwin-user -I$(SRC_PATH)/darwin-user/$(TARGET_ARCH) 14.29 -endif 14.30 -ifdef CONFIG_LINUX_USER 14.31 -VPATH+=:$(SRC_PATH)/linux-user 14.32 -CPPFLAGS+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ARCH) 14.33 -endif 14.34 -BASE_CFLAGS= 14.35 -BASE_LDFLAGS= 14.36 -SSE2 := $(call cc-option,$(CC),-msse2,) 14.37 -ifeq ($(SSE2),-msse2) 14.38 -CFLAGS += -DUSE_SSE2=1 -msse2 14.39 -endif 14.40 -#CFLAGS+=-Werror 14.41 -LIBS= 14.42 -HELPER_CFLAGS=$(CFLAGS) 14.43 -DYNGEN=../dyngen$(EXESUF) 14.44 -# user emulator name 14.45 -TARGET_ARCH2=$(TARGET_ARCH) 14.46 -ifeq ($(TARGET_ARCH),arm) 14.47 - ifeq ($(TARGET_WORDS_BIGENDIAN),yes) 14.48 - TARGET_ARCH2=armeb 14.49 - endif 14.50 -endif 14.51 -ifeq ($(TARGET_ARCH),sh4) 14.52 - ifeq ($(TARGET_WORDS_BIGENDIAN),yes) 14.53 - TARGET_ARCH2=sh4eb 14.54 - endif 14.55 -endif 14.56 -ifeq ($(TARGET_ARCH),mips) 14.57 - ifneq ($(TARGET_WORDS_BIGENDIAN),yes) 14.58 - TARGET_ARCH2=mipsel 14.59 - endif 14.60 -endif 14.61 -QEMU_USER=qemu-$(TARGET_ARCH2) 14.62 -# system emulator name 14.63 -ifdef CONFIG_SOFTMMU 14.64 -ifeq ($(TARGET_ARCH), i386) 14.65 -QEMU_SYSTEM=qemu$(EXESUF) 14.66 -else 14.67 -QEMU_SYSTEM=qemu-system-$(TARGET_ARCH2)$(EXESUF) 14.68 -endif 14.69 -else 14.70 -QEMU_SYSTEM=qemu-fast 14.71 -endif 14.72 - 14.73 -ifdef CONFIG_STUBDOM 14.74 -QEMU_SYSTEM=qemu.a 14.75 -else 14.76 -QEMU_SYSTEM=qemu-dm 14.77 -endif 14.78 - 14.79 -ifdef CONFIG_USER_ONLY 14.80 -PROGS=$(QEMU_USER) 14.81 -else 14.82 -PROGS+=$(QEMU_SYSTEM) 14.83 -ifndef CONFIG_SOFTMMU 14.84 -CONFIG_STATIC=y 14.85 -endif 14.86 -endif # !CONFIG_USER_ONLY 14.87 - 14.88 -ifdef CONFIG_STATIC 14.89 -BASE_LDFLAGS+=-static 14.90 -endif 14.91 - 14.92 -# We require -O2 to avoid the stack setup prologue in EXIT_TB 14.93 -OP_CFLAGS = -Wall -O2 -g -fno-strict-aliasing 14.94 - 14.95 -ifeq ($(ARCH),i386) 14.96 -HELPER_CFLAGS+=-fomit-frame-pointer 14.97 -OP_CFLAGS+=-mpreferred-stack-boundary=2 -fomit-frame-pointer 14.98 -ifeq ($(HAVE_GCC3_OPTIONS),yes) 14.99 -OP_CFLAGS+= -falign-functions=0 -fno-gcse 14.100 -else 14.101 -OP_CFLAGS+= -malign-functions=0 14.102 -endif 14.103 -ifdef TARGET_GPROF 14.104 -USE_I386_LD=y 14.105 -endif 14.106 -ifdef CONFIG_STATIC 14.107 -USE_I386_LD=y 14.108 -endif 14.109 -ifdef USE_I386_LD 14.110 -BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld 14.111 -else 14.112 -ifdef CONFIG_LINUX_USER 14.113 -# WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object 14.114 -# that the kernel ELF loader considers as an executable. I think this 14.115 -# is the simplest way to make it self virtualizable! 14.116 -BASE_LDFLAGS+=-Wl,-shared 14.117 -endif 14.118 -endif 14.119 -endif 14.120 - 14.121 -ifeq ($(ARCH),x86_64) 14.122 -BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld 14.123 -endif 14.124 - 14.125 -ifeq ($(ARCH),ppc) 14.126 -CPPFLAGS+= -D__powerpc__ 14.127 -ifdef CONFIG_LINUX_USER 14.128 -BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld 14.129 -endif 14.130 -endif 14.131 - 14.132 -ifeq ($(ARCH),s390) 14.133 -BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld 14.134 -endif 14.135 - 14.136 -ifeq ($(ARCH),sparc) 14.137 -ifeq ($(CONFIG_SOLARIS),yes) 14.138 -BASE_CFLAGS+=-mcpu=ultrasparc -m32 -ffixed-g2 -ffixed-g3 14.139 -BASE_LDFLAGS+=-m32 14.140 -OP_CFLAGS+=-fno-delayed-branch -fno-omit-frame-pointer -ffixed-i0 14.141 -else 14.142 -BASE_CFLAGS+=-mcpu=ultrasparc -m32 -ffixed-g1 -ffixed-g2 -ffixed-g3 -ffixed-g6 14.143 -BASE_LDFLAGS+=-m32 14.144 -OP_CFLAGS+=-fno-delayed-branch -ffixed-i0 14.145 -HELPER_CFLAGS=$(CFLAGS) -ffixed-i0 -mflat 14.146 -# -static is used to avoid g1/g3 usage by the dynamic linker 14.147 -BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -static 14.148 -endif 14.149 -endif 14.150 - 14.151 -ifeq ($(ARCH),sparc64) 14.152 -BASE_CFLAGS+=-mcpu=ultrasparc -m64 -ffixed-g1 -ffixed-g4 -ffixed-g5 -ffixed-g7 14.153 -BASE_LDFLAGS+=-m64 14.154 -BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld 14.155 -OP_CFLAGS+=-mcpu=ultrasparc -m64 -ffixed-g1 -ffixed-g4 -ffixed-g5 -ffixed-g7 -fno-delayed-branch -ffixed-i0 14.156 -endif 14.157 - 14.158 -ifeq ($(ARCH),alpha) 14.159 -# -msmall-data is not used for OP_CFLAGS because we want two-instruction 14.160 -# relocations for the constant constructions 14.161 -# Ensure there's only a single GP 14.162 -BASE_CFLAGS+=-msmall-data 14.163 -BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld 14.164 -endif 14.165 - 14.166 -ifeq ($(ARCH),ia64) 14.167 -BASE_CFLAGS+=-mno-sdata 14.168 -OP_CFLAGS+=-mno-sdata 14.169 -BASE_LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld 14.170 -endif 14.171 - 14.172 -ifeq ($(ARCH),arm) 14.173 -OP_CFLAGS+=-mno-sched-prolog -fno-omit-frame-pointer 14.174 -BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld 14.175 -endif 14.176 - 14.177 -ifeq ($(ARCH),m68k) 14.178 -OP_CFLAGS+=-fomit-frame-pointer 14.179 -BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld 14.180 -endif 14.181 - 14.182 -ifeq ($(ARCH),mips) 14.183 -BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld 14.184 -endif 14.185 - 14.186 -ifeq ($(HAVE_GCC3_OPTIONS),yes) 14.187 -# very important to generate a return at the end of every operation 14.188 -OP_CFLAGS+=-fno-reorder-blocks -fno-optimize-sibling-calls 14.189 -endif 14.190 - 14.191 -ifeq ($(CONFIG_DARWIN),yes) 14.192 -LIBS+=-lmx 14.193 -endif 14.194 - 14.195 -ifdef CONFIG_DARWIN_USER 14.196 -# Leave some space for the regular program loading zone 14.197 -BASE_LDFLAGS+=-Wl,-segaddr,__STD_PROG_ZONE,0x1000 -image_base 0x0e000000 14.198 -endif 14.199 - 14.200 -OP_CFLAGS+=$(OS_CFLAGS) 14.201 - 14.202 -######################################################### 14.203 - 14.204 -CPPFLAGS+=-D_GNU_SOURCE 14.205 -# -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE 14.206 -LIBS+=-lm 14.207 -LIBS+=-L../../libxc -lxenctrl -lxenguest 14.208 -LIBS+=-L../../xenstore -lxenstore 14.209 -ifndef CONFIG_USER_ONLY 14.210 -LIBS+=-lz 14.211 -endif 14.212 -ifdef CONFIG_WIN32 14.213 -LIBS+=-lwinmm -lws2_32 -liphlpapi 14.214 -endif 14.215 -ifdef CONFIG_SOLARIS 14.216 -LIBS+=-lsocket -lnsl -lresolv 14.217 -endif 14.218 - 14.219 -# profiling code 14.220 -ifdef TARGET_GPROF 14.221 -BASE_LDFLAGS+=-p 14.222 -main.o: BASE_CFLAGS+=-p 14.223 -endif 14.224 - 14.225 -ifdef CONFIG_LINUX_USER 14.226 -OBJS= main.o syscall.o mmap.o signal.o path.o osdep.o thunk.o \ 14.227 - elfload.o linuxload.o 14.228 -ifdef TARGET_HAS_BFLT 14.229 -OBJS+= flatload.o 14.230 -endif 14.231 - 14.232 -ifeq ($(TARGET_ARCH), i386) 14.233 -OBJS+= vm86.o 14.234 -endif 14.235 -ifeq ($(TARGET_ARCH), arm) 14.236 -OBJS+=nwfpe/fpa11.o nwfpe/fpa11_cpdo.o \ 14.237 -nwfpe/fpa11_cpdt.o nwfpe/fpa11_cprt.o nwfpe/fpopcode.o nwfpe/single_cpdo.o \ 14.238 - nwfpe/double_cpdo.o nwfpe/extended_cpdo.o arm-semi.o 14.239 -endif 14.240 -ifeq ($(TARGET_ARCH), m68k) 14.241 -OBJS+= m68k-sim.o m68k-semi.o 14.242 -endif 14.243 -endif #CONFIG_LINUX_USER 14.244 - 14.245 -ifdef CONFIG_DARWIN_USER 14.246 -OBJS= main.o commpage.o machload.o mmap.o osdep.o signal.o syscall.o thunk.o 14.247 -endif 14.248 - 14.249 -SRCS:= $(OBJS:.o=.c) 14.250 -OBJS+= libqemu.a 14.251 - 14.252 -# cpu emulator library 14.253 -LIBOBJS=exec.o kqemu.o translate-op.o translate-all.o cpu-exec.o\ 14.254 - translate.o op.o 14.255 -ifdef CONFIG_SOFTFLOAT 14.256 -LIBOBJS+=fpu/softfloat.o 14.257 -else 14.258 -LIBOBJS+=fpu/softfloat-native.o 14.259 -endif 14.260 -CPPFLAGS+=-I$(SRC_PATH)/fpu 14.261 - 14.262 -ifeq ($(TARGET_ARCH), i386) 14.263 -LIBOBJS+=helper.o helper2.o 14.264 -ifeq ($(ARCH), i386) 14.265 -LIBOBJS+=translate-copy.o 14.266 -endif 14.267 -endif 14.268 - 14.269 -ifeq ($(TARGET_ARCH), x86_64) 14.270 -LIBOBJS+=helper.o helper2.o 14.271 -endif 14.272 - 14.273 -ifeq ($(TARGET_BASE_ARCH), ppc) 14.274 -LIBOBJS+= op_helper.o helper.o 14.275 -endif 14.276 - 14.277 -ifeq ($(TARGET_ARCH), mips) 14.278 -LIBOBJS+= op_helper.o helper.o 14.279 -endif 14.280 - 14.281 -ifeq ($(TARGET_BASE_ARCH), sparc) 14.282 -LIBOBJS+= op_helper.o helper.o 14.283 -endif 14.284 - 14.285 -ifeq ($(TARGET_BASE_ARCH), arm) 14.286 -LIBOBJS+= op_helper.o helper.o 14.287 -endif 14.288 - 14.289 -ifeq ($(TARGET_BASE_ARCH), sh4) 14.290 -LIBOBJS+= op_helper.o helper.o 14.291 -endif 14.292 - 14.293 -ifeq ($(TARGET_BASE_ARCH), m68k) 14.294 -LIBOBJS+= helper.o 14.295 -endif 14.296 - 14.297 -# NOTE: the disassembler code is only needed for debugging 14.298 -LIBOBJS+=disas.o 14.299 -ifeq ($(findstring i386, $(TARGET_ARCH) $(ARCH)),i386) 14.300 -USE_I386_DIS=y 14.301 -endif 14.302 -ifeq ($(findstring x86_64, $(TARGET_ARCH) $(ARCH)),x86_64) 14.303 -USE_I386_DIS=y 14.304 -endif 14.305 -ifdef USE_I386_DIS 14.306 -LIBOBJS+=i386-dis.o 14.307 -endif 14.308 -ifeq ($(findstring alpha, $(TARGET_ARCH) $(ARCH)),alpha) 14.309 -LIBOBJS+=alpha-dis.o 14.310 -endif 14.311 -ifeq ($(findstring ppc, $(TARGET_BASE_ARCH) $(ARCH)),ppc) 14.312 -LIBOBJS+=ppc-dis.o 14.313 -endif 14.314 -ifeq ($(findstring mips, $(TARGET_ARCH) $(ARCH)),mips) 14.315 -LIBOBJS+=mips-dis.o 14.316 -endif 14.317 -ifeq ($(findstring sparc, $(TARGET_BASE_ARCH) $(ARCH)),sparc) 14.318 -LIBOBJS+=sparc-dis.o 14.319 -endif 14.320 -ifeq ($(findstring arm, $(TARGET_ARCH) $(ARCH)),arm) 14.321 -LIBOBJS+=arm-dis.o 14.322 -endif 14.323 -ifeq ($(findstring m68k, $(TARGET_ARCH) $(ARCH)),m68k) 14.324 -LIBOBJS+=m68k-dis.o 14.325 -endif 14.326 -ifeq ($(findstring sh4, $(TARGET_ARCH) $(ARCH)),sh4) 14.327 -LIBOBJS+=sh4-dis.o 14.328 -endif 14.329 - 14.330 -ifdef CONFIG_GDBSTUB 14.331 -OBJS+=gdbstub.o 14.332 -endif 14.333 - 14.334 -# qemu-dm objects 14.335 -ifeq ($(ARCH),ia64) 14.336 -LIBOBJS=helper2.o exec-dm.o i8259-dm.o piix_pci-dm.o 14.337 -else 14.338 -LIBOBJS=helper2.o exec-dm.o i8259-dm.o rtc-dm.o piix_pci-dm.o 14.339 -endif 14.340 - 14.341 -all: $(PROGS) 14.342 - 14.343 -$(QEMU_USER): $(OBJS) 14.344 - $(CC) $(CFLAGS) $(LDFLAGS) $(BASE_LDFLAGS) -o $@ $^ $(LIBS) 14.345 -ifeq ($(ARCH),alpha) 14.346 -# Mark as 32 bit binary, i. e. it will be mapped into the low 31 bit of 14.347 -# the address space (31 bit so sign extending doesn't matter) 14.348 - echo -ne '\001\000\000\000' | dd of=qemu bs=1 seek=48 count=4 conv=notrunc 14.349 -endif 14.350 - 14.351 -# must use static linking to avoid leaving stuff in virtual address space 14.352 -VL_OBJS=vl.o osdep.o readline.o monitor.o pci.o console.o isa_mmio.o 14.353 -VL_OBJS+=cutils.o 14.354 -VL_OBJS+=block.o block-raw.o 14.355 -VL_OBJS+=block-cow.o block-qcow.o aes.o block-vmdk.o block-cloop.o block-dmg.o block-bochs.o block-vpc.o block-vvfat.o block-qcow2.o 14.356 -ifdef CONFIG_STUBDOM 14.357 -VL_OBJS+=block-vbd.o 14.358 -endif 14.359 -ifdef CONFIG_WIN32 14.360 -VL_OBJS+=tap-win32.o 14.361 -endif 14.362 - 14.363 -ifdef CONFIG_STUBDOM 14.364 -CONFIG_PASSTHROUGH=1 14.365 -else 14.366 - ifeq (,$(wildcard /usr/include/pci)) 14.367 -$(warning *** pciutils-devl package not found - missing /usr/include/pci) 14.368 -$(warning *** PCI passthrough capability has been disabled) 14.369 - else 14.370 -CONFIG_PASSTHROUGH=1 14.371 - endif 14.372 -endif 14.373 - 14.374 -ifdef CONFIG_PASSTHROUGH 14.375 -LIBS+=-lpci 14.376 -VL_OBJS+= pass-through.o pt-msi.o 14.377 -CFLAGS += -DCONFIG_PASSTHROUGH 14.378 -$(info *** PCI passthrough capability has been enabled ***) 14.379 -endif 14.380 - 14.381 -SOUND_HW = sb16.o es1370.o 14.382 -AUDIODRV = audio.o noaudio.o wavaudio.o 14.383 -ifdef CONFIG_SDL 14.384 -AUDIODRV += sdlaudio.o 14.385 -endif 14.386 -ifdef CONFIG_OSS 14.387 -AUDIODRV += ossaudio.o 14.388 -endif 14.389 -ifdef CONFIG_COREAUDIO 14.390 -AUDIODRV += coreaudio.o 14.391 -endif 14.392 -ifdef CONFIG_ALSA 14.393 -AUDIODRV += alsaaudio.o 14.394 -LIBS += -lasound 14.395 -endif 14.396 -ifdef CONFIG_DSOUND 14.397 -AUDIODRV += dsoundaudio.o 14.398 -LIBS += -lole32 -ldxguid 14.399 -endif 14.400 -ifdef CONFIG_FMOD 14.401 -AUDIODRV += fmodaudio.o 14.402 -audio.o fmodaudio.o: CPPFLAGS := -I$(CONFIG_FMOD_INC) $(CPPFLAGS) 14.403 -LIBS += $(CONFIG_FMOD_LIB) 14.404 -endif 14.405 -ifdef CONFIG_ADLIB 14.406 -SOUND_HW += fmopl.o adlib.o 14.407 -endif 14.408 -AUDIODRV+= wavcapture.o 14.409 - 14.410 -ifdef CONFIG_VNC_TLS 14.411 -CPPFLAGS += $(CONFIG_VNC_TLS_CFLAGS) 14.412 -LIBS += $(CONFIG_VNC_TLS_LIBS) 14.413 -endif 14.414 - 14.415 -# SCSI layer 14.416 -VL_OBJS+= scsi-disk.o cdrom.o lsi53c895a.o 14.417 - 14.418 -# USB layer 14.419 -VL_OBJS+= usb.o usb-hub.o usb-linux.o usb-hid.o usb-ohci.o usb-msd.o 14.420 - 14.421 -# PCI network cards 14.422 -VL_OBJS+= ne2000.o rtl8139.o pcnet.o e100.o e1000.o 14.423 - 14.424 -ifeq ($(TARGET_BASE_ARCH), i386) 14.425 -# Hardware support 14.426 -VL_OBJS+= ide.o pckbd.o ps2.o vga.o dma.o extboot.o 14.427 -ifeq ($(ARCH),ia64) 14.428 -VL_OBJS+= fdc.o mc146818rtc.o serial.o pc.o 14.429 -else 14.430 -VL_OBJS+= fdc.o serial.o pc.o 14.431 -endif 14.432 -VL_OBJS+= cirrus_vga.o parallel.o acpi.o 14.433 -VL_OBJS+= usb-uhci.o smbus_eeprom.o 14.434 -VL_OBJS+= piix4acpi.o 14.435 -VL_OBJS+= xenstore.o 14.436 -ifndef CONFIG_STUBDOM 14.437 -VL_OBJS+= xen_blktap.o 14.438 -endif 14.439 -VL_OBJS+= xen_platform.o 14.440 -VL_OBJS+= xen_machine_fv.o 14.441 -VL_OBJS+= xen_machine_pv.o 14.442 -VL_OBJS+= xenfb.o 14.443 -ifdef CONFIG_STUBDOM 14.444 -VL_OBJS+= xenfbfront.o 14.445 -endif 14.446 -VL_OBJS+= xen_console.o 14.447 -VL_OBJS+= pci_emulation.o 14.448 -ifndef CONFIG_STUBDOM 14.449 -VL_OBJS+= tpm_tis.o 14.450 -VL_OBJS+= $(SOUND_HW) $(AUDIODRV) mixeng.o 14.451 -CPPFLAGS += -DHAS_TPM 14.452 -CPPFLAGS += -DHAS_AUDIO 14.453 -endif 14.454 -endif 14.455 -ifeq ($(TARGET_BASE_ARCH), ppc) 14.456 -VL_OBJS+= ppc.o ide.o pckbd.o ps2.o vga.o dma.o 14.457 -VL_OBJS+= mc146818rtc.o serial.o i8259.o i8254.o fdc.o m48t59.o 14.458 -VL_OBJS+= ppc_prep.o ppc_chrp.o cuda.o adb.o openpic.o heathrow_pic.o mixeng.o 14.459 -VL_OBJS+= grackle_pci.o prep_pci.o unin_pci.o 14.460 -ifndef CONFIG_STUBDOM 14.461 -VL_OBJS+= $(SOUND_HW) $(AUDIODRV) 14.462 -CPPFLAGS += -DHAS_AUDIO 14.463 -endif 14.464 -endif 14.465 -ifeq ($(TARGET_ARCH), mips) 14.466 -VL_OBJS+= mips_r4k.o mips_malta.o mips_timer.o mips_int.o dma.o vga.o serial.o i8254.o i8259.o 14.467 -VL_OBJS+= ide.o gt64xxx.o pckbd.o ps2.o fdc.o mc146818rtc.o usb-uhci.o acpi.o 14.468 -VL_OBJS+= piix_pci.o parallel.o mixeng.o cirrus_vga.o 14.469 -ifndef CONFIG_STUBDOM 14.470 -VL_OBJS+= $(SOUND_HW) $(AUDIODRV) 14.471 -DEFINES += -DHAS_AUDIO 14.472 -endif 14.473 -endif 14.474 -ifeq ($(TARGET_BASE_ARCH), sparc) 14.475 -ifeq ($(TARGET_ARCH), sparc64) 14.476 -VL_OBJS+= sun4u.o ide.o pckbd.o ps2.o vga.o apb_pci.o 14.477 -VL_OBJS+= fdc.o mc146818rtc.o serial.o m48t59.o 14.478 -VL_OBJS+= cirrus_vga.o parallel.o 14.479 -else 14.480 -VL_OBJS+= sun4m.o tcx.o pcnet.o iommu.o m48t59.o slavio_intctl.o 14.481 -VL_OBJS+= slavio_timer.o slavio_serial.o slavio_misc.o fdc.o esp.o sparc32_dma.o 14.482 -VL_OBJS+= cs4231.o 14.483 -endif 14.484 -endif 14.485 -ifeq ($(TARGET_BASE_ARCH), arm) 14.486 -VL_OBJS+= integratorcp.o versatilepb.o ps2.o smc91c111.o arm_pic.o arm_timer.o 14.487 -VL_OBJS+= arm_boot.o pl011.o pl050.o pl080.o pl110.o pl190.o 14.488 -VL_OBJS+= versatile_pci.o 14.489 -VL_OBJS+= arm_gic.o realview.o arm_sysctl.o 14.490 -VL_OBJS+= arm-semi.o 14.491 -endif 14.492 -ifeq ($(TARGET_BASE_ARCH), sh4) 14.493 -VL_OBJS+= shix.o sh7750.o sh7750_regnames.o tc58128.o 14.494 -endif 14.495 -ifdef CONFIG_GDBSTUB 14.496 -VL_OBJS+=gdbstub.o 14.497 -endif 14.498 -ifdef CONFIG_SDL 14.499 -VL_OBJS+=sdl.o x_keymap.o 14.500 -endif 14.501 -VL_OBJS+=vnc.o d3des.o 14.502 -ifdef CONFIG_COCOA 14.503 -VL_OBJS+=cocoa.o 14.504 -COCOA_LIBS=-F/System/Library/Frameworks -framework Cocoa -framework IOKit 14.505 -ifdef CONFIG_COREAUDIO 14.506 -COCOA_LIBS+=-framework CoreAudio 14.507 -endif 14.508 -endif 14.509 -ifdef CONFIG_SLIRP 14.510 -CPPFLAGS+=-I$(SRC_PATH)/slirp 14.511 -SLIRP_OBJS=cksum.o if.o ip_icmp.o ip_input.o ip_output.o \ 14.512 -slirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_output.o \ 14.513 -tcp_subr.o tcp_timer.o udp.o bootp.o debug.o tftp.o 14.514 -VL_OBJS+=$(addprefix slirp/, $(SLIRP_OBJS)) 14.515 -endif 14.516 - 14.517 -VL_LDFLAGS= 14.518 -# specific flags are needed for non soft mmu emulator 14.519 -ifdef CONFIG_STATIC 14.520 -VL_LDFLAGS+=-static 14.521 -endif 14.522 -ifndef CONFIG_SOFTMMU 14.523 -VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/i386-vl.ld 14.524 -endif 14.525 -ifndef CONFIG_DARWIN 14.526 -ifndef CONFIG_WIN32 14.527 -ifndef CONFIG_SOLARIS 14.528 -VL_LIBS=-lutil -lrt 14.529 -endif 14.530 -endif 14.531 -endif 14.532 -ifdef TARGET_GPROF 14.533 -vl.o: BASE_CFLAGS+=-p 14.534 -VL_LDFLAGS+=-p 14.535 -endif 14.536 - 14.537 -ifeq ($(ARCH),sparc64) 14.538 -VL_LDFLAGS+=-m64 14.539 -VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/sparc64.ld 14.540 -endif 14.541 - 14.542 -ifdef CONFIG_WIN32 14.543 -SDL_LIBS := $(filter-out -mwindows, $(SDL_LIBS)) -mconsole 14.544 -endif 14.545 - 14.546 -$(QEMU_SYSTEM): $(VL_OBJS) libqemu.a 14.547 -ifdef CONFIG_STUBDOM 14.548 - $(AR) rcs $@ $(VL_OBJS) 14.549 -else 14.550 - $(CC) $(VL_LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(COCOA_LIBS) $(VL_LIBS) 14.551 -endif 14.552 - 14.553 -cocoa.o: cocoa.m 14.554 - $(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $< 14.555 - 14.556 -sdl.o: sdl.c keymaps.c sdl_keysym.h 14.557 - $(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) $(BASE_CFLAGS) -c -o $@ $< 14.558 - 14.559 -vnc.o: vnc.c keymaps.c sdl_keysym.h vnchextile.h d3des.c d3des.h 14.560 - $(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $< 14.561 - 14.562 -sdlaudio.o: sdlaudio.c 14.563 - $(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) $(BASE_CFLAGS) -c -o $@ $< 14.564 - 14.565 -depend: $(SRCS) 14.566 - $(CC) -MM $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) $^ 1>.depend 14.567 - 14.568 -vldepend: $(VL_OBJS:.o=.c) 14.569 - $(CC) -MM $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) $^ 1>.depend 14.570 - 14.571 -# libqemu 14.572 - 14.573 -libqemu.a: $(LIBOBJS) 14.574 - rm -f $@ 14.575 - $(AR) rcs $@ $(LIBOBJS) 14.576 - 14.577 -translate.o: translate.c gen-op.h opc.h cpu.h 14.578 - 14.579 -translate-all.o: translate-all.c opc.h cpu.h 14.580 - 14.581 -translate-op.o: translate-all.c op.h opc.h cpu.h 14.582 - 14.583 -op.h: op.o $(DYNGEN) 14.584 - $(DYNGEN) -o $@ $< 14.585 - 14.586 -opc.h: op.o $(DYNGEN) 14.587 - $(DYNGEN) -c -o $@ $< 14.588 - 14.589 -gen-op.h: op.o $(DYNGEN) 14.590 - $(DYNGEN) -g -o $@ $< 14.591 - 14.592 -op.o: op.c 14.593 - $(CC) $(OP_CFLAGS) $(CPPFLAGS) -c -o $@ $< 14.594 - 14.595 -# HELPER_CFLAGS is used for all the code compiled with static register 14.596 -# variables 14.597 -ifeq ($(TARGET_BASE_ARCH), i386) 14.598 -# XXX: rename helper.c to op_helper.c 14.599 -helper.o: helper.c 14.600 - $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $< 14.601 -else 14.602 -op_helper.o: op_helper.c 14.603 - $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $< 14.604 -endif 14.605 - 14.606 -cpu-exec.o: cpu-exec.c 14.607 - $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $< 14.608 - 14.609 -# Note: this is a workaround. The real fix is to avoid compiling 14.610 -# cpu_signal_handler() in cpu-exec.c. 14.611 -signal.o: signal.c 14.612 - $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $< 14.613 - 14.614 -ifeq ($(TARGET_BASE_ARCH), i386) 14.615 -op.o: op.c opreg_template.h ops_template.h ops_template_mem.h ops_mem.h ops_sse.h 14.616 -endif 14.617 - 14.618 -ifeq ($(TARGET_ARCH), arm) 14.619 -op.o: op.c op_template.h 14.620 -pl110.o: pl110_template.h 14.621 -endif 14.622 - 14.623 -ifeq ($(TARGET_BASE_ARCH), sparc) 14.624 -op.o: op.c op_template.h op_mem.h fop_template.h fbranch_template.h 14.625 -magic_load.o: elf_op.h 14.626 -endif 14.627 - 14.628 -ifeq ($(TARGET_BASE_ARCH), ppc) 14.629 -op.o: op.c op_template.h op_mem.h 14.630 -op_helper.o: op_helper_mem.h 14.631 -translate.o: translate.c translate_init.c 14.632 -endif 14.633 - 14.634 -ifeq ($(TARGET_ARCH), mips) 14.635 -op.o: op.c op_template.c fop_template.c op_mem.c 14.636 -op_helper.o: op_helper_mem.c 14.637 -endif 14.638 - 14.639 -loader.o: loader.c elf_ops.h 14.640 - 14.641 -ifeq ($(TARGET_ARCH), sh4) 14.642 -op.o: op.c op_mem.c cpu.h 14.643 -op_helper.o: op_helper.c exec.h cpu.h 14.644 -helper.o: helper.c exec.h cpu.h 14.645 -sh7750.o: sh7750.c sh7750_regs.h sh7750_regnames.h cpu.h 14.646 -shix.o: shix.c sh7750_regs.h sh7750_regnames.h 14.647 -sh7750_regnames.o: sh7750_regnames.c sh7750_regnames.h sh7750_regs.h 14.648 -tc58128.o: tc58128.c 14.649 -endif 14.650 - 14.651 -$(OBJS) $(LIBOBJS) $(VL_OBJS): config.h ../config-host.h 14.652 - 14.653 -%.o: %.c 14.654 - $(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $< 14.655 - 14.656 -%.o: %.S 14.657 - $(CC) $(CPPFLAGS) -c -o $@ $< 14.658 - 14.659 -clean: 14.660 - rm -f *.o *.a *~ $(PROGS) gen-op.h opc.h op.h nwfpe/*.o slirp/*.o fpu/*.o 14.661 - 14.662 -distclean: clean 14.663 - rm -rf config.mak config.h 14.664 - 14.665 -install: all 14.666 - mkdir -p "$(DESTDIR)$(bindir)" "$(DESTDIR)$(configdir)" 14.667 -ifneq ($(PROGS),) 14.668 - $(INSTALL_PROG) $(PROGS) "$(DESTDIR)$(bindir)" 14.669 -endif 14.670 - $(INSTALL_PROG) $(TARGET_PATH)/qemu-dm.debug "$(DESTDIR)$(bindir)" 14.671 - $(INSTALL_PROG) $(TARGET_PATH)/qemu-ifup "$(DESTDIR)$(configdir)" 14.672 - 14.673 -ifneq ($(wildcard .depend),) 14.674 -include .depend 14.675 -endif 14.676 - 14.677 -ifeq (1, 0) 14.678 -audio.o sdlaudio.o dsoundaudio.o ossaudio.o wavaudio.o noaudio.o \ 14.679 -fmodaudio.o alsaaudio.o mixeng.o sb16.o es1370.o gus.o adlib.o: \ 14.680 -CFLAGS := $(CFLAGS) -Wall -Werror -W -Wsign-compare 14.681 -endif
15.1 --- a/tools/ioemu/README Wed Sep 17 14:16:02 2008 +0100 15.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 15.3 @@ -1,3 +0,0 @@ 15.4 -Read the documentation in qemu-doc.html. 15.5 - 15.6 -Fabrice Bellard. 15.7 \ No newline at end of file
16.1 --- a/tools/ioemu/TODO Wed Sep 17 14:16:02 2008 +0100 16.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 16.3 @@ -1,55 +0,0 @@ 16.4 -short term: 16.5 ----------- 16.6 -- cycle counter for all archs 16.7 -- cpu_interrupt() win32/SMP fix 16.8 -- support variable tsc freq 16.9 -- USB host async 16.10 -- IDE async 16.11 -- debug option in 'configure' script + disable -fomit-frame-pointer 16.12 -- Precise VGA timings for old games/demos (malc patch) 16.13 -- merge PIC spurious interrupt patch 16.14 -- warning for OS/2: must not use 128 MB memory (merge bochs cmos patch ?) 16.15 -- config file (at least for windows/Mac OS X) 16.16 -- update doc: PCI infos. 16.17 -- basic VGA optimizations 16.18 -- better code fetch (different exception handling + CS.limit support) 16.19 -- do not resize vga if invalid size. 16.20 -- avoid looping if only exceptions 16.21 -- TLB code protection support for PPC 16.22 -- see openMosix Doc 16.23 -- disable SMC handling for ARM/SPARC/PPC (not finished) 16.24 -- see undefined flags for BTx insn 16.25 -- user/kernel PUSHL/POPL in helper.c 16.26 -- keyboard output buffer filling timing emulation 16.27 -- return UD exception if LOCK prefix incorrectly used 16.28 -- test ldt limit < 7 ? 16.29 -- tests for each target CPU 16.30 -- fix CCOP optimisation 16.31 -- fix all remaining thread lock issues (must put TBs in a specific invalid 16.32 - state, find a solution for tb_flush()). 16.33 - 16.34 -ppc specific: 16.35 ------------- 16.36 -- TLB invalidate not needed if msr_pr changes 16.37 -- enable shift optimizations ? 16.38 - 16.39 -linux-user specific: 16.40 -------------------- 16.41 -- add IPC syscalls 16.42 -- handle rare page fault cases (in particular if page fault in helpers or 16.43 - in syscall emulation code). 16.44 -- more syscalls (in particular all 64 bit ones, IPCs, fix 64 bit 16.45 - issues, fix 16 bit uid issues) 16.46 -- use page_unprotect_range in every suitable syscall to handle all 16.47 - cases of self modifying code. 16.48 -- fix thread stack freeing (use kernel 2.5.x CLONE_CHILD_CLEARTID) 16.49 -- use kernel traps for unaligned accesses on ARM ? 16.50 - 16.51 - 16.52 -lower priority: 16.53 --------------- 16.54 -- int15 ah=86: use better timing 16.55 -- suppress shift_mem ops 16.56 -- fix some 16 bit sp push/pop overflow (pusha/popa, lcall lret) 16.57 -- optimize FPU operations (evaluate x87 stack pointer statically) 16.58 -- use -msoft-float on ARM
17.1 --- a/tools/ioemu/VERSION Wed Sep 17 14:16:02 2008 +0100 17.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 17.3 @@ -1,1 +0,0 @@ 17.4 -0.9.0 17.5 \ No newline at end of file
18.1 --- a/tools/ioemu/a.out.h Wed Sep 17 14:16:02 2008 +0100 18.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 18.3 @@ -1,431 +0,0 @@ 18.4 -/* a.out.h 18.5 - 18.6 - Copyright 1997, 1998, 1999, 2001 Red Hat, Inc. 18.7 - 18.8 -This file is part of Cygwin. 18.9 - 18.10 -This software is a copyrighted work licensed under the terms of the 18.11 -Cygwin license. Please consult the file "CYGWIN_LICENSE" for 18.12 -details. */ 18.13 - 18.14 -#ifndef _A_OUT_H_ 18.15 -#define _A_OUT_H_ 18.16 - 18.17 -#ifdef __cplusplus 18.18 -extern "C" { 18.19 -#endif 18.20 -#define COFF_IMAGE_WITH_PE 18.21 -#define COFF_LONG_SECTION_NAMES 18.22 - 18.23 -/*** coff information for Intel 386/486. */ 18.24 - 18.25 - 18.26 -/********************** FILE HEADER **********************/ 18.27 - 18.28 -struct external_filehdr { 18.29 - short f_magic; /* magic number */ 18.30 - short f_nscns; /* number of sections */ 18.31 - unsigned long f_timdat; /* time & date stamp */ 18.32 - unsigned long f_symptr; /* file pointer to symtab */ 18.33 - unsigned long f_nsyms; /* number of symtab entries */ 18.34 - short f_opthdr; /* sizeof(optional hdr) */ 18.35 - short f_flags; /* flags */ 18.36 -}; 18.37 - 18.38 -/* Bits for f_flags: 18.39 - * F_RELFLG relocation info stripped from file 18.40 - * F_EXEC file is executable (no unresolved external references) 18.41 - * F_LNNO line numbers stripped from file 18.42 - * F_LSYMS local symbols stripped from file 18.43 - * F_AR32WR file has byte ordering of an AR32WR machine (e.g. vax) 18.44 - */ 18.45 - 18.46 -#define F_RELFLG (0x0001) 18.47 -#define F_EXEC (0x0002) 18.48 -#define F_LNNO (0x0004) 18.49 -#define F_LSYMS (0x0008) 18.50 - 18.51 - 18.52 - 18.53 -#define I386MAGIC 0x14c 18.54 -#define I386PTXMAGIC 0x154 18.55 -#define I386AIXMAGIC 0x175 18.56 - 18.57 -/* This is Lynx's all-platform magic number for executables. */ 18.58 - 18.59 -#define LYNXCOFFMAGIC 0415 18.60 - 18.61 -#define I386BADMAG(x) (((x).f_magic != I386MAGIC) \ 18.62 - && (x).f_magic != I386AIXMAGIC \ 18.63 - && (x).f_magic != I386PTXMAGIC \ 18.64 - && (x).f_magic != LYNXCOFFMAGIC) 18.65 - 18.66 -#define FILHDR struct external_filehdr 18.67 -#define FILHSZ 20 18.68 - 18.69 - 18.70 -/********************** AOUT "OPTIONAL HEADER"= 18.71 - **********************/ 18.72 - 18.73 - 18.74 -typedef struct 18.75 -{ 18.76 - unsigned short magic; /* type of file */ 18.77 - unsigned short vstamp; /* version stamp */ 18.78 - unsigned long tsize; /* text size in bytes, padded to FW bdry*/ 18.79 - unsigned long dsize; /* initialized data " " */ 18.80 - unsigned long bsize; /* uninitialized data " " */ 18.81 - unsigned long entry; /* entry pt. */ 18.82 - unsigned long text_start; /* base of text used for this file */ 18.83 - unsigned long data_start; /* base of data used for this file= 18.84 - */ 18.85 -} 18.86 -AOUTHDR; 18.87 - 18.88 -#define AOUTSZ 28 18.89 -#define AOUTHDRSZ 28 18.90 - 18.91 -#define OMAGIC 0404 /* object files, eg as output */ 18.92 -#define ZMAGIC 0413 /* demand load format, eg normal ld output */ 18.93 -#define STMAGIC 0401 /* target shlib */ 18.94 -#define SHMAGIC 0443 /* host shlib */ 18.95 - 18.96 - 18.97 -/* define some NT default values */ 18.98 -/* #define NT_IMAGE_BASE 0x400000 moved to internal.h */ 18.99 -#define NT_SECTION_ALIGNMENT 0x1000 18.100 -#define NT_FILE_ALIGNMENT 0x200 18.101 -#define NT_DEF_RESERVE 0x100000 18.102 -#define NT_DEF_COMMIT 0x1000 18.103 - 18.104 -/********************** SECTION HEADER **********************/ 18.105 - 18.106 - 18.107 -struct external_scnhdr { 18.108 - char s_name[8]; /* section name */ 18.109 - unsigned long s_paddr; /* physical address, offset 18.110 - of last addr in scn */ 18.111 - unsigned long s_vaddr; /* virtual address */ 18.112 - unsigned long s_size; /* section size */ 18.113 - unsigned long s_scnptr; /* file ptr to raw data for section */ 18.114 - unsigned long s_relptr; /* file ptr to relocation */ 18.115 - unsigned long s_lnnoptr; /* file ptr to line numbers */ 18.116 - unsigned short s_nreloc; /* number of relocation entries */ 18.117 - unsigned short s_nlnno; /* number of line number entries*/ 18.118 - unsigned long s_flags; /* flags */ 18.119 -}; 18.120 - 18.121 -#define SCNHDR struct external_scnhdr 18.122 -#define SCNHSZ 40 18.123 - 18.124 -/* 18.125 - * names of "special" sections 18.126 - */ 18.127 -#define _TEXT ".text" 18.128 -#define _DATA ".data" 18.129 -#define _BSS ".bss" 18.130 -#define _COMMENT ".comment" 18.131 -#define _LIB ".lib" 18.132 - 18.133 -/********************** LINE NUMBERS **********************/ 18.134 - 18.135 -/* 1 line number entry for every "breakpointable" source line in a section. 18.136 - * Line numbers are grouped on a per function basis; first entry in a function 18.137 - * grouping will have l_lnno = 0 and in place of physical address will be the 18.138 - * symbol table index of the function name. 18.139 - */ 18.140 -struct external_lineno { 18.141 - union { 18.142 - unsigned long l_symndx; /* function name symbol index, iff l_lnno 0 */ 18.143 - unsigned long l_paddr; /* (physical) address of line number */ 18.144 - } l_addr; 18.145 - unsigned short l_lnno; /* line number */ 18.146 -}; 18.147 - 18.148 -#define LINENO struct external_lineno 18.149 -#define LINESZ 6 18.150 - 18.151 -/********************** SYMBOLS **********************/ 18.152 - 18.153 -#define E_SYMNMLEN 8 /* # characters in a symbol name */ 18.154 -#define E_FILNMLEN 14 /* # characters in a file name */ 18.155 -#define E_DIMNUM 4 /* # array dimensions in auxiliary entry */ 18.156 - 18.157 -struct __attribute__((packed)) external_syment 18.158 -{ 18.159 - union { 18.160 - char e_name[E_SYMNMLEN]; 18.161 - struct { 18.162 - unsigned long e_zeroes; 18.163 - unsigned long e_offset; 18.164 - } e; 18.165 - } e; 18.166 - unsigned long e_value; 18.167 - unsigned short e_scnum; 18.168 - unsigned short e_type; 18.169 - char e_sclass[1]; 18.170 - char e_numaux[1]; 18.171 -}; 18.172 - 18.173 -#define N_BTMASK (0xf) 18.174 -#define N_TMASK (0x30) 18.175 -#define N_BTSHFT (4) 18.176 -#define N_TSHIFT (2) 18.177 - 18.178 -union external_auxent { 18.179 - struct { 18.180 - unsigned long x_tagndx; /* str, un, or enum tag indx */ 18.181 - union { 18.182 - struct { 18.183 - unsigned short x_lnno; /* declaration line number */ 18.184 - unsigned short x_size; /* str/union/array size */ 18.185 - } x_lnsz; 18.186 - unsigned long x_fsize; /* size of function */ 18.187 - } x_misc; 18.188 - union { 18.189 - struct { /* if ISFCN, tag, or .bb */ 18.190 - unsigned long x_lnnoptr;/* ptr to fcn line # */ 18.191 - unsigned long x_endndx; /* entry ndx past block end */ 18.192 - } x_fcn; 18.193 - struct { /* if ISARY, up to 4 dimen. */ 18.194 - char x_dimen[E_DIMNUM][2]; 18.195 - } x_ary; 18.196 - } x_fcnary; 18.197 - unsigned short x_tvndx; /* tv index */ 18.198 - } x_sym; 18.199 - 18.200 - union { 18.201 - char x_fname[E_FILNMLEN]; 18.202 - struct { 18.203 - unsigned long x_zeroes; 18.204 - unsigned long x_offset; 18.205 - } x_n; 18.206 - } x_file; 18.207 - 18.208 - struct { 18.209 - unsigned long x_scnlen; /* section length */ 18.210 - unsigned short x_nreloc; /* # relocation entries */ 18.211 - unsigned short x_nlinno; /* # line numbers */ 18.212 - unsigned long x_checksum; /* section COMDAT checksum */ 18.213 - unsigned short x_associated;/* COMDAT associated section index */ 18.214 - char x_comdat[1]; /* COMDAT selection number */ 18.215 - } x_scn; 18.216 - 18.217 - struct { 18.218 - unsigned long x_tvfill; /* tv fill value */ 18.219 - unsigned short x_tvlen; /* length of .tv */ 18.220 - char x_tvran[2][2]; /* tv range */ 18.221 - } x_tv; /* info about .tv section (in auxent of symbol .tv)) */ 18.222 - 18.223 -}; 18.224 - 18.225 -#define SYMENT struct external_syment 18.226 -#define SYMESZ 18 18.227 -#define AUXENT union external_auxent 18.228 -#define AUXESZ 18 18.229 - 18.230 -#define _ETEXT "etext" 18.231 - 18.232 -/********************** RELOCATION DIRECTIVES **********************/ 18.233 - 18.234 -struct external_reloc { 18.235 - char r_vaddr[4]; 18.236 - char r_symndx[4]; 18.237 - char r_type[2]; 18.238 -}; 18.239 - 18.240 -#define RELOC struct external_reloc 18.241 -#define RELSZ 10 18.242 - 18.243 -/* end of coff/i386.h */ 18.244 - 18.245 -/* PE COFF header information */ 18.246 - 18.247 -#ifndef _PE_H 18.248 -#define _PE_H 18.249 - 18.250 -/* NT specific file attributes */ 18.251 -#define IMAGE_FILE_RELOCS_STRIPPED 0x0001 18.252 -#define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002 18.253 -#define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004 18.254 -#define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008 18.255 -#define IMAGE_FILE_BYTES_REVERSED_LO 0x0080 18.256 -#define IMAGE_FILE_32BIT_MACHINE 0x0100 18.257 -#define IMAGE_FILE_DEBUG_STRIPPED 0x0200 18.258 -#define IMAGE_FILE_SYSTEM 0x1000 18.259 -#define IMAGE_FILE_DLL 0x2000 18.260 -#define IMAGE_FILE_BYTES_REVERSED_HI 0x8000 18.261 - 18.262 -/* additional flags to be set for section headers to allow the NT loader to 18.263 - read and write to the section data (to replace the addresses of data in 18.264 - dlls for one thing); also to execute the section in .text's case= 18.265 - */ 18.266 -#define IMAGE_SCN_MEM_DISCARDABLE 0x02000000 18.267 -#define IMAGE_SCN_MEM_EXECUTE 0x20000000 18.268 -#define IMAGE_SCN_MEM_READ 0x40000000 18.269 -#define IMAGE_SCN_MEM_WRITE 0x80000000 18.270 - 18.271 -/* 18.272 - * Section characteristics added for ppc-nt 18.273 - */ 18.274 - 18.275 -#define IMAGE_SCN_TYPE_NO_PAD 0x00000008 /* Reserved. */ 18.276 - 18.277 -#define IMAGE_SCN_CNT_CODE 0x00000020 /* Section contains code. */ 18.278 -#define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040 /* Section contains initialized data. */ 18.279 -#define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080 /* Section contains uninitialized data. */ 18.280 - 18.281 -#define IMAGE_SCN_LNK_OTHER 0x00000100 /* Reserved. */ 18.282 -#define IMAGE_SCN_LNK_INFO 0x00000200 /* Section contains comments or some other type of information. */ 18.283 -#define IMAGE_SCN_LNK_REMOVE 0x00000800 /* Section contents will not become part of image. */ 18.284 -#define IMAGE_SCN_LNK_COMDAT 0x00001000 /* Section contents comdat. */ 18.285 - 18.286 -#define IMAGE_SCN_MEM_FARDATA 0x00008000 18.287 - 18.288 -#define IMAGE_SCN_MEM_PURGEABLE 0x00020000 18.289 -#define IMAGE_SCN_MEM_16BIT 0x00020000 18.290 -#define IMAGE_SCN_MEM_LOCKED 0x00040000 18.291 -#define IMAGE_SCN_MEM_PRELOAD 0x00080000 18.292 - 18.293 -#define IMAGE_SCN_ALIGN_1BYTES 0x00100000 18.294 -#define IMAGE_SCN_ALIGN_2BYTES 0x00200000 18.295 -#define IMAGE_SCN_ALIGN_4BYTES 0x00300000 18.296 -#define IMAGE_SCN_ALIGN_8BYTES 0x00400000 18.297 -#define IMAGE_SCN_ALIGN_16BYTES 0x00500000 /* Default alignment if no others are specified. */ 18.298 -#define IMAGE_SCN_ALIGN_32BYTES 0x00600000 18.299 -#define IMAGE_SCN_ALIGN_64BYTES 0x00700000 18.300 - 18.301 - 18.302 -#define IMAGE_SCN_LNK_NRELOC_OVFL 0x01000000 /* Section contains extended relocations. */ 18.303 -#define IMAGE_SCN_MEM_NOT_CACHED 0x04000000 /* Section is not cachable. */ 18.304 -#define IMAGE_SCN_MEM_NOT_PAGED 0x08000000 /* Section is not pageable. */ 18.305 -#define IMAGE_SCN_MEM_SHARED 0x10000000 /* Section is shareable. */ 18.306 - 18.307 -/* COMDAT selection codes. */ 18.308 - 18.309 -#define IMAGE_COMDAT_SELECT_NODUPLICATES (1) /* Warn if duplicates. */ 18.310 -#define IMAGE_COMDAT_SELECT_ANY (2) /* No warning. */ 18.311 -#define IMAGE_COMDAT_SELECT_SAME_SIZE (3) /* Warn if different size. */ 18.312 -#define IMAGE_COMDAT_SELECT_EXACT_MATCH (4) /* Warn if different. */ 18.313 -#define IMAGE_COMDAT_SELECT_ASSOCIATIVE (5) /* Base on other section. */ 18.314 - 18.315 -/* Magic values that are true for all dos/nt implementations */ 18.316 -#define DOSMAGIC 0x5a4d 18.317 -#define NT_SIGNATURE 0x00004550 18.318 - 18.319 -/* NT allows long filenames, we want to accommodate this. This may break 18.320 - some of the bfd functions */ 18.321 -#undef FILNMLEN 18.322 -#define FILNMLEN 18 /* # characters in a file name */ 18.323 - 18.324 - 18.325 -#ifdef COFF_IMAGE_WITH_PE 18.326 -/* The filehdr is only weired in images */ 18.327 - 18.328 -#undef FILHDR 18.329 -struct external_PE_filehdr 18.330 -{ 18.331 - /* DOS header fields */ 18.332 - unsigned short e_magic; /* Magic number, 0x5a4d */ 18.333 - unsigned short e_cblp; /* Bytes on last page of file, 0x90 */ 18.334 - unsigned short e_cp; /* Pages in file, 0x3 */ 18.335 - unsigned short e_crlc; /* Relocations, 0x0 */ 18.336 - unsigned short e_cparhdr; /* Size of header in paragraphs, 0x4 */ 18.337 - unsigned short e_minalloc; /* Minimum extra paragraphs needed, 0x0 */ 18.338 - unsigned short e_maxalloc; /* Maximum extra paragraphs needed, 0xFFFF */ 18.339 - unsigned short e_ss; /* Initial (relative) SS value, 0x0 */ 18.340 - unsigned short e_sp; /* Initial SP value, 0xb8 */ 18.341 - unsigned short e_csum; /* Checksum, 0x0 */ 18.342 - unsigned short e_ip; /* Initial IP value, 0x0 */ 18.343 - unsigned short e_cs; /* Initial (relative) CS value, 0x0 */ 18.344 - unsigned short e_lfarlc; /* File address of relocation table, 0x40 */ 18.345 - unsigned short e_ovno; /* Overlay number, 0x0 */ 18.346 - char e_res[4][2]; /* Reserved words, all 0x0 */ 18.347 - unsigned short e_oemid; /* OEM identifier (for e_oeminfo), 0x0 */ 18.348 - unsigned short e_oeminfo; /* OEM information; e_oemid specific, 0x0 */ 18.349 - char e_res2[10][2]; /* Reserved words, all 0x0 */ 18.350 - unsigned long e_lfanew; /* File address of new exe header, 0x80 */ 18.351 - char dos_message[16][4]; /* other stuff, always follow DOS header */ 18.352 - unsigned int nt_signature; /* required NT signature, 0x4550 */ 18.353 - 18.354 - /* From standard header */ 18.355 - 18.356 - unsigned short f_magic; /* magic number */ 18.357 - unsigned short f_nscns; /* number of sections */ 18.358 - unsigned long f_timdat; /* time & date stamp */ 18.359 - unsigned long f_symptr; /* file pointer to symtab */ 18.360 - unsigned long f_nsyms; /* number of symtab entries */ 18.361 - unsigned short f_opthdr; /* sizeof(optional hdr) */ 18.362 - unsigned short f_flags; /* flags */ 18.363 -}; 18.364 - 18.365 - 18.366 -#define FILHDR struct external_PE_filehdr 18.367 -#undef FILHSZ 18.368 -#define FILHSZ 152 18.369 - 18.370 -#endif 18.371 - 18.372 -typedef struct 18.373 -{ 18.374 - unsigned short magic; /* type of file */ 18.375 - unsigned short vstamp; /* version stamp */ 18.376 - unsigned long tsize; /* text size in bytes, padded to FW bdry*/ 18.377 - unsigned long dsize; /* initialized data " " */ 18.378 - unsigned long bsize; /* uninitialized data " " */ 18.379 - unsigned long entry; /* entry pt. */ 18.380 - unsigned long text_start; /* base of text used for this file */ 18.381 - unsigned long data_start; /* base of all data used for this file */ 18.382 - 18.383 - /* NT extra fields; see internal.h for descriptions */ 18.384 - unsigned long ImageBase; 18.385 - unsigned long SectionAlignment; 18.386 - unsigned long FileAlignment; 18.387 - unsigned short MajorOperatingSystemVersion; 18.388 - unsigned short MinorOperatingSystemVersion; 18.389 - unsigned short MajorImageVersion; 18.390 - unsigned short MinorImageVersion; 18.391 - unsigned short MajorSubsystemVersion; 18.392 - unsigned short MinorSubsystemVersion; 18.393 - char Reserved1[4]; 18.394 - unsigned long SizeOfImage; 18.395 - unsigned long SizeOfHeaders; 18.396 - unsigned long CheckSum; 18.397 - unsigned short Subsystem; 18.398 - unsigned short DllCharacteristics; 18.399 - unsigned long SizeOfStackReserve; 18.400 - unsigned long SizeOfStackCommit; 18.401 - unsigned long SizeOfHeapReserve; 18.402 - unsigned long SizeOfHeapCommit; 18.403 - unsigned long LoaderFlags; 18.404 - unsigned long NumberOfRvaAndSizes; 18.405 - /* IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]; */ 18.406 - char DataDirectory[16][2][4]; /* 16 entries, 2 elements/entry, 4 chars */ 18.407 - 18.408 -} PEAOUTHDR; 18.409 - 18.410 - 18.411 -#undef AOUTSZ 18.412 -#define AOUTSZ (AOUTHDRSZ + 196) 18.413 - 18.414 -#undef E_FILNMLEN 18.415 -#define E_FILNMLEN 18 /* # characters in a file name */ 18.416 -#endif 18.417 - 18.418 -/* end of coff/pe.h */ 18.419 - 18.420 -#define DT_NON (0) /* no derived type */ 18.421 -#define DT_PTR (1) /* pointer */ 18.422 -#define DT_FCN (2) /* function */ 18.423 -#define DT_ARY (3) /* array */ 18.424 - 18.425 -#define ISPTR(x) (((x) & N_TMASK) == (DT_PTR << N_BTSHFT)) 18.426 -#define ISFCN(x) (((x) & N_TMASK) == (DT_FCN << N_BTSHFT)) 18.427 -#define ISARY(x) (((x) & N_TMASK) == (DT_ARY << N_BTSHFT)) 18.428 - 18.429 -#ifdef __cplusplus 18.430 -} 18.431 -#endif 18.432 - 18.433 -#endif /* _A_OUT_H_ */ 18.434 -
19.1 --- a/tools/ioemu/aes.c Wed Sep 17 14:16:02 2008 +0100 19.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 19.3 @@ -1,1319 +0,0 @@ 19.4 -/** 19.5 - * 19.6 - * aes.c - integrated in QEMU by Fabrice Bellard from the OpenSSL project. 19.7 - */ 19.8 -/* 19.9 - * rijndael-alg-fst.c 19.10 - * 19.11 - * @version 3.0 (December 2000) 19.12 - * 19.13 - * Optimised ANSI C code for the Rijndael cipher (now AES) 19.14 - * 19.15 - * @author Vincent Rijmen <vincent.rijmen@esat.kuleuven.ac.be> 19.16 - * @author Antoon Bosselaers <antoon.bosselaers@esat.kuleuven.ac.be> 19.17 - * @author Paulo Barreto <paulo.barreto@terra.com.br> 19.18 - * 19.19 - * This code is hereby placed in the public domain. 19.20 - * 19.21 - * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ''AS IS'' AND ANY EXPRESS 19.22 - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19.23 - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19.24 - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE 19.25 - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 19.26 - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 19.27 - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 19.28 - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 19.29 - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 19.30 - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 19.31 - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 19.32 - */ 19.33 -#include "vl.h" 19.34 -#include "aes.h" 19.35 - 19.36 -#define NDEBUG 19.37 -#include <assert.h> 19.38 - 19.39 -#ifndef CONFIG_STUBDOM 19.40 -typedef uint32_t u32; 19.41 -typedef uint16_t u16; 19.42 -typedef uint8_t u8; 19.43 -#endif 19.44 - 19.45 -#define MAXKC (256/32) 19.46 -#define MAXKB (256/8) 19.47 -#define MAXNR 14 19.48 - 19.49 -/* This controls loop-unrolling in aes_core.c */ 19.50 -#undef FULL_UNROLL 19.51 -# define GETU32(pt) (((u32)(pt)[0] << 24) ^ ((u32)(pt)[1] << 16) ^ ((u32)(pt)[2] << 8) ^ ((u32)(pt)[3])) 19.52 -# define PUTU32(ct, st) { (ct)[0] = (u8)((st) >> 24); (ct)[1] = (u8)((st) >> 16); (ct)[2] = (u8)((st) >> 8); (ct)[3] = (u8)(st); } 19.53 - 19.54 -/* 19.55 -Te0[x] = S [x].[02, 01, 01, 03]; 19.56 -Te1[x] = S [x].[03, 02, 01, 01]; 19.57 -Te2[x] = S [x].[01, 03, 02, 01]; 19.58 -Te3[x] = S [x].[01, 01, 03, 02]; 19.59 -Te4[x] = S [x].[01, 01, 01, 01]; 19.60 - 19.61 -Td0[x] = Si[x].[0e, 09, 0d, 0b]; 19.62 -Td1[x] = Si[x].[0b, 0e, 09, 0d]; 19.63 -Td2[x] = Si[x].[0d, 0b, 0e, 09]; 19.64 -Td3[x] = Si[x].[09, 0d, 0b, 0e]; 19.65 -Td4[x] = Si[x].[01, 01, 01, 01]; 19.66 -*/ 19.67 - 19.68 -static const u32 Te0[256] = { 19.69 - 0xc66363a5U, 0xf87c7c84U, 0xee777799U, 0xf67b7b8dU, 19.70 - 0xfff2f20dU, 0xd66b6bbdU, 0xde6f6fb1U, 0x91c5c554U, 19.71 - 0x60303050U, 0x02010103U, 0xce6767a9U, 0x562b2b7dU, 19.72 - 0xe7fefe19U, 0xb5d7d762U, 0x4dababe6U, 0xec76769aU, 19.73 - 0x8fcaca45U, 0x1f82829dU, 0x89c9c940U, 0xfa7d7d87U, 19.74 - 0xeffafa15U, 0xb25959ebU, 0x8e4747c9U, 0xfbf0f00bU, 19.75 - 0x41adadecU, 0xb3d4d467U, 0x5fa2a2fdU, 0x45afafeaU, 19.76 - 0x239c9cbfU, 0x53a4a4f7U, 0xe4727296U, 0x9bc0c05bU, 19.77 - 0x75b7b7c2U, 0xe1fdfd1cU, 0x3d9393aeU, 0x4c26266aU, 19.78 - 0x6c36365aU, 0x7e3f3f41U, 0xf5f7f702U, 0x83cccc4fU, 19.79 - 0x6834345cU, 0x51a5a5f4U, 0xd1e5e534U, 0xf9f1f108U, 19.80 - 0xe2717193U, 0xabd8d873U, 0x62313153U, 0x2a15153fU, 19.81 - 0x0804040cU, 0x95c7c752U, 0x46232365U, 0x9dc3c35eU, 19.82 - 0x30181828U, 0x379696a1U, 0x0a05050fU, 0x2f9a9ab5U, 19.83 - 0x0e070709U, 0x24121236U, 0x1b80809bU, 0xdfe2e23dU, 19.84 - 0xcdebeb26U, 0x4e272769U, 0x7fb2b2cdU, 0xea75759fU, 19.85 - 0x1209091bU, 0x1d83839eU, 0x582c2c74U, 0x341a1a2eU, 19.86 - 0x361b1b2dU, 0xdc6e6eb2U, 0xb45a5aeeU, 0x5ba0a0fbU, 19.87 - 0xa45252f6U, 0x763b3b4dU, 0xb7d6d661U, 0x7db3b3ceU, 19.88 - 0x5229297bU, 0xdde3e33eU, 0x5e2f2f71U, 0x13848497U, 19.89 - 0xa65353f5U, 0xb9d1d168U, 0x00000000U, 0xc1eded2cU, 19.90 - 0x40202060U, 0xe3fcfc1fU, 0x79b1b1c8U, 0xb65b5bedU, 19.91 - 0xd46a6abeU, 0x8dcbcb46U, 0x67bebed9U, 0x7239394bU, 19.92 - 0x944a4adeU, 0x984c4cd4U, 0xb05858e8U, 0x85cfcf4aU, 19.93 - 0xbbd0d06bU, 0xc5efef2aU, 0x4faaaae5U, 0xedfbfb16U, 19.94 - 0x864343c5U, 0x9a4d4dd7U, 0x66333355U, 0x11858594U, 19.95 - 0x8a4545cfU, 0xe9f9f910U, 0x04020206U, 0xfe7f7f81U, 19.96 - 0xa05050f0U, 0x783c3c44U, 0x259f9fbaU, 0x4ba8a8e3U, 19.97 - 0xa25151f3U, 0x5da3a3feU, 0x804040c0U, 0x058f8f8aU, 19.98 - 0x3f9292adU, 0x219d9dbcU, 0x70383848U, 0xf1f5f504U, 19.99 - 0x63bcbcdfU, 0x77b6b6c1U, 0xafdada75U, 0x42212163U, 19.100 - 0x20101030U, 0xe5ffff1aU, 0xfdf3f30eU, 0xbfd2d26dU, 19.101 - 0x81cdcd4cU, 0x180c0c14U, 0x26131335U, 0xc3ecec2fU, 19.102 - 0xbe5f5fe1U, 0x359797a2U, 0x884444ccU, 0x2e171739U, 19.103 - 0x93c4c457U, 0x55a7a7f2U, 0xfc7e7e82U, 0x7a3d3d47U, 19.104 - 0xc86464acU, 0xba5d5de7U, 0x3219192bU, 0xe6737395U, 19.105 - 0xc06060a0U, 0x19818198U, 0x9e4f4fd1U, 0xa3dcdc7fU, 19.106 - 0x44222266U, 0x542a2a7eU, 0x3b9090abU, 0x0b888883U, 19.107 - 0x8c4646caU, 0xc7eeee29U, 0x6bb8b8d3U, 0x2814143cU, 19.108 - 0xa7dede79U, 0xbc5e5ee2U, 0x160b0b1dU, 0xaddbdb76U, 19.109 - 0xdbe0e03bU, 0x64323256U, 0x743a3a4eU, 0x140a0a1eU, 19.110 - 0x924949dbU, 0x0c06060aU, 0x4824246cU, 0xb85c5ce4U, 19.111 - 0x9fc2c25dU, 0xbdd3d36eU, 0x43acacefU, 0xc46262a6U, 19.112 - 0x399191a8U, 0x319595a4U, 0xd3e4e437U, 0xf279798bU, 19.113 - 0xd5e7e732U, 0x8bc8c843U, 0x6e373759U, 0xda6d6db7U, 19.114 - 0x018d8d8cU, 0xb1d5d564U, 0x9c4e4ed2U, 0x49a9a9e0U, 19.115 - 0xd86c6cb4U, 0xac5656faU, 0xf3f4f407U, 0xcfeaea25U, 19.116 - 0xca6565afU, 0xf47a7a8eU, 0x47aeaee9U, 0x10080818U, 19.117 - 0x6fbabad5U, 0xf0787888U, 0x4a25256fU, 0x5c2e2e72U, 19.118 - 0x381c1c24U, 0x57a6a6f1U, 0x73b4b4c7U, 0x97c6c651U, 19.119 - 0xcbe8e823U, 0xa1dddd7cU, 0xe874749cU, 0x3e1f1f21U, 19.120 - 0x964b4bddU, 0x61bdbddcU, 0x0d8b8b86U, 0x0f8a8a85U, 19.121 - 0xe0707090U, 0x7c3e3e42U, 0x71b5b5c4U, 0xcc6666aaU, 19.122 - 0x904848d8U, 0x06030305U, 0xf7f6f601U, 0x1c0e0e12U, 19.123 - 0xc26161a3U, 0x6a35355fU, 0xae5757f9U, 0x69b9b9d0U, 19.124 - 0x17868691U, 0x99c1c158U, 0x3a1d1d27U, 0x279e9eb9U, 19.125 - 0xd9e1e138U, 0xebf8f813U, 0x2b9898b3U, 0x22111133U, 19.126 - 0xd26969bbU, 0xa9d9d970U, 0x078e8e89U, 0x339494a7U, 19.127 - 0x2d9b9bb6U, 0x3c1e1e22U, 0x15878792U, 0xc9e9e920U, 19.128 - 0x87cece49U, 0xaa5555ffU, 0x50282878U, 0xa5dfdf7aU, 19.129 - 0x038c8c8fU, 0x59a1a1f8U, 0x09898980U, 0x1a0d0d17U, 19.130 - 0x65bfbfdaU, 0xd7e6e631U, 0x844242c6U, 0xd06868b8U, 19.131 - 0x824141c3U, 0x299999b0U, 0x5a2d2d77U, 0x1e0f0f11U, 19.132 - 0x7bb0b0cbU, 0xa85454fcU, 0x6dbbbbd6U, 0x2c16163aU, 19.133 -}; 19.134 -static const u32 Te1[256] = { 19.135 - 0xa5c66363U, 0x84f87c7cU, 0x99ee7777U, 0x8df67b7bU, 19.136 - 0x0dfff2f2U, 0xbdd66b6bU, 0xb1de6f6fU, 0x5491c5c5U, 19.137 - 0x50603030U, 0x03020101U, 0xa9ce6767U, 0x7d562b2bU, 19.138 - 0x19e7fefeU, 0x62b5d7d7U, 0xe64dababU, 0x9aec7676U, 19.139 - 0x458fcacaU, 0x9d1f8282U, 0x4089c9c9U, 0x87fa7d7dU, 19.140 - 0x15effafaU, 0xebb25959U, 0xc98e4747U, 0x0bfbf0f0U, 19.141 - 0xec41adadU, 0x67b3d4d4U, 0xfd5fa2a2U, 0xea45afafU, 19.142 - 0xbf239c9cU, 0xf753a4a4U, 0x96e47272U, 0x5b9bc0c0U, 19.143 - 0xc275b7b7U, 0x1ce1fdfdU, 0xae3d9393U, 0x6a4c2626U, 19.144 - 0x5a6c3636U, 0x417e3f3fU, 0x02f5f7f7U, 0x4f83ccccU, 19.145 - 0x5c683434U, 0xf451a5a5U, 0x34d1e5e5U, 0x08f9f1f1U, 19.146 - 0x93e27171U, 0x73abd8d8U, 0x53623131U, 0x3f2a1515U, 19.147 - 0x0c080404U, 0x5295c7c7U, 0x65462323U, 0x5e9dc3c3U, 19.148 - 0x28301818U, 0xa1379696U, 0x0f0a0505U, 0xb52f9a9aU, 19.149 - 0x090e0707U, 0x36241212U, 0x9b1b8080U, 0x3ddfe2e2U, 19.150 - 0x26cdebebU, 0x694e2727U, 0xcd7fb2b2U, 0x9fea7575U, 19.151 - 0x1b120909U, 0x9e1d8383U, 0x74582c2cU, 0x2e341a1aU, 19.152 - 0x2d361b1bU, 0xb2dc6e6eU, 0xeeb45a5aU, 0xfb5ba0a0U, 19.153 - 0xf6a45252U, 0x4d763b3bU, 0x61b7d6d6U, 0xce7db3b3U, 19.154 - 0x7b522929U, 0x3edde3e3U, 0x715e2f2fU, 0x97138484U, 19.155 - 0xf5a65353U, 0x68b9d1d1U, 0x00000000U, 0x2cc1ededU, 19.156 - 0x60402020U, 0x1fe3fcfcU, 0xc879b1b1U, 0xedb65b5bU, 19.157 - 0xbed46a6aU, 0x468dcbcbU, 0xd967bebeU, 0x4b723939U, 19.158 - 0xde944a4aU, 0xd4984c4cU, 0xe8b05858U, 0x4a85cfcfU, 19.159 - 0x6bbbd0d0U, 0x2ac5efefU, 0xe54faaaaU, 0x16edfbfbU, 19.160 - 0xc5864343U, 0xd79a4d4dU, 0x55663333U, 0x94118585U, 19.161 - 0xcf8a4545U, 0x10e9f9f9U, 0x06040202U, 0x81fe7f7fU, 19.162 - 0xf0a05050U, 0x44783c3cU, 0xba259f9fU, 0xe34ba8a8U, 19.163 - 0xf3a25151U, 0xfe5da3a3U, 0xc0804040U, 0x8a058f8fU, 19.164 - 0xad3f9292U, 0xbc219d9dU, 0x48703838U, 0x04f1f5f5U, 19.165 - 0xdf63bcbcU, 0xc177b6b6U, 0x75afdadaU, 0x63422121U, 19.166 - 0x30201010U, 0x1ae5ffffU, 0x0efdf3f3U, 0x6dbfd2d2U, 19.167 - 0x4c81cdcdU, 0x14180c0cU, 0x35261313U, 0x2fc3ececU, 19.168 - 0xe1be5f5fU, 0xa2359797U, 0xcc884444U, 0x392e1717U, 19.169 - 0x5793c4c4U, 0xf255a7a7U, 0x82fc7e7eU, 0x477a3d3dU, 19.170 - 0xacc86464U, 0xe7ba5d5dU, 0x2b321919U, 0x95e67373U, 19.171 - 0xa0c06060U, 0x98198181U, 0xd19e4f4fU, 0x7fa3dcdcU, 19.172 - 0x66442222U, 0x7e542a2aU, 0xab3b9090U, 0x830b8888U, 19.173 - 0xca8c4646U, 0x29c7eeeeU, 0xd36bb8b8U, 0x3c281414U, 19.174 - 0x79a7dedeU, 0xe2bc5e5eU, 0x1d160b0bU, 0x76addbdbU, 19.175 - 0x3bdbe0e0U, 0x56643232U, 0x4e743a3aU, 0x1e140a0aU, 19.176 - 0xdb924949U, 0x0a0c0606U, 0x6c482424U, 0xe4b85c5cU, 19.177 - 0x5d9fc2c2U, 0x6ebdd3d3U, 0xef43acacU, 0xa6c46262U, 19.178 - 0xa8399191U, 0xa4319595U, 0x37d3e4e4U, 0x8bf27979U, 19.179 - 0x32d5e7e7U, 0x438bc8c8U, 0x596e3737U, 0xb7da6d6dU, 19.180 - 0x8c018d8dU, 0x64b1d5d5U, 0xd29c4e4eU, 0xe049a9a9U, 19.181 - 0xb4d86c6cU, 0xfaac5656U, 0x07f3f4f4U, 0x25cfeaeaU, 19.182 - 0xafca6565U, 0x8ef47a7aU, 0xe947aeaeU, 0x18100808U, 19.183 - 0xd56fbabaU, 0x88f07878U, 0x6f4a2525U, 0x725c2e2eU, 19.184 - 0x24381c1cU, 0xf157a6a6U, 0xc773b4b4U, 0x5197c6c6U, 19.185 - 0x23cbe8e8U, 0x7ca1ddddU, 0x9ce87474U, 0x213e1f1fU, 19.186 - 0xdd964b4bU, 0xdc61bdbdU, 0x860d8b8bU, 0x850f8a8aU, 19.187 - 0x90e07070U, 0x427c3e3eU, 0xc471b5b5U, 0xaacc6666U, 19.188 - 0xd8904848U, 0x05060303U, 0x01f7f6f6U, 0x121c0e0eU, 19.189 - 0xa3c26161U, 0x5f6a3535U, 0xf9ae5757U, 0xd069b9b9U, 19.190 - 0x91178686U, 0x5899c1c1U, 0x273a1d1dU, 0xb9279e9eU, 19.191 - 0x38d9e1e1U, 0x13ebf8f8U, 0xb32b9898U, 0x33221111U, 19.192 - 0xbbd26969U, 0x70a9d9d9U, 0x89078e8eU, 0xa7339494U, 19.193 - 0xb62d9b9bU, 0x223c1e1eU, 0x92158787U, 0x20c9e9e9U, 19.194 - 0x4987ceceU, 0xffaa5555U, 0x78502828U, 0x7aa5dfdfU, 19.195 - 0x8f038c8cU, 0xf859a1a1U, 0x80098989U, 0x171a0d0dU, 19.196 - 0xda65bfbfU, 0x31d7e6e6U, 0xc6844242U, 0xb8d06868U, 19.197 - 0xc3824141U, 0xb0299999U, 0x775a2d2dU, 0x111e0f0fU, 19.198 - 0xcb7bb0b0U, 0xfca85454U, 0xd66dbbbbU, 0x3a2c1616U, 19.199 -}; 19.200 -static const u32 Te2[256] = { 19.201 - 0x63a5c663U, 0x7c84f87cU, 0x7799ee77U, 0x7b8df67bU, 19.202 - 0xf20dfff2U, 0x6bbdd66bU, 0x6fb1de6fU, 0xc55491c5U, 19.203 - 0x30506030U, 0x01030201U, 0x67a9ce67U, 0x2b7d562bU, 19.204 - 0xfe19e7feU, 0xd762b5d7U, 0xabe64dabU, 0x769aec76U, 19.205 - 0xca458fcaU, 0x829d1f82U, 0xc94089c9U, 0x7d87fa7dU, 19.206 - 0xfa15effaU, 0x59ebb259U, 0x47c98e47U, 0xf00bfbf0U, 19.207 - 0xadec41adU, 0xd467b3d4U, 0xa2fd5fa2U, 0xafea45afU, 19.208 - 0x9cbf239cU, 0xa4f753a4U, 0x7296e472U, 0xc05b9bc0U, 19.209 - 0xb7c275b7U, 0xfd1ce1fdU, 0x93ae3d93U, 0x266a4c26U, 19.210 - 0x365a6c36U, 0x3f417e3fU, 0xf702f5f7U, 0xcc4f83ccU, 19.211 - 0x345c6834U, 0xa5f451a5U, 0xe534d1e5U, 0xf108f9f1U, 19.212 - 0x7193e271U, 0xd873abd8U, 0x31536231U, 0x153f2a15U, 19.213 - 0x040c0804U, 0xc75295c7U, 0x23654623U, 0xc35e9dc3U, 19.214 - 0x18283018U, 0x96a13796U, 0x050f0a05U, 0x9ab52f9aU, 19.215 - 0x07090e07U, 0x12362412U, 0x809b1b80U, 0xe23ddfe2U, 19.216 - 0xeb26cdebU, 0x27694e27U, 0xb2cd7fb2U, 0x759fea75U, 19.217 - 0x091b1209U, 0x839e1d83U, 0x2c74582cU, 0x1a2e341aU, 19.218 - 0x1b2d361bU, 0x6eb2dc6eU, 0x5aeeb45aU, 0xa0fb5ba0U, 19.219 - 0x52f6a452U, 0x3b4d763bU, 0xd661b7d6U, 0xb3ce7db3U, 19.220 - 0x297b5229U, 0xe33edde3U, 0x2f715e2fU, 0x84971384U, 19.221 - 0x53f5a653U, 0xd168b9d1U, 0x00000000U, 0xed2cc1edU, 19.222 - 0x20604020U, 0xfc1fe3fcU, 0xb1c879b1U, 0x5bedb65bU, 19.223 - 0x6abed46aU, 0xcb468dcbU, 0xbed967beU, 0x394b7239U, 19.224 - 0x4ade944aU, 0x4cd4984cU, 0x58e8b058U, 0xcf4a85cfU, 19.225 - 0xd06bbbd0U, 0xef2ac5efU, 0xaae54faaU, 0xfb16edfbU, 19.226 - 0x43c58643U, 0x4dd79a4dU, 0x33556633U, 0x85941185U, 19.227 - 0x45cf8a45U, 0xf910e9f9U, 0x02060402U, 0x7f81fe7fU, 19.228 - 0x50f0a050U, 0x3c44783cU, 0x9fba259fU, 0xa8e34ba8U, 19.229 - 0x51f3a251U, 0xa3fe5da3U, 0x40c08040U, 0x8f8a058fU, 19.230 - 0x92ad3f92U, 0x9dbc219dU, 0x38487038U, 0xf504f1f5U, 19.231 - 0xbcdf63bcU, 0xb6c177b6U, 0xda75afdaU, 0x21634221U, 19.232 - 0x10302010U, 0xff1ae5ffU, 0xf30efdf3U, 0xd26dbfd2U, 19.233 - 0xcd4c81cdU, 0x0c14180cU, 0x13352613U, 0xec2fc3ecU, 19.234 - 0x5fe1be5fU, 0x97a23597U, 0x44cc8844U, 0x17392e17U, 19.235 - 0xc45793c4U, 0xa7f255a7U, 0x7e82fc7eU, 0x3d477a3dU, 19.236 - 0x64acc864U, 0x5de7ba5dU, 0x192b3219U, 0x7395e673U, 19.237 - 0x60a0c060U, 0x81981981U, 0x4fd19e4fU, 0xdc7fa3dcU, 19.238 - 0x22664422U, 0x2a7e542aU, 0x90ab3b90U, 0x88830b88U, 19.239 - 0x46ca8c46U, 0xee29c7eeU, 0xb8d36bb8U, 0x143c2814U, 19.240 - 0xde79a7deU, 0x5ee2bc5eU, 0x0b1d160bU, 0xdb76addbU, 19.241 - 0xe03bdbe0U, 0x32566432U, 0x3a4e743aU, 0x0a1e140aU, 19.242 - 0x49db9249U, 0x060a0c06U, 0x246c4824U, 0x5ce4b85cU, 19.243 - 0xc25d9fc2U, 0xd36ebdd3U, 0xacef43acU, 0x62a6c462U, 19.244 - 0x91a83991U, 0x95a43195U, 0xe437d3e4U, 0x798bf279U, 19.245 - 0xe732d5e7U, 0xc8438bc8U, 0x37596e37U, 0x6db7da6dU, 19.246 - 0x8d8c018dU, 0xd564b1d5U, 0x4ed29c4eU, 0xa9e049a9U, 19.247 - 0x6cb4d86cU, 0x56faac56U, 0xf407f3f4U, 0xea25cfeaU, 19.248 - 0x65afca65U, 0x7a8ef47aU, 0xaee947aeU, 0x08181008U, 19.249 - 0xbad56fbaU, 0x7888f078U, 0x256f4a25U, 0x2e725c2eU, 19.250 - 0x1c24381cU, 0xa6f157a6U, 0xb4c773b4U, 0xc65197c6U, 19.251 - 0xe823cbe8U, 0xdd7ca1ddU, 0x749ce874U, 0x1f213e1fU, 19.252 - 0x4bdd964bU, 0xbddc61bdU, 0x8b860d8bU, 0x8a850f8aU, 19.253 - 0x7090e070U, 0x3e427c3eU, 0xb5c471b5U, 0x66aacc66U, 19.254 - 0x48d89048U, 0x03050603U, 0xf601f7f6U, 0x0e121c0eU, 19.255 - 0x61a3c261U, 0x355f6a35U, 0x57f9ae57U, 0xb9d069b9U, 19.256 - 0x86911786U, 0xc15899c1U, 0x1d273a1dU, 0x9eb9279eU, 19.257 - 0xe138d9e1U, 0xf813ebf8U, 0x98b32b98U, 0x11332211U, 19.258 - 0x69bbd269U, 0xd970a9d9U, 0x8e89078eU, 0x94a73394U, 19.259 - 0x9bb62d9bU, 0x1e223c1eU, 0x87921587U, 0xe920c9e9U, 19.260 - 0xce4987ceU, 0x55ffaa55U, 0x28785028U, 0xdf7aa5dfU, 19.261 - 0x8c8f038cU, 0xa1f859a1U, 0x89800989U, 0x0d171a0dU, 19.262 - 0xbfda65bfU, 0xe631d7e6U, 0x42c68442U, 0x68b8d068U, 19.263 - 0x41c38241U, 0x99b02999U, 0x2d775a2dU, 0x0f111e0fU, 19.264 - 0xb0cb7bb0U, 0x54fca854U, 0xbbd66dbbU, 0x163a2c16U, 19.265 -}; 19.266 -static const u32 Te3[256] = { 19.267 - 19.268 - 0x6363a5c6U, 0x7c7c84f8U, 0x777799eeU, 0x7b7b8df6U, 19.269 - 0xf2f20dffU, 0x6b6bbdd6U, 0x6f6fb1deU, 0xc5c55491U, 19.270 - 0x30305060U, 0x01010302U, 0x6767a9ceU, 0x2b2b7d56U, 19.271 - 0xfefe19e7U, 0xd7d762b5U, 0xababe64dU, 0x76769aecU, 19.272 - 0xcaca458fU, 0x82829d1fU, 0xc9c94089U, 0x7d7d87faU, 19.273 - 0xfafa15efU, 0x5959ebb2U, 0x4747c98eU, 0xf0f00bfbU, 19.274 - 0xadadec41U, 0xd4d467b3U, 0xa2a2fd5fU, 0xafafea45U, 19.275 - 0x9c9cbf23U, 0xa4a4f753U, 0x727296e4U, 0xc0c05b9bU, 19.276 - 0xb7b7c275U, 0xfdfd1ce1U, 0x9393ae3dU, 0x26266a4cU, 19.277 - 0x36365a6cU, 0x3f3f417eU, 0xf7f702f5U, 0xcccc4f83U, 19.278 - 0x34345c68U, 0xa5a5f451U, 0xe5e534d1U, 0xf1f108f9U, 19.279 - 0x717193e2U, 0xd8d873abU, 0x31315362U, 0x15153f2aU, 19.280 - 0x04040c08U, 0xc7c75295U, 0x23236546U, 0xc3c35e9dU, 19.281 - 0x18182830U, 0x9696a137U, 0x05050f0aU, 0x9a9ab52fU, 19.282 - 0x0707090eU, 0x12123624U, 0x80809b1bU, 0xe2e23ddfU, 19.283 - 0xebeb26cdU, 0x2727694eU, 0xb2b2cd7fU, 0x75759feaU, 19.284 - 0x09091b12U, 0x83839e1dU, 0x2c2c7458U, 0x1a1a2e34U, 19.285 - 0x1b1b2d36U, 0x6e6eb2dcU, 0x5a5aeeb4U, 0xa0a0fb5bU, 19.286 - 0x5252f6a4U, 0x3b3b4d76U, 0xd6d661b7U, 0xb3b3ce7dU, 19.287 - 0x29297b52U, 0xe3e33eddU, 0x2f2f715eU, 0x84849713U, 19.288 - 0x5353f5a6U, 0xd1d168b9U, 0x00000000U, 0xeded2cc1U, 19.289 - 0x20206040U, 0xfcfc1fe3U, 0xb1b1c879U, 0x5b5bedb6U, 19.290 - 0x6a6abed4U, 0xcbcb468dU, 0xbebed967U, 0x39394b72U, 19.291 - 0x4a4ade94U, 0x4c4cd498U, 0x5858e8b0U, 0xcfcf4a85U, 19.292 - 0xd0d06bbbU, 0xefef2ac5U, 0xaaaae54fU, 0xfbfb16edU, 19.293 - 0x4343c586U, 0x4d4dd79aU, 0x33335566U, 0x85859411U, 19.294 - 0x4545cf8aU, 0xf9f910e9U, 0x02020604U, 0x7f7f81feU, 19.295 - 0x5050f0a0U, 0x3c3c4478U, 0x9f9fba25U, 0xa8a8e34bU, 19.296 - 0x5151f3a2U, 0xa3a3fe5dU, 0x4040c080U, 0x8f8f8a05U, 19.297 - 0x9292ad3fU, 0x9d9dbc21U, 0x38384870U, 0xf5f504f1U, 19.298 - 0xbcbcdf63U, 0xb6b6c177U, 0xdada75afU, 0x21216342U, 19.299 - 0x10103020U, 0xffff1ae5U, 0xf3f30efdU, 0xd2d26dbfU, 19.300 - 0xcdcd4c81U, 0x0c0c1418U, 0x13133526U, 0xecec2fc3U, 19.301 - 0x5f5fe1beU, 0x9797a235U, 0x4444cc88U, 0x1717392eU, 19.302 - 0xc4c45793U, 0xa7a7f255U, 0x7e7e82fcU, 0x3d3d477aU, 19.303 - 0x6464acc8U, 0x5d5de7baU, 0x19192b32U, 0x737395e6U, 19.304 - 0x6060a0c0U, 0x81819819U, 0x4f4fd19eU, 0xdcdc7fa3U, 19.305 - 0x22226644U, 0x2a2a7e54U, 0x9090ab3bU, 0x8888830bU, 19.306 - 0x4646ca8cU, 0xeeee29c7U, 0xb8b8d36bU, 0x14143c28U, 19.307 - 0xdede79a7U, 0x5e5ee2bcU, 0x0b0b1d16U, 0xdbdb76adU, 19.308 - 0xe0e03bdbU, 0x32325664U, 0x3a3a4e74U, 0x0a0a1e14U, 19.309 - 0x4949db92U, 0x06060a0cU, 0x24246c48U, 0x5c5ce4b8U, 19.310 - 0xc2c25d9fU, 0xd3d36ebdU, 0xacacef43U, 0x6262a6c4U, 19.311 - 0x9191a839U, 0x9595a431U, 0xe4e437d3U, 0x79798bf2U, 19.312 - 0xe7e732d5U, 0xc8c8438bU, 0x3737596eU, 0x6d6db7daU, 19.313 - 0x8d8d8c01U, 0xd5d564b1U, 0x4e4ed29cU, 0xa9a9e049U, 19.314 - 0x6c6cb4d8U, 0x5656faacU, 0xf4f407f3U, 0xeaea25cfU, 19.315 - 0x6565afcaU, 0x7a7a8ef4U, 0xaeaee947U, 0x08081810U, 19.316 - 0xbabad56fU, 0x787888f0U, 0x25256f4aU, 0x2e2e725cU, 19.317 - 0x1c1c2438U, 0xa6a6f157U, 0xb4b4c773U, 0xc6c65197U, 19.318 - 0xe8e823cbU, 0xdddd7ca1U, 0x74749ce8U, 0x1f1f213eU, 19.319 - 0x4b4bdd96U, 0xbdbddc61U, 0x8b8b860dU, 0x8a8a850fU, 19.320 - 0x707090e0U, 0x3e3e427cU, 0xb5b5c471U, 0x6666aaccU, 19.321 - 0x4848d890U, 0x03030506U, 0xf6f601f7U, 0x0e0e121cU, 19.322 - 0x6161a3c2U, 0x35355f6aU, 0x5757f9aeU, 0xb9b9d069U, 19.323 - 0x86869117U, 0xc1c15899U, 0x1d1d273aU, 0x9e9eb927U, 19.324 - 0xe1e138d9U, 0xf8f813ebU, 0x9898b32bU, 0x11113322U, 19.325 - 0x6969bbd2U, 0xd9d970a9U, 0x8e8e8907U, 0x9494a733U, 19.326 - 0x9b9bb62dU, 0x1e1e223cU, 0x87879215U, 0xe9e920c9U, 19.327 - 0xcece4987U, 0x5555ffaaU, 0x28287850U, 0xdfdf7aa5U, 19.328 - 0x8c8c8f03U, 0xa1a1f859U, 0x89898009U, 0x0d0d171aU, 19.329 - 0xbfbfda65U, 0xe6e631d7U, 0x4242c684U, 0x6868b8d0U, 19.330 - 0x4141c382U, 0x9999b029U, 0x2d2d775aU, 0x0f0f111eU, 19.331 - 0xb0b0cb7bU, 0x5454fca8U, 0xbbbbd66dU, 0x16163a2cU, 19.332 -}; 19.333 -static const u32 Te4[256] = { 19.334 - 0x63636363U, 0x7c7c7c7cU, 0x77777777U, 0x7b7b7b7bU, 19.335 - 0xf2f2f2f2U, 0x6b6b6b6bU, 0x6f6f6f6fU, 0xc5c5c5c5U, 19.336 - 0x30303030U, 0x01010101U, 0x67676767U, 0x2b2b2b2bU, 19.337 - 0xfefefefeU, 0xd7d7d7d7U, 0xababababU, 0x76767676U, 19.338 - 0xcacacacaU, 0x82828282U, 0xc9c9c9c9U, 0x7d7d7d7dU, 19.339 - 0xfafafafaU, 0x59595959U, 0x47474747U, 0xf0f0f0f0U, 19.340 - 0xadadadadU, 0xd4d4d4d4U, 0xa2a2a2a2U, 0xafafafafU, 19.341 - 0x9c9c9c9cU, 0xa4a4a4a4U, 0x72727272U, 0xc0c0c0c0U, 19.342 - 0xb7b7b7b7U, 0xfdfdfdfdU, 0x93939393U, 0x26262626U, 19.343 - 0x36363636U, 0x3f3f3f3fU, 0xf7f7f7f7U, 0xccccccccU, 19.344 - 0x34343434U, 0xa5a5a5a5U, 0xe5e5e5e5U, 0xf1f1f1f1U, 19.345 - 0x71717171U, 0xd8d8d8d8U, 0x31313131U, 0x15151515U, 19.346 - 0x04040404U, 0xc7c7c7c7U, 0x23232323U, 0xc3c3c3c3U, 19.347 - 0x18181818U, 0x96969696U, 0x05050505U, 0x9a9a9a9aU, 19.348 - 0x07070707U, 0x12121212U, 0x80808080U, 0xe2e2e2e2U, 19.349 - 0xebebebebU, 0x27272727U, 0xb2b2b2b2U, 0x75757575U, 19.350 - 0x09090909U, 0x83838383U, 0x2c2c2c2cU, 0x1a1a1a1aU, 19.351 - 0x1b1b1b1bU, 0x6e6e6e6eU, 0x5a5a5a5aU, 0xa0a0a0a0U, 19.352 - 0x52525252U, 0x3b3b3b3bU, 0xd6d6d6d6U, 0xb3b3b3b3U, 19.353 - 0x29292929U, 0xe3e3e3e3U, 0x2f2f2f2fU, 0x84848484U, 19.354 - 0x53535353U, 0xd1d1d1d1U, 0x00000000U, 0xededededU, 19.355 - 0x20202020U, 0xfcfcfcfcU, 0xb1b1b1b1U, 0x5b5b5b5bU, 19.356 - 0x6a6a6a6aU, 0xcbcbcbcbU, 0xbebebebeU, 0x39393939U, 19.357 - 0x4a4a4a4aU, 0x4c4c4c4cU, 0x58585858U, 0xcfcfcfcfU, 19.358 - 0xd0d0d0d0U, 0xefefefefU, 0xaaaaaaaaU, 0xfbfbfbfbU, 19.359 - 0x43434343U, 0x4d4d4d4dU, 0x33333333U, 0x85858585U, 19.360 - 0x45454545U, 0xf9f9f9f9U, 0x02020202U, 0x7f7f7f7fU, 19.361 - 0x50505050U, 0x3c3c3c3cU, 0x9f9f9f9fU, 0xa8a8a8a8U, 19.362 - 0x51515151U, 0xa3a3a3a3U, 0x40404040U, 0x8f8f8f8fU, 19.363 - 0x92929292U, 0x9d9d9d9dU, 0x38383838U, 0xf5f5f5f5U, 19.364 - 0xbcbcbcbcU, 0xb6b6b6b6U, 0xdadadadaU, 0x21212121U, 19.365 - 0x10101010U, 0xffffffffU, 0xf3f3f3f3U, 0xd2d2d2d2U, 19.366 - 0xcdcdcdcdU, 0x0c0c0c0cU, 0x13131313U, 0xececececU, 19.367 - 0x5f5f5f5fU, 0x97979797U, 0x44444444U, 0x17171717U, 19.368 - 0xc4c4c4c4U, 0xa7a7a7a7U, 0x7e7e7e7eU, 0x3d3d3d3dU, 19.369 - 0x64646464U, 0x5d5d5d5dU, 0x19191919U, 0x73737373U, 19.370 - 0x60606060U, 0x81818181U, 0x4f4f4f4fU, 0xdcdcdcdcU, 19.371 - 0x22222222U, 0x2a2a2a2aU, 0x90909090U, 0x88888888U, 19.372 - 0x46464646U, 0xeeeeeeeeU, 0xb8b8b8b8U, 0x14141414U, 19.373 - 0xdedededeU, 0x5e5e5e5eU, 0x0b0b0b0bU, 0xdbdbdbdbU, 19.374 - 0xe0e0e0e0U, 0x32323232U, 0x3a3a3a3aU, 0x0a0a0a0aU, 19.375 - 0x49494949U, 0x06060606U, 0x24242424U, 0x5c5c5c5cU, 19.376 - 0xc2c2c2c2U, 0xd3d3d3d3U, 0xacacacacU, 0x62626262U, 19.377 - 0x91919191U, 0x95959595U, 0xe4e4e4e4U, 0x79797979U, 19.378 - 0xe7e7e7e7U, 0xc8c8c8c8U, 0x37373737U, 0x6d6d6d6dU, 19.379 - 0x8d8d8d8dU, 0xd5d5d5d5U, 0x4e4e4e4eU, 0xa9a9a9a9U, 19.380 - 0x6c6c6c6cU, 0x56565656U, 0xf4f4f4f4U, 0xeaeaeaeaU, 19.381 - 0x65656565U, 0x7a7a7a7aU, 0xaeaeaeaeU, 0x08080808U, 19.382 - 0xbabababaU, 0x78787878U, 0x25252525U, 0x2e2e2e2eU, 19.383 - 0x1c1c1c1cU, 0xa6a6a6a6U, 0xb4b4b4b4U, 0xc6c6c6c6U, 19.384 - 0xe8e8e8e8U, 0xddddddddU, 0x74747474U, 0x1f1f1f1fU, 19.385 - 0x4b4b4b4bU, 0xbdbdbdbdU, 0x8b8b8b8bU, 0x8a8a8a8aU, 19.386 - 0x70707070U, 0x3e3e3e3eU, 0xb5b5b5b5U, 0x66666666U, 19.387 - 0x48484848U, 0x03030303U, 0xf6f6f6f6U, 0x0e0e0e0eU, 19.388 - 0x61616161U, 0x35353535U, 0x57575757U, 0xb9b9b9b9U, 19.389 - 0x86868686U, 0xc1c1c1c1U, 0x1d1d1d1dU, 0x9e9e9e9eU, 19.390 - 0xe1e1e1e1U, 0xf8f8f8f8U, 0x98989898U, 0x11111111U, 19.391 - 0x69696969U, 0xd9d9d9d9U, 0x8e8e8e8eU, 0x94949494U, 19.392 - 0x9b9b9b9bU, 0x1e1e1e1eU, 0x87878787U, 0xe9e9e9e9U, 19.393 - 0xcecececeU, 0x55555555U, 0x28282828U, 0xdfdfdfdfU, 19.394 - 0x8c8c8c8cU, 0xa1a1a1a1U, 0x89898989U, 0x0d0d0d0dU, 19.395 - 0xbfbfbfbfU, 0xe6e6e6e6U, 0x42424242U, 0x68686868U, 19.396 - 0x41414141U, 0x99999999U, 0x2d2d2d2dU, 0x0f0f0f0fU, 19.397 - 0xb0b0b0b0U, 0x54545454U, 0xbbbbbbbbU, 0x16161616U, 19.398 -}; 19.399 -static const u32 Td0[256] = { 19.400 - 0x51f4a750U, 0x7e416553U, 0x1a17a4c3U, 0x3a275e96U, 19.401 - 0x3bab6bcbU, 0x1f9d45f1U, 0xacfa58abU, 0x4be30393U, 19.402 - 0x2030fa55U, 0xad766df6U, 0x88cc7691U, 0xf5024c25U, 19.403 - 0x4fe5d7fcU, 0xc52acbd7U, 0x26354480U, 0xb562a38fU, 19.404 - 0xdeb15a49U, 0x25ba1b67U, 0x45ea0e98U, 0x5dfec0e1U, 19.405 - 0xc32f7502U, 0x814cf012U, 0x8d4697a3U, 0x6bd3f9c6U, 19.406 - 0x038f5fe7U, 0x15929c95U, 0xbf6d7aebU, 0x955259daU, 19.407 - 0xd4be832dU, 0x587421d3U, 0x49e06929U, 0x8ec9c844U, 19.408 - 0x75c2896aU, 0xf48e7978U, 0x99583e6bU, 0x27b971ddU, 19.409 - 0xbee14fb6U, 0xf088ad17U, 0xc920ac66U, 0x7dce3ab4U, 19.410 - 0x63df4a18U, 0xe51a3182U, 0x97513360U, 0x62537f45U, 19.411 - 0xb16477e0U, 0xbb6bae84U, 0xfe81a01cU, 0xf9082b94U, 19.412 - 0x70486858U, 0x8f45fd19U, 0x94de6c87U, 0x527bf8b7U, 19.413 - 0xab73d323U, 0x724b02e2U, 0xe31f8f57U, 0x6655ab2aU, 19.414 - 0xb2eb2807U, 0x2fb5c203U, 0x86c57b9aU, 0xd33708a5U, 19.415 - 0x302887f2U, 0x23bfa5b2U, 0x02036abaU, 0xed16825cU, 19.416 - 0x8acf1c2bU, 0xa779b492U, 0xf307f2f0U, 0x4e69e2a1U, 19.417 - 0x65daf4cdU, 0x0605bed5U, 0xd134621fU, 0xc4a6fe8aU, 19.418 - 0x342e539dU, 0xa2f355a0U, 0x058ae132U, 0xa4f6eb75U, 19.419 - 0x0b83ec39U, 0x4060efaaU, 0x5e719f06U, 0xbd6e1051U, 19.420 - 0x3e218af9U, 0x96dd063dU, 0xdd3e05aeU, 0x4de6bd46U, 19.421 - 0x91548db5U, 0x71c45d05U, 0x0406d46fU, 0x605015ffU, 19.422 - 0x1998fb24U, 0xd6bde997U, 0x894043ccU, 0x67d99e77U, 19.423 - 0xb0e842bdU, 0x07898b88U, 0xe7195b38U, 0x79c8eedbU, 19.424 - 0xa17c0a47U, 0x7c420fe9U, 0xf8841ec9U, 0x00000000U, 19.425 - 0x09808683U, 0x322bed48U, 0x1e1170acU, 0x6c5a724eU, 19.426 - 0xfd0efffbU, 0x0f853856U, 0x3daed51eU, 0x362d3927U, 19.427 - 0x0a0fd964U, 0x685ca621U, 0x9b5b54d1U, 0x24362e3aU, 19.428 - 0x0c0a67b1U, 0x9357e70fU, 0xb4ee96d2U, 0x1b9b919eU, 19.429 - 0x80c0c54fU, 0x61dc20a2U, 0x5a774b69U, 0x1c121a16U, 19.430 - 0xe293ba0aU, 0xc0a02ae5U, 0x3c22e043U, 0x121b171dU, 19.431 - 0x0e090d0bU, 0xf28bc7adU, 0x2db6a8b9U, 0x141ea9c8U, 19.432 - 0x57f11985U, 0xaf75074cU, 0xee99ddbbU, 0xa37f60fdU, 19.433 - 0xf701269fU, 0x5c72f5bcU, 0x44663bc5U, 0x5bfb7e34U, 19.434 - 0x8b432976U, 0xcb23c6dcU, 0xb6edfc68U, 0xb8e4f163U, 19.435 - 0xd731dccaU, 0x42638510U, 0x13972240U, 0x84c61120U, 19.436 - 0x854a247dU, 0xd2bb3df8U, 0xaef93211U, 0xc729a16dU, 19.437 - 0x1d9e2f4bU, 0xdcb230f3U, 0x0d8652ecU, 0x77c1e3d0U, 19.438 - 0x2bb3166cU, 0xa970b999U, 0x119448faU, 0x47e96422U, 19.439 - 0xa8fc8cc4U, 0xa0f03f1aU, 0x567d2cd8U, 0x223390efU, 19.440 - 0x87494ec7U, 0xd938d1c1U, 0x8ccaa2feU, 0x98d40b36U, 19.441 - 0xa6f581cfU, 0xa57ade28U, 0xdab78e26U, 0x3fadbfa4U, 19.442 - 0x2c3a9de4U, 0x5078920dU, 0x6a5fcc9bU, 0x547e4662U, 19.443 - 0xf68d13c2U, 0x90d8b8e8U, 0x2e39f75eU, 0x82c3aff5U, 19.444 - 0x9f5d80beU, 0x69d0937cU, 0x6fd52da9U, 0xcf2512b3U, 19.445 - 0xc8ac993bU, 0x10187da7U, 0xe89c636eU, 0xdb3bbb7bU, 19.446 - 0xcd267809U, 0x6e5918f4U, 0xec9ab701U, 0x834f9aa8U, 19.447 - 0xe6956e65U, 0xaaffe67eU, 0x21bccf08U, 0xef15e8e6U, 19.448 - 0xbae79bd9U, 0x4a6f36ceU, 0xea9f09d4U, 0x29b07cd6U, 19.449 - 0x31a4b2afU, 0x2a3f2331U, 0xc6a59430U, 0x35a266c0U, 19.450 - 0x744ebc37U, 0xfc82caa6U, 0xe090d0b0U, 0x33a7d815U, 19.451 - 0xf104984aU, 0x41ecdaf7U, 0x7fcd500eU, 0x1791f62fU, 19.452 - 0x764dd68dU, 0x43efb04dU, 0xccaa4d54U, 0xe49604dfU, 19.453 - 0x9ed1b5e3U, 0x4c6a881bU, 0xc12c1fb8U, 0x4665517fU, 19.454 - 0x9d5eea04U, 0x018c355dU, 0xfa877473U, 0xfb0b412eU, 19.455 - 0xb3671d5aU, 0x92dbd252U, 0xe9105633U, 0x6dd64713U, 19.456 - 0x9ad7618cU, 0x37a10c7aU, 0x59f8148eU, 0xeb133c89U, 19.457 - 0xcea927eeU, 0xb761c935U, 0xe11ce5edU, 0x7a47b13cU, 19.458 - 0x9cd2df59U, 0x55f2733fU, 0x1814ce79U, 0x73c737bfU, 19.459 - 0x53f7cdeaU, 0x5ffdaa5bU, 0xdf3d6f14U, 0x7844db86U, 19.460 - 0xcaaff381U, 0xb968c43eU, 0x3824342cU, 0xc2a3405fU, 19.461 - 0x161dc372U, 0xbce2250cU, 0x283c498bU, 0xff0d9541U, 19.462 - 0x39a80171U, 0x080cb3deU, 0xd8b4e49cU, 0x6456c190U, 19.463 - 0x7bcb8461U, 0xd532b670U, 0x486c5c74U, 0xd0b85742U, 19.464 -}; 19.465 -static const u32 Td1[256] = { 19.466 - 0x5051f4a7U, 0x537e4165U, 0xc31a17a4U, 0x963a275eU, 19.467 - 0xcb3bab6bU, 0xf11f9d45U, 0xabacfa58U, 0x934be303U, 19.468 - 0x552030faU, 0xf6ad766dU, 0x9188cc76U, 0x25f5024cU, 19.469 - 0xfc4fe5d7U, 0xd7c52acbU, 0x80263544U, 0x8fb562a3U, 19.470 - 0x49deb15aU, 0x6725ba1bU, 0x9845ea0eU, 0xe15dfec0U, 19.471 - 0x02c32f75U, 0x12814cf0U, 0xa38d4697U, 0xc66bd3f9U, 19.472 - 0xe7038f5fU, 0x9515929cU, 0xebbf6d7aU, 0xda955259U, 19.473 - 0x2dd4be83U, 0xd3587421U, 0x2949e069U, 0x448ec9c8U, 19.474 - 0x6a75c289U, 0x78f48e79U, 0x6b99583eU, 0xdd27b971U, 19.475 - 0xb6bee14fU, 0x17f088adU, 0x66c920acU, 0xb47dce3aU, 19.476 - 0x1863df4aU, 0x82e51a31U, 0x60975133U, 0x4562537fU, 19.477 - 0xe0b16477U, 0x84bb6baeU, 0x1cfe81a0U, 0x94f9082bU, 19.478 - 0x58704868U, 0x198f45fdU, 0x8794de6cU, 0xb7527bf8U, 19.479 - 0x23ab73d3U, 0xe2724b02U, 0x57e31f8fU, 0x2a6655abU, 19.480 - 0x07b2eb28U, 0x032fb5c2U, 0x9a86c57bU, 0xa5d33708U, 19.481 - 0xf2302887U, 0xb223bfa5U, 0xba02036aU, 0x5ced1682U, 19.482 - 0x2b8acf1cU, 0x92a779b4U, 0xf0f307f2U, 0xa14e69e2U, 19.483 - 0xcd65daf4U, 0xd50605beU, 0x1fd13462U, 0x8ac4a6feU, 19.484 - 0x9d342e53U, 0xa0a2f355U, 0x32058ae1U, 0x75a4f6ebU, 19.485 - 0x390b83ecU, 0xaa4060efU, 0x065e719fU, 0x51bd6e10U, 19.486 - 0xf93e218aU, 0x3d96dd06U, 0xaedd3e05U, 0x464de6bdU, 19.487 - 0xb591548dU, 0x0571c45dU, 0x6f0406d4U, 0xff605015U, 19.488 - 0x241998fbU, 0x97d6bde9U, 0xcc894043U, 0x7767d99eU, 19.489 - 0xbdb0e842U, 0x8807898bU, 0x38e7195bU, 0xdb79c8eeU, 19.490 - 0x47a17c0aU, 0xe97c420fU, 0xc9f8841eU, 0x00000000U, 19.491 - 0x83098086U, 0x48322bedU, 0xac1e1170U, 0x4e6c5a72U, 19.492 - 0xfbfd0effU, 0x560f8538U, 0x1e3daed5U, 0x27362d39U, 19.493 - 0x640a0fd9U, 0x21685ca6U, 0xd19b5b54U, 0x3a24362eU, 19.494 - 0xb10c0a67U, 0x0f9357e7U, 0xd2b4ee96U, 0x9e1b9b91U, 19.495 - 0x4f80c0c5U, 0xa261dc20U, 0x695a774bU, 0x161c121aU, 19.496 - 0x0ae293baU, 0xe5c0a02aU, 0x433c22e0U, 0x1d121b17U, 19.497 - 0x0b0e090dU, 0xadf28bc7U, 0xb92db6a8U, 0xc8141ea9U, 19.498 - 0x8557f119U, 0x4caf7507U, 0xbbee99ddU, 0xfda37f60U, 19.499 - 0x9ff70126U, 0xbc5c72f5U, 0xc544663bU, 0x345bfb7eU, 19.500 - 0x768b4329U, 0xdccb23c6U, 0x68b6edfcU, 0x63b8e4f1U, 19.501 - 0xcad731dcU, 0x10426385U, 0x40139722U, 0x2084c611U, 19.502 - 0x7d854a24U, 0xf8d2bb3dU, 0x11aef932U, 0x6dc729a1U, 19.503 - 0x4b1d9e2fU, 0xf3dcb230U, 0xec0d8652U, 0xd077c1e3U, 19.504 - 0x6c2bb316U, 0x99a970b9U, 0xfa119448U, 0x2247e964U, 19.505 - 0xc4a8fc8cU, 0x1aa0f03fU, 0xd8567d2cU, 0xef223390U, 19.506 - 0xc787494eU, 0xc1d938d1U, 0xfe8ccaa2U, 0x3698d40bU, 19.507 - 0xcfa6f581U, 0x28a57adeU, 0x26dab78eU, 0xa43fadbfU, 19.508 - 0xe42c3a9dU, 0x0d507892U, 0x9b6a5fccU, 0x62547e46U, 19.509 - 0xc2f68d13U, 0xe890d8b8U, 0x5e2e39f7U, 0xf582c3afU, 19.510 - 0xbe9f5d80U, 0x7c69d093U, 0xa96fd52dU, 0xb3cf2512U, 19.511 - 0x3bc8ac99U, 0xa710187dU, 0x6ee89c63U, 0x7bdb3bbbU, 19.512 - 0x09cd2678U, 0xf46e5918U, 0x01ec9ab7U, 0xa8834f9aU, 19.513 - 0x65e6956eU, 0x7eaaffe6U, 0x0821bccfU, 0xe6ef15e8U, 19.514 - 0xd9bae79bU, 0xce4a6f36U, 0xd4ea9f09U, 0xd629b07cU, 19.515 - 0xaf31a4b2U, 0x312a3f23U, 0x30c6a594U, 0xc035a266U, 19.516 - 0x37744ebcU, 0xa6fc82caU, 0xb0e090d0U, 0x1533a7d8U, 19.517 - 0x4af10498U, 0xf741ecdaU, 0x0e7fcd50U, 0x2f1791f6U, 19.518 - 0x8d764dd6U, 0x4d43efb0U, 0x54ccaa4dU, 0xdfe49604U, 19.519 - 0xe39ed1b5U, 0x1b4c6a88U, 0xb8c12c1fU, 0x7f466551U, 19.520 - 0x049d5eeaU, 0x5d018c35U, 0x73fa8774U, 0x2efb0b41U, 19.521 - 0x5ab3671dU, 0x5292dbd2U, 0x33e91056U, 0x136dd647U, 19.522 - 0x8c9ad761U, 0x7a37a10cU, 0x8e59f814U, 0x89eb133cU, 19.523 - 0xeecea927U, 0x35b761c9U, 0xede11ce5U, 0x3c7a47b1U, 19.524 - 0x599cd2dfU, 0x3f55f273U, 0x791814ceU, 0xbf73c737U, 19.525 - 0xea53f7cdU, 0x5b5ffdaaU, 0x14df3d6fU, 0x867844dbU, 19.526 - 0x81caaff3U, 0x3eb968c4U, 0x2c382434U, 0x5fc2a340U, 19.527 - 0x72161dc3U, 0x0cbce225U, 0x8b283c49U, 0x41ff0d95U, 19.528 - 0x7139a801U, 0xde080cb3U, 0x9cd8b4e4U, 0x906456c1U, 19.529 - 0x617bcb84U, 0x70d532b6U, 0x74486c5cU, 0x42d0b857U, 19.530 -}; 19.531 -static const u32 Td2[256] = { 19.532 - 0xa75051f4U, 0x65537e41U, 0xa4c31a17U, 0x5e963a27U, 19.533 - 0x6bcb3babU, 0x45f11f9dU, 0x58abacfaU, 0x03934be3U, 19.534 - 0xfa552030U, 0x6df6ad76U, 0x769188ccU, 0x4c25f502U, 19.535 - 0xd7fc4fe5U, 0xcbd7c52aU, 0x44802635U, 0xa38fb562U, 19.536 - 0x5a49deb1U, 0x1b6725baU, 0x0e9845eaU, 0xc0e15dfeU, 19.537 - 0x7502c32fU, 0xf012814cU, 0x97a38d46U, 0xf9c66bd3U, 19.538 - 0x5fe7038fU, 0x9c951592U, 0x7aebbf6dU, 0x59da9552U, 19.539 - 0x832dd4beU, 0x21d35874U, 0x692949e0U, 0xc8448ec9U, 19.540 - 0x896a75c2U, 0x7978f48eU, 0x3e6b9958U, 0x71dd27b9U, 19.541 - 0x4fb6bee1U, 0xad17f088U, 0xac66c920U, 0x3ab47dceU, 19.542 - 0x4a1863dfU, 0x3182e51aU, 0x33609751U, 0x7f456253U, 19.543 - 0x77e0b164U, 0xae84bb6bU, 0xa01cfe81U, 0x2b94f908U, 19.544 - 0x68587048U, 0xfd198f45U, 0x6c8794deU, 0xf8b7527bU, 19.545 - 0xd323ab73U, 0x02e2724bU, 0x8f57e31fU, 0xab2a6655U, 19.546 - 0x2807b2ebU, 0xc2032fb5U, 0x7b9a86c5U, 0x08a5d337U, 19.547 - 0x87f23028U, 0xa5b223bfU, 0x6aba0203U, 0x825ced16U, 19.548 - 0x1c2b8acfU, 0xb492a779U, 0xf2f0f307U, 0xe2a14e69U, 19.549 - 0xf4cd65daU, 0xbed50605U, 0x621fd134U, 0xfe8ac4a6U, 19.550 - 0x539d342eU, 0x55a0a2f3U, 0xe132058aU, 0xeb75a4f6U, 19.551 - 0xec390b83U, 0xefaa4060U, 0x9f065e71U, 0x1051bd6eU, 19.552 - 19.553 - 0x8af93e21U, 0x063d96ddU, 0x05aedd3eU, 0xbd464de6U, 19.554 - 0x8db59154U, 0x5d0571c4U, 0xd46f0406U, 0x15ff6050U, 19.555 - 0xfb241998U, 0xe997d6bdU, 0x43cc8940U, 0x9e7767d9U, 19.556 - 0x42bdb0e8U, 0x8b880789U, 0x5b38e719U, 0xeedb79c8U, 19.557 - 0x0a47a17cU, 0x0fe97c42U, 0x1ec9f884U, 0x00000000U, 19.558 - 0x86830980U, 0xed48322bU, 0x70ac1e11U, 0x724e6c5aU, 19.559 - 0xfffbfd0eU, 0x38560f85U, 0xd51e3daeU, 0x3927362dU, 19.560 - 0xd9640a0fU, 0xa621685cU, 0x54d19b5bU, 0x2e3a2436U, 19.561 - 0x67b10c0aU, 0xe70f9357U, 0x96d2b4eeU, 0x919e1b9bU, 19.562 - 0xc54f80c0U, 0x20a261dcU, 0x4b695a77U, 0x1a161c12U, 19.563 - 0xba0ae293U, 0x2ae5c0a0U, 0xe0433c22U, 0x171d121bU, 19.564 - 0x0d0b0e09U, 0xc7adf28bU, 0xa8b92db6U, 0xa9c8141eU, 19.565 - 0x198557f1U, 0x074caf75U, 0xddbbee99U, 0x60fda37fU, 19.566 - 0x269ff701U, 0xf5bc5c72U, 0x3bc54466U, 0x7e345bfbU, 19.567 - 0x29768b43U, 0xc6dccb23U, 0xfc68b6edU, 0xf163b8e4U, 19.568 - 0xdccad731U, 0x85104263U, 0x22401397U, 0x112084c6U, 19.569 - 0x247d854aU, 0x3df8d2bbU, 0x3211aef9U, 0xa16dc729U, 19.570 - 0x2f4b1d9eU, 0x30f3dcb2U, 0x52ec0d86U, 0xe3d077c1U, 19.571 - 0x166c2bb3U, 0xb999a970U, 0x48fa1194U, 0x642247e9U, 19.572 - 0x8cc4a8fcU, 0x3f1aa0f0U, 0x2cd8567dU, 0x90ef2233U, 19.573 - 0x4ec78749U, 0xd1c1d938U, 0xa2fe8ccaU, 0x0b3698d4U, 19.574 - 0x81cfa6f5U, 0xde28a57aU, 0x8e26dab7U, 0xbfa43fadU, 19.575 - 0x9de42c3aU, 0x920d5078U, 0xcc9b6a5fU, 0x4662547eU, 19.576 - 0x13c2f68dU, 0xb8e890d8U, 0xf75e2e39U, 0xaff582c3U, 19.577 - 0x80be9f5dU, 0x937c69d0U, 0x2da96fd5U, 0x12b3cf25U, 19.578 - 0x993bc8acU, 0x7da71018U, 0x636ee89cU, 0xbb7bdb3bU, 19.579 - 0x7809cd26U, 0x18f46e59U, 0xb701ec9aU, 0x9aa8834fU, 19.580 - 0x6e65e695U, 0xe67eaaffU, 0xcf0821bcU, 0xe8e6ef15U, 19.581 - 0x9bd9bae7U, 0x36ce4a6fU, 0x09d4ea9fU, 0x7cd629b0U, 19.582 - 0xb2af31a4U, 0x23312a3fU, 0x9430c6a5U, 0x66c035a2U, 19.583 - 0xbc37744eU, 0xcaa6fc82U, 0xd0b0e090U, 0xd81533a7U, 19.584 - 0x984af104U, 0xdaf741ecU, 0x500e7fcdU, 0xf62f1791U, 19.585 - 0xd68d764dU, 0xb04d43efU, 0x4d54ccaaU, 0x04dfe496U, 19.586 - 0xb5e39ed1U, 0x881b4c6aU, 0x1fb8c12cU, 0x517f4665U, 19.587 - 0xea049d5eU, 0x355d018cU, 0x7473fa87U, 0x412efb0bU, 19.588 - 0x1d5ab367U, 0xd25292dbU, 0x5633e910U, 0x47136dd6U, 19.589 - 0x618c9ad7U, 0x0c7a37a1U, 0x148e59f8U, 0x3c89eb13U, 19.590 - 0x27eecea9U, 0xc935b761U, 0xe5ede11cU, 0xb13c7a47U, 19.591 - 0xdf599cd2U, 0x733f55f2U, 0xce791814U, 0x37bf73c7U, 19.592 - 0xcdea53f7U, 0xaa5b5ffdU, 0x6f14df3dU, 0xdb867844U, 19.593 - 0xf381caafU, 0xc43eb968U, 0x342c3824U, 0x405fc2a3U, 19.594 - 0xc372161dU, 0x250cbce2U, 0x498b283cU, 0x9541ff0dU, 19.595 - 0x017139a8U, 0xb3de080cU, 0xe49cd8b4U, 0xc1906456U, 19.596 - 0x84617bcbU, 0xb670d532U, 0x5c74486cU, 0x5742d0b8U, 19.597 -}; 19.598 -static const u32 Td3[256] = { 19.599 - 0xf4a75051U, 0x4165537eU, 0x17a4c31aU, 0x275e963aU, 19.600 - 0xab6bcb3bU, 0x9d45f11fU, 0xfa58abacU, 0xe303934bU, 19.601 - 0x30fa5520U, 0x766df6adU, 0xcc769188U, 0x024c25f5U, 19.602 - 0xe5d7fc4fU, 0x2acbd7c5U, 0x35448026U, 0x62a38fb5U, 19.603 - 0xb15a49deU, 0xba1b6725U, 0xea0e9845U, 0xfec0e15dU, 19.604 - 0x2f7502c3U, 0x4cf01281U, 0x4697a38dU, 0xd3f9c66bU, 19.605 - 0x8f5fe703U, 0x929c9515U, 0x6d7aebbfU, 0x5259da95U, 19.606 - 0xbe832dd4U, 0x7421d358U, 0xe0692949U, 0xc9c8448eU, 19.607 - 0xc2896a75U, 0x8e7978f4U, 0x583e6b99U, 0xb971dd27U, 19.608 - 0xe14fb6beU, 0x88ad17f0U, 0x20ac66c9U, 0xce3ab47dU, 19.609 - 0xdf4a1863U, 0x1a3182e5U, 0x51336097U, 0x537f4562U, 19.610 - 0x6477e0b1U, 0x6bae84bbU, 0x81a01cfeU, 0x082b94f9U, 19.611 - 0x48685870U, 0x45fd198fU, 0xde6c8794U, 0x7bf8b752U, 19.612 - 0x73d323abU, 0x4b02e272U, 0x1f8f57e3U, 0x55ab2a66U, 19.613 - 0xeb2807b2U, 0xb5c2032fU, 0xc57b9a86U, 0x3708a5d3U, 19.614 - 0x2887f230U, 0xbfa5b223U, 0x036aba02U, 0x16825cedU, 19.615 - 0xcf1c2b8aU, 0x79b492a7U, 0x07f2f0f3U, 0x69e2a14eU, 19.616 - 0xdaf4cd65U, 0x05bed506U, 0x34621fd1U, 0xa6fe8ac4U, 19.617 - 0x2e539d34U, 0xf355a0a2U, 0x8ae13205U, 0xf6eb75a4U, 19.618 - 0x83ec390bU, 0x60efaa40U, 0x719f065eU, 0x6e1051bdU, 19.619 - 0x218af93eU, 0xdd063d96U, 0x3e05aeddU, 0xe6bd464dU, 19.620 - 0x548db591U, 0xc45d0571U, 0x06d46f04U, 0x5015ff60U, 19.621 - 0x98fb2419U, 0xbde997d6U, 0x4043cc89U, 0xd99e7767U, 19.622 - 0xe842bdb0U, 0x898b8807U, 0x195b38e7U, 0xc8eedb79U, 19.623 - 0x7c0a47a1U, 0x420fe97cU, 0x841ec9f8U, 0x00000000U, 19.624 - 0x80868309U, 0x2bed4832U, 0x1170ac1eU, 0x5a724e6cU, 19.625 - 0x0efffbfdU, 0x8538560fU, 0xaed51e3dU, 0x2d392736U, 19.626 - 0x0fd9640aU, 0x5ca62168U, 0x5b54d19bU, 0x362e3a24U, 19.627 - 0x0a67b10cU, 0x57e70f93U, 0xee96d2b4U, 0x9b919e1bU, 19.628 - 0xc0c54f80U, 0xdc20a261U, 0x774b695aU, 0x121a161cU, 19.629 - 0x93ba0ae2U, 0xa02ae5c0U, 0x22e0433cU, 0x1b171d12U, 19.630 - 0x090d0b0eU, 0x8bc7adf2U, 0xb6a8b92dU, 0x1ea9c814U, 19.631 - 0xf1198557U, 0x75074cafU, 0x99ddbbeeU, 0x7f60fda3U, 19.632 - 0x01269ff7U, 0x72f5bc5cU, 0x663bc544U, 0xfb7e345bU, 19.633 - 0x4329768bU, 0x23c6dccbU, 0xedfc68b6U, 0xe4f163b8U, 19.634 - 0x31dccad7U, 0x63851042U, 0x97224013U, 0xc6112084U, 19.635 - 0x4a247d85U, 0xbb3df8d2U, 0xf93211aeU, 0x29a16dc7U, 19.636 - 0x9e2f4b1dU, 0xb230f3dcU, 0x8652ec0dU, 0xc1e3d077U, 19.637 - 0xb3166c2bU, 0x70b999a9U, 0x9448fa11U, 0xe9642247U, 19.638 - 0xfc8cc4a8U, 0xf03f1aa0U, 0x7d2cd856U, 0x3390ef22U, 19.639 - 0x494ec787U, 0x38d1c1d9U, 0xcaa2fe8cU, 0xd40b3698U, 19.640 - 0xf581cfa6U, 0x7ade28a5U, 0xb78e26daU, 0xadbfa43fU, 19.641 - 0x3a9de42cU, 0x78920d50U, 0x5fcc9b6aU, 0x7e466254U, 19.642 - 0x8d13c2f6U, 0xd8b8e890U, 0x39f75e2eU, 0xc3aff582U, 19.643 - 0x5d80be9fU, 0xd0937c69U, 0xd52da96fU, 0x2512b3cfU, 19.644 - 0xac993bc8U, 0x187da710U, 0x9c636ee8U, 0x3bbb7bdbU, 19.645 - 0x267809cdU, 0x5918f46eU, 0x9ab701ecU, 0x4f9aa883U, 19.646 - 0x956e65e6U, 0xffe67eaaU, 0xbccf0821U, 0x15e8e6efU, 19.647 - 0xe79bd9baU, 0x6f36ce4aU, 0x9f09d4eaU, 0xb07cd629U, 19.648 - 0xa4b2af31U, 0x3f23312aU, 0xa59430c6U, 0xa266c035U, 19.649 - 0x4ebc3774U, 0x82caa6fcU, 0x90d0b0e0U, 0xa7d81533U, 19.650 - 0x04984af1U, 0xecdaf741U, 0xcd500e7fU, 0x91f62f17U, 19.651 - 0x4dd68d76U, 0xefb04d43U, 0xaa4d54ccU, 0x9604dfe4U, 19.652 - 0xd1b5e39eU, 0x6a881b4cU, 0x2c1fb8c1U, 0x65517f46U, 19.653 - 0x5eea049dU, 0x8c355d01U, 0x877473faU, 0x0b412efbU, 19.654 - 0x671d5ab3U, 0xdbd25292U, 0x105633e9U, 0xd647136dU, 19.655 - 0xd7618c9aU, 0xa10c7a37U, 0xf8148e59U, 0x133c89ebU, 19.656 - 0xa927eeceU, 0x61c935b7U, 0x1ce5ede1U, 0x47b13c7aU, 19.657 - 0xd2df599cU, 0xf2733f55U, 0x14ce7918U, 0xc737bf73U, 19.658 - 0xf7cdea53U, 0xfdaa5b5fU, 0x3d6f14dfU, 0x44db8678U, 19.659 - 0xaff381caU, 0x68c43eb9U, 0x24342c38U, 0xa3405fc2U, 19.660 - 0x1dc37216U, 0xe2250cbcU, 0x3c498b28U, 0x0d9541ffU, 19.661 - 0xa8017139U, 0x0cb3de08U, 0xb4e49cd8U, 0x56c19064U, 19.662 - 0xcb84617bU, 0x32b670d5U, 0x6c5c7448U, 0xb85742d0U, 19.663 -}; 19.664 -static const u32 Td4[256] = { 19.665 - 0x52525252U, 0x09090909U, 0x6a6a6a6aU, 0xd5d5d5d5U, 19.666 - 0x30303030U, 0x36363636U, 0xa5a5a5a5U, 0x38383838U, 19.667 - 0xbfbfbfbfU, 0x40404040U, 0xa3a3a3a3U, 0x9e9e9e9eU, 19.668 - 0x81818181U, 0xf3f3f3f3U, 0xd7d7d7d7U, 0xfbfbfbfbU, 19.669 - 0x7c7c7c7cU, 0xe3e3e3e3U, 0x39393939U, 0x82828282U, 19.670 - 0x9b9b9b9bU, 0x2f2f2f2fU, 0xffffffffU, 0x87878787U, 19.671 - 0x34343434U, 0x8e8e8e8eU, 0x43434343U, 0x44444444U, 19.672 - 0xc4c4c4c4U, 0xdedededeU, 0xe9e9e9e9U, 0xcbcbcbcbU, 19.673 - 0x54545454U, 0x7b7b7b7bU, 0x94949494U, 0x32323232U, 19.674 - 0xa6a6a6a6U, 0xc2c2c2c2U, 0x23232323U, 0x3d3d3d3dU, 19.675 - 0xeeeeeeeeU, 0x4c4c4c4cU, 0x95959595U, 0x0b0b0b0bU, 19.676 - 0x42424242U, 0xfafafafaU, 0xc3c3c3c3U, 0x4e4e4e4eU, 19.677 - 0x08080808U, 0x2e2e2e2eU, 0xa1a1a1a1U, 0x66666666U, 19.678 - 0x28282828U, 0xd9d9d9d9U, 0x24242424U, 0xb2b2b2b2U, 19.679 - 0x76767676U, 0x5b5b5b5bU, 0xa2a2a2a2U, 0x49494949U, 19.680 - 0x6d6d6d6dU, 0x8b8b8b8bU, 0xd1d1d1d1U, 0x25252525U, 19.681 - 0x72727272U, 0xf8f8f8f8U, 0xf6f6f6f6U, 0x64646464U, 19.682 - 0x86868686U, 0x68686868U, 0x98989898U, 0x16161616U, 19.683 - 0xd4d4d4d4U, 0xa4a4a4a4U, 0x5c5c5c5cU, 0xccccccccU, 19.684 - 0x5d5d5d5dU, 0x65656565U, 0xb6b6b6b6U, 0x92929292U, 19.685 - 0x6c6c6c6cU, 0x70707070U, 0x48484848U, 0x50505050U, 19.686 - 0xfdfdfdfdU, 0xededededU, 0xb9b9b9b9U, 0xdadadadaU, 19.687 - 0x5e5e5e5eU, 0x15151515U, 0x46464646U, 0x57575757U, 19.688 - 0xa7a7a7a7U, 0x8d8d8d8dU, 0x9d9d9d9dU, 0x84848484U, 19.689 - 0x90909090U, 0xd8d8d8d8U, 0xababababU, 0x00000000U, 19.690 - 0x8c8c8c8cU, 0xbcbcbcbcU, 0xd3d3d3d3U, 0x0a0a0a0aU, 19.691 - 0xf7f7f7f7U, 0xe4e4e4e4U, 0x58585858U, 0x05050505U, 19.692 - 0xb8b8b8b8U, 0xb3b3b3b3U, 0x45454545U, 0x06060606U, 19.693 - 0xd0d0d0d0U, 0x2c2c2c2cU, 0x1e1e1e1eU, 0x8f8f8f8fU, 19.694 - 0xcacacacaU, 0x3f3f3f3fU, 0x0f0f0f0fU, 0x02020202U, 19.695 - 0xc1c1c1c1U, 0xafafafafU, 0xbdbdbdbdU, 0x03030303U, 19.696 - 0x01010101U, 0x13131313U, 0x8a8a8a8aU, 0x6b6b6b6bU, 19.697 - 0x3a3a3a3aU, 0x91919191U, 0x11111111U, 0x41414141U, 19.698 - 0x4f4f4f4fU, 0x67676767U, 0xdcdcdcdcU, 0xeaeaeaeaU, 19.699 - 0x97979797U, 0xf2f2f2f2U, 0xcfcfcfcfU, 0xcecececeU, 19.700 - 0xf0f0f0f0U, 0xb4b4b4b4U, 0xe6e6e6e6U, 0x73737373U, 19.701 - 0x96969696U, 0xacacacacU, 0x74747474U, 0x22222222U, 19.702 - 0xe7e7e7e7U, 0xadadadadU, 0x35353535U, 0x85858585U, 19.703 - 0xe2e2e2e2U, 0xf9f9f9f9U, 0x37373737U, 0xe8e8e8e8U, 19.704 - 0x1c1c1c1cU, 0x75757575U, 0xdfdfdfdfU, 0x6e6e6e6eU, 19.705 - 0x47474747U, 0xf1f1f1f1U, 0x1a1a1a1aU, 0x71717171U, 19.706 - 0x1d1d1d1dU, 0x29292929U, 0xc5c5c5c5U, 0x89898989U, 19.707 - 0x6f6f6f6fU, 0xb7b7b7b7U, 0x62626262U, 0x0e0e0e0eU, 19.708 - 0xaaaaaaaaU, 0x18181818U, 0xbebebebeU, 0x1b1b1b1bU, 19.709 - 0xfcfcfcfcU, 0x56565656U, 0x3e3e3e3eU, 0x4b4b4b4bU, 19.710 - 0xc6c6c6c6U, 0xd2d2d2d2U, 0x79797979U, 0x20202020U, 19.711 - 0x9a9a9a9aU, 0xdbdbdbdbU, 0xc0c0c0c0U, 0xfefefefeU, 19.712 - 0x78787878U, 0xcdcdcdcdU, 0x5a5a5a5aU, 0xf4f4f4f4U, 19.713 - 0x1f1f1f1fU, 0xddddddddU, 0xa8a8a8a8U, 0x33333333U, 19.714 - 0x88888888U, 0x07070707U, 0xc7c7c7c7U, 0x31313131U, 19.715 - 0xb1b1b1b1U, 0x12121212U, 0x10101010U, 0x59595959U, 19.716 - 0x27272727U, 0x80808080U, 0xececececU, 0x5f5f5f5fU, 19.717 - 0x60606060U, 0x51515151U, 0x7f7f7f7fU, 0xa9a9a9a9U, 19.718 - 0x19191919U, 0xb5b5b5b5U, 0x4a4a4a4aU, 0x0d0d0d0dU, 19.719 - 0x2d2d2d2dU, 0xe5e5e5e5U, 0x7a7a7a7aU, 0x9f9f9f9fU, 19.720 - 0x93939393U, 0xc9c9c9c9U, 0x9c9c9c9cU, 0xefefefefU, 19.721 - 0xa0a0a0a0U, 0xe0e0e0e0U, 0x3b3b3b3bU, 0x4d4d4d4dU, 19.722 - 0xaeaeaeaeU, 0x2a2a2a2aU, 0xf5f5f5f5U, 0xb0b0b0b0U, 19.723 - 0xc8c8c8c8U, 0xebebebebU, 0xbbbbbbbbU, 0x3c3c3c3cU, 19.724 - 0x83838383U, 0x53535353U, 0x99999999U, 0x61616161U, 19.725 - 0x17171717U, 0x2b2b2b2bU, 0x04040404U, 0x7e7e7e7eU, 19.726 - 0xbabababaU, 0x77777777U, 0xd6d6d6d6U, 0x26262626U, 19.727 - 0xe1e1e1e1U, 0x69696969U, 0x14141414U, 0x63636363U, 19.728 - 0x55555555U, 0x21212121U, 0x0c0c0c0cU, 0x7d7d7d7dU, 19.729 -}; 19.730 -static const u32 rcon[] = { 19.731 - 0x01000000, 0x02000000, 0x04000000, 0x08000000, 19.732 - 0x10000000, 0x20000000, 0x40000000, 0x80000000, 19.733 - 0x1B000000, 0x36000000, /* for 128-bit blocks, Rijndael never uses more than 10 rcon values */ 19.734 -}; 19.735 - 19.736 -/** 19.737 - * Expand the cipher key into the encryption key schedule. 19.738 - */ 19.739 -int AES_set_encrypt_key(const unsigned char *userKey, const int bits, 19.740 - AES_KEY *key) { 19.741 - 19.742 - u32 *rk; 19.743 - int i = 0; 19.744 - u32 temp; 19.745 - 19.746 - if (!userKey || !key) 19.747 - return -1; 19.748 - if (bits != 128 && bits != 192 && bits != 256) 19.749 - return -2; 19.750 - 19.751 - rk = key->rd_key; 19.752 - 19.753 - if (bits==128) 19.754 - key->rounds = 10; 19.755 - else if (bits==192) 19.756 - key->rounds = 12; 19.757 - else 19.758 - key->rounds = 14; 19.759 - 19.760 - rk[0] = GETU32(userKey ); 19.761 - rk[1] = GETU32(userKey + 4); 19.762 - rk[2] = GETU32(userKey + 8); 19.763 - rk[3] = GETU32(userKey + 12); 19.764 - if (bits == 128) { 19.765 - while (1) { 19.766 - temp = rk[3]; 19.767 - rk[4] = rk[0] ^ 19.768 - (Te4[(temp >> 16) & 0xff] & 0xff000000) ^ 19.769 - (Te4[(temp >> 8) & 0xff] & 0x00ff0000) ^ 19.770 - (Te4[(temp ) & 0xff] & 0x0000ff00) ^ 19.771 - (Te4[(temp >> 24) ] & 0x000000ff) ^ 19.772 - rcon[i]; 19.773 - rk[5] = rk[1] ^ rk[4]; 19.774 - rk[6] = rk[2] ^ rk[5]; 19.775 - rk[7] = rk[3] ^ rk[6]; 19.776 - if (++i == 10) { 19.777 - return 0; 19.778 - } 19.779 - rk += 4; 19.780 - } 19.781 - } 19.782 - rk[4] = GETU32(userKey + 16); 19.783 - rk[5] = GETU32(userKey + 20); 19.784 - if (bits == 192) { 19.785 - while (1) { 19.786 - temp = rk[ 5]; 19.787 - rk[ 6] = rk[ 0] ^ 19.788 - (Te4[(temp >> 16) & 0xff] & 0xff000000) ^ 19.789 - (Te4[(temp >> 8) & 0xff] & 0x00ff0000) ^ 19.790 - (Te4[(temp ) & 0xff] & 0x0000ff00) ^ 19.791 - (Te4[(temp >> 24) ] & 0x000000ff) ^ 19.792 - rcon[i]; 19.793 - rk[ 7] = rk[ 1] ^ rk[ 6]; 19.794 - rk[ 8] = rk[ 2] ^ rk[ 7]; 19.795 - rk[ 9] = rk[ 3] ^ rk[ 8]; 19.796 - if (++i == 8) { 19.797 - return 0; 19.798 - } 19.799 - rk[10] = rk[ 4] ^ rk[ 9]; 19.800 - rk[11] = rk[ 5] ^ rk[10]; 19.801 - rk += 6; 19.802 - } 19.803 - } 19.804 - rk[6] = GETU32(userKey + 24); 19.805 - rk[7] = GETU32(userKey + 28); 19.806 - if (bits == 256) { 19.807 - while (1) { 19.808 - temp = rk[ 7]; 19.809 - rk[ 8] = rk[ 0] ^ 19.810 - (Te4[(temp >> 16) & 0xff] & 0xff000000) ^ 19.811 - (Te4[(temp >> 8) & 0xff] & 0x00ff0000) ^ 19.812 - (Te4[(temp ) & 0xff] & 0x0000ff00) ^ 19.813 - (Te4[(temp >> 24) ] & 0x000000ff) ^ 19.814 - rcon[i]; 19.815 - rk[ 9] = rk[ 1] ^ rk[ 8]; 19.816 - rk[10] = rk[ 2] ^ rk[ 9]; 19.817 - rk[11] = rk[ 3] ^ rk[10]; 19.818 - if (++i == 7) { 19.819 - return 0; 19.820 - } 19.821 - temp = rk[11]; 19.822 - rk[12] = rk[ 4] ^ 19.823 - (Te4[(temp >> 24) ] & 0xff000000) ^ 19.824 - (Te4[(temp >> 16) & 0xff] & 0x00ff0000) ^ 19.825 - (Te4[(temp >> 8) & 0xff] & 0x0000ff00) ^ 19.826 - (Te4[(temp ) & 0xff] & 0x000000ff); 19.827 - rk[13] = rk[ 5] ^ rk[12]; 19.828 - rk[14] = rk[ 6] ^ rk[13]; 19.829 - rk[15] = rk[ 7] ^ rk[14]; 19.830 - 19.831 - rk += 8; 19.832 - } 19.833 - } 19.834 - return 0; 19.835 -} 19.836 - 19.837 -/** 19.838 - * Expand the cipher key into the decryption key schedule. 19.839 - */ 19.840 -int AES_set_decrypt_key(const unsigned char *userKey, const int bits, 19.841 - AES_KEY *key) { 19.842 - 19.843 - u32 *rk; 19.844 - int i, j, status; 19.845 - u32 temp; 19.846 - 19.847 - /* first, start with an encryption schedule */ 19.848 - status = AES_set_encrypt_key(userKey, bits, key); 19.849 - if (status < 0) 19.850 - return status; 19.851 - 19.852 - rk = key->rd_key; 19.853 - 19.854 - /* invert the order of the round keys: */ 19.855 - for (i = 0, j = 4*(key->rounds); i < j; i += 4, j -= 4) { 19.856 - temp = rk[i ]; rk[i ] = rk[j ]; rk[j ] = temp; 19.857 - temp = rk[i + 1]; rk[i + 1] = rk[j + 1]; rk[j + 1] = temp; 19.858 - temp = rk[i + 2]; rk[i + 2] = rk[j + 2]; rk[j + 2] = temp; 19.859 - temp = rk[i + 3]; rk[i + 3] = rk[j + 3]; rk[j + 3] = temp; 19.860 - } 19.861 - /* apply the inverse MixColumn transform to all round keys but the first and the last: */ 19.862 - for (i = 1; i < (key->rounds); i++) { 19.863 - rk += 4; 19.864 - rk[0] = 19.865 - Td0[Te4[(rk[0] >> 24) ] & 0xff] ^ 19.866 - Td1[Te4[(rk[0] >> 16) & 0xff] & 0xff] ^ 19.867 - Td2[Te4[(rk[0] >> 8) & 0xff] & 0xff] ^ 19.868 - Td3[Te4[(rk[0] ) & 0xff] & 0xff]; 19.869 - rk[1] = 19.870 - Td0[Te4[(rk[1] >> 24) ] & 0xff] ^ 19.871 - Td1[Te4[(rk[1] >> 16) & 0xff] & 0xff] ^ 19.872 - Td2[Te4[(rk[1] >> 8) & 0xff] & 0xff] ^ 19.873 - Td3[Te4[(rk[1] ) & 0xff] & 0xff]; 19.874 - rk[2] = 19.875 - Td0[Te4[(rk[2] >> 24) ] & 0xff] ^ 19.876 - Td1[Te4[(rk[2] >> 16) & 0xff] & 0xff] ^ 19.877 - Td2[Te4[(rk[2] >> 8) & 0xff] & 0xff] ^ 19.878 - Td3[Te4[(rk[2] ) & 0xff] & 0xff]; 19.879 - rk[3] = 19.880 - Td0[Te4[(rk[3] >> 24) ] & 0xff] ^ 19.881 - Td1[Te4[(rk[3] >> 16) & 0xff] & 0xff] ^ 19.882 - Td2[Te4[(rk[3] >> 8) & 0xff] & 0xff] ^ 19.883 - Td3[Te4[(rk[3] ) & 0xff] & 0xff]; 19.884 - } 19.885 - return 0; 19.886 -} 19.887 - 19.888 -#ifndef AES_ASM 19.889 -/* 19.890 - * Encrypt a single block 19.891 - * in and out can overlap 19.892 - */ 19.893 -void AES_encrypt(const unsigned char *in, unsigned char *out, 19.894 - const AES_KEY *key) { 19.895 - 19.896 - const u32 *rk; 19.897 - u32 s0, s1, s2, s3, t0, t1, t2, t3; 19.898 -#ifndef FULL_UNROLL 19.899 - int r; 19.900 -#endif /* ?FULL_UNROLL */ 19.901 - 19.902 - assert(in && out && key); 19.903 - rk = key->rd_key; 19.904 - 19.905 - /* 19.906 - * map byte array block to cipher state 19.907 - * and add initial round key: 19.908 - */ 19.909 - s0 = GETU32(in ) ^ rk[0]; 19.910 - s1 = GETU32(in + 4) ^ rk[1]; 19.911 - s2 = GETU32(in + 8) ^ rk[2]; 19.912 - s3 = GETU32(in + 12) ^ rk[3]; 19.913 -#ifdef FULL_UNROLL 19.914 - /* round 1: */ 19.915 - t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >> 8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[ 4]; 19.916 - t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >> 8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[ 5]; 19.917 - t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >> 8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[ 6]; 19.918 - t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >> 8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[ 7]; 19.919 - /* round 2: */ 19.920 - s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >> 8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[ 8]; 19.921 - s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >> 8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[ 9]; 19.922 - s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >> 8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[10]; 19.923 - s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >> 8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[11]; 19.924 - /* round 3: */ 19.925 - t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >> 8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[12]; 19.926 - t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >> 8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[13]; 19.927 - t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >> 8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[14]; 19.928 - t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >> 8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[15]; 19.929 - /* round 4: */ 19.930 - s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >> 8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[16]; 19.931 - s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >> 8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[17]; 19.932 - s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >> 8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[18]; 19.933 - s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >> 8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[19]; 19.934 - /* round 5: */ 19.935 - t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >> 8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[20]; 19.936 - t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >> 8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[21]; 19.937 - t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >> 8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[22]; 19.938 - t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >> 8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[23]; 19.939 - /* round 6: */ 19.940 - s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >> 8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[24]; 19.941 - s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >> 8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[25]; 19.942 - s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >> 8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[26]; 19.943 - s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >> 8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[27]; 19.944 - /* round 7: */ 19.945 - t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >> 8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[28]; 19.946 - t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >> 8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[29]; 19.947 - t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >> 8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[30]; 19.948 - t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >> 8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[31]; 19.949 - /* round 8: */ 19.950 - s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >> 8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[32]; 19.951 - s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >> 8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[33]; 19.952 - s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >> 8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[34]; 19.953 - s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >> 8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[35]; 19.954 - /* round 9: */ 19.955 - t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >> 8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[36]; 19.956 - t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >> 8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[37]; 19.957 - t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >> 8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[38]; 19.958 - t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >> 8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[39]; 19.959 - if (key->rounds > 10) { 19.960 - /* round 10: */ 19.961 - s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >> 8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[40]; 19.962 - s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >> 8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[41]; 19.963 - s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >> 8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[42]; 19.964 - s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >> 8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[43]; 19.965 - /* round 11: */ 19.966 - t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >> 8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[44]; 19.967 - t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >> 8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[45]; 19.968 - t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >> 8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[46]; 19.969 - t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >> 8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[47]; 19.970 - if (key->rounds > 12) { 19.971 - /* round 12: */ 19.972 - s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >> 8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[48]; 19.973 - s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >> 8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[49]; 19.974 - s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >> 8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[50]; 19.975 - s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >> 8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[51]; 19.976 - /* round 13: */ 19.977 - t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >> 8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[52]; 19.978 - t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >> 8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[53]; 19.979 - t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >> 8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[54]; 19.980 - t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >> 8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[55]; 19.981 - } 19.982 - } 19.983 - rk += key->rounds << 2; 19.984 -#else /* !FULL_UNROLL */ 19.985 - /* 19.986 - * Nr - 1 full rounds: 19.987 - */ 19.988 - r = key->rounds >> 1; 19.989 - for (;;) { 19.990 - t0 = 19.991 - Te0[(s0 >> 24) ] ^ 19.992 - Te1[(s1 >> 16) & 0xff] ^ 19.993 - Te2[(s2 >> 8) & 0xff] ^ 19.994 - Te3[(s3 ) & 0xff] ^ 19.995 - rk[4]; 19.996 - t1 = 19.997 - Te0[(s1 >> 24) ] ^ 19.998 - Te1[(s2 >> 16) & 0xff] ^ 19.999 - Te2[(s3 >> 8) & 0xff] ^ 19.1000 - Te3[(s0 ) & 0xff] ^ 19.1001 - rk[5]; 19.1002 - t2 = 19.1003 - Te0[(s2 >> 24) ] ^ 19.1004 - Te1[(s3 >> 16) & 0xff] ^ 19.1005 - Te2[(s0 >> 8) & 0xff] ^ 19.1006 - Te3[(s1 ) & 0xff] ^ 19.1007 - rk[6]; 19.1008 - t3 = 19.1009 - Te0[(s3 >> 24) ] ^ 19.1010 - Te1[(s0 >> 16) & 0xff] ^ 19.1011 - Te2[(s1 >> 8) & 0xff] ^ 19.1012 - Te3[(s2 ) & 0xff] ^ 19.1013 - rk[7]; 19.1014 - 19.1015 - rk += 8; 19.1016 - if (--r == 0) { 19.1017 - break; 19.1018 - } 19.1019 - 19.1020 - s0 = 19.1021 - Te0[(t0 >> 24) ] ^ 19.1022 - Te1[(t1 >> 16) & 0xff] ^ 19.1023 - Te2[(t2 >> 8) & 0xff] ^ 19.1024 - Te3[(t3 ) & 0xff] ^ 19.1025 - rk[0]; 19.1026 - s1 = 19.1027 - Te0[(t1 >> 24) ] ^ 19.1028 - Te1[(t2 >> 16) & 0xff] ^ 19.1029 - Te2[(t3 >> 8) & 0xff] ^ 19.1030 - Te3[(t0 ) & 0xff] ^ 19.1031 - rk[1]; 19.1032 - s2 = 19.1033 - Te0[(t2 >> 24) ] ^ 19.1034 - Te1[(t3 >> 16) & 0xff] ^ 19.1035 - Te2[(t0 >> 8) & 0xff] ^ 19.1036 - Te3[(t1 ) & 0xff] ^ 19.1037 - rk[2]; 19.1038 - s3 = 19.1039 - Te0[(t3 >> 24) ] ^ 19.1040 - Te1[(t0 >> 16) & 0xff] ^ 19.1041 - Te2[(t1 >> 8) & 0xff] ^ 19.1042 - Te3[(t2 ) & 0xff] ^ 19.1043 - rk[3]; 19.1044 - } 19.1045 -#endif /* ?FULL_UNROLL */ 19.1046 - /* 19.1047 - * apply last round and 19.1048 - * map cipher state to byte array block: 19.1049 - */ 19.1050 - s0 = 19.1051 - (Te4[(t0 >> 24) ] & 0xff000000) ^ 19.1052 - (Te4[(t1 >> 16) & 0xff] & 0x00ff0000) ^ 19.1053 - (Te4[(t2 >> 8) & 0xff] & 0x0000ff00) ^ 19.1054 - (Te4[(t3 ) & 0xff] & 0x000000ff) ^ 19.1055 - rk[0]; 19.1056 - PUTU32(out , s0); 19.1057 - s1 = 19.1058 - (Te4[(t1 >> 24) ] & 0xff000000) ^ 19.1059 - (Te4[(t2 >> 16) & 0xff] & 0x00ff0000) ^ 19.1060 - (Te4[(t3 >> 8) & 0xff] & 0x0000ff00) ^ 19.1061 - (Te4[(t0 ) & 0xff] & 0x000000ff) ^ 19.1062 - rk[1]; 19.1063 - PUTU32(out + 4, s1); 19.1064 - s2 = 19.1065 - (Te4[(t2 >> 24) ] & 0xff000000) ^ 19.1066 - (Te4[(t3 >> 16) & 0xff] & 0x00ff0000) ^ 19.1067 - (Te4[(t0 >> 8) & 0xff] & 0x0000ff00) ^ 19.1068 - (Te4[(t1 ) & 0xff] & 0x000000ff) ^ 19.1069 - rk[2]; 19.1070 - PUTU32(out + 8, s2); 19.1071 - s3 = 19.1072 - (Te4[(t3 >> 24) ] & 0xff000000) ^ 19.1073 - (Te4[(t0 >> 16) & 0xff] & 0x00ff0000) ^ 19.1074 - (Te4[(t1 >> 8) & 0xff] & 0x0000ff00) ^ 19.1075 - (Te4[(t2 ) & 0xff] & 0x000000ff) ^ 19.1076 - rk[3]; 19.1077 - PUTU32(out + 12, s3); 19.1078 -} 19.1079 - 19.1080 -/* 19.1081 - * Decrypt a single block 19.1082 - * in and out can overlap 19.1083 - */ 19.1084 -void AES_decrypt(const unsigned char *in, unsigned char *out, 19.1085 - const AES_KEY *key) { 19.1086 - 19.1087 - const u32 *rk; 19.1088 - u32 s0, s1, s2, s3, t0, t1, t2, t3; 19.1089 -#ifndef FULL_UNROLL 19.1090 - int r; 19.1091 -#endif /* ?FULL_UNROLL */ 19.1092 - 19.1093 - assert(in && out && key); 19.1094 - rk = key->rd_key; 19.1095 - 19.1096 - /* 19.1097 - * map byte array block to cipher state 19.1098 - * and add initial round key: 19.1099 - */ 19.1100 - s0 = GETU32(in ) ^ rk[0]; 19.1101 - s1 = GETU32(in + 4) ^ rk[1]; 19.1102 - s2 = GETU32(in + 8) ^ rk[2]; 19.1103 - s3 = GETU32(in + 12) ^ rk[3]; 19.1104 -#ifdef FULL_UNROLL 19.1105 - /* round 1: */ 19.1106 - t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >> 8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[ 4]; 19.1107 - t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >> 8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[ 5]; 19.1108 - t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >> 8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[ 6]; 19.1109 - t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >> 8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[ 7]; 19.1110 - /* round 2: */ 19.1111 - s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >> 8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[ 8]; 19.1112 - s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >> 8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[ 9]; 19.1113 - s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >> 8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[10]; 19.1114 - s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >> 8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[11]; 19.1115 - /* round 3: */ 19.1116 - t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >> 8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[12]; 19.1117 - t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >> 8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[13]; 19.1118 - t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >> 8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[14]; 19.1119 - t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >> 8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[15]; 19.1120 - /* round 4: */ 19.1121 - s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >> 8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[16]; 19.1122 - s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >> 8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[17]; 19.1123 - s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >> 8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[18]; 19.1124 - s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >> 8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[19]; 19.1125 - /* round 5: */ 19.1126 - t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >> 8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[20]; 19.1127 - t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >> 8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[21]; 19.1128 - t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >> 8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[22]; 19.1129 - t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >> 8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[23]; 19.1130 - /* round 6: */ 19.1131 - s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >> 8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[24]; 19.1132 - s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >> 8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[25]; 19.1133 - s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >> 8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[26]; 19.1134 - s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >> 8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[27]; 19.1135 - /* round 7: */ 19.1136 - t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >> 8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[28]; 19.1137 - t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >> 8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[29]; 19.1138 - t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >> 8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[30]; 19.1139 - t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >> 8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[31]; 19.1140 - /* round 8: */ 19.1141 - s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >> 8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[32]; 19.1142 - s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >> 8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[33]; 19.1143 - s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >> 8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[34]; 19.1144 - s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >> 8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[35]; 19.1145 - /* round 9: */ 19.1146 - t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >> 8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[36]; 19.1147 - t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >> 8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[37]; 19.1148 - t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >> 8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[38]; 19.1149 - t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >> 8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[39]; 19.1150 - if (key->rounds > 10) { 19.1151 - /* round 10: */ 19.1152 - s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >> 8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[40]; 19.1153 - s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >> 8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[41]; 19.1154 - s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >> 8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[42]; 19.1155 - s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >> 8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[43]; 19.1156 - /* round 11: */ 19.1157 - t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >> 8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[44]; 19.1158 - t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >> 8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[45]; 19.1159 - t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >> 8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[46]; 19.1160 - t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >> 8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[47]; 19.1161 - if (key->rounds > 12) { 19.1162 - /* round 12: */ 19.1163 - s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >> 8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[48]; 19.1164 - s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >> 8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[49]; 19.1165 - s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >> 8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[50]; 19.1166 - s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >> 8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[51]; 19.1167 - /* round 13: */ 19.1168 - t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >> 8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[52]; 19.1169 - t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >> 8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[53]; 19.1170 - t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >> 8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[54]; 19.1171 - t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >> 8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[55]; 19.1172 - } 19.1173 - } 19.1174 - rk += key->rounds << 2; 19.1175 -#else /* !FULL_UNROLL */ 19.1176 - /* 19.1177 - * Nr - 1 full rounds: 19.1178 - */ 19.1179 - r = key->rounds >> 1; 19.1180 - for (;;) { 19.1181 - t0 = 19.1182 - Td0[(s0 >> 24) ] ^ 19.1183 - Td1[(s3 >> 16) & 0xff] ^ 19.1184 - Td2[(s2 >> 8) & 0xff] ^ 19.1185 - Td3[(s1 ) & 0xff] ^ 19.1186 - rk[4]; 19.1187 - t1 = 19.1188 - Td0[(s1 >> 24) ] ^ 19.1189 - Td1[(s0 >> 16) & 0xff] ^ 19.1190 - Td2[(s3 >> 8) & 0xff] ^ 19.1191 - Td3[(s2 ) & 0xff] ^ 19.1192 - rk[5]; 19.1193 - t2 = 19.1194 - Td0[(s2 >> 24) ] ^ 19.1195 - Td1[(s1 >> 16) & 0xff] ^ 19.1196 - Td2[(s0 >> 8) & 0xff] ^ 19.1197 - Td3[(s3 ) & 0xff] ^ 19.1198 - rk[6]; 19.1199 - t3 = 19.1200 - Td0[(s3 >> 24) ] ^ 19.1201 - Td1[(s2 >> 16) & 0xff] ^ 19.1202 - Td2[(s1 >> 8) & 0xff] ^ 19.1203 - Td3[(s0 ) & 0xff] ^ 19.1204 - rk[7]; 19.1205 - 19.1206 - rk += 8; 19.1207 - if (--r == 0) { 19.1208 - break; 19.1209 - } 19.1210 - 19.1211 - s0 = 19.1212 - Td0[(t0 >> 24) ] ^ 19.1213 - Td1[(t3 >> 16) & 0xff] ^ 19.1214 - Td2[(t2 >> 8) & 0xff] ^ 19.1215 - Td3[(t1 ) & 0xff] ^ 19.1216 - rk[0]; 19.1217 - s1 = 19.1218 - Td0[(t1 >> 24) ] ^ 19.1219 - Td1[(t0 >> 16) & 0xff] ^ 19.1220 - Td2[(t3 >> 8) & 0xff] ^ 19.1221 - Td3[(t2 ) & 0xff] ^ 19.1222 - rk[1]; 19.1223 - s2 = 19.1224 - Td0[(t2 >> 24) ] ^ 19.1225 - Td1[(t1 >> 16) & 0xff] ^ 19.1226 - Td2[(t0 >> 8) & 0xff] ^ 19.1227 - Td3[(t3 ) & 0xff] ^ 19.1228 - rk[2]; 19.1229 - s3 = 19.1230 - Td0[(t3 >> 24) ] ^ 19.1231 - Td1[(t2 >> 16) & 0xff] ^ 19.1232 - Td2[(t1 >> 8) & 0xff] ^ 19.1233 - Td3[(t0 ) & 0xff] ^ 19.1234 - rk[3]; 19.1235 - } 19.1236 -#endif /* ?FULL_UNROLL */ 19.1237 - /* 19.1238 - * apply last round and 19.1239 - * map cipher state to byte array block: 19.1240 - */ 19.1241 - s0 = 19.1242 - (Td4[(t0 >> 24) ] & 0xff000000) ^ 19.1243 - (Td4[(t3 >> 16) & 0xff] & 0x00ff0000) ^ 19.1244 - (Td4[(t2 >> 8) & 0xff] & 0x0000ff00) ^ 19.1245 - (Td4[(t1 ) & 0xff] & 0x000000ff) ^ 19.1246 - rk[0]; 19.1247 - PUTU32(out , s0); 19.1248 - s1 = 19.1249 - (Td4[(t1 >> 24) ] & 0xff000000) ^ 19.1250 - (Td4[(t0 >> 16) & 0xff] & 0x00ff0000) ^ 19.1251 - (Td4[(t3 >> 8) & 0xff] & 0x0000ff00) ^ 19.1252 - (Td4[(t2 ) & 0xff] & 0x000000ff) ^ 19.1253 - rk[1]; 19.1254 - PUTU32(out + 4, s1); 19.1255 - s2 = 19.1256 - (Td4[(t2 >> 24) ] & 0xff000000) ^ 19.1257 - (Td4[(t1 >> 16) & 0xff] & 0x00ff0000) ^ 19.1258 - (Td4[(t0 >> 8) & 0xff] & 0x0000ff00) ^ 19.1259 - (Td4[(t3 ) & 0xff] & 0x000000ff) ^ 19.1260 - rk[2]; 19.1261 - PUTU32(out + 8, s2); 19.1262 - s3 = 19.1263 - (Td4[(t3 >> 24) ] & 0xff000000) ^ 19.1264 - (Td4[(t2 >> 16) & 0xff] & 0x00ff0000) ^ 19.1265 - (Td4[(t1 >> 8) & 0xff] & 0x0000ff00) ^ 19.1266 - (Td4[(t0 ) & 0xff] & 0x000000ff) ^ 19.1267 - rk[3]; 19.1268 - PUTU32(out + 12, s3); 19.1269 -} 19.1270 - 19.1271 -#endif /* AES_ASM */ 19.1272 - 19.1273 -void AES_cbc_encrypt(const unsigned char *in, unsigned char *out, 19.1274 - const unsigned long length, const AES_KEY *key, 19.1275 - unsigned char *ivec, const int enc) 19.1276 -{ 19.1277 - 19.1278 - unsigned long n; 19.1279 - unsigned long len = length; 19.1280 - unsigned char tmp[AES_BLOCK_SIZE]; 19.1281 - 19.1282 - assert(in && out && key && ivec); 19.1283 - 19.1284 - if (enc) { 19.1285 - while (len >= AES_BLOCK_SIZE) { 19.1286 - for(n=0; n < AES_BLOCK_SIZE; ++n) 19.1287 - tmp[n] = in[n] ^ ivec[n]; 19.1288 - AES_encrypt(tmp, out, key); 19.1289 - memcpy(ivec, out, AES_BLOCK_SIZE); 19.1290 - len -= AES_BLOCK_SIZE; 19.1291 - in += AES_BLOCK_SIZE; 19.1292 - out += AES_BLOCK_SIZE; 19.1293 - } 19.1294 - if (len) { 19.1295 - for(n=0; n < len; ++n) 19.1296 - tmp[n] = in[n] ^ ivec[n]; 19.1297 - for(n=len; n < AES_BLOCK_SIZE; ++n) 19.1298 - tmp[n] = ivec[n]; 19.1299 - AES_encrypt(tmp, tmp, key); 19.1300 - memcpy(out, tmp, AES_BLOCK_SIZE); 19.1301 - memcpy(ivec, tmp, AES_BLOCK_SIZE); 19.1302 - } 19.1303 - } else { 19.1304 - while (len >= AES_BLOCK_SIZE) { 19.1305 - memcpy(tmp, in, AES_BLOCK_SIZE); 19.1306 - AES_decrypt(in, out, key); 19.1307 - for(n=0; n < AES_BLOCK_SIZE; ++n) 19.1308 - out[n] ^= ivec[n]; 19.1309 - memcpy(ivec, tmp, AES_BLOCK_SIZE); 19.1310 - len -= AES_BLOCK_SIZE; 19.1311 - in += AES_BLOCK_SIZE; 19.1312 - out += AES_BLOCK_SIZE; 19.1313 - } 19.1314 - if (len) { 19.1315 - memcpy(tmp, in, AES_BLOCK_SIZE); 19.1316 - AES_decrypt(tmp, tmp, key); 19.1317 - for(n=0; n < len; ++n) 19.1318 - out[n] = tmp[n] ^ ivec[n]; 19.1319 - memcpy(ivec, tmp, AES_BLOCK_SIZE); 19.1320 - } 19.1321 - } 19.1322 -}
20.1 --- a/tools/ioemu/aes.h Wed Sep 17 14:16:02 2008 +0100 20.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 20.3 @@ -1,26 +0,0 @@ 20.4 -#ifndef QEMU_AES_H 20.5 -#define QEMU_AES_H 20.6 - 20.7 -#define AES_MAXNR 14 20.8 -#define AES_BLOCK_SIZE 16 20.9 - 20.10 -struct aes_key_st { 20.11 - uint32_t rd_key[4 *(AES_MAXNR + 1)]; 20.12 - int rounds; 20.13 -}; 20.14 -typedef struct aes_key_st AES_KEY; 20.15 - 20.16 -int AES_set_encrypt_key(const unsigned char *userKey, const int bits, 20.17 - AES_KEY *key); 20.18 -int AES_set_decrypt_key(const unsigned char *userKey, const int bits, 20.19 - AES_KEY *key); 20.20 - 20.21 -void AES_encrypt(const unsigned char *in, unsigned char *out, 20.22 - const AES_KEY *key); 20.23 -void AES_decrypt(const unsigned char *in, unsigned char *out, 20.24 - const AES_KEY *key); 20.25 -void AES_cbc_encrypt(const unsigned char *in, unsigned char *out, 20.26 - const unsigned long length, const AES_KEY *key, 20.27 - unsigned char *ivec, const int enc); 20.28 - 20.29 -#endif
21.1 --- a/tools/ioemu/audio/.CVS/Entries Wed Sep 17 14:16:02 2008 +0100 21.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 21.3 @@ -1,20 +0,0 @@ 21.4 -/alsaaudio.c/1.7/Fri Jan 5 14:34:35 2007//Trelease_0_9_0 21.5 -/audio.c/1.15/Thu May 3 17:17:59 2007//Trelease_0_9_0 21.6 -/audio.h/1.8/Fri Jan 5 14:34:35 2007//Trelease_0_9_0 21.7 -/audio_int.h/1.10/Fri Jan 5 14:34:35 2007//Trelease_0_9_0 21.8 -/audio_template.h/1.8/Fri Jan 5 14:34:35 2007//Trelease_0_9_0 21.9 -/coreaudio.c/1.7/Fri Jan 5 14:34:35 2007//Trelease_0_9_0 21.10 -/dsound_template.h/1.4/Fri Jan 5 14:34:35 2007//Trelease_0_9_0 21.11 -/dsoundaudio.c/1.3/Fri Jan 5 14:34:35 2007//Trelease_0_9_0 21.12 -/fmodaudio.c/1.7/Fri Jan 5 14:34:35 2007//Trelease_0_9_0 21.13 -/mixeng.c/1.4/Wed Oct 18 10:11:20 2006//Trelease_0_9_0 21.14 -/mixeng.h/1.2/Wed Oct 18 10:11:20 2006//Trelease_0_9_0 21.15 -/mixeng_template.h/1.2/Wed Oct 18 10:11:20 2006//Trelease_0_9_0 21.16 -/noaudio.c/1.7/Fri Jan 5 14:34:35 2007//Trelease_0_9_0 21.17 -/ossaudio.c/1.11/Fri Jan 5 14:34:35 2007//Trelease_0_9_0 21.18 -/rate_template.h/1.3/Fri Jan 5 14:34:35 2007//Trelease_0_9_0 21.19 -/sdlaudio.c/1.8/Fri Jan 5 14:34:35 2007//Trelease_0_9_0 21.20 -/sys-queue.h/1.1/Wed Oct 18 10:11:20 2006//Trelease_0_9_0 21.21 -/wavaudio.c/1.9/Thu May 3 17:17:59 2007//Trelease_0_9_0 21.22 -/wavcapture.c/1.7/Thu May 3 17:17:59 2007//Trelease_0_9_0 21.23 -D
22.1 --- a/tools/ioemu/audio/.CVS/Repository Wed Sep 17 14:16:02 2008 +0100 22.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 22.3 @@ -1,1 +0,0 @@ 22.4 -qemu/audio
23.1 --- a/tools/ioemu/audio/.CVS/Root Wed Sep 17 14:16:02 2008 +0100 23.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 23.3 @@ -1,1 +0,0 @@ 23.4 -:pserver:anonymous@cvs.savannah.nongnu.org:/sources/qemu
24.1 --- a/tools/ioemu/audio/.CVS/Tag Wed Sep 17 14:16:02 2008 +0100 24.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 24.3 @@ -1,1 +0,0 @@ 24.4 -Nrelease_0_9_0
25.1 --- a/tools/ioemu/audio/alsaaudio.c Wed Sep 17 14:16:02 2008 +0100 25.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 25.3 @@ -1,974 +0,0 @@ 25.4 -/* 25.5 - * QEMU ALSA audio driver 25.6 - * 25.7 - * Copyright (c) 2005 Vassili Karpov (malc) 25.8 - * 25.9 - * Permission is hereby granted, free of charge, to any person obtaining a copy 25.10 - * of this software and associated documentation files (the "Software"), to deal 25.11 - * in the Software without restriction, including without limitation the rights 25.12 - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 25.13 - * copies of the Software, and to permit persons to whom the Software is 25.14 - * furnished to do so, subject to the following conditions: 25.15 - * 25.16 - * The above copyright notice and this permission notice shall be included in 25.17 - * all copies or substantial portions of the Software. 25.18 - * 25.19 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 25.20 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25.21 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 25.22 - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25.23 - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25.24 - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25.25 - * THE SOFTWARE. 25.26 - */ 25.27 -#include <alsa/asoundlib.h> 25.28 -#include "vl.h" 25.29 - 25.30 -#define AUDIO_CAP "alsa" 25.31 -#include "audio_int.h" 25.32 - 25.33 -typedef struct ALSAVoiceOut { 25.34 - HWVoiceOut hw; 25.35 - void *pcm_buf; 25.36 - snd_pcm_t *handle; 25.37 -} ALSAVoiceOut; 25.38 - 25.39 -typedef struct ALSAVoiceIn { 25.40 - HWVoiceIn hw; 25.41 - snd_pcm_t *handle; 25.42 - void *pcm_buf; 25.43 -} ALSAVoiceIn; 25.44 - 25.45 -static struct { 25.46 - int size_in_usec_in; 25.47 - int size_in_usec_out; 25.48 - const char *pcm_name_in; 25.49 - const char *pcm_name_out; 25.50 - unsigned int buffer_size_in; 25.51 - unsigned int period_size_in; 25.52 - unsigned int buffer_size_out; 25.53 - unsigned int period_size_out; 25.54 - unsigned int threshold; 25.55 - 25.56 - int buffer_size_in_overriden; 25.57 - int period_size_in_overriden; 25.58 - 25.59 - int buffer_size_out_overriden; 25.60 - int period_size_out_overriden; 25.61 - int verbose; 25.62 -} conf = { 25.63 -#ifdef HIGH_LATENCY 25.64 - .size_in_usec_in = 1, 25.65 - .size_in_usec_out = 1, 25.66 -#endif 25.67 - .pcm_name_out = "default", 25.68 - .pcm_name_in = "default", 25.69 -#ifdef HIGH_LATENCY 25.70 - .buffer_size_in = 400000, 25.71 - .period_size_in = 400000 / 4, 25.72 - .buffer_size_out = 400000, 25.73 - .period_size_out = 400000 / 4, 25.74 -#else 25.75 -#define DEFAULT_BUFFER_SIZE 1024 25.76 -#define DEFAULT_PERIOD_SIZE 256 25.77 - .buffer_size_in = DEFAULT_BUFFER_SIZE * 4, 25.78 - .period_size_in = DEFAULT_PERIOD_SIZE * 4, 25.79 - .buffer_size_out = DEFAULT_BUFFER_SIZE, 25.80 - .period_size_out = DEFAULT_PERIOD_SIZE, 25.81 - .buffer_size_in_overriden = 0, 25.82 - .buffer_size_out_overriden = 0, 25.83 - .period_size_in_overriden = 0, 25.84 - .period_size_out_overriden = 0, 25.85 -#endif 25.86 - .threshold = 0, 25.87 - .verbose = 0 25.88 -}; 25.89 - 25.90 -struct alsa_params_req { 25.91 - int freq; 25.92 - audfmt_e fmt; 25.93 - int nchannels; 25.94 - unsigned int buffer_size; 25.95 - unsigned int period_size; 25.96 -}; 25.97 - 25.98 -struct alsa_params_obt { 25.99 - int freq; 25.100 - audfmt_e fmt; 25.101 - int nchannels; 25.102 - snd_pcm_uframes_t samples; 25.103 -}; 25.104 - 25.105 -static void GCC_FMT_ATTR (2, 3) alsa_logerr (int err, const char *fmt, ...) 25.106 -{ 25.107 - va_list ap; 25.108 - 25.109 - va_start (ap, fmt); 25.110 - AUD_vlog (AUDIO_CAP, fmt, ap); 25.111 - va_end (ap); 25.112 - 25.113 - AUD_log (AUDIO_CAP, "Reason: %s\n", snd_strerror (err)); 25.114 -} 25.115 - 25.116 -static void GCC_FMT_ATTR (3, 4) alsa_logerr2 ( 25.117 - int err, 25.118 - const char *typ, 25.119 - const char *fmt, 25.120 - ... 25.121 - ) 25.122 -{ 25.123 - va_list ap; 25.124 - 25.125 - AUD_log (AUDIO_CAP, "Could not initialize %s\n", typ); 25.126 - 25.127 - va_start (ap, fmt); 25.128 - AUD_vlog (AUDIO_CAP, fmt, ap); 25.129 - va_end (ap); 25.130 - 25.131 - AUD_log (AUDIO_CAP, "Reason: %s\n", snd_strerror (err)); 25.132 -} 25.133 - 25.134 -static void alsa_anal_close (snd_pcm_t **handlep) 25.135 -{ 25.136 - int err = snd_pcm_close (*handlep); 25.137 - if (err) { 25.138 - alsa_logerr (err, "Failed to close PCM handle %p\n", *handlep); 25.139 - } 25.140 - *handlep = NULL; 25.141 -} 25.142 - 25.143 -static int alsa_write (SWVoiceOut *sw, void *buf, int len) 25.144 -{ 25.145 - return audio_pcm_sw_write (sw, buf, len); 25.146 -} 25.147 - 25.148 -static int aud_to_alsafmt (audfmt_e fmt) 25.149 -{ 25.150 - switch (fmt) { 25.151 - case AUD_FMT_S8: 25.152 - return SND_PCM_FORMAT_S8; 25.153 - 25.154 - case AUD_FMT_U8: 25.155 - return SND_PCM_FORMAT_U8; 25.156 - 25.157 - case AUD_FMT_S16: 25.158 - return SND_PCM_FORMAT_S16_LE; 25.159 - 25.160 - case AUD_FMT_U16: 25.161 - return SND_PCM_FORMAT_U16_LE; 25.162 - 25.163 - default: 25.164 - dolog ("Internal logic error: Bad audio format %d\n", fmt); 25.165 -#ifdef DEBUG_AUDIO 25.166 - abort (); 25.167 -#endif 25.168 - return SND_PCM_FORMAT_U8; 25.169 - } 25.170 -} 25.171 - 25.172 -static int alsa_to_audfmt (int alsafmt, audfmt_e *fmt, int *endianness) 25.173 -{ 25.174 - switch (alsafmt) { 25.175 - case SND_PCM_FORMAT_S8: 25.176 - *endianness = 0; 25.177 - *fmt = AUD_FMT_S8; 25.178 - break; 25.179 - 25.180 - case SND_PCM_FORMAT_U8: 25.181 - *endianness = 0; 25.182 - *fmt = AUD_FMT_U8; 25.183 - break; 25.184 - 25.185 - case SND_PCM_FORMAT_S16_LE: 25.186 - *endianness = 0; 25.187 - *fmt = AUD_FMT_S16; 25.188 - break; 25.189 - 25.190 - case SND_PCM_FORMAT_U16_LE: 25.191 - *endianness = 0; 25.192 - *fmt = AUD_FMT_U16; 25.193 - break; 25.194 - 25.195 - case SND_PCM_FORMAT_S16_BE: 25.196 - *endianness = 1; 25.197 - *fmt = AUD_FMT_S16; 25.198 - break; 25.199 - 25.200 - case SND_PCM_FORMAT_U16_BE: 25.201 - *endianness = 1; 25.202 - *fmt = AUD_FMT_U16; 25.203 - break; 25.204 - 25.205 - default: 25.206 - dolog ("Unrecognized audio format %d\n", alsafmt); 25.207 - return -1; 25.208 - } 25.209 - 25.210 - return 0; 25.211 -} 25.212 - 25.213 -#if defined DEBUG_MISMATCHES || defined DEBUG 25.214 -static void alsa_dump_info (struct alsa_params_req *req, 25.215 - struct alsa_params_obt *obt) 25.216 -{ 25.217 - dolog ("parameter | requested value | obtained value\n"); 25.218 - dolog ("format | %10d | %10d\n", req->fmt, obt->fmt); 25.219 - dolog ("channels | %10d | %10d\n", 25.220 - req->nchannels, obt->nchannels); 25.221 - dolog ("frequency | %10d | %10d\n", req->freq, obt->freq); 25.222 - dolog ("============================================\n"); 25.223 - dolog ("requested: buffer size %d period size %d\n", 25.224 - req->buffer_size, req->period_size); 25.225 - dolog ("obtained: samples %ld\n", obt->samples); 25.226 -} 25.227 -#endif 25.228 - 25.229 -static void alsa_set_threshold (snd_pcm_t *handle, snd_pcm_uframes_t threshold) 25.230 -{ 25.231 - int err; 25.232 - snd_pcm_sw_params_t *sw_params; 25.233 - 25.234 - snd_pcm_sw_params_alloca (&sw_params); 25.235 - 25.236 - err = snd_pcm_sw_params_current (handle, sw_params); 25.237 - if (err < 0) { 25.238 - dolog ("Could not fully initialize DAC\n"); 25.239 - alsa_logerr (err, "Failed to get current software parameters\n"); 25.240 - return; 25.241 - } 25.242 - 25.243 - err = snd_pcm_sw_params_set_start_threshold (handle, sw_params, threshold); 25.244 - if (err < 0) { 25.245 - dolog ("Could not fully initialize DAC\n"); 25.246 - alsa_logerr (err, "Failed to set software threshold to %ld\n", 25.247 - threshold); 25.248 - return; 25.249 - } 25.250 - 25.251 - err = snd_pcm_sw_params (handle, sw_params); 25.252 - if (err < 0) { 25.253 - dolog ("Could not fully initialize DAC\n"); 25.254 - alsa_logerr (err, "Failed to set software parameters\n"); 25.255 - return; 25.256 - } 25.257 -} 25.258 - 25.259 -static int alsa_open (int in, struct alsa_params_req *req, 25.260 - struct alsa_params_obt *obt, snd_pcm_t **handlep) 25.261 -{ 25.262 - snd_pcm_t *handle; 25.263 - snd_pcm_hw_params_t *hw_params; 25.264 - int err, freq, nchannels; 25.265 - const char *pcm_name = in ? conf.pcm_name_in : conf.pcm_name_out; 25.266 - unsigned int period_size, buffer_size; 25.267 - snd_pcm_uframes_t obt_buffer_size; 25.268 - const char *typ = in ? "ADC" : "DAC"; 25.269 - 25.270 - freq = req->freq; 25.271 - period_size = req->period_size; 25.272 - buffer_size = req->buffer_size; 25.273 - nchannels = req->nchannels; 25.274 - 25.275 - snd_pcm_hw_params_alloca (&hw_params); 25.276 - 25.277 - err = snd_pcm_open ( 25.278 - &handle, 25.279 - pcm_name, 25.280 - in ? SND_PCM_STREAM_CAPTURE : SND_PCM_STREAM_PLAYBACK, 25.281 - SND_PCM_NONBLOCK 25.282 - ); 25.283 - if (err < 0) { 25.284 - alsa_logerr2 (err, typ, "Failed to open `%s':\n", pcm_name); 25.285 - return -1; 25.286 - } 25.287 - 25.288 - err = snd_pcm_hw_params_any (handle, hw_params); 25.289 - if (err < 0) { 25.290 - alsa_logerr2 (err, typ, "Failed to initialize hardware parameters\n"); 25.291 - goto err; 25.292 - } 25.293 - 25.294 - err = snd_pcm_hw_params_set_access ( 25.295 - handle, 25.296 - hw_params, 25.297 - SND_PCM_ACCESS_RW_INTERLEAVED 25.298 - ); 25.299 - if (err < 0) { 25.300 - alsa_logerr2 (err, typ, "Failed to set access type\n"); 25.301 - goto err; 25.302 - } 25.303 - 25.304 - err = snd_pcm_hw_params_set_format (handle, hw_params, req->fmt); 25.305 - if (err < 0) { 25.306 - alsa_logerr2 (err, typ, "Failed to set format %d\n", req->fmt); 25.307 - goto err; 25.308 - } 25.309 - 25.310 - err = snd_pcm_hw_params_set_rate_near (handle, hw_params, &freq, 0); 25.311 - if (err < 0) { 25.312 - alsa_logerr2 (err, typ, "Failed to set frequency %d\n", req->freq); 25.313 - goto err; 25.314 - } 25.315 - 25.316 - err = snd_pcm_hw_params_set_channels_near ( 25.317 - handle, 25.318 - hw_params, 25.319 - &nchannels 25.320 - ); 25.321 - if (err < 0) { 25.322 - alsa_logerr2 (err, typ, "Failed to set number of channels %d\n", 25.323 - req->nchannels); 25.324 - goto err; 25.325 - } 25.326 - 25.327 - if (nchannels != 1 && nchannels != 2) { 25.328 - alsa_logerr2 (err, typ, 25.329 - "Can not handle obtained number of channels %d\n", 25.330 - nchannels); 25.331 - goto err; 25.332 - } 25.333 - 25.334 - if (!((in && conf.size_in_usec_in) || (!in && conf.size_in_usec_out))) { 25.335 - if (!buffer_size) { 25.336 - buffer_size = DEFAULT_BUFFER_SIZE; 25.337 - period_size= DEFAULT_PERIOD_SIZE; 25.338 - } 25.339 - } 25.340 - 25.341 - if (buffer_size) { 25.342 - if ((in && conf.size_in_usec_in) || (!in && conf.size_in_usec_out)) { 25.343 - if (period_size) { 25.344 - err = snd_pcm_hw_params_set_period_time_near ( 25.345 - handle, 25.346 - hw_params, 25.347 - &period_size, 25.348 - 0 25.349 - ); 25.350 - if (err < 0) { 25.351 - alsa_logerr2 (err, typ, 25.352 - "Failed to set period time %d\n", 25.353 - req->period_size); 25.354 - goto err; 25.355 - } 25.356 - } 25.357 - 25.358 - err = snd_pcm_hw_params_set_buffer_time_near ( 25.359 - handle, 25.360 - hw_params, 25.361 - &buffer_size, 25.362 - 0 25.363 - ); 25.364 - 25.365 - if (err < 0) { 25.366 - alsa_logerr2 (err, typ, 25.367 - "Failed to set buffer time %d\n", 25.368 - req->buffer_size); 25.369 - goto err; 25.370 - } 25.371 - } 25.372 - else { 25.373 - int dir; 25.374 - snd_pcm_uframes_t minval; 25.375 - 25.376 - if (period_size) { 25.377 - minval = period_size; 25.378 - dir = 0; 25.379 - 25.380 - err = snd_pcm_hw_params_get_period_size_min ( 25.381 - hw_params, 25.382 - &minval, 25.383 - &dir 25.384 - ); 25.385 - if (err < 0) { 25.386 - alsa_logerr ( 25.387 - err, 25.388 - "Could not get minmal period size for %s\n", 25.389 - typ 25.390 - ); 25.391 - } 25.392 - else { 25.393 - if (period_size < minval) { 25.394 - if ((in && conf.period_size_in_overriden) 25.395 - || (!in && conf.period_size_out_overriden)) { 25.396 - dolog ("%s period size(%d) is less " 25.397 - "than minmal period size(%ld)\n", 25.398 - typ, 25.399 - period_size, 25.400 - minval); 25.401 - } 25.402 - period_size = minval; 25.403 - } 25.404 - } 25.405 - 25.406 - err = snd_pcm_hw_params_set_period_size ( 25.407 - handle, 25.408 - hw_params, 25.409 - period_size, 25.410 - 0 25.411 - ); 25.412 - if (err < 0) { 25.413 - alsa_logerr2 (err, typ, "Failed to set period size %d\n", 25.414 - req->period_size); 25.415 - goto err; 25.416 - } 25.417 - } 25.418 - 25.419 - minval = buffer_size; 25.420 - err = snd_pcm_hw_params_get_buffer_size_min ( 25.421 - hw_params, 25.422 - &minval 25.423 - ); 25.424 - if (err < 0) { 25.425 - alsa_logerr (err, "Could not get minmal buffer size for %s\n", 25.426 - typ); 25.427 - } 25.428 - else { 25.429 - if (buffer_size < minval) { 25.430 - if ((in && conf.buffer_size_in_overriden) 25.431 - || (!in && conf.buffer_size_out_overriden)) { 25.432 - dolog ( 25.433 - "%s buffer size(%d) is less " 25.434 - "than minimal buffer size(%ld)\n", 25.435 - typ, 25.436 - buffer_size, 25.437 - minval 25.438 - ); 25.439 - } 25.440 - buffer_size = minval; 25.441 - } 25.442 - } 25.443 - 25.444 - err = snd_pcm_hw_params_set_buffer_size ( 25.445 - handle, 25.446 - hw_params, 25.447 - buffer_size 25.448 - ); 25.449 - if (err < 0) { 25.450 - alsa_logerr2 (err, typ, "Failed to set buffer size %d\n", 25.451 - req->buffer_size); 25.452 - goto err; 25.453 - } 25.454 - } 25.455 - } 25.456 - else { 25.457 - dolog ("warning: Buffer size is not set\n"); 25.458 - } 25.459 - 25.460 - err = snd_pcm_hw_params (handle, hw_params); 25.461 - if (err < 0) { 25.462 - alsa_logerr2 (err, typ, "Failed to apply audio parameters\n"); 25.463 - goto err; 25.464 - } 25.465 - 25.466 - err = snd_pcm_hw_params_get_buffer_size (hw_params, &obt_buffer_size); 25.467 - if (err < 0) { 25.468 - alsa_logerr2 (err, typ, "Failed to get buffer size\n"); 25.469 - goto err; 25.470 - } 25.471 - 25.472 - err = snd_pcm_prepare (handle); 25.473 - if (err < 0) { 25.474 - alsa_logerr2 (err, typ, "Could not prepare handle %p\n", handle); 25.475 - goto err; 25.476 - } 25.477 - 25.478 - if (!in && conf.threshold) { 25.479 - snd_pcm_uframes_t threshold; 25.480 - int bytes_per_sec; 25.481 - 25.482 - bytes_per_sec = freq 25.483 - << (nchannels == 2) 25.484 - << (req->fmt == AUD_FMT_S16 || req->fmt == AUD_FMT_U16); 25.485 - 25.486 - threshold = (conf.threshold * bytes_per_sec) / 1000; 25.487 - alsa_set_threshold (handle, threshold); 25.488 - } 25.489 - 25.490 - obt->fmt = req->fmt; 25.491 - obt->nchannels = nchannels; 25.492 - obt->freq = freq; 25.493 - obt->samples = obt_buffer_size; 25.494 - *handlep = handle; 25.495 - 25.496 -#if defined DEBUG_MISMATCHES || defined DEBUG 25.497 - if (obt->fmt != req->fmt || 25.498 - obt->nchannels != req->nchannels || 25.499 - obt->freq != req->freq) { 25.500 - dolog ("Audio paramters mismatch for %s\n", typ); 25.501 - alsa_dump_info (req, obt); 25.502 - } 25.503 -#endif 25.504 - 25.505 -#ifdef DEBUG 25.506 - alsa_dump_info (req, obt); 25.507 -#endif 25.508 - return 0; 25.509 - 25.510 - err: 25.511 - alsa_anal_close (&handle); 25.512 - return -1; 25.513 -} 25.514 - 25.515 -static int alsa_recover (snd_pcm_t *handle) 25.516 -{ 25.517 - int err = snd_pcm_prepare (handle); 25.518 - if (err < 0) { 25.519 - alsa_logerr (err, "Failed to prepare handle %p\n", handle); 25.520 - return -1; 25.521 - } 25.522 - return 0; 25.523 -} 25.524 - 25.525 -static snd_pcm_sframes_t alsa_get_avail (snd_pcm_t *handle) 25.526 -{ 25.527 - snd_pcm_sframes_t avail; 25.528 - 25.529 - avail = snd_pcm_avail_update (handle); 25.530 - if (avail < 0) { 25.531 - if (avail == -EPIPE) { 25.532 - if (!alsa_recover (handle)) { 25.533 - avail = snd_pcm_avail_update (handle); 25.534 - } 25.535 - } 25.536 - 25.537 - if (avail < 0) { 25.538 - alsa_logerr (avail, 25.539 - "Could not obtain number of available frames\n"); 25.540 - return -1; 25.541 - } 25.542 - } 25.543 - 25.544 - return avail; 25.545 -} 25.546 - 25.547 -static int alsa_run_out (HWVoiceOut *hw) 25.548 -{ 25.549 - ALSAVoiceOut *alsa = (ALSAVoiceOut *) hw; 25.550 - int rpos, live, decr; 25.551 - int samples; 25.552 - uint8_t *dst; 25.553 - st_sample_t *src; 25.554 - snd_pcm_sframes_t avail; 25.555 - 25.556 - live = audio_pcm_hw_get_live_out (hw); 25.557 - if (!live) { 25.558 - return 0; 25.559 - } 25.560 - 25.561 - avail = alsa_get_avail (alsa->handle); 25.562 - if (avail < 0) { 25.563 - dolog ("Could not get number of available playback frames\n"); 25.564 - return 0; 25.565 - } 25.566 - 25.567 - decr = audio_MIN (live, avail); 25.568 - samples = decr; 25.569 - rpos = hw->rpos; 25.570 - while (samples) { 25.571 - int left_till_end_samples = hw->samples - rpos; 25.572 - int len = audio_MIN (samples, left_till_end_samples); 25.573 - snd_pcm_sframes_t written; 25.574 - 25.575 - src = hw->mix_buf + rpos; 25.576 - dst = advance (alsa->pcm_buf, rpos << hw->info.shift); 25.577 - 25.578 - hw->clip (dst, src, len); 25.579 - 25.580 - while (len) { 25.581 - written = snd_pcm_writei (alsa->handle, dst, len); 25.582 - 25.583 - if (written <= 0) { 25.584 - switch (written) { 25.585 - case 0: 25.586 - if (conf.verbose) { 25.587 - dolog ("Failed to write %d frames (wrote zero)\n", len); 25.588 - } 25.589 - goto exit; 25.590 - 25.591 - case -EPIPE: 25.592 - if (alsa_recover (alsa->handle)) { 25.593 - alsa_logerr (written, "Failed to write %d frames\n", 25.594 - len); 25.595 - goto exit; 25.596 - } 25.597 - if (conf.verbose) { 25.598 - dolog ("Recovering from playback xrun\n"); 25.599 - } 25.600 - continue; 25.601 - 25.602 - case -EAGAIN: 25.603 - goto exit; 25.604 - 25.605 - default: 25.606 - alsa_logerr (written, "Failed to write %d frames to %p\n", 25.607 - len, dst); 25.608 - goto exit; 25.609 - } 25.610 - } 25.611 - 25.612 - rpos = (rpos + written) % hw->samples; 25.613 - samples -= written; 25.614 - len -= written; 25.615 - dst = advance (dst, written << hw->info.shift); 25.616 - src += written; 25.617 - } 25.618 - } 25.619 - 25.620 - exit: 25.621 - hw->rpos = rpos; 25.622 - return decr; 25.623 -} 25.624 - 25.625 -static void alsa_fini_out (HWVoiceOut *hw) 25.626 -{ 25.627 - ALSAVoiceOut *alsa = (ALSAVoiceOut *) hw; 25.628 - 25.629 - ldebug ("alsa_fini\n"); 25.630 - alsa_anal_close (&alsa->handle); 25.631 - 25.632 - if (alsa->pcm_buf) { 25.633 - qemu_free (alsa->pcm_buf); 25.634 - alsa->pcm_buf = NULL; 25.635 - } 25.636 -} 25.637 - 25.638 -static int alsa_init_out (HWVoiceOut *hw, audsettings_t *as) 25.639 -{ 25.640 - ALSAVoiceOut *alsa = (ALSAVoiceOut *) hw; 25.641 - struct alsa_params_req req; 25.642 - struct alsa_params_obt obt; 25.643 - audfmt_e effective_fmt; 25.644 - int endianness; 25.645 - int err; 25.646 - snd_pcm_t *handle; 25.647 - audsettings_t obt_as; 25.648 - 25.649 - req.fmt = aud_to_alsafmt (as->fmt); 25.650 - req.freq = as->freq; 25.651 - req.nchannels = as->nchannels; 25.652 - req.period_size = conf.period_size_out; 25.653 - req.buffer_size = conf.buffer_size_out; 25.654 - 25.655 - if (alsa_open (0, &req, &obt, &handle)) { 25.656 - return -1; 25.657 - } 25.658 - 25.659 - err = alsa_to_audfmt (obt.fmt, &effective_fmt, &endianness); 25.660 - if (err) { 25.661 - alsa_anal_close (&handle); 25.662 - return -1; 25.663 - } 25.664 - 25.665 - obt_as.freq = obt.freq; 25.666 - obt_as.nchannels = obt.nchannels; 25.667 - obt_as.fmt = effective_fmt; 25.668 - obt_as.endianness = endianness; 25.669 - 25.670 - audio_pcm_init_info (&hw->info, &obt_as); 25.671 - hw->samples = obt.samples; 25.672 - 25.673 - alsa->pcm_buf = audio_calloc (AUDIO_FUNC, obt.samples, 1 << hw->info.shift); 25.674 - if (!alsa->pcm_buf) { 25.675 - dolog ("Could not allocate DAC buffer (%d samples, each %d bytes)\n", 25.676 - hw->samples, 1 << hw->info.shift); 25.677 - alsa_anal_close (&handle); 25.678 - return -1; 25.679 - } 25.680 - 25.681 - alsa->handle = handle; 25.682 - return 0; 25.683 -} 25.684 - 25.685 -static int alsa_voice_ctl (snd_pcm_t *handle, const char *typ, int pause) 25.686 -{ 25.687 - int err; 25.688 - 25.689 - if (pause) { 25.690 - err = snd_pcm_drop (handle); 25.691 - if (err < 0) { 25.692 - alsa_logerr (err, "Could not stop %s\n", typ); 25.693 - return -1; 25.694 - } 25.695 - } 25.696 - else { 25.697 - err = snd_pcm_prepare (handle); 25.698 - if (err < 0) { 25.699 - alsa_logerr (err, "Could not prepare handle for %s\n", typ); 25.700 - return -1; 25.701 - } 25.702 - } 25.703 - 25.704 - return 0; 25.705 -} 25.706 - 25.707 -static int alsa_ctl_out (HWVoiceOut *hw, int cmd, ...) 25.708 -{ 25.709 - ALSAVoiceOut *alsa = (ALSAVoiceOut *) hw; 25.710 - 25.711 - switch (cmd) { 25.712 - case VOICE_ENABLE: 25.713 - ldebug ("enabling voice\n"); 25.714 - return alsa_voice_ctl (alsa->handle, "playback", 0); 25.715 - 25.716 - case VOICE_DISABLE: 25.717 - ldebug ("disabling voice\n"); 25.718 - return alsa_voice_ctl (alsa->handle, "playback", 1); 25.719 - } 25.720 - 25.721 - return -1; 25.722 -} 25.723 - 25.724 -static int alsa_init_in (HWVoiceIn *hw, audsettings_t *as) 25.725 -{ 25.726 - ALSAVoiceIn *alsa = (ALSAVoiceIn *) hw; 25.727 - struct alsa_params_req req; 25.728 - struct alsa_params_obt obt; 25.729 - int endianness; 25.730 - int err; 25.731 - audfmt_e effective_fmt; 25.732 - snd_pcm_t *handle; 25.733 - audsettings_t obt_as; 25.734 - 25.735 - req.fmt = aud_to_alsafmt (as->fmt); 25.736 - req.freq = as->freq; 25.737 - req.nchannels = as->nchannels; 25.738 - req.period_size = conf.period_size_in; 25.739 - req.buffer_size = conf.buffer_size_in; 25.740 - 25.741 - if (alsa_open (1, &req, &obt, &handle)) { 25.742 - return -1; 25.743 - } 25.744 - 25.745 - err = alsa_to_audfmt (obt.fmt, &effective_fmt, &endianness); 25.746 - if (err) { 25.747 - alsa_anal_close (&handle); 25.748 - return -1; 25.749 - } 25.750 - 25.751 - obt_as.freq = obt.freq; 25.752 - obt_as.nchannels = obt.nchannels; 25.753 - obt_as.fmt = effective_fmt; 25.754 - obt_as.endianness = endianness; 25.755 - 25.756 - audio_pcm_init_info (&hw->info, &obt_as); 25.757 - hw->samples = obt.samples; 25.758 - 25.759 - alsa->pcm_buf = audio_calloc (AUDIO_FUNC, hw->samples, 1 << hw->info.shift); 25.760 - if (!alsa->pcm_buf) { 25.761 - dolog ("Could not allocate ADC buffer (%d samples, each %d bytes)\n", 25.762 - hw->samples, 1 << hw->info.shift); 25.763 - alsa_anal_close (&handle); 25.764 - return -1; 25.765 - } 25.766 - 25.767 - alsa->handle = handle; 25.768 - return 0; 25.769 -} 25.770 - 25.771 -static void alsa_fini_in (HWVoiceIn *hw) 25.772 -{ 25.773 - ALSAVoiceIn *alsa = (ALSAVoiceIn *) hw; 25.774 - 25.775 - alsa_anal_close (&alsa->handle); 25.776 - 25.777 - if (alsa->pcm_buf) { 25.778 - qemu_free (alsa->pcm_buf); 25.779 - alsa->pcm_buf = NULL; 25.780 - } 25.781 -} 25.782 - 25.783 -static int alsa_run_in (HWVoiceIn *hw) 25.784 -{ 25.785 - ALSAVoiceIn *alsa = (ALSAVoiceIn *) hw; 25.786 - int hwshift = hw->info.shift; 25.787 - int i; 25.788 - int live = audio_pcm_hw_get_live_in (hw); 25.789 - int dead = hw->samples - live; 25.790 - int decr; 25.791 - struct { 25.792 - int add; 25.793 - int len; 25.794 - } bufs[2] = { 25.795 - { hw->wpos, 0 }, 25.796 - { 0, 0 } 25.797 - }; 25.798 - snd_pcm_sframes_t avail; 25.799 - snd_pcm_uframes_t read_samples = 0; 25.800 - 25.801 - if (!dead) { 25.802 - return 0; 25.803 - } 25.804 - 25.805 - avail = alsa_get_avail (alsa->handle); 25.806 - if (avail < 0) { 25.807 - dolog ("Could not get number of captured frames\n"); 25.808 - return 0; 25.809 - } 25.810 - 25.811 - if (!avail && (snd_pcm_state (alsa->handle) == SND_PCM_STATE_PREPARED)) { 25.812 - avail = hw->samples; 25.813 - } 25.814 - 25.815 - decr = audio_MIN (dead, avail); 25.816 - if (!decr) { 25.817 - return 0; 25.818 - } 25.819 - 25.820 - if (hw->wpos + decr > hw->samples) { 25.821 - bufs[0].len = (hw->samples - hw->wpos); 25.822 - bufs[1].len = (decr - (hw->samples - hw->wpos)); 25.823 - } 25.824 - else { 25.825 - bufs[0].len = decr; 25.826 - } 25.827 - 25.828 - for (i = 0; i < 2; ++i) { 25.829 - void *src; 25.830 - st_sample_t *dst; 25.831 - snd_pcm_sframes_t nread; 25.832 - snd_pcm_uframes_t len; 25.833 - 25.834 - len = bufs[i].len; 25.835 - 25.836 - src = advance (alsa->pcm_buf, bufs[i].add << hwshift); 25.837 - dst = hw->conv_buf + bufs[i].add; 25.838 - 25.839 - while (len) { 25.840 - nread = snd_pcm_readi (alsa->handle, src, len); 25.841 - 25.842 - if (nread <= 0) { 25.843 - switch (nread) { 25.844 - case 0: 25.845 - if (conf.verbose) { 25.846 - dolog ("Failed to read %ld frames (read zero)\n", len); 25.847 - } 25.848 - goto exit; 25.849 - 25.850 - case -EPIPE: 25.851 - if (alsa_recover (alsa->handle)) { 25.852 - alsa_logerr (nread, "Failed to read %ld frames\n", len); 25.853 - goto exit; 25.854 - } 25.855 - if (conf.verbose) { 25.856 - dolog ("Recovering from capture xrun\n"); 25.857 - } 25.858 - continue; 25.859 - 25.860 - case -EAGAIN: 25.861 - goto exit; 25.862 - 25.863 - default: 25.864 - alsa_logerr ( 25.865 - nread, 25.866 - "Failed to read %ld frames from %p\n", 25.867 - len, 25.868 - src 25.869 - ); 25.870 - goto exit; 25.871 - } 25.872 - } 25.873 - 25.874 - hw->conv (dst, src, nread, &nominal_volume); 25.875 - 25.876 - src = advance (src, nread << hwshift); 25.877 - dst += nread; 25.878 - 25.879 - read_samples += nread; 25.880 - len -= nread; 25.881 - } 25.882 - } 25.883 - 25.884 - exit: 25.885 - hw->wpos = (hw->wpos + read_samples) % hw->samples; 25.886 - return read_samples; 25.887 -} 25.888 - 25.889 -static int alsa_read (SWVoiceIn *sw, void *buf, int size) 25.890 -{ 25.891 - return audio_pcm_sw_read (sw, buf, size); 25.892 -} 25.893 - 25.894 -static int alsa_ctl_in (HWVoiceIn *hw, int cmd, ...) 25.895 -{ 25.896 - ALSAVoiceIn *alsa = (ALSAVoiceIn *) hw; 25.897 - 25.898 - switch (cmd) { 25.899 - case VOICE_ENABLE: 25.900 - ldebug ("enabling voice\n"); 25.901 - return alsa_voice_ctl (alsa->handle, "capture", 0); 25.902 - 25.903 - case VOICE_DISABLE: 25.904 - ldebug ("disabling voice\n"); 25.905 - return alsa_voice_ctl (alsa->handle, "capture", 1); 25.906 - } 25.907 - 25.908 - return -1; 25.909 -} 25.910 - 25.911 -static void *alsa_audio_init (void) 25.912 -{ 25.913 - return &conf; 25.914 -} 25.915 - 25.916 -static void alsa_audio_fini (void *opaque) 25.917 -{ 25.918 - (void) opaque; 25.919 -} 25.920 - 25.921 -static struct audio_option alsa_options[] = { 25.922 - {"DAC_SIZE_IN_USEC", AUD_OPT_BOOL, &conf.size_in_usec_out, 25.923 - "DAC period/buffer size in microseconds (otherwise in frames)", NULL, 0}, 25.924 - {"DAC_PERIOD_SIZE", AUD_OPT_INT, &conf.period_size_out, 25.925 - "DAC period size", &conf.period_size_out_overriden, 0}, 25.926 - {"DAC_BUFFER_SIZE", AUD_OPT_INT, &conf.buffer_size_out, 25.927 - "DAC buffer size", &conf.buffer_size_out_overriden, 0}, 25.928 - 25.929 - {"ADC_SIZE_IN_USEC", AUD_OPT_BOOL, &conf.size_in_usec_in, 25.930 - "ADC period/buffer size in microseconds (otherwise in frames)", NULL, 0}, 25.931 - {"ADC_PERIOD_SIZE", AUD_OPT_INT, &conf.period_size_in, 25.932 - "ADC period size", &conf.period_size_in_overriden, 0}, 25.933 - {"ADC_BUFFER_SIZE", AUD_OPT_INT, &conf.buffer_size_in, 25.934 - "ADC buffer size", &conf.buffer_size_in_overriden, 0}, 25.935 - 25.936 - {"THRESHOLD", AUD_OPT_INT, &conf.threshold, 25.937 - "(undocumented)", NULL, 0}, 25.938 - 25.939 - {"DAC_DEV", AUD_OPT_STR, &conf.pcm_name_out, 25.940 - "DAC device name (for instance dmix)", NULL, 0}, 25.941 - 25.942 - {"ADC_DEV", AUD_OPT_STR, &conf.pcm_name_in, 25.943 - "ADC device name", NULL, 0}, 25.944 - 25.945 - {"VERBOSE", AUD_OPT_BOOL, &conf.verbose, 25.946 - "Behave in a more verbose way", NULL, 0}, 25.947 - 25.948 - {NULL, 0, NULL, NULL, NULL, 0} 25.949 -}; 25.950 - 25.951 -static struct audio_pcm_ops alsa_pcm_ops = { 25.952 - alsa_init_out, 25.953 - alsa_fini_out, 25.954 - alsa_run_out, 25.955 - alsa_write, 25.956 - alsa_ctl_out, 25.957 - 25.958 - alsa_init_in, 25.959 - alsa_fini_in, 25.960 - alsa_run_in, 25.961 - alsa_read, 25.962 - alsa_ctl_in 25.963 -}; 25.964 - 25.965 -struct audio_driver alsa_audio_driver = { 25.966 - INIT_FIELD (name = ) "alsa", 25.967 - INIT_FIELD (descr = ) "ALSA http://www.alsa-project.org", 25.968 - INIT_FIELD (options = ) alsa_options, 25.969 - INIT_FIELD (init = ) alsa_audio_init, 25.970 - INIT_FIELD (fini = ) alsa_audio_fini, 25.971 - INIT_FIELD (pcm_ops = ) &alsa_pcm_ops, 25.972 - INIT_FIELD (can_be_default = ) 1, 25.973 - INIT_FIELD (max_voices_out = ) INT_MAX, 25.974 - INIT_FIELD (max_voices_in = ) INT_MAX, 25.975 - INIT_FIELD (voice_size_out = ) sizeof (ALSAVoiceOut), 25.976 - INIT_FIELD (voice_size_in = ) sizeof (ALSAVoiceIn) 25.977 -};
26.1 --- a/tools/ioemu/audio/audio.c Wed Sep 17 14:16:02 2008 +0100 26.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 26.3 @@ -1,1871 +0,0 @@ 26.4 -/* 26.5 - * QEMU Audio subsystem 26.6 - * 26.7 - * Copyright (c) 2003-2005 Vassili Karpov (malc) 26.8 - * 26.9 - * Permission is hereby granted, free of charge, to any person obtaining a copy 26.10 - * of this software and associated documentation files (the "Software"), to deal 26.11 - * in the Software without restriction, including without limitation the rights 26.12 - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 26.13 - * copies of the Software, and to permit persons to whom the Software is 26.14 - * furnished to do so, subject to the following conditions: 26.15 - * 26.16 - * The above copyright notice and this permission notice shall be included in 26.17 - * all copies or substantial portions of the Software. 26.18 - * 26.19 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26.20 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 26.21 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 26.22 - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26.23 - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 26.24 - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 26.25 - * THE SOFTWARE. 26.26 - */ 26.27 -#include "vl.h" 26.28 - 26.29 -#define AUDIO_CAP "audio" 26.30 -#include "audio_int.h" 26.31 - 26.32 -/* #define DEBUG_PLIVE */ 26.33 -/* #define DEBUG_LIVE */ 26.34 -/* #define DEBUG_OUT */ 26.35 -/* #define DEBUG_CAPTURE */ 26.36 - 26.37 -#define SW_NAME(sw) (sw)->name ? (sw)->name : "unknown" 26.38 - 26.39 -static struct audio_driver *drvtab[] = { 26.40 -#ifdef CONFIG_OSS 26.41 - &oss_audio_driver, 26.42 -#endif 26.43 -#ifdef CONFIG_ALSA 26.44 - &alsa_audio_driver, 26.45 -#endif 26.46 -#ifdef CONFIG_COREAUDIO 26.47 - &coreaudio_audio_driver, 26.48 -#endif 26.49 -#ifdef CONFIG_DSOUND 26.50 - &dsound_audio_driver, 26.51 -#endif 26.52 -#ifdef CONFIG_FMOD 26.53 - &fmod_audio_driver, 26.54 -#endif 26.55 -#ifdef CONFIG_SDL 26.56 - &sdl_audio_driver, 26.57 -#endif 26.58 - &no_audio_driver, 26.59 - &wav_audio_driver 26.60 -}; 26.61 - 26.62 -struct fixed_settings { 26.63 - int enabled; 26.64 - int nb_voices; 26.65 - int greedy; 26.66 - audsettings_t settings; 26.67 -}; 26.68 - 26.69 -static struct { 26.70 - struct fixed_settings fixed_out; 26.71 - struct fixed_settings fixed_in; 26.72 - union { 26.73 - int hz; 26.74 - int64_t ticks; 26.75 - } period; 26.76 - int plive; 26.77 - int log_to_monitor; 26.78 -} conf = { 26.79 - { /* DAC fixed settings */ 26.80 - 1, /* enabled */ 26.81 - 1, /* nb_voices */ 26.82 - 1, /* greedy */ 26.83 - { 26.84 - 44100, /* freq */ 26.85 - 2, /* nchannels */ 26.86 - AUD_FMT_S16 /* fmt */ 26.87 - } 26.88 - }, 26.89 - 26.90 - { /* ADC fixed settings */ 26.91 - 1, /* enabled */ 26.92 - 1, /* nb_voices */ 26.93 - 1, /* greedy */ 26.94 - { 26.95 - 44100, /* freq */ 26.96 - 2, /* nchannels */ 26.97 - AUD_FMT_S16 /* fmt */ 26.98 - } 26.99 - }, 26.100 - 26.101 - { 0 }, /* period */ 26.102 - 0, /* plive */ 26.103 - 0 /* log_to_monitor */ 26.104 -}; 26.105 - 26.106 -static AudioState glob_audio_state; 26.107 - 26.108 -volume_t nominal_volume = { 26.109 - 0, 26.110 -#ifdef FLOAT_MIXENG 26.111 - 1.0, 26.112 - 1.0 26.113 -#else 26.114 - UINT_MAX, 26.115 - UINT_MAX 26.116 -#endif 26.117 -}; 26.118 - 26.119 -/* http://www.df.lth.se/~john_e/gems/gem002d.html */ 26.120 -/* http://www.multi-platforms.com/Tips/PopCount.htm */ 26.121 -uint32_t popcount (uint32_t u) 26.122 -{ 26.123 - u = ((u&0x55555555) + ((u>>1)&0x55555555)); 26.124 - u = ((u&0x33333333) + ((u>>2)&0x33333333)); 26.125 - u = ((u&0x0f0f0f0f) + ((u>>4)&0x0f0f0f0f)); 26.126 - u = ((u&0x00ff00ff) + ((u>>8)&0x00ff00ff)); 26.127 - u = ( u&0x0000ffff) + (u>>16); 26.128 - return u; 26.129 -} 26.130 - 26.131 -inline uint32_t lsbindex (uint32_t u) 26.132 -{ 26.133 - return popcount ((u&-u)-1); 26.134 -} 26.135 - 26.136 -#ifdef AUDIO_IS_FLAWLESS_AND_NO_CHECKS_ARE_REQURIED 26.137 -#error No its not 26.138 -#else 26.139 -int audio_bug (const char *funcname, int cond) 26.140 -{ 26.141 - if (cond) { 26.142 - static int shown; 26.143 - 26.144 - AUD_log (NULL, "A bug was just triggered in %s\n", funcname); 26.145 - if (!shown) { 26.146 - shown = 1; 26.147 - AUD_log (NULL, "Save all your work and restart without audio\n"); 26.148 - AUD_log (NULL, "Please send bug report to malc@pulsesoft.com\n"); 26.149 - AUD_log (NULL, "I am sorry\n"); 26.150 - } 26.151 - AUD_log (NULL, "Context:\n"); 26.152 - 26.153 -#if defined AUDIO_BREAKPOINT_ON_BUG 26.154 -# if defined HOST_I386 26.155 -# if defined __GNUC__ 26.156 - __asm__ ("int3"); 26.157 -# elif defined _MSC_VER 26.158 - _asm _emit 0xcc; 26.159 -# else 26.160 - abort (); 26.161 -# endif 26.162 -# else 26.163 - abort (); 26.164 -# endif 26.165 -#endif 26.166 - } 26.167 - 26.168 - return cond; 26.169 -} 26.170 -#endif 26.171 - 26.172 -void *audio_calloc (const char *funcname, int nmemb, size_t size) 26.173 -{ 26.174 - int cond; 26.175 - size_t len; 26.176 - 26.177 - len = nmemb * size; 26.178 - cond = !nmemb || !size; 26.179 - cond |= nmemb < 0; 26.180 - cond |= len < size; 26.181 - 26.182 - if (audio_bug ("audio_calloc", cond)) { 26.183 - AUD_log (NULL, "%s passed invalid arguments to audio_calloc\n", 26.184 - funcname); 26.185 - AUD_log (NULL, "nmemb=%d size=%zu (len=%zu)\n", nmemb, size, len); 26.186 - return NULL; 26.187 - } 26.188 - 26.189 - return qemu_mallocz (len); 26.190 -} 26.191 - 26.192 -static char *audio_alloc_prefix (const char *s) 26.193 -{ 26.194 - const char qemu_prefix[] = "QEMU_"; 26.195 - size_t len; 26.196 - char *r; 26.197 - 26.198 - if (!s) { 26.199 - return NULL; 26.200 - } 26.201 - 26.202 - len = strlen (s); 26.203 - r = qemu_malloc (len + sizeof (qemu_prefix)); 26.204 - 26.205 - if (r) { 26.206 - size_t i; 26.207 - char *u = r + sizeof (qemu_prefix) - 1; 26.208 - 26.209 - strcpy (r, qemu_prefix); 26.210 - strcat (r, s); 26.211 - 26.212 - for (i = 0; i < len; ++i) { 26.213 - u[i] = toupper ((uint8_t)u[i]); 26.214 - } 26.215 - } 26.216 - return r; 26.217 -} 26.218 - 26.219 -const char *audio_audfmt_to_string (audfmt_e fmt) 26.220 -{ 26.221 - switch (fmt) { 26.222 - case AUD_FMT_U8: 26.223 - return "U8"; 26.224 - 26.225 - case AUD_FMT_U16: 26.226 - return "U16"; 26.227 - 26.228 - case AUD_FMT_S8: 26.229 - return "S8"; 26.230 - 26.231 - case AUD_FMT_S16: 26.232 - return "S16"; 26.233 - } 26.234 - 26.235 - dolog ("Bogus audfmt %d returning S16\n", fmt); 26.236 - return "S16"; 26.237 -} 26.238 - 26.239 -audfmt_e audio_string_to_audfmt (const char *s, audfmt_e defval, int *defaultp) 26.240 -{ 26.241 - if (!strcasecmp (s, "u8")) { 26.242 - *defaultp = 0; 26.243 - return AUD_FMT_U8; 26.244 - } 26.245 - else if (!strcasecmp (s, "u16")) { 26.246 - *defaultp = 0; 26.247 - return AUD_FMT_U16; 26.248 - } 26.249 - else if (!strcasecmp (s, "s8")) { 26.250 - *defaultp = 0; 26.251 - return AUD_FMT_S8; 26.252 - } 26.253 - else if (!strcasecmp (s, "s16")) { 26.254 - *defaultp = 0; 26.255 - return AUD_FMT_S16; 26.256 - } 26.257 - else { 26.258 - dolog ("Bogus audio format `%s' using %s\n", 26.259 - s, audio_audfmt_to_string (defval)); 26.260 - *defaultp = 1; 26.261 - return defval; 26.262 - } 26.263 -} 26.264 - 26.265 -static audfmt_e audio_get_conf_fmt (const char *envname, 26.266 - audfmt_e defval, 26.267 - int *defaultp) 26.268 -{ 26.269 - const char *var = getenv (envname); 26.270 - if (!var) { 26.271 - *defaultp = 1; 26.272 - return defval; 26.273 - } 26.274 - return audio_string_to_audfmt (var, defval, defaultp); 26.275 -} 26.276 - 26.277 -static int audio_get_conf_int (const char *key, int defval, int *defaultp) 26.278 -{ 26.279 - int val; 26.280 - char *strval; 26.281 - 26.282 - strval = getenv (key); 26.283 - if (strval) { 26.284 - *defaultp = 0; 26.285 - val = atoi (strval); 26.286 - return val; 26.287 - } 26.288 - else { 26.289 - *defaultp = 1; 26.290 - return defval; 26.291 - } 26.292 -} 26.293 - 26.294 -static const char *audio_get_conf_str (const char *key, 26.295 - const char *defval, 26.296 - int *defaultp) 26.297 -{ 26.298 - const char *val = getenv (key); 26.299 - if (!val) { 26.300 - *defaultp = 1; 26.301 - return defval; 26.302 - } 26.303 - else { 26.304 - *defaultp = 0; 26.305 - return val; 26.306 - } 26.307 -} 26.308 - 26.309 -void AUD_vlog (const char *cap, const char *fmt, va_list ap) 26.310 -{ 26.311 - if (conf.log_to_monitor) { 26.312 - if (cap) { 26.313 - term_printf ("%s: ", cap); 26.314 - } 26.315 - 26.316 - term_vprintf (fmt, ap); 26.317 - } 26.318 - else { 26.319 - if (cap) { 26.320 - fprintf (stderr, "%s: ", cap); 26.321 - } 26.322 - 26.323 - vfprintf (stderr, fmt, ap); 26.324 - } 26.325 -} 26.326 - 26.327 -void AUD_log (const char *cap, const char *fmt, ...) 26.328 -{ 26.329 - va_list ap; 26.330 - 26.331 - va_start (ap, fmt); 26.332 - AUD_vlog (cap, fmt, ap); 26.333 - va_end (ap); 26.334 -} 26.335 - 26.336 -static void audio_print_options (const char *prefix, 26.337 - struct audio_option *opt) 26.338 -{ 26.339 - char *uprefix; 26.340 - 26.341 - if (!prefix) { 26.342 - dolog ("No prefix specified\n"); 26.343 - return; 26.344 - } 26.345 - 26.346 - if (!opt) { 26.347 - dolog ("No options\n"); 26.348 - return; 26.349 - } 26.350 - 26.351 - uprefix = audio_alloc_prefix (prefix); 26.352 - 26.353 - for (; opt->name; opt++) { 26.354 - const char *state = "default"; 26.355 - printf (" %s_%s: ", uprefix, opt->name); 26.356 - 26.357 - if (opt->overridenp && *opt->overridenp) { 26.358 - state = "current"; 26.359 - } 26.360 - 26.361 - switch (opt->tag) { 26.362 - case AUD_OPT_BOOL: 26.363 - { 26.364 - int *intp = opt->valp; 26.365 - printf ("boolean, %s = %d\n", state, *intp ? 1 : 0); 26.366 - } 26.367 - break; 26.368 - 26.369 - case AUD_OPT_INT: 26.370 - { 26.371 - int *intp = opt->valp; 26.372 - printf ("integer, %s = %d\n", state, *intp); 26.373 - } 26.374 - break; 26.375 - 26.376 - case AUD_OPT_FMT: 26.377 - { 26.378 - audfmt_e *fmtp = opt->valp; 26.379 - printf ( 26.380 - "format, %s = %s, (one of: U8 S8 U16 S16)\n", 26.381 - state, 26.382 - audio_audfmt_to_string (*fmtp) 26.383 - ); 26.384 - } 26.385 - break; 26.386 - 26.387 - case AUD_OPT_STR: 26.388 - { 26.389 - const char **strp = opt->valp; 26.390 - printf ("string, %s = %s\n", 26.391 - state, 26.392 - *strp ? *strp : "(not set)"); 26.393 - } 26.394 - break; 26.395 - 26.396 - default: 26.397 - printf ("???\n"); 26.398 - dolog ("Bad value tag for option %s_%s %d\n", 26.399 - uprefix, opt->name, opt->tag); 26.400 - break; 26.401 - } 26.402 - printf (" %s\n", opt->descr); 26.403 - } 26.404 - 26.405 - qemu_free (uprefix); 26.406 -} 26.407 - 26.408 -static void audio_process_options (const char *prefix, 26.409 - struct audio_option *opt) 26.410 -{ 26.411 - char *optname; 26.412 - const char qemu_prefix[] = "QEMU_"; 26.413 - size_t preflen; 26.414 - 26.415 - if (audio_bug (AUDIO_FUNC, !prefix)) { 26.416 - dolog ("prefix = NULL\n"); 26.417 - return; 26.418 - } 26.419 - 26.420 - if (audio_bug (AUDIO_FUNC, !opt)) { 26.421 - dolog ("opt = NULL\n"); 26.422 - return; 26.423 - } 26.424 - 26.425 - preflen = strlen (prefix); 26.426 - 26.427 - for (; opt->name; opt++) { 26.428 - size_t len, i; 26.429 - int def; 26.430 - 26.431 - if (!opt->valp) { 26.432 - dolog ("Option value pointer for `%s' is not set\n", 26.433 - opt->name); 26.434 - continue; 26.435 - } 26.436 - 26.437 - len = strlen (opt->name); 26.438 - /* len of opt->name + len of prefix + size of qemu_prefix 26.439 - * (includes trailing zero) + zero + underscore (on behalf of 26.440 - * sizeof) */ 26.441 - optname = qemu_malloc (len + preflen + sizeof (qemu_prefix) + 1); 26.442 - if (!optname) { 26.443 - dolog ("Could not allocate memory for option name `%s'\n", 26.444 - opt->name); 26.445 - continue; 26.446 - } 26.447 - 26.448 - strcpy (optname, qemu_prefix); 26.449 - 26.450 - /* copy while upper-casing, including trailing zero */ 26.451 - for (i = 0; i <= preflen; ++i) { 26.452 - optname[i + sizeof (qemu_prefix) - 1] = toupper ((uint8_t)prefix[i]); 26.453 - } 26.454 - strcat (optname, "_"); 26.455 - strcat (optname, opt->name); 26.456 - 26.457 - def = 1; 26.458 - switch (opt->tag) { 26.459 - case AUD_OPT_BOOL: 26.460 - case AUD_OPT_INT: 26.461 - { 26.462 - int *intp = opt->valp; 26.463 - *intp = audio_get_conf_int (optname, *intp, &def); 26.464 - } 26.465 - break; 26.466 - 26.467 - case AUD_OPT_FMT: 26.468 - { 26.469 - audfmt_e *fmtp = opt->valp; 26.470 - *fmtp = audio_get_conf_fmt (optname, *fmtp, &def); 26.471 - } 26.472 - break; 26.473 - 26.474 - case AUD_OPT_STR: 26.475 - { 26.476 - const char **strp = opt->valp; 26.477 - *strp = audio_get_conf_str (optname, *strp, &def); 26.478 - } 26.479 - break; 26.480 - 26.481 - default: 26.482 - dolog ("Bad value tag for option `%s' - %d\n", 26.483 - optname, opt->tag); 26.484 - break; 26.485 - } 26.486 - 26.487 - if (!opt->overridenp) { 26.488 - opt->overridenp = &opt->overriden; 26.489 - } 26.490 - *opt->overridenp = !def; 26.491 - qemu_free (optname); 26.492 - } 26.493 -} 26.494 - 26.495 -static void audio_print_settings (audsettings_t *as) 26.496 -{ 26.497 - dolog ("frequency=%d nchannels=%d fmt=", as->freq, as->nchannels); 26.498 - 26.499 - switch (as->fmt) { 26.500 - case AUD_FMT_S8: 26.501 - AUD_log (NULL, "S8"); 26.502 - break; 26.503 - case AUD_FMT_U8: 26.504 - AUD_log (NULL, "U8"); 26.505 - break; 26.506 - case AUD_FMT_S16: 26.507 - AUD_log (NULL, "S16"); 26.508 - break; 26.509 - case AUD_FMT_U16: 26.510 - AUD_log (NULL, "U16"); 26.511 - break; 26.512 - default: 26.513 - AUD_log (NULL, "invalid(%d)", as->fmt); 26.514 - break; 26.515 - } 26.516 - 26.517 - AUD_log (NULL, " endianness="); 26.518 - switch (as->endianness) { 26.519 - case 0: 26.520 - AUD_log (NULL, "little"); 26.521 - break; 26.522 - case 1: 26.523 - AUD_log (NULL, "big"); 26.524 - break; 26.525 - default: 26.526 - AUD_log (NULL, "invalid"); 26.527 - break; 26.528 - } 26.529 - AUD_log (NULL, "\n"); 26.530 -} 26.531 - 26.532 -static int audio_validate_settings (audsettings_t *as) 26.533 -{ 26.534 - int invalid; 26.535 - 26.536 - invalid = as->nchannels != 1 && as->nchannels != 2; 26.537 - invalid |= as->endianness != 0 && as->endianness != 1; 26.538 - 26.539 - switch (as->fmt) { 26.540 - case AUD_FMT_S8: 26.541 - case AUD_FMT_U8: 26.542 - case AUD_FMT_S16: 26.543 - case AUD_FMT_U16: 26.544 - break; 26.545 - default: 26.546 - invalid = 1; 26.547 - break; 26.548 - } 26.549 - 26.550 - invalid |= as->freq <= 0; 26.551 - return invalid ? -1 : 0; 26.552 -} 26.553 - 26.554 -static int audio_pcm_info_eq (struct audio_pcm_info *info, audsettings_t *as) 26.555 -{ 26.556 - int bits = 8, sign = 0; 26.557 - 26.558 - switch (as->fmt) { 26.559 - case AUD_FMT_S8: 26.560 - sign = 1; 26.561 - case AUD_FMT_U8: 26.562 - break; 26.563 - 26.564 - case AUD_FMT_S16: 26.565 - sign = 1; 26.566 - case AUD_FMT_U16: 26.567 - bits = 16; 26.568 - break; 26.569 - } 26.570 - return info->freq == as->freq 26.571 - && info->nchannels == as->nchannels 26.572 - && info->sign == sign 26.573 - && info->bits == bits 26.574 - && info->swap_endianness == (as->endianness != AUDIO_HOST_ENDIANNESS); 26.575 -} 26.576 - 26.577 -void audio_pcm_init_info (struct audio_pcm_info *info, audsettings_t *as) 26.578 -{ 26.579 - int bits = 8, sign = 0; 26.580 - 26.581 - switch (as->fmt) { 26.582 - case AUD_FMT_S8: 26.583 - sign = 1; 26.584 - case AUD_FMT_U8: 26.585 - break; 26.586 - 26.587 - case AUD_FMT_S16: 26.588 - sign = 1; 26.589 - case AUD_FMT_U16: 26.590 - bits = 16; 26.591 - break; 26.592 - } 26.593 - 26.594 - info->freq = as->freq; 26.595 - info->bits = bits; 26.596 - info->sign = sign; 26.597 - info->nchannels = as->nchannels; 26.598 - info->shift = (as->nchannels == 2) + (bits == 16); 26.599 - info->align = (1 << info->shift) - 1; 26.600 - info->bytes_per_second = info->freq << info->shift; 26.601 - info->swap_endianness = (as->endianness != AUDIO_HOST_ENDIANNESS); 26.602 -} 26.603 - 26.604 -void audio_pcm_info_clear_buf (struct audio_pcm_info *info, void *buf, int len) 26.605 -{ 26.606 - if (!len) { 26.607 - return; 26.608 - } 26.609 - 26.610 - if (info->sign) { 26.611 - memset (buf, 0x00, len << info->shift); 26.612 - } 26.613 - else { 26.614 - if (info->bits == 8) { 26.615 - memset (buf, 0x80, len << info->shift); 26.616 - } 26.617 - else { 26.618 - int i; 26.619 - uint16_t *p = buf; 26.620 - int shift = info->nchannels - 1; 26.621 - short s = INT16_MAX; 26.622 - 26.623 - if (info->swap_endianness) { 26.624 - s = bswap16 (s); 26.625 - } 26.626 - 26.627 - for (i = 0; i < len << shift; i++) { 26.628 - p[i] = s; 26.629 - } 26.630 - } 26.631 - } 26.632 -} 26.633 - 26.634 -/* 26.635 - * Capture 26.636 - */ 26.637 -static void noop_conv (st_sample_t *dst, const void *src, 26.638 - int samples, volume_t *vol) 26.639 -{ 26.640 - (void) src; 26.641 - (void) dst; 26.642 - (void) samples; 26.643 - (void) vol; 26.644 -} 26.645 - 26.646 -static CaptureVoiceOut *audio_pcm_capture_find_specific ( 26.647 - AudioState *s, 26.648 - audsettings_t *as 26.649 - ) 26.650 -{ 26.651 - CaptureVoiceOut *cap; 26.652 - 26.653 - for (cap = s->cap_head.lh_first; cap; cap = cap->entries.le_next) { 26.654 - if (audio_pcm_info_eq (&cap->hw.info, as)) { 26.655 - return cap; 26.656 - } 26.657 - } 26.658 - return NULL; 26.659 -} 26.660 - 26.661 -static void audio_notify_capture (CaptureVoiceOut *cap, audcnotification_e cmd) 26.662 -{ 26.663 - struct capture_callback *cb; 26.664 - 26.665 -#ifdef DEBUG_CAPTURE 26.666 - dolog ("notification %d sent\n", cmd); 26.667 -#endif 26.668 - for (cb = cap->cb_head.lh_first; cb; cb = cb->entries.le_next) { 26.669 - cb->ops.notify (cb->opaque, cmd); 26.670 - } 26.671 -} 26.672 - 26.673 -static void audio_capture_maybe_changed (CaptureVoiceOut *cap, int enabled) 26.674 -{ 26.675 - if (cap->hw.enabled != enabled) { 26.676 - audcnotification_e cmd; 26.677 - cap->hw.enabled = enabled; 26.678 - cmd = enabled ? AUD_CNOTIFY_ENABLE : AUD_CNOTIFY_DISABLE; 26.679 - audio_notify_capture (cap, cmd); 26.680 - } 26.681 -} 26.682 - 26.683 -static void audio_recalc_and_notify_capture (CaptureVoiceOut *cap) 26.684 -{ 26.685 - HWVoiceOut *hw = &cap->hw; 26.686 - SWVoiceOut *sw; 26.687 - int enabled = 0; 26.688 - 26.689 - for (sw = hw->sw_head.lh_first; sw; sw = sw->entries.le_next) { 26.690 - if (sw->active) { 26.691 - enabled = 1; 26.692 - break; 26.693 - } 26.694 - } 26.695 - audio_capture_maybe_changed (cap, enabled); 26.696 -} 26.697 - 26.698 -static void audio_detach_capture (HWVoiceOut *hw) 26.699 -{ 26.700 - SWVoiceCap *sc = hw->cap_head.lh_first; 26.701 - 26.702 - while (sc) { 26.703 - SWVoiceCap *sc1 = sc->entries.le_next; 26.704 - SWVoiceOut *sw = &sc->sw; 26.705 - CaptureVoiceOut *cap = sc->cap; 26.706 - int was_active = sw->active; 26.707 - 26.708 - if (sw->rate) { 26.709 - st_rate_stop (sw->rate); 26.710 - sw->rate = NULL; 26.711 - } 26.712 - 26.713 - LIST_REMOVE (sw, entries); 26.714 - LIST_REMOVE (sc, entries); 26.715 - qemu_free (sc); 26.716 - if (was_active) { 26.717 - /* We have removed soft voice from the capture: 26.718 - this might have changed the overall status of the capture 26.719 - since this might have been the only active voice */ 26.720 - audio_recalc_and_notify_capture (cap); 26.721 - } 26.722 - sc = sc1; 26.723 - } 26.724 -} 26.725 - 26.726 -static int audio_attach_capture (AudioState *s, HWVoiceOut *hw) 26.727 -{ 26.728 - CaptureVoiceOut *cap; 26.729 - 26.730 - audio_detach_capture (hw); 26.731 - for (cap = s->cap_head.lh_first; cap; cap = cap->entries.le_next) { 26.732 - SWVoiceCap *sc; 26.733 - SWVoiceOut *sw; 26.734 - HWVoiceOut *hw_cap = &cap->hw; 26.735 - 26.736 - sc = audio_calloc (AUDIO_FUNC, 1, sizeof (*sc)); 26.737 - if (!sc) { 26.738 - dolog ("Could not allocate soft capture voice (%zu bytes)\n", 26.739 - sizeof (*sc)); 26.740 - return -1; 26.741 - } 26.742 - 26.743 - sc->cap = cap; 26.744 - sw = &sc->sw; 26.745 - sw->hw = hw_cap; 26.746 - sw->info = hw->info; 26.747 - sw->empty = 1; 26.748 - sw->active = hw->enabled; 26.749 - sw->conv = noop_conv; 26.750 - sw->ratio = ((int64_t) hw_cap->info.freq << 32) / sw->info.freq; 26.751 - sw->rate = st_rate_start (sw->info.freq, hw_cap->info.freq); 26.752 - if (!sw->rate) { 26.753 - dolog ("Could not start rate conversion for `%s'\n", SW_NAME (sw)); 26.754 - qemu_free (sw); 26.755 - return -1; 26.756 - } 26.757 - LIST_INSERT_HEAD (&hw_cap->sw_head, sw, entries); 26.758 - LIST_INSERT_HEAD (&hw->cap_head, sc, entries); 26.759 -#ifdef DEBUG_CAPTURE 26.760 - asprintf (&sw->name, "for %p %d,%d,%d", 26.761 - hw, sw->info.freq, sw->info.bits, sw->info.nchannels); 26.762 - dolog ("Added %s active = %d\n", sw->name, sw->active); 26.763 -#endif 26.764 - if (sw->active) { 26.765 - audio_capture_maybe_changed (cap, 1); 26.766 - } 26.767 - } 26.768 - return 0; 26.769 -} 26.770 - 26.771 -/* 26.772 - * Hard voice (capture) 26.773 - */ 26.774 -static int audio_pcm_hw_find_min_in (HWVoiceIn *hw) 26.775 -{ 26.776 - SWVoiceIn *sw; 26.777 - int m = hw->total_samples_captured; 26.778 - 26.779 - for (sw = hw->sw_head.lh_first; sw; sw = sw->entries.le_next) { 26.780 - if (sw->active) { 26.781 - m = audio_MIN (m, sw->total_hw_samples_acquired); 26.782 - } 26.783 - } 26.784 - return m; 26.785 -} 26.786 - 26.787 -int audio_pcm_hw_get_live_in (HWVoiceIn *hw) 26.788 -{ 26.789 - int live = hw->total_samples_captured - audio_pcm_hw_find_min_in (hw); 26.790 - if (audio_bug (AUDIO_FUNC, live < 0 || live > hw->samples)) { 26.791 - dolog ("live=%d hw->samples=%d\n", live, hw->samples); 26.792 - return 0; 26.793 - } 26.794 - return live; 26.795 -} 26.796 - 26.797 -/* 26.798 - * Soft voice (capture) 26.799 - */ 26.800 -static int audio_pcm_sw_get_rpos_in (SWVoiceIn *sw) 26.801 -{ 26.802 - HWVoiceIn *hw = sw->hw; 26.803 - int live = hw->total_samples_captured - sw->total_hw_samples_acquired; 26.804 - int rpos; 26.805 - 26.806 - if (audio_bug (AUDIO_FUNC, live < 0 || live > hw->samples)) { 26.807 - dolog ("live=%d hw->samples=%d\n", live, hw->samples); 26.808 - return 0; 26.809 - } 26.810 - 26.811 - rpos = hw->wpos - live; 26.812 - if (rpos >= 0) { 26.813 - return rpos; 26.814 - } 26.815 - else { 26.816 - return hw->samples + rpos; 26.817 - } 26.818 -} 26.819 - 26.820 -int audio_pcm_sw_read (SWVoiceIn *sw, void *buf, int size) 26.821 -{ 26.822 - HWVoiceIn *hw = sw->hw; 26.823 - int samples, live, ret = 0, swlim, isamp, osamp, rpos, total = 0; 26.824 - st_sample_t *src, *dst = sw->buf; 26.825 - 26.826 - rpos = audio_pcm_sw_get_rpos_in (sw) % hw->samples; 26.827 - 26.828 - live = hw->total_samples_captured - sw->total_hw_samples_acquired; 26.829 - if (audio_bug (AUDIO_FUNC, live < 0 || live > hw->samples)) { 26.830 - dolog ("live_in=%d hw->samples=%d\n", live, hw->samples); 26.831 - return 0; 26.832 - } 26.833 - 26.834 - samples = size >> sw->info.shift; 26.835 - if (!live) { 26.836 - return 0; 26.837 - } 26.838 - 26.839 - swlim = (live * sw->ratio) >> 32; 26.840 - swlim = audio_MIN (swlim, samples); 26.841 - 26.842 - while (swlim) { 26.843 - src = hw->conv_buf + rpos; 26.844 - isamp = hw->wpos - rpos; 26.845 - /* XXX: <= ? */ 26.846 - if (isamp <= 0) { 26.847 - isamp = hw->samples - rpos; 26.848 - } 26.849 - 26.850 - if (!isamp) { 26.851 - break; 26.852 - } 26.853 - osamp = swlim; 26.854 - 26.855 - if (audio_bug (AUDIO_FUNC, osamp < 0)) { 26.856 - dolog ("osamp=%d\n", osamp); 26.857 - return 0; 26.858 - } 26.859 - 26.860 - st_rate_flow (sw->rate, src, dst, &isamp, &osamp); 26.861 - swlim -= osamp; 26.862 - rpos = (rpos + isamp) % hw->samples; 26.863 - dst += osamp; 26.864 - ret += osamp; 26.865 - total += isamp; 26.866 - } 26.867 - 26.868 - sw->clip (buf, sw->buf, ret); 26.869 - sw->total_hw_samples_acquired += total; 26.870 - return ret << sw->info.shift; 26.871 -} 26.872 - 26.873 -/* 26.874 - * Hard voice (playback) 26.875 - */ 26.876 -static int audio_pcm_hw_find_min_out (HWVoiceOut *hw, int *nb_livep) 26.877 -{ 26.878 - SWVoiceOut *sw; 26.879 - int m = INT_MAX; 26.880 - int nb_live = 0; 26.881 - 26.882 - for (sw = hw->sw_head.lh_first; sw; sw = sw->entries.le_next) { 26.883 - if (sw->active || !sw->empty) { 26.884 - m = audio_MIN (m, sw->total_hw_samples_mixed); 26.885 - nb_live += 1; 26.886 - } 26.887 - } 26.888 - 26.889 - *nb_livep = nb_live; 26.890 - return m; 26.891 -} 26.892 - 26.893 -int audio_pcm_hw_get_live_out2 (HWVoiceOut *hw, int *nb_live) 26.894 -{ 26.895 - int smin; 26.896 - 26.897 - smin = audio_pcm_hw_find_min_out (hw, nb_live); 26.898 - 26.899 - if (!*nb_live) { 26.900 - return 0; 26.901 - } 26.902 - else { 26.903 - int live = smin; 26.904 - 26.905 - if (audio_bug (AUDIO_FUNC, live < 0 || live > hw->samples)) { 26.906 - dolog ("live=%d hw->samples=%d\n", live, hw->samples); 26.907 - return 0; 26.908 - } 26.909 - return live; 26.910 - } 26.911 -} 26.912 - 26.913 -int audio_pcm_hw_get_live_out (HWVoiceOut *hw) 26.914 -{ 26.915 - int nb_live; 26.916 - int live; 26.917 - 26.918 - live = audio_pcm_hw_get_live_out2 (hw, &nb_live); 26.919 - if (audio_bug (AUDIO_FUNC, live < 0 || live > hw->samples)) { 26.920 - dolog ("live=%d hw->samples=%d\n", live, hw->samples); 26.921 - return 0; 26.922 - } 26.923 - return live; 26.924 -} 26.925 - 26.926 -/* 26.927 - * Soft voice (playback) 26.928 - */ 26.929 -int audio_pcm_sw_write (SWVoiceOut *sw, void *buf, int size) 26.930 -{ 26.931 - int hwsamples, samples, isamp, osamp, wpos, live, dead, left, swlim, blck; 26.932 - int ret = 0, pos = 0, total = 0; 26.933 - 26.934 - if (!sw) { 26.935 - return size; 26.936 - } 26.937 - 26.938 - hwsamples = sw->hw->samples; 26.939 - 26.940 - live = sw->total_hw_samples_mixed; 26.941 - if (audio_bug (AUDIO_FUNC, live < 0 || live > hwsamples)){ 26.942 - dolog ("live=%d hw->samples=%d\n", live, hwsamples); 26.943 - return 0; 26.944 - } 26.945 - 26.946 - if (live == hwsamples) { 26.947 -#ifdef DEBUG_OUT 26.948 - dolog ("%s is full %d\n", sw->name, live); 26.949 -#endif 26.950 - return 0; 26.951 - } 26.952 - 26.953 - wpos = (sw->hw->rpos + live) % hwsamples; 26.954 - samples = size >> sw->info.shift; 26.955 - 26.956 - dead = hwsamples - live; 26.957 - swlim = ((int64_t) dead << 32) / sw->ratio; 26.958 - swlim = audio_MIN (swlim, samples); 26.959 - if (swlim) { 26.960 - sw->conv (sw->buf, buf, swlim, &sw->vol); 26.961 - } 26.962 - 26.963 - while (swlim) { 26.964 - dead = hwsamples - live; 26.965 - left = hwsamples - wpos; 26.966 - blck = audio_MIN (dead, left); 26.967 - if (!blck) { 26.968 - break; 26.969 - } 26.970 - isamp = swlim; 26.971 - osamp = blck; 26.972 - st_rate_flow_mix ( 26.973 - sw->rate, 26.974 - sw->buf + pos, 26.975 - sw->hw->mix_buf + wpos, 26.976 - &isamp, 26.977 - &osamp 26.978 - ); 26.979 - ret += isamp; 26.980 - swlim -= isamp; 26.981 - pos += isamp; 26.982 - live += osamp; 26.983 - wpos = (wpos + osamp) % hwsamples; 26.984 - total += osamp; 26.985 - } 26.986 - 26.987 - sw->total_hw_samples_mixed += total; 26.988 - sw->empty = sw->total_hw_samples_mixed == 0; 26.989 - 26.990 -#ifdef DEBUG_OUT 26.991 - dolog ( 26.992 - "%s: write size %d ret %d total sw %d\n", 26.993 - SW_NAME (sw), 26.994 - size >> sw->info.shift, 26.995 - ret, 26.996 - sw->total_hw_samples_mixed 26.997 - ); 26.998 -#endif 26.999 - 26.1000 - return ret << sw->info.shift; 26.1001 -} 26.1002 - 26.1003 -#ifdef DEBUG_AUDIO 26.1004 -static void audio_pcm_print_info (const char *cap, struct audio_pcm_info *info) 26.1005 -{ 26.1006 - dolog ("%s: bits %d, sign %d, freq %d, nchan %d\n", 26.1007 - cap, info->bits, info->sign, info->freq, info->nchannels); 26.1008 -} 26.1009 -#endif 26.1010 - 26.1011 -#define DAC 26.1012 -#include "audio_template.h" 26.1013 -#undef DAC 26.1014 -#include "audio_template.h" 26.1015 - 26.1016 -int AUD_write (SWVoiceOut *sw, void *buf, int size) 26.1017 -{ 26.1018 - int bytes; 26.1019 - 26.1020 - if (!sw) { 26.1021 - /* XXX: Consider options */ 26.1022 - return size; 26.1023 - } 26.1024 - 26.1025 - if (!sw->hw->enabled) { 26.1026 - dolog ("Writing to disabled voice %s\n", SW_NAME (sw)); 26.1027 - return 0; 26.1028 - } 26.1029 - 26.1030 - bytes = sw->hw->pcm_ops->write (sw, buf, size); 26.1031 - return bytes; 26.1032 -} 26.1033 - 26.1034 -int AUD_read (SWVoiceIn *sw, void *buf, int size) 26.1035 -{ 26.1036 - int bytes; 26.1037 - 26.1038 - if (!sw) { 26.1039 - /* XXX: Consider options */ 26.1040 - return size; 26.1041 - } 26.1042 - 26.1043 - if (!sw->hw->enabled) { 26.1044 - dolog ("Reading from disabled voice %s\n", SW_NAME (sw)); 26.1045 - return 0; 26.1046 - } 26.1047 - 26.1048 - bytes = sw->hw->pcm_ops->read (sw, buf, size); 26.1049 - return bytes; 26.1050 -} 26.1051 - 26.1052 -int AUD_get_buffer_size_out (SWVoiceOut *sw) 26.1053 -{ 26.1054 - return sw->hw->samples << sw->hw->info.shift; 26.1055 -} 26.1056 - 26.1057 -void AUD_set_active_out (SWVoiceOut *sw, int on) 26.1058 -{ 26.1059 - HWVoiceOut *hw; 26.1060 - 26.1061 - if (!sw) { 26.1062 - return; 26.1063 - } 26.1064 - 26.1065 - hw = sw->hw; 26.1066 - if (sw->active != on) { 26.1067 - SWVoiceOut *temp_sw; 26.1068 - SWVoiceCap *sc; 26.1069 - 26.1070 - if (on) { 26.1071 - hw->pending_disable = 0; 26.1072 - if (!hw->enabled) { 26.1073 - hw->enabled = 1; 26.1074 - hw->pcm_ops->ctl_out (hw, VOICE_ENABLE); 26.1075 - } 26.1076 - } 26.1077 - else { 26.1078 - if (hw->enabled) { 26.1079 - int nb_active = 0; 26.1080 - 26.1081 - for (temp_sw = hw->sw_head.lh_first; temp_sw; 26.1082 - temp_sw = temp_sw->entries.le_next) { 26.1083 - nb_active += temp_sw->active != 0; 26.1084 - } 26.1085 - 26.1086 - hw->pending_disable = nb_active == 1; 26.1087 - } 26.1088 - } 26.1089 - 26.1090 - for (sc = hw->cap_head.lh_first; sc; sc = sc->entries.le_next) { 26.1091 - sc->sw.active = hw->enabled; 26.1092 - if (hw->enabled) { 26.1093 - audio_capture_maybe_changed (sc->cap, 1); 26.1094 - } 26.1095 - } 26.1096 - sw->active = on; 26.1097 - } 26.1098 -} 26.1099 - 26.1100 -void AUD_set_active_in (SWVoiceIn *sw, int on) 26.1101 -{ 26.1102 - HWVoiceIn *hw; 26.1103 - 26.1104 - if (!sw) { 26.1105 - return; 26.1106 - } 26.1107 - 26.1108 - hw = sw->hw; 26.1109 - if (sw->active != on) { 26.1110 - SWVoiceIn *temp_sw; 26.1111 - 26.1112 - if (on) { 26.1113 - if (!hw->enabled) { 26.1114 - hw->enabled = 1; 26.1115 - hw->pcm_ops->ctl_in (hw, VOICE_ENABLE); 26.1116 - } 26.1117 - sw->total_hw_samples_acquired = hw->total_samples_captured; 26.1118 - } 26.1119 - else { 26.1120 - if (hw->enabled) { 26.1121 - int nb_active = 0; 26.1122 - 26.1123 - for (temp_sw = hw->sw_head.lh_first; temp_sw; 26.1124 - temp_sw = temp_sw->entries.le_next) { 26.1125 - nb_active += temp_sw->active != 0; 26.1126 - } 26.1127 - 26.1128 - if (nb_active == 1) { 26.1129 - hw->enabled = 0; 26.1130 - hw->pcm_ops->ctl_in (hw, VOICE_DISABLE); 26.1131 - } 26.1132 - } 26.1133 - } 26.1134 - sw->active = on; 26.1135 - } 26.1136 -} 26.1137 - 26.1138 -static int audio_get_avail (SWVoiceIn *sw) 26.1139 -{ 26.1140 - int live; 26.1141 - 26.1142 - if (!sw) { 26.1143 - return 0; 26.1144 - } 26.1145 - 26.1146 - live = sw->hw->total_samples_captured - sw->total_hw_samples_acquired; 26.1147 - if (audio_bug (AUDIO_FUNC, live < 0 || live > sw->hw->samples)) { 26.1148 - dolog ("live=%d sw->hw->samples=%d\n", live, sw->hw->samples); 26.1149 - return 0; 26.1150 - } 26.1151 - 26.1152 - ldebug ( 26.1153 - "%s: get_avail live %d ret %" PRId64 "\n", 26.1154 - SW_NAME (sw), 26.1155 - live, (((int64_t) live << 32) / sw->ratio) << sw->info.shift 26.1156 - ); 26.1157 - 26.1158 - return (((int64_t) live << 32) / sw->ratio) << sw->info.shift; 26.1159 -} 26.1160 - 26.1161 -static int audio_get_free (SWVoiceOut *sw) 26.1162 -{ 26.1163 - int live, dead; 26.1164 - 26.1165 - if (!sw) { 26.1166 - return 0; 26.1167 - } 26.1168 - 26.1169 - live = sw->total_hw_samples_mixed; 26.1170 - 26.1171 - if (audio_bug (AUDIO_FUNC, live < 0 || live > sw->hw->samples)) { 26.1172 - dolog ("live=%d sw->hw->samples=%d\n", live, sw->hw->samples); 26.1173 - return 0; 26.1174 - } 26.1175 - 26.1176 - dead = sw->hw->samples - live; 26.1177 - 26.1178 -#ifdef DEBUG_OUT 26.1179 - dolog ("%s: get_free live %d dead %d ret %" PRId64 "\n", 26.1180 - SW_NAME (sw), 26.1181 - live, dead, (((int64_t) dead << 32) / sw->ratio) << sw->info.shift); 26.1182 -#endif 26.1183 - 26.1184 - return (((int64_t) dead << 32) / sw->ratio) << sw->info.shift; 26.1185 -} 26.1186 - 26.1187 -static void audio_capture_mix_and_clear (HWVoiceOut *hw, int rpos, int samples) 26.1188 -{ 26.1189 - int n; 26.1190 - 26.1191 - if (hw->enabled) { 26.1192 - SWVoiceCap *sc; 26.1193 - 26.1194 - for (sc = hw->cap_head.lh_first; sc; sc = sc->entries.le_next) { 26.1195 - SWVoiceOut *sw = &sc->sw; 26.1196 - int rpos2 = rpos; 26.1197 - 26.1198 - n = samples; 26.1199 - while (n) { 26.1200 - int till_end_of_hw = hw->samples - rpos2; 26.1201 - int to_write = audio_MIN (till_end_of_hw, n); 26.1202 - int bytes = to_write << hw->info.shift; 26.1203 - int written; 26.1204 - 26.1205 - sw->buf = hw->mix_buf + rpos2; 26.1206 - written = audio_pcm_sw_write (sw, NULL, bytes); 26.1207 - if (written - bytes) { 26.1208 - dolog ("Could not mix %d bytes into a capture " 26.1209 - "buffer, mixed %d\n", 26.1210 - bytes, written); 26.1211 - break; 26.1212 - } 26.1213 - n -= to_write; 26.1214 - rpos2 = (rpos2 + to_write) % hw->samples; 26.1215 - } 26.1216 - } 26.1217 - } 26.1218 - 26.1219 - n = audio_MIN (samples, hw->samples - rpos); 26.1220 - mixeng_clear (hw->mix_buf + rpos, n); 26.1221 - mixeng_clear (hw->mix_buf, samples - n); 26.1222 -} 26.1223 - 26.1224 -static void audio_run_out (AudioState *s) 26.1225 -{ 26.1226 - HWVoiceOut *hw = NULL; 26.1227 - SWVoiceOut *sw; 26.1228 - 26.1229 - while ((hw = audio_pcm_hw_find_any_enabled_out (s, hw))) { 26.1230 - int played; 26.1231 - int live, free, nb_live, cleanup_required, prev_rpos; 26.1232 - 26.1233 - live = audio_pcm_hw_get_live_out2 (hw, &nb_live); 26.1234 - if (!nb_live) { 26.1235 - live = 0; 26.1236 - } 26.1237 - 26.1238 - if (audio_bug (AUDIO_FUNC, live < 0 || live > hw->samples)) { 26.1239 - dolog ("live=%d hw->samples=%d\n", live, hw->samples); 26.1240 - continue; 26.1241 - } 26.1242 - 26.1243 - if (hw->pending_disable && !nb_live) { 26.1244 - SWVoiceCap *sc; 26.1245 -#ifdef DEBUG_OUT 26.1246 - dolog ("Disabling voice\n"); 26.1247 -#endif 26.1248 - hw->enabled = 0; 26.1249 - hw->pending_disable = 0; 26.1250 - hw->pcm_ops->ctl_out (hw, VOICE_DISABLE); 26.1251 - for (sc = hw->cap_head.lh_first; sc; sc = sc->entries.le_next) { 26.1252 - sc->sw.active = 0; 26.1253 - audio_recalc_and_notify_capture (sc->cap); 26.1254 - } 26.1255 - continue; 26.1256 - } 26.1257 - 26.1258 - if (!live) { 26.1259 - for (sw = hw->sw_head.lh_first; sw; sw = sw->entries.le_next) { 26.1260 - if (sw->active) { 26.1261 - free = audio_get_free (sw); 26.1262 - if (free > 0) { 26.1263 - sw->callback.fn (sw->callback.opaque, free); 26.1264 - } 26.1265 - } 26.1266 - } 26.1267 - continue; 26.1268 - } 26.1269 - 26.1270 - prev_rpos = hw->rpos; 26.1271 - played = hw->pcm_ops->run_out (hw); 26.1272 - if (audio_bug (AUDIO_FUNC, hw->rpos >= hw->samples)) { 26.1273 - dolog ("hw->rpos=%d hw->samples=%d played=%d\n", 26.1274 - hw->rpos, hw->samples, played); 26.1275 - hw->rpos = 0; 26.1276 - } 26.1277 - 26.1278 -#ifdef DEBUG_OUT 26.1279 - dolog ("played=%d\n", played); 26.1280 -#endif 26.1281 - 26.1282 - if (played) { 26.1283 - hw->ts_helper += played; 26.1284 - audio_capture_mix_and_clear (hw, prev_rpos, played); 26.1285 - } 26.1286 - 26.1287 - cleanup_required = 0; 26.1288 - for (sw = hw->sw_head.lh_first; sw; sw = sw->entries.le_next) { 26.1289 - if (!sw->active && sw->empty) { 26.1290 - continue; 26.1291 - } 26.1292 - 26.1293 - if (audio_bug (AUDIO_FUNC, played > sw->total_hw_samples_mixed)) { 26.1294 - dolog ("played=%d sw->total_hw_samples_mixed=%d\n", 26.1295 - played, sw->total_hw_samples_mixed); 26.1296 - played = sw->total_hw_samples_mixed; 26.1297 - } 26.1298 - 26.1299 - sw->total_hw_samples_mixed -= played; 26.1300 - 26.1301 - if (!sw->total_hw_samples_mixed) { 26.1302 - sw->empty = 1; 26.1303 - cleanup_required |= !sw->active && !sw->callback.fn; 26.1304 - } 26.1305 - 26.1306 - if (sw->active) { 26.1307 - free = audio_get_free (sw); 26.1308 - if (free > 0) { 26.1309 - sw->callback.fn (sw->callback.opaque, free); 26.1310 - } 26.1311 - } 26.1312 - } 26.1313 - 26.1314 - if (cleanup_required) { 26.1315 - SWVoiceOut *sw1; 26.1316 - 26.1317 - sw = hw->sw_head.lh_first; 26.1318 - while (sw) { 26.1319 - sw1 = sw->entries.le_next; 26.1320 - if (!sw->active && !sw->callback.fn) { 26.1321 -#ifdef DEBUG_PLIVE 26.1322 - dolog ("Finishing with old voice\n"); 26.1323 -#endif 26.1324 - audio_close_out (s, sw); 26.1325 - } 26.1326 - sw = sw1; 26.1327 - } 26.1328 - } 26.1329 - } 26.1330 -} 26.1331 - 26.1332 -static void audio_run_in (AudioState *s) 26.1333 -{ 26.1334 - HWVoiceIn *hw = NULL; 26.1335 - 26.1336 - while ((hw = audio_pcm_hw_find_any_enabled_in (s, hw))) { 26.1337 - SWVoiceIn *sw; 26.1338 - int captured, min; 26.1339 - 26.1340 - captured = hw->pcm_ops->run_in (hw); 26.1341 - 26.1342 - min = audio_pcm_hw_find_min_in (hw); 26.1343 - hw->total_samples_captured += captured - min; 26.1344 - hw->ts_helper += captured; 26.1345 - 26.1346 - for (sw = hw->sw_head.lh_first; sw; sw = sw->entries.le_next) { 26.1347 - sw->total_hw_samples_acquired -= min; 26.1348 - 26.1349 - if (sw->active) { 26.1350 - int avail; 26.1351 - 26.1352 - avail = audio_get_avail (sw); 26.1353 - if (avail > 0) { 26.1354 - sw->callback.fn (sw->callback.opaque, avail); 26.1355 - } 26.1356 - } 26.1357 - } 26.1358 - } 26.1359 -} 26.1360 - 26.1361 -static void audio_run_capture (AudioState *s) 26.1362 -{ 26.1363 - CaptureVoiceOut *cap; 26.1364 - 26.1365 - for (cap = s->cap_head.lh_first; cap; cap = cap->entries.le_next) { 26.1366 - int live, rpos, captured; 26.1367 - HWVoiceOut *hw = &cap->hw; 26.1368 - SWVoiceOut *sw; 26.1369 - 26.1370 - captured = live = audio_pcm_hw_get_live_out (hw); 26.1371 - rpos = hw->rpos; 26.1372 - while (live) { 26.1373 - int left = hw->samples - rpos; 26.1374 - int to_capture = audio_MIN (live, left); 26.1375 - st_sample_t *src; 26.1376 - struct capture_callback *cb; 26.1377 - 26.1378 - src = hw->mix_buf + rpos; 26.1379 - hw->clip (cap->buf, src, to_capture); 26.1380 - mixeng_clear (src, to_capture); 26.1381 - 26.1382 - for (cb = cap->cb_head.lh_first; cb; cb = cb->entries.le_next) { 26.1383 - cb->ops.capture (cb->opaque, cap->buf, 26.1384 - to_capture << hw->info.shift); 26.1385 - } 26.1386 - rpos = (rpos + to_capture) % hw->samples; 26.1387 - live -= to_capture; 26.1388 - } 26.1389 - hw->rpos = rpos; 26.1390 - 26.1391 - for (sw = hw->sw_head.lh_first; sw; sw = sw->entries.le_next) { 26.1392 - if (!sw->active && sw->empty) { 26.1393 - continue; 26.1394 - } 26.1395 - 26.1396 - if (audio_bug (AUDIO_FUNC, captured > sw->total_hw_samples_mixed)) { 26.1397 - dolog ("captured=%d sw->total_hw_samples_mixed=%d\n", 26.1398 - captured, sw->total_hw_samples_mixed); 26.1399 - captured = sw->total_hw_samples_mixed; 26.1400 - } 26.1401 - 26.1402 - sw->total_hw_samples_mixed -= captured; 26.1403 - sw->empty = sw->total_hw_samples_mixed == 0; 26.1404 - } 26.1405 - } 26.1406 -} 26.1407 - 26.1408 -static void audio_timer (void *opaque) 26.1409 -{ 26.1410 - AudioState *s = opaque; 26.1411 - 26.1412 - audio_run_out (s); 26.1413 - audio_run_in (s); 26.1414 - audio_run_capture (s); 26.1415 - 26.1416 - qemu_mod_timer (s->ts, qemu_get_clock (vm_clock) + conf.period.ticks); 26.1417 -} 26.1418 - 26.1419 -static struct audio_option audio_options[] = { 26.1420 - /* DAC */ 26.1421 - {"DAC_FIXED_SETTINGS", AUD_OPT_BOOL, &conf.fixed_out.enabled, 26.1422 - "Use fixed settings for host DAC", NULL, 0}, 26.1423 - 26.1424 - {"DAC_FIXED_FREQ", AUD_OPT_INT, &conf.fixed_out.settings.freq, 26.1425 - "Frequency for fixed host DAC", NULL, 0}, 26.1426 - 26.1427 - {"DAC_FIXED_FMT", AUD_OPT_FMT, &conf.fixed_out.settings.fmt, 26.1428 - "Format for fixed host DAC", NULL, 0}, 26.1429 - 26.1430 - {"DAC_FIXED_CHANNELS", AUD_OPT_INT, &conf.fixed_out.settings.nchannels, 26.1431 - "Number of channels for fixed DAC (1 - mono, 2 - stereo)", NULL, 0}, 26.1432 - 26.1433 - {"DAC_VOICES", AUD_OPT_INT, &conf.fixed_out.nb_voices, 26.1434 - "Number of voices for DAC", NULL, 0}, 26.1435 - 26.1436 - /* ADC */ 26.1437 - {"ADC_FIXED_SETTINGS", AUD_OPT_BOOL, &conf.fixed_in.enabled, 26.1438 - "Use fixed settings for host ADC", NULL, 0}, 26.1439 - 26.1440 - {"ADC_FIXED_FREQ", AUD_OPT_INT, &conf.fixed_in.settings.freq, 26.1441 - "Frequency for fixed host ADC", NULL, 0}, 26.1442 - 26.1443 - {"ADC_FIXED_FMT", AUD_OPT_FMT, &conf.fixed_in.settings.fmt, 26.1444 - "Format for fixed host ADC", NULL, 0}, 26.1445 - 26.1446 - {"ADC_FIXED_CHANNELS", AUD_OPT_INT, &conf.fixed_in.settings.nchannels, 26.1447 - "Number of channels for fixed ADC (1 - mono, 2 - stereo)", NULL, 0}, 26.1448 - 26.1449 - {"ADC_VOICES", AUD_OPT_INT, &conf.fixed_in.nb_voices, 26.1450 - "Number of voices for ADC", NULL, 0}, 26.1451 - 26.1452 - /* Misc */ 26.1453 - {"TIMER_PERIOD", AUD_OPT_INT, &conf.period.hz, 26.1454 - "Timer period in HZ (0 - use lowest possible)", NULL, 0}, 26.1455 - 26.1456 - {"PLIVE", AUD_OPT_BOOL, &conf.plive, 26.1457 - "(undocumented)", NULL, 0}, 26.1458 - 26.1459 - {"LOG_TO_MONITOR", AUD_OPT_BOOL, &conf.log_to_monitor, 26.1460 - "print logging messages to montior instead of stderr", NULL, 0}, 26.1461 - 26.1462 - {NULL, 0, NULL, NULL, NULL, 0} 26.1463 -}; 26.1464 - 26.1465 -static void audio_pp_nb_voices (const char *typ, int nb) 26.1466 -{ 26.1467 - switch (nb) { 26.1468 - case 0: 26.1469 - printf ("Does not support %s\n", typ); 26.1470 - break; 26.1471 - case 1: 26.1472 - printf ("One %s voice\n", typ); 26.1473 - break; 26.1474 - case INT_MAX: 26.1475 - printf ("Theoretically supports many %s voices\n", typ); 26.1476 - break; 26.1477 - default: 26.1478 - printf ("Theoretically supports upto %d %s voices\n", nb, typ); 26.1479 - break; 26.1480 - } 26.1481 - 26.1482 -} 26.1483 - 26.1484 -void AUD_help (void) 26.1485 -{ 26.1486 - size_t i; 26.1487 - 26.1488 - audio_process_options ("AUDIO", audio_options); 26.1489 - for (i = 0; i < sizeof (drvtab) / sizeof (drvtab[0]); i++) { 26.1490 - struct audio_driver *d = drvtab[i]; 26.1491 - if (d->options) { 26.1492 - audio_process_options (d->name, d->options); 26.1493 - } 26.1494 - } 26.1495 - 26.1496 - printf ("Audio options:\n"); 26.1497 - audio_print_options ("AUDIO", audio_options); 26.1498 - printf ("\n"); 26.1499 - 26.1500 - printf ("Available drivers:\n"); 26.1501 - 26.1502 - for (i = 0; i < sizeof (drvtab) / sizeof (drvtab[0]); i++) { 26.1503 - struct audio_driver *d = drvtab[i]; 26.1504 - 26.1505 - printf ("Name: %s\n", d->name); 26.1506 - printf ("Description: %s\n", d->descr); 26.1507 - 26.1508 - audio_pp_nb_voices ("playback", d->max_voices_out); 26.1509 - audio_pp_nb_voices ("capture", d->max_voices_in); 26.1510 - 26.1511 - if (d->options) { 26.1512 - printf ("Options:\n"); 26.1513 - audio_print_options (d->name, d->options); 26.1514 - } 26.1515 - else { 26.1516 - printf ("No options\n"); 26.1517 - } 26.1518 - printf ("\n"); 26.1519 - } 26.1520 - 26.1521 - printf ( 26.1522 - "Options are settable through environment variables.\n" 26.1523 - "Example:\n" 26.1524 -#ifdef _WIN32 26.1525 - " set QEMU_AUDIO_DRV=wav\n" 26.1526 - " set QEMU_WAV_PATH=c:\\tune.wav\n" 26.1527 -#else 26.1528 - " export QEMU_AUDIO_DRV=wav\n" 26.1529 - " export QEMU_WAV_PATH=$HOME/tune.wav\n" 26.1530 - "(for csh replace export with setenv in the above)\n" 26.1531 -#endif 26.1532 - " qemu ...\n\n" 26.1533 - ); 26.1534 -} 26.1535 - 26.1536 -static int audio_driver_init (AudioState *s, struct audio_driver *drv) 26.1537 -{ 26.1538 - if (drv->options) { 26.1539 - audio_process_options (drv->name, drv->options); 26.1540 - } 26.1541 - s->drv_opaque = drv->init (); 26.1542 - 26.1543 - if (s->drv_opaque) { 26.1544 - audio_init_nb_voices_out (s, drv); 26.1545 - audio_init_nb_voices_in (s, drv); 26.1546 - s->drv = drv; 26.1547 - return 0; 26.1548 - } 26.1549 - else { 26.1550 - dolog ("Could not init `%s' audio driver\n", drv->name); 26.1551 - return -1; 26.1552 - } 26.1553 -} 26.1554 - 26.1555 -static void audio_vm_change_state_handler (void *opaque, int running) 26.1556 -{ 26.1557 - AudioState *s = opaque; 26.1558 - HWVoiceOut *hwo = NULL; 26.1559 - HWVoiceIn *hwi = NULL; 26.1560 - int op = running ? VOICE_ENABLE : VOICE_DISABLE; 26.1561 - 26.1562 - while ((hwo = audio_pcm_hw_find_any_enabled_out (s, hwo))) { 26.1563 - hwo->pcm_ops->ctl_out (hwo, op); 26.1564 - } 26.1565 - 26.1566 - while ((hwi = audio_pcm_hw_find_any_enabled_in (s, hwi))) { 26.1567 - hwi->pcm_ops->ctl_in (hwi, op); 26.1568 - } 26.1569 -} 26.1570 - 26.1571 -static void audio_atexit (void) 26.1572 -{ 26.1573 - AudioState *s = &glob_audio_state; 26.1574 - HWVoiceOut *hwo = NULL; 26.1575 - HWVoiceIn *hwi = NULL; 26.1576 - 26.1577 - while ((hwo = audio_pcm_hw_find_any_enabled_out (s, hwo))) { 26.1578 - SWVoiceCap *sc; 26.1579 - 26.1580 - hwo->pcm_ops->ctl_out (hwo, VOICE_DISABLE); 26.1581 - hwo->pcm_ops->fini_out (hwo); 26.1582 - 26.1583 - for (sc = hwo->cap_head.lh_first; sc; sc = sc->entries.le_next) { 26.1584 - CaptureVoiceOut *cap = sc->cap; 26.1585 - struct capture_callback *cb; 26.1586 - 26.1587 - for (cb = cap->cb_head.lh_first; cb; cb = cb->entries.le_next) { 26.1588 - cb->ops.destroy (cb->opaque); 26.1589 - } 26.1590 - } 26.1591 - } 26.1592 - 26.1593 - while ((hwi = audio_pcm_hw_find_any_enabled_in (s, hwi))) { 26.1594 - hwi->pcm_ops->ctl_in (hwi, VOICE_DISABLE); 26.1595 - hwi->pcm_ops->fini_in (hwi); 26.1596 - } 26.1597 - 26.1598 - if (s->drv) { 26.1599 - s->drv->fini (s->drv_opaque); 26.1600 - } 26.1601 -} 26.1602 - 26.1603 -static void audio_save (QEMUFile *f, void *opaque) 26.1604 -{ 26.1605 - (void) f; 26.1606 - (void) opaque; 26.1607 -} 26.1608 - 26.1609 -static int audio_load (QEMUFile *f, void *opaque, int version_id) 26.1610 -{ 26.1611 - (void) f; 26.1612 - (void) opaque; 26.1613 - 26.1614 - if (version_id != 1) { 26.1615 - return -EINVAL; 26.1616 - } 26.1617 - 26.1618 - return 0; 26.1619 -} 26.1620 - 26.1621 -void AUD_register_card (AudioState *s, const char *name, QEMUSoundCard *card) 26.1622 -{ 26.1623 - card->audio = s; 26.1624 - card->name = qemu_strdup (name); 26.1625 - memset (&card->entries, 0, sizeof (card->entries)); 26.1626 - LIST_INSERT_HEAD (&s->card_head, card, entries); 26.1627 -} 26.1628 - 26.1629 -void AUD_remove_card (QEMUSoundCard *card) 26.1630 -{ 26.1631 - LIST_REMOVE (card, entries); 26.1632 - card->audio = NULL; 26.1633 - qemu_free (card->name); 26.1634 -} 26.1635 - 26.1636 -AudioState *AUD_init (void) 26.1637 -{ 26.1638 - size_t i; 26.1639 - int done = 0; 26.1640 - const char *drvname; 26.1641 - AudioState *s = &glob_audio_state; 26.1642 - 26.1643 - LIST_INIT (&s->hw_head_out); 26.1644 - LIST_INIT (&s->hw_head_in); 26.1645 - LIST_INIT (&s->cap_head); 26.1646 - atexit (audio_atexit); 26.1647 - 26.1648 - s->ts = qemu_new_timer (vm_clock, audio_timer, s); 26.1649 - if (!s->ts) { 26.1650 - dolog ("Could not create audio timer\n"); 26.1651 - return NULL; 26.1652 - } 26.1653 - 26.1654 - audio_process_options ("AUDIO", audio_options); 26.1655 - 26.1656 - s->nb_hw_voices_out = conf.fixed_out.nb_voices; 26.1657 - s->nb_hw_voices_in = conf.fixed_in.nb_voices; 26.1658 - 26.1659 - if (s->nb_hw_voices_out <= 0) { 26.1660 - dolog ("Bogus number of playback voices %d, setting to 1\n", 26.1661 - s->nb_hw_voices_out); 26.1662 - s->nb_hw_voices_out = 1; 26.1663 - } 26.1664 - 26.1665 - if (s->nb_hw_voices_in <= 0) { 26.1666 - dolog ("Bogus number of capture voices %d, setting to 0\n", 26.1667 - s->nb_hw_voices_in); 26.1668 - s->nb_hw_voices_in = 0; 26.1669 - } 26.1670 - 26.1671 - { 26.1672 - int def; 26.1673 - drvname = audio_get_conf_str ("QEMU_AUDIO_DRV", NULL, &def); 26.1674 - } 26.1675 - 26.1676 - if (drvname) { 26.1677 - int found = 0; 26.1678 - 26.1679 - for (i = 0; i < sizeof (drvtab) / sizeof (drvtab[0]); i++) { 26.1680 - if (!strcmp (drvname, drvtab[i]->name)) { 26.1681 - done = !audio_driver_init (s, drvtab[i]); 26.1682 - found = 1; 26.1683 - break; 26.1684 - } 26.1685 - } 26.1686 - 26.1687 - if (!found) { 26.1688 - dolog ("Unknown audio driver `%s'\n", drvname); 26.1689 - dolog ("Run with -audio-help to list available drivers\n"); 26.1690 - } 26.1691 - } 26.1692 - 26.1693 - if (!done) { 26.1694 - for (i = 0; !done && i < sizeof (drvtab) / sizeof (drvtab[0]); i++) { 26.1695 - if (drvtab[i]->can_be_default) { 26.1696 - done = !audio_driver_init (s, drvtab[i]); 26.1697 - } 26.1698 - } 26.1699 - } 26.1700 - 26.1701 - if (!done) { 26.1702 - done = !audio_driver_init (s, &no_audio_driver); 26.1703 - if (!done) { 26.1704 - dolog ("Could not initialize audio subsystem\n"); 26.1705 - } 26.1706 - else { 26.1707 - dolog ("warning: Using timer based audio emulation\n"); 26.1708 - } 26.1709 - } 26.1710 - 26.1711 - if (done) { 26.1712 - VMChangeStateEntry *e; 26.1713 - 26.1714 - if (conf.period.hz <= 0) { 26.1715 - if (conf.period.hz < 0) { 26.1716 - dolog ("warning: Timer period is negative - %d " 26.1717 - "treating as zero\n", 26.1718 - conf.period.hz); 26.1719 - } 26.1720 - conf.period.ticks = 1; 26.1721 - } 26.1722 - else { 26.1723 - conf.period.ticks = ticks_per_sec / conf.period.hz; 26.1724 - } 26.1725 - 26.1726 - e = qemu_add_vm_change_state_handler (audio_vm_change_state_handler, s); 26.1727 - if (!e) { 26.1728 - dolog ("warning: Could not register change state handler\n" 26.1729 - "(Audio can continue looping even after stopping the VM)\n"); 26.1730 - } 26.1731 - } 26.1732 - else { 26.1733 - qemu_del_timer (s->ts); 26.1734 - return NULL; 26.1735 - } 26.1736 - 26.1737 - LIST_INIT (&s->card_head); 26.1738 - register_savevm ("audio", 0, 1, audio_save, audio_load, s); 26.1739 - qemu_mod_timer (s->ts, qemu_get_clock (vm_clock) + conf.period.ticks); 26.1740 - return s; 26.1741 -} 26.1742 - 26.1743 -CaptureVoiceOut *AUD_add_capture ( 26.1744 - AudioState *s, 26.1745 - audsettings_t *as, 26.1746 - struct audio_capture_ops *ops, 26.1747 - void *cb_opaque 26.1748 - ) 26.1749 -{ 26.1750 - CaptureVoiceOut *cap; 26.1751 - struct capture_callback *cb; 26.1752 - 26.1753 - if (!s) { 26.1754 - /* XXX suppress */ 26.1755 - s = &glob_audio_state; 26.1756 - } 26.1757 - 26.1758 - if (audio_validate_settings (as)) { 26.1759 - dolog ("Invalid settings were passed when trying to add capture\n"); 26.1760 - audio_print_settings (as); 26.1761 - goto err0; 26.1762 - } 26.1763 - 26.1764 - cb = audio_calloc (AUDIO_FUNC, 1, sizeof (*cb)); 26.1765 - if (!cb) { 26.1766 - dolog ("Could not allocate capture callback information, size %zu\n", 26.1767 - sizeof (*cb)); 26.1768 - goto err0; 26.1769 - } 26.1770 - cb->ops = *ops; 26.1771 - cb->opaque = cb_opaque; 26.1772 - 26.1773 - cap = audio_pcm_capture_find_specific (s, as); 26.1774 - if (cap) { 26.1775 - LIST_INSERT_HEAD (&cap->cb_head, cb, entries); 26.1776 - return cap; 26.1777 - } 26.1778 - else { 26.1779 - HWVoiceOut *hw; 26.1780 - CaptureVoiceOut *cap; 26.1781 - 26.1782 - cap = audio_calloc (AUDIO_FUNC, 1, sizeof (*cap)); 26.1783 - if (!cap) { 26.1784 - dolog ("Could not allocate capture voice, size %zu\n", 26.1785 - sizeof (*cap)); 26.1786 - goto err1; 26.1787 - } 26.1788 - 26.1789 - hw = &cap->hw; 26.1790 - LIST_INIT (&hw->sw_head); 26.1791 - LIST_INIT (&cap->cb_head); 26.1792 - 26.1793 - /* XXX find a more elegant way */ 26.1794 - hw->samples = 4096 * 4; 26.1795 - hw->mix_buf = audio_calloc (AUDIO_FUNC, hw->samples, 26.1796 - sizeof (st_sample_t)); 26.1797 - if (!hw->mix_buf) { 26.1798 - dolog ("Could not allocate capture mix buffer (%d samples)\n", 26.1799 - hw->samples); 26.1800 - goto err2; 26.1801 - } 26.1802 - 26.1803 - audio_pcm_init_info (&hw->info, as); 26.1804 - 26.1805 - cap->buf = audio_calloc (AUDIO_FUNC, hw->samples, 1 << hw->info.shift); 26.1806 - if (!cap->buf) { 26.1807 - dolog ("Could not allocate capture buffer " 26.1808 - "(%d samples, each %d bytes)\n", 26.1809 - hw->samples, 1 << hw->info.shift); 26.1810 - goto err3; 26.1811 - } 26.1812 - 26.1813 - hw->clip = mixeng_clip 26.1814 - [hw->info.nchannels == 2] 26.1815 - [hw->info.sign] 26.1816 - [hw->info.swap_endianness] 26.1817 - [hw->info.bits == 16]; 26.1818 - 26.1819 - LIST_INSERT_HEAD (&s->cap_head, cap, entries); 26.1820 - LIST_INSERT_HEAD (&cap->cb_head, cb, entries); 26.1821 - 26.1822 - hw = NULL; 26.1823 - while ((hw = audio_pcm_hw_find_any_out (s, hw))) { 26.1824 - audio_attach_capture (s, hw); 26.1825 - } 26.1826 - return cap; 26.1827 - 26.1828 - err3: 26.1829 - qemu_free (cap->hw.mix_buf); 26.1830 - err2: 26.1831 - qemu_free (cap); 26.1832 - err1: 26.1833 - qemu_free (cb); 26.1834 - err0: 26.1835 - return NULL; 26.1836 - } 26.1837 -} 26.1838 - 26.1839 -void AUD_del_capture (CaptureVoiceOut *cap, void *cb_opaque) 26.1840 -{ 26.1841 - struct capture_callback *cb; 26.1842 - 26.1843 - for (cb = cap->cb_head.lh_first; cb; cb = cb->entries.le_next) { 26.1844 - if (cb->opaque == cb_opaque) { 26.1845 - cb->ops.destroy (cb_opaque); 26.1846 - LIST_REMOVE (cb, entries); 26.1847 - qemu_free (cb); 26.1848 - 26.1849 - if (!cap->cb_head.lh_first) { 26.1850 - SWVoiceOut *sw = cap->hw.sw_head.lh_first, *sw1; 26.1851 - 26.1852 - while (sw) { 26.1853 - SWVoiceCap *sc = (SWVoiceCap *) sw; 26.1854 -#ifdef DEBUG_CAPTURE 26.1855 - dolog ("freeing %s\n", sw->name); 26.1856 -#endif 26.1857 - 26.1858 - sw1 = sw->entries.le_next; 26.1859 - if (sw->rate) { 26.1860 - st_rate_stop (sw->rate); 26.1861 - sw->rate = NULL; 26.1862 - } 26.1863 - LIST_REMOVE (sw, entries); 26.1864 - LIST_REMOVE (sc, entries); 26.1865 - qemu_free (sc); 26.1866 - sw = sw1; 26.1867 - } 26.1868 - LIST_REMOVE (cap, entries); 26.1869 - qemu_free (cap); 26.1870 - } 26.1871 - return; 26.1872 - } 26.1873 - } 26.1874 -}
27.1 --- a/tools/ioemu/audio/audio.h Wed Sep 17 14:16:02 2008 +0100 27.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 27.3 @@ -1,169 +0,0 @@ 27.4 -/* 27.5 - * QEMU Audio subsystem header 27.6 - * 27.7 - * Copyright (c) 2003-2005 Vassili Karpov (malc) 27.8 - * 27.9 - * Permission is hereby granted, free of charge, to any person obtaining a copy 27.10 - * of this software and associated documentation files (the "Software"), to deal 27.11 - * in the Software without restriction, including without limitation the rights 27.12 - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 27.13 - * copies of the Software, and to permit persons to whom the Software is 27.14 - * furnished to do so, subject to the following conditions: 27.15 - * 27.16 - * The above copyright notice and this permission notice shall be included in 27.17 - * all copies or substantial portions of the Software. 27.18 - * 27.19 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 27.20 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27.21 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 27.22 - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 27.23 - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27.24 - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 27.25 - * THE SOFTWARE. 27.26 - */ 27.27 -#ifndef QEMU_AUDIO_H 27.28 -#define QEMU_AUDIO_H 27.29 - 27.30 -#include "config.h" 27.31 -#include "sys-queue.h" 27.32 - 27.33 -typedef void (*audio_callback_fn_t) (void *opaque, int avail); 27.34 - 27.35 -typedef enum { 27.36 - AUD_FMT_U8, 27.37 - AUD_FMT_S8, 27.38 - AUD_FMT_U16, 27.39 - AUD_FMT_S16 27.40 -} audfmt_e; 27.41 - 27.42 -#ifdef WORDS_BIGENDIAN 27.43 -#define AUDIO_HOST_ENDIANNESS 1 27.44 -#else 27.45 -#define AUDIO_HOST_ENDIANNESS 0 27.46 -#endif 27.47 - 27.48 -typedef struct { 27.49 - int freq; 27.50 - int nchannels; 27.51 - audfmt_e fmt; 27.52 - int endianness; 27.53 -} audsettings_t; 27.54 - 27.55 -typedef enum { 27.56 - AUD_CNOTIFY_ENABLE, 27.57 - AUD_CNOTIFY_DISABLE 27.58 -} audcnotification_e; 27.59 - 27.60 -struct audio_capture_ops { 27.61 - void (*notify) (void *opaque, audcnotification_e cmd); 27.62 - void (*capture) (void *opaque, void *buf, int size); 27.63 - void (*destroy) (void *opaque); 27.64 -}; 27.65 - 27.66 -struct capture_ops { 27.67 - void (*info) (void *opaque); 27.68 - void (*destroy) (void *opaque); 27.69 -}; 27.70 - 27.71 -typedef struct CaptureState { 27.72 - void *opaque; 27.73 - struct capture_ops ops; 27.74 - LIST_ENTRY (CaptureState) entries; 27.75 -} CaptureState; 27.76 - 27.77 -typedef struct AudioState AudioState; 27.78 -typedef struct SWVoiceOut SWVoiceOut; 27.79 -typedef struct CaptureVoiceOut CaptureVoiceOut; 27.80 -typedef struct SWVoiceIn SWVoiceIn; 27.81 - 27.82 -typedef struct QEMUSoundCard { 27.83 - AudioState *audio; 27.84 - char *name; 27.85 - LIST_ENTRY (QEMUSoundCard) entries; 27.86 -} QEMUSoundCard; 27.87 - 27.88 -typedef struct QEMUAudioTimeStamp { 27.89 - uint64_t old_ts; 27.90 -} QEMUAudioTimeStamp; 27.91 - 27.92 -void AUD_vlog (const char *cap, const char *fmt, va_list ap); 27.93 -void AUD_log (const char *cap, const char *fmt, ...) 27.94 -#ifdef __GNUC__ 27.95 - __attribute__ ((__format__ (__printf__, 2, 3))) 27.96 -#endif 27.97 - ; 27.98 - 27.99 -AudioState *AUD_init (void); 27.100 -void AUD_help (void); 27.101 -void AUD_register_card (AudioState *s, const char *name, QEMUSoundCard *card); 27.102 -void AUD_remove_card (QEMUSoundCard *card); 27.103 -CaptureVoiceOut *AUD_add_capture ( 27.104 - AudioState *s, 27.105 - audsettings_t *as, 27.106 - struct audio_capture_ops *ops, 27.107 - void *opaque 27.108 - ); 27.109 -void AUD_del_capture (CaptureVoiceOut *cap, void *cb_opaque); 27.110 - 27.111 -SWVoiceOut *AUD_open_out ( 27.112 - QEMUSoundCard *card, 27.113 - SWVoiceOut *sw, 27.114 - const char *name, 27.115 - void *callback_opaque, 27.116 - audio_callback_fn_t callback_fn, 27.117 - audsettings_t *settings 27.118 - ); 27.119 - 27.120 -void AUD_close_out (QEMUSoundCard *card, SWVoiceOut *sw); 27.121 -int AUD_write (SWVoiceOut *sw, void *pcm_buf, int size); 27.122 -int AUD_get_buffer_size_out (SWVoiceOut *sw); 27.123 -void AUD_set_active_out (SWVoiceOut *sw, int on); 27.124 -int AUD_is_active_out (SWVoiceOut *sw); 27.125 - 27.126 -void AUD_init_time_stamp_out (SWVoiceOut *sw, QEMUAudioTimeStamp *ts); 27.127 -uint64_t AUD_get_elapsed_usec_out (SWVoiceOut *sw, QEMUAudioTimeStamp *ts); 27.128 - 27.129 -SWVoiceIn *AUD_open_in ( 27.130 - QEMUSoundCard *card, 27.131 - SWVoiceIn *sw, 27.132 - const char *name, 27.133 - void *callback_opaque, 27.134 - audio_callback_fn_t callback_fn, 27.135 - audsettings_t *settings 27.136 - ); 27.137 - 27.138 -void AUD_close_in (QEMUSoundCard *card, SWVoiceIn *sw); 27.139 -int AUD_read (SWVoiceIn *sw, void *pcm_buf, int size); 27.140 -void AUD_set_active_in (SWVoiceIn *sw, int on); 27.141 -int AUD_is_active_in (SWVoiceIn *sw); 27.142 - 27.143 -void AUD_init_time_stamp_in (SWVoiceIn *sw, QEMUAudioTimeStamp *ts); 27.144 -uint64_t AUD_get_elapsed_usec_in (SWVoiceIn *sw, QEMUAudioTimeStamp *ts); 27.145 - 27.146 -static inline void *advance (void *p, int incr) 27.147 -{ 27.148 - uint8_t *d = p; 27.149 - return (d + incr); 27.150 -} 27.151 - 27.152 -uint32_t popcount (uint32_t u); 27.153 -uint32_t lsbindex (uint32_t u); 27.154 - 27.155 -#ifdef __GNUC__ 27.156 -#define audio_MIN(a, b) ( __extension__ ({ \ 27.157 - __typeof (a) ta = a; \ 27.158 - __typeof (b) tb = b; \ 27.159 - ((ta)>(tb)?(tb):(ta)); \ 27.160 -})) 27.161 - 27.162 -#define audio_MAX(a, b) ( __extension__ ({ \ 27.163 - __typeof (a) ta = a; \ 27.164 - __typeof (b) tb = b; \ 27.165 - ((ta)<(tb)?(tb):(ta)); \ 27.166 -})) 27.167 -#else 27.168 -#define audio_MIN(a, b) ((a)>(b)?(b):(a)) 27.169 -#define audio_MAX(a, b) ((a)<(b)?(b):(a)) 27.170 -#endif 27.171 - 27.172 -#endif /* audio.h */
28.1 --- a/tools/ioemu/audio/audio_int.h Wed Sep 17 14:16:02 2008 +0100 28.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 28.3 @@ -1,280 +0,0 @@ 28.4 -/* 28.5 - * QEMU Audio subsystem header 28.6 - * 28.7 - * Copyright (c) 2003-2005 Vassili Karpov (malc) 28.8 - * 28.9 - * Permission is hereby granted, free of charge, to any person obtaining a copy 28.10 - * of this software and associated documentation files (the "Software"), to deal 28.11 - * in the Software without restriction, including without limitation the rights 28.12 - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 28.13 - * copies of the Software, and to permit persons to whom the Software is 28.14 - * furnished to do so, subject to the following conditions: 28.15 - * 28.16 - * The above copyright notice and this permission notice shall be included in 28.17 - * all copies or substantial portions of the Software. 28.18 - * 28.19 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 28.20 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 28.21 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 28.22 - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 28.23 - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 28.24 - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28.25 - * THE SOFTWARE. 28.26 - */ 28.27 -#ifndef QEMU_AUDIO_INT_H 28.28 -#define QEMU_AUDIO_INT_H 28.29 - 28.30 -#ifdef CONFIG_COREAUDIO 28.31 -#define FLOAT_MIXENG 28.32 -/* #define RECIPROCAL */ 28.33 -#endif 28.34 -#include "mixeng.h" 28.35 - 28.36 -struct audio_pcm_ops; 28.37 - 28.38 -typedef enum { 28.39 - AUD_OPT_INT, 28.40 - AUD_OPT_FMT, 28.41 - AUD_OPT_STR, 28.42 - AUD_OPT_BOOL 28.43 -} audio_option_tag_e; 28.44 - 28.45 -struct audio_option { 28.46 - const char *name; 28.47 - audio_option_tag_e tag; 28.48 - void *valp; 28.49 - const char *descr; 28.50 - int *overridenp; 28.51 - int overriden; 28.52 -}; 28.53 - 28.54 -struct audio_callback { 28.55 - void *opaque; 28.56 - audio_callback_fn_t fn; 28.57 -}; 28.58 - 28.59 -struct audio_pcm_info { 28.60 - int bits; 28.61 - int sign; 28.62 - int freq; 28.63 - int nchannels; 28.64 - int align; 28.65 - int shift; 28.66 - int bytes_per_second; 28.67 - int swap_endianness; 28.68 -}; 28.69 - 28.70 -typedef struct SWVoiceCap SWVoiceCap; 28.71 - 28.72 -typedef struct HWVoiceOut { 28.73 - int enabled; 28.74 - int pending_disable; 28.75 - struct audio_pcm_info info; 28.76 - 28.77 - f_sample *clip; 28.78 - 28.79 - int rpos; 28.80 - uint64_t ts_helper; 28.81 - 28.82 - st_sample_t *mix_buf; 28.83 - 28.84 - int samples; 28.85 - LIST_HEAD (sw_out_listhead, SWVoiceOut) sw_head; 28.86 - LIST_HEAD (sw_cap_listhead, SWVoiceCap) cap_head; 28.87 - struct audio_pcm_ops *pcm_ops; 28.88 - LIST_ENTRY (HWVoiceOut) entries; 28.89 -} HWVoiceOut; 28.90 - 28.91 -typedef struct HWVoiceIn { 28.92 - int enabled; 28.93 - struct audio_pcm_info info; 28.94 - 28.95 - t_sample *conv; 28.96 - 28.97 - int wpos; 28.98 - int total_samples_captured; 28.99 - uint64_t ts_helper; 28.100 - 28.101 - st_sample_t *conv_buf; 28.102 - 28.103 - int samples; 28.104 - LIST_HEAD (sw_in_listhead, SWVoiceIn) sw_head; 28.105 - struct audio_pcm_ops *pcm_ops; 28.106 - LIST_ENTRY (HWVoiceIn) entries; 28.107 -} HWVoiceIn; 28.108 - 28.109 -struct SWVoiceOut { 28.110 - struct audio_pcm_info info; 28.111 - t_sample *conv; 28.112 - int64_t ratio; 28.113 - st_sample_t *buf; 28.114 - void *rate; 28.115 - int total_hw_samples_mixed; 28.116 - int active; 28.117 - int empty; 28.118 - HWVoiceOut *hw; 28.119 - char *name; 28.120 - volume_t vol; 28.121 - struct audio_callback callback; 28.122 - LIST_ENTRY (SWVoiceOut) entries; 28.123 -}; 28.124 - 28.125 -struct SWVoiceIn { 28.126 - int active; 28.127 - struct audio_pcm_info info; 28.128 - int64_t ratio; 28.129 - void *rate; 28.130 - int total_hw_samples_acquired; 28.131 - st_sample_t *buf; 28.132 - f_sample *clip; 28.133 - HWVoiceIn *hw; 28.134 - char *name; 28.135 - volume_t vol; 28.136 - struct audio_callback callback; 28.137 - LIST_ENTRY (SWVoiceIn) entries; 28.138 -}; 28.139 - 28.140 -struct audio_driver { 28.141 - const char *name; 28.142 - const char *descr; 28.143 - struct audio_option *options; 28.144 - void *(*init) (void); 28.145 - void (*fini) (void *); 28.146 - struct audio_pcm_ops *pcm_ops; 28.147 - int can_be_default; 28.148 - int max_voices_out; 28.149 - int max_voices_in; 28.150 - int voice_size_out; 28.151 - int voice_size_in; 28.152 -}; 28.153 - 28.154 -struct audio_pcm_ops { 28.155 - int (*init_out)(HWVoiceOut *hw, audsettings_t *as); 28.156 - void (*fini_out)(HWVoiceOut *hw); 28.157 - int (*run_out) (HWVoiceOut *hw); 28.158 - int (*write) (SWVoiceOut *sw, void *buf, int size); 28.159 - int (*ctl_out) (HWVoiceOut *hw, int cmd, ...); 28.160 - 28.161 - int (*init_in) (HWVoiceIn *hw, audsettings_t *as); 28.162 - void (*fini_in) (HWVoiceIn *hw); 28.163 - int (*run_in) (HWVoiceIn *hw); 28.164 - int (*read) (SWVoiceIn *sw, void *buf, int size); 28.165 - int (*ctl_in) (HWVoiceIn *hw, int cmd, ...); 28.166 -}; 28.167 - 28.168 -struct capture_callback { 28.169 - struct audio_capture_ops ops; 28.170 - void *opaque; 28.171 - LIST_ENTRY (capture_callback) entries; 28.172 -}; 28.173 - 28.174 -struct CaptureVoiceOut { 28.175 - HWVoiceOut hw; 28.176 - void *buf; 28.177 - LIST_HEAD (cb_listhead, capture_callback) cb_head; 28.178 - LIST_ENTRY (CaptureVoiceOut) entries; 28.179 -}; 28.180 - 28.181 -struct SWVoiceCap { 28.182 - SWVoiceOut sw; 28.183 - CaptureVoiceOut *cap; 28.184 - LIST_ENTRY (SWVoiceCap) entries; 28.185 -}; 28.186 - 28.187 -struct AudioState { 28.188 - struct audio_driver *drv; 28.189 - void *drv_opaque; 28.190 - 28.191 - QEMUTimer *ts; 28.192 - LIST_HEAD (card_listhead, QEMUSoundCard) card_head; 28.193 - LIST_HEAD (hw_in_listhead, HWVoiceIn) hw_head_in; 28.194 - LIST_HEAD (hw_out_listhead, HWVoiceOut) hw_head_out; 28.195 - LIST_HEAD (cap_listhead, CaptureVoiceOut) cap_head; 28.196 - int nb_hw_voices_out; 28.197 - int nb_hw_voices_in; 28.198 -}; 28.199 - 28.200 -extern struct audio_driver no_audio_driver; 28.201 -extern struct audio_driver oss_audio_driver; 28.202 -extern struct audio_driver sdl_audio_driver; 28.203 -extern struct audio_driver wav_audio_driver; 28.204 -extern struct audio_driver fmod_audio_driver; 28.205 -extern struct audio_driver alsa_audio_driver; 28.206 -extern struct audio_driver coreaudio_audio_driver; 28.207 -extern struct audio_driver dsound_audio_driver; 28.208 -extern volume_t nominal_volume; 28.209 - 28.210 -void audio_pcm_init_info (struct audio_pcm_info *info, audsettings_t *as); 28.211 -void audio_pcm_info_clear_buf (struct audio_pcm_info *info, void *buf, int len); 28.212 - 28.213 -int audio_pcm_sw_write (SWVoiceOut *sw, void *buf, int len); 28.214 -int audio_pcm_hw_get_live_in (HWVoiceIn *hw); 28.215 - 28.216 -int audio_pcm_sw_read (SWVoiceIn *sw, void *buf, int len); 28.217 -int audio_pcm_hw_get_live_out (HWVoiceOut *hw); 28.218 -int audio_pcm_hw_get_live_out2 (HWVoiceOut *hw, int *nb_live); 28.219 - 28.220 -int audio_bug (const char *funcname, int cond); 28.221 -void *audio_calloc (const char *funcname, int nmemb, size_t size); 28.222 - 28.223 -#define VOICE_ENABLE 1 28.224 -#define VOICE_DISABLE 2 28.225 - 28.226 -static inline int audio_ring_dist (int dst, int src, int len) 28.227 -{ 28.228 - return (dst >= src) ? (dst - src) : (len - src + dst); 28.229 -} 28.230 - 28.231 -#if defined __GNUC__ 28.232 -#define GCC_ATTR __attribute__ ((__unused__, __format__ (__printf__, 1, 2))) 28.233 -#define INIT_FIELD(f) . f 28.234 -#define GCC_FMT_ATTR(n, m) __attribute__ ((__format__ (__printf__, n, m))) 28.235 -#else 28.236 -#define GCC_ATTR /**/ 28.237 -#define INIT_FIELD(f) /**/ 28.238 -#define GCC_FMT_ATTR(n, m) 28.239 -#endif 28.240 - 28.241 -static void GCC_ATTR dolog (const char *fmt, ...) 28.242 -{ 28.243 - va_list ap; 28.244 - 28.245 - va_start (ap, fmt); 28.246 - AUD_vlog (AUDIO_CAP, fmt, ap); 28.247 - va_end (ap); 28.248 -} 28.249 - 28.250 -#ifdef DEBUG 28.251 -static void GCC_ATTR ldebug (const char *fmt, ...) 28.252 -{ 28.253 - va_list ap; 28.254 - 28.255 - va_start (ap, fmt); 28.256 - AUD_vlog (AUDIO_CAP, fmt, ap); 28.257 - va_end (ap); 28.258 -} 28.259 -#else 28.260 -#if defined NDEBUG && defined __GNUC__ 28.261 -#define ldebug(...) 28.262 -#elif defined NDEBUG && defined _MSC_VER 28.263 -#define ldebug __noop 28.264 -#else 28.265 -static void GCC_ATTR ldebug (const char *fmt, ...) 28.266 -{ 28.267 - (void) fmt; 28.268 -} 28.269 -#endif 28.270 -#endif 28.271 - 28.272 -#undef GCC_ATTR 28.273 - 28.274 -#define AUDIO_STRINGIFY_(n) #n 28.275 -#define AUDIO_STRINGIFY(n) AUDIO_STRINGIFY_(n) 28.276 - 28.277 -#if defined _MSC_VER || defined __GNUC__ 28.278 -#define AUDIO_FUNC __FUNCTION__ 28.279 -#else 28.280 -#define AUDIO_FUNC __FILE__ ":" AUDIO_STRINGIFY (__LINE__) 28.281 -#endif 28.282 - 28.283 -#endif /* audio_int.h */
29.1 --- a/tools/ioemu/audio/audio_template.h Wed Sep 17 14:16:02 2008 +0100 29.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 29.3 @@ -1,570 +0,0 @@ 29.4 -/* 29.5 - * QEMU Audio subsystem header 29.6 - * 29.7 - * Copyright (c) 2005 Vassili Karpov (malc) 29.8 - * 29.9 - * Permission is hereby granted, free of charge, to any person obtaining a copy 29.10 - * of this software and associated documentation files (the "Software"), to deal 29.11 - * in the Software without restriction, including without limitation the rights 29.12 - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 29.13 - * copies of the Software, and to permit persons to whom the Software is 29.14 - * furnished to do so, subject to the following conditions: 29.15 - * 29.16 - * The above copyright notice and this permission notice shall be included in 29.17 - * all copies or substantial portions of the Software. 29.18 - * 29.19 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 29.20 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 29.21 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 29.22 - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29.23 - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 29.24 - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 29.25 - * THE SOFTWARE. 29.26 - */ 29.27 - 29.28 -#ifdef DAC 29.29 -#define NAME "playback" 29.30 -#define HWBUF hw->mix_buf 29.31 -#define TYPE out 29.32 -#define HW HWVoiceOut 29.33 -#define SW SWVoiceOut 29.34 -#else 29.35 -#define NAME "capture" 29.36 -#define TYPE in 29.37 -#define HW HWVoiceIn 29.38 -#define SW SWVoiceIn 29.39 -#define HWBUF hw->conv_buf 29.40 -#endif 29.41 - 29.42 -static void glue (audio_init_nb_voices_, TYPE) ( 29.43 - AudioState *s, 29.44 - struct audio_driver *drv 29.45 - ) 29.46 -{ 29.47 - int max_voices = glue (drv->max_voices_, TYPE); 29.48 - int voice_size = glue (drv->voice_size_, TYPE); 29.49 - 29.50 - if (glue (s->nb_hw_voices_, TYPE) > max_voices) { 29.51 - if (!max_voices) { 29.52 -#ifdef DAC 29.53 - dolog ("Driver `%s' does not support " NAME "\n", drv->name); 29.54 -#endif 29.55 - } 29.56 - else { 29.57 - dolog ("Driver `%s' does not support %d " NAME " voices, max %d\n", 29.58 - drv->name, 29.59 - glue (s->nb_hw_voices_, TYPE), 29.60 - max_voices); 29.61 - } 29.62 - glue (s->nb_hw_voices_, TYPE) = max_voices; 29.63 - } 29.64 - 29.65 - if (audio_bug (AUDIO_FUNC, !voice_size && max_voices)) { 29.66 - dolog ("drv=`%s' voice_size=0 max_voices=%d\n", 29.67 - drv->name, max_voices); 29.68 - glue (s->nb_hw_voices_, TYPE) = 0; 29.69 - } 29.70 - 29.71 - if (audio_bug (AUDIO_FUNC, voice_size && !max_voices)) { 29.72 - dolog ("drv=`%s' voice_size=%d max_voices=0\n", 29.73 - drv->name, voice_size); 29.74 - } 29.75 -} 29.76 - 29.77 -static void glue (audio_pcm_hw_free_resources_, TYPE) (HW *hw) 29.78 -{ 29.79 - if (HWBUF) { 29.80 - qemu_free (HWBUF); 29.81 - } 29.82 - 29.83 - HWBUF = NULL; 29.84 -} 29.85 - 29.86 -static int glue (audio_pcm_hw_alloc_resources_, TYPE) (HW *hw) 29.87 -{ 29.88 - HWBUF = audio_calloc (AUDIO_FUNC, hw->samples, sizeof (st_sample_t)); 29.89 - if (!HWBUF) { 29.90 - dolog ("Could not allocate " NAME " buffer (%d samples)\n", 29.91 - hw->samples); 29.92 - return -1; 29.93 - } 29.94 - 29.95 - return 0; 29.96 -} 29.97 - 29.98 -static void glue (audio_pcm_sw_free_resources_, TYPE) (SW *sw) 29.99 -{ 29.100 - if (sw->buf) { 29.101 - qemu_free (sw->buf); 29.102 - } 29.103 - 29.104 - if (sw->rate) { 29.105 - st_rate_stop (sw->rate); 29.106 - } 29.107 - 29.108 - sw->buf = NULL; 29.109 - sw->rate = NULL; 29.110 -} 29.111 - 29.112 -static int glue (audio_pcm_sw_alloc_resources_, TYPE) (SW *sw) 29.113 -{ 29.114 - int samples; 29.115 - 29.116 -#ifdef DAC 29.117 - samples = sw->hw->samples; 29.118 -#else 29.119 - samples = ((int64_t) sw->hw->samples << 32) / sw->ratio; 29.120 -#endif 29.121 - 29.122 - sw->buf = audio_calloc (AUDIO_FUNC, samples, sizeof (st_sample_t)); 29.123 - if (!sw->buf) { 29.124 - dolog ("Could not allocate buffer for `%s' (%d samples)\n", 29.125 - SW_NAME (sw), samples); 29.126 - return -1; 29.127 - } 29.128 - 29.129 -#ifdef DAC 29.130 - sw->rate = st_rate_start (sw->info.freq, sw->hw->info.freq); 29.131 -#else 29.132 - sw->rate = st_rate_start (sw->hw->info.freq, sw->info.freq); 29.133 -#endif 29.134 - if (!sw->rate) { 29.135 - qemu_free (sw->buf); 29.136 - sw->buf = NULL; 29.137 - return -1; 29.138 - } 29.139 - return 0; 29.140 -} 29.141 - 29.142 -static int glue (audio_pcm_sw_init_, TYPE) ( 29.143 - SW *sw, 29.144 - HW *hw, 29.145 - const char *name, 29.146 - audsettings_t *as 29.147 - ) 29.148 -{ 29.149 - int err; 29.150 - 29.151 - audio_pcm_init_info (&sw->info, as); 29.152 - sw->hw = hw; 29.153 - sw->active = 0; 29.154 -#ifdef DAC 29.155 - sw->ratio = ((int64_t) sw->hw->info.freq << 32) / sw->info.freq; 29.156 - sw->total_hw_samples_mixed = 0; 29.157 - sw->empty = 1; 29.158 -#else 29.159 - sw->ratio = ((int64_t) sw->info.freq << 32) / sw->hw->info.freq; 29.160 -#endif 29.161 - 29.162 -#ifdef DAC 29.163 - sw->conv = mixeng_conv 29.164 -#else 29.165 - sw->clip = mixeng_clip 29.166 -#endif 29.167 - [sw->info.nchannels == 2] 29.168 - [sw->info.sign] 29.169 - [sw->info.swap_endianness] 29.170 - [sw->info.bits == 16]; 29.171 - 29.172 - sw->name = qemu_strdup (name); 29.173 - err = glue (audio_pcm_sw_alloc_resources_, TYPE) (sw); 29.174 - if (err) { 29.175 - qemu_free (sw->name); 29.176 - sw->name = NULL; 29.177 - } 29.178 - return err; 29.179 -} 29.180 - 29.181 -static void glue (audio_pcm_sw_fini_, TYPE) (SW *sw) 29.182 -{ 29.183 - glue (audio_pcm_sw_free_resources_, TYPE) (sw); 29.184 - if (sw->name) { 29.185 - qemu_free (sw->name); 29.186 - sw->name = NULL; 29.187 - } 29.188 -} 29.189 - 29.190 -static void glue (audio_pcm_hw_add_sw_, TYPE) (HW *hw, SW *sw) 29.191 -{ 29.192 - LIST_INSERT_HEAD (&hw->sw_head, sw, entries); 29.193 -} 29.194 - 29.195 -static void glue (audio_pcm_hw_del_sw_, TYPE) (SW *sw) 29.196 -{ 29.197 - LIST_REMOVE (sw, entries); 29.198 -} 29.199 - 29.200 -static void glue (audio_pcm_hw_gc_, TYPE) (AudioState *s, HW **hwp) 29.201 -{ 29.202 - HW *hw = *hwp; 29.203 - 29.204 - if (!hw->sw_head.lh_first) { 29.205 -#ifdef DAC 29.206 - audio_detach_capture (hw); 29.207 -#endif 29.208 - LIST_REMOVE (hw, entries); 29.209 - glue (s->nb_hw_voices_, TYPE) += 1; 29.210 - glue (audio_pcm_hw_free_resources_ ,TYPE) (hw); 29.211 - glue (hw->pcm_ops->fini_, TYPE) (hw); 29.212 - qemu_free (hw); 29.213 - *hwp = NULL; 29.214 - } 29.215 -} 29.216 - 29.217 -static HW *glue (audio_pcm_hw_find_any_, TYPE) (AudioState *s, HW *hw) 29.218 -{ 29.219 - return hw ? hw->entries.le_next : s->glue (hw_head_, TYPE).lh_first; 29.220 -} 29.221 - 29.222 -static HW *glue (audio_pcm_hw_find_any_enabled_, TYPE) (AudioState *s, HW *hw) 29.223 -{ 29.224 - while ((hw = glue (audio_pcm_hw_find_any_, TYPE) (s, hw))) { 29.225 - if (hw->enabled) { 29.226 - return hw; 29.227 - } 29.228 - } 29.229 - return NULL; 29.230 -} 29.231 - 29.232 -static HW *glue (audio_pcm_hw_find_specific_, TYPE) ( 29.233 - AudioState *s, 29.234 - HW *hw, 29.235 - audsettings_t *as 29.236 - ) 29.237 -{ 29.238 - while ((hw = glue (audio_pcm_hw_find_any_, TYPE) (s, hw))) { 29.239 - if (audio_pcm_info_eq (&hw->info, as)) { 29.240 - return hw; 29.241 - } 29.242 - } 29.243 - return NULL; 29.244 -} 29.245 - 29.246 -static HW *glue (audio_pcm_hw_add_new_, TYPE) (AudioState *s, audsettings_t *as) 29.247 -{ 29.248 - HW *hw; 29.249 - struct audio_driver *drv = s->drv; 29.250 - 29.251 - if (!glue (s->nb_hw_voices_, TYPE)) { 29.252 - return NULL; 29.253 - } 29.254 - 29.255 - if (audio_bug (AUDIO_FUNC, !drv)) { 29.256 - dolog ("No host audio driver\n"); 29.257 - return NULL; 29.258 - } 29.259 - 29.260 - if (audio_bug (AUDIO_FUNC, !drv->pcm_ops)) { 29.261 - dolog ("Host audio driver without pcm_ops\n"); 29.262 - return NULL; 29.263 - } 29.264 - 29.265 - hw = audio_calloc (AUDIO_FUNC, 1, glue (drv->voice_size_, TYPE)); 29.266 - if (!hw) { 29.267 - dolog ("Can not allocate voice `%s' size %d\n", 29.268 - drv->name, glue (drv->voice_size_, TYPE)); 29.269 - return NULL; 29.270 - } 29.271 - 29.272 - hw->pcm_ops = drv->pcm_ops; 29.273 - LIST_INIT (&hw->sw_head); 29.274 -#ifdef DAC 29.275 - LIST_INIT (&hw->cap_head); 29.276 -#endif 29.277 - if (glue (hw->pcm_ops->init_, TYPE) (hw, as)) { 29.278 - goto err0; 29.279 - } 29.280 - 29.281 - if (audio_bug (AUDIO_FUNC, hw->samples <= 0)) { 29.282 - dolog ("hw->samples=%d\n", hw->samples); 29.283 - goto err1; 29.284 - } 29.285 - 29.286 -#ifdef DAC 29.287 - hw->clip = mixeng_clip 29.288 -#else 29.289 - hw->conv = mixeng_conv 29.290 -#endif 29.291 - [hw->info.nchannels == 2] 29.292 - [hw->info.sign] 29.293 - [hw->info.swap_endianness] 29.294 - [hw->info.bits == 16]; 29.295 - 29.296 - if (glue (audio_pcm_hw_alloc_resources_, TYPE) (hw)) { 29.297 - goto err1; 29.298 - } 29.299 - 29.300 - LIST_INSERT_HEAD (&s->glue (hw_head_, TYPE), hw, entries); 29.301 - glue (s->nb_hw_voices_, TYPE) -= 1; 29.302 -#ifdef DAC 29.303 - audio_attach_capture (s, hw); 29.304 -#endif 29.305 - return hw; 29.306 - 29.307 - err1: 29.308 - glue (hw->pcm_ops->fini_, TYPE) (hw); 29.309 - err0: 29.310 - qemu_free (hw); 29.311 - return NULL; 29.312 -} 29.313 - 29.314 -static HW *glue (audio_pcm_hw_add_, TYPE) (AudioState *s, audsettings_t *as) 29.315 -{ 29.316 - HW *hw; 29.317 - 29.318 - if (glue (conf.fixed_, TYPE).enabled && glue (conf.fixed_, TYPE).greedy) { 29.319 - hw = glue (audio_pcm_hw_add_new_, TYPE) (s, as); 29.320 - if (hw) { 29.321 - return hw; 29.322 - } 29.323 - } 29.324 - 29.325 - hw = glue (audio_pcm_hw_find_specific_, TYPE) (s, NULL, as); 29.326 - if (hw) { 29.327 - return hw; 29.328 - } 29.329 - 29.330 - hw = glue (audio_pcm_hw_add_new_, TYPE) (s, as); 29.331 - if (hw) { 29.332 - return hw; 29.333 - } 29.334 - 29.335 - return glue (audio_pcm_hw_find_any_, TYPE) (s, NULL); 29.336 -} 29.337 - 29.338 -static SW *glue (audio_pcm_create_voice_pair_, TYPE) ( 29.339 - AudioState *s, 29.340 - const char *sw_name, 29.341 - audsettings_t *as 29.342 - ) 29.343 -{ 29.344 - SW *sw; 29.345 - HW *hw; 29.346 - audsettings_t hw_as; 29.347 - 29.348 - if (glue (conf.fixed_, TYPE).enabled) { 29.349 - hw_as = glue (conf.fixed_, TYPE).settings; 29.350 - } 29.351 - else { 29.352 - hw_as = *as; 29.353 - } 29.354 - 29.355 - sw = audio_calloc (AUDIO_FUNC, 1, sizeof (*sw)); 29.356 - if (!sw) { 29.357 - dolog ("Could not allocate soft voice `%s' (%zu bytes)\n", 29.358 - sw_name ? sw_name : "unknown", sizeof (*sw)); 29.359 - goto err1; 29.360 - } 29.361 - 29.362 - hw = glue (audio_pcm_hw_add_, TYPE) (s, &hw_as); 29.363 - if (!hw) { 29.364 - goto err2; 29.365 - } 29.366 - 29.367 - glue (audio_pcm_hw_add_sw_, TYPE) (hw, sw); 29.368 - 29.369 - if (glue (audio_pcm_sw_init_, TYPE) (sw, hw, sw_name, as)) { 29.370 - goto err3; 29.371 - } 29.372 - 29.373 - return sw; 29.374 - 29.375 -err3: 29.376 - glue (audio_pcm_hw_del_sw_, TYPE) (sw); 29.377 - glue (audio_pcm_hw_gc_, TYPE) (s, &hw); 29.378 -err2: 29.379 - qemu_free (sw); 29.380 -err1: 29.381 - return NULL; 29.382 -} 29.383 - 29.384 -static void glue (audio_close_, TYPE) (AudioState *s, SW *sw) 29.385 -{ 29.386 - glue (audio_pcm_sw_fini_, TYPE) (sw); 29.387 - glue (audio_pcm_hw_del_sw_, TYPE) (sw); 29.388 - glue (audio_pcm_hw_gc_, TYPE) (s, &sw->hw); 29.389 - qemu_free (sw); 29.390 -} 29.391 - 29.392 -void glue (AUD_close_, TYPE) (QEMUSoundCard *card, SW *sw) 29.393 -{ 29.394 - if (sw) { 29.395 - if (audio_bug (AUDIO_FUNC, !card || !card->audio)) { 29.396 - dolog ("card=%p card->audio=%p\n", 29.397 - card, card ? card->audio : NULL); 29.398 - return; 29.399 - } 29.400 - 29.401 - glue (audio_close_, TYPE) (card->audio, sw); 29.402 - } 29.403 -} 29.404 - 29.405 -SW *glue (AUD_open_, TYPE) ( 29.406 - QEMUSoundCard *card, 29.407 - SW *sw, 29.408 - const char *name, 29.409 - void *callback_opaque , 29.410 - audio_callback_fn_t callback_fn, 29.411 - audsettings_t *as 29.412 - ) 29.413 -{ 29.414 - AudioState *s; 29.415 -#ifdef DAC 29.416 - int live = 0; 29.417 - SW *old_sw = NULL; 29.418 -#endif 29.419 - 29.420 - ldebug ("open %s, freq %d, nchannels %d, fmt %d\n", 29.421 - name, as->freq, as->nchannels, as->fmt); 29.422 - 29.423 - if (audio_bug (AUDIO_FUNC, 29.424 - !card || !card->audio || !name || !callback_fn || !as)) { 29.425 - dolog ("card=%p card->audio=%p name=%p callback_fn=%p as=%p\n", 29.426 - card, card ? card->audio : NULL, name, callback_fn, as); 29.427 - goto fail; 29.428 - } 29.429 - 29.430 - s = card->audio; 29.431 - 29.432 - if (audio_bug (AUDIO_FUNC, audio_validate_settings (as))) { 29.433 - audio_print_settings (as); 29.434 - goto fail; 29.435 - } 29.436 - 29.437 - if (audio_bug (AUDIO_FUNC, !s->drv)) { 29.438 - dolog ("Can not open `%s' (no host audio driver)\n", name); 29.439 - goto fail; 29.440 - } 29.441 - 29.442 - if (sw && audio_pcm_info_eq (&sw->info, as)) { 29.443 - return sw; 29.444 - } 29.445 - 29.446 -#ifdef DAC 29.447 - if (conf.plive && sw && (!sw->active && !sw->empty)) { 29.448 - live = sw->total_hw_samples_mixed; 29.449 - 29.450 -#ifdef DEBUG_PLIVE 29.451 - dolog ("Replacing voice %s with %d live samples\n", SW_NAME (sw), live); 29.452 - dolog ("Old %s freq %d, bits %d, channels %d\n", 29.453 - SW_NAME (sw), sw->info.freq, sw->info.bits, sw->info.nchannels); 29.454 - dolog ("New %s freq %d, bits %d, channels %d\n", 29.455 - name, 29.456 - freq, 29.457 - (fmt == AUD_FMT_S16 || fmt == AUD_FMT_U16) ? 16 : 8, 29.458 - nchannels); 29.459 -#endif 29.460 - 29.461 - if (live) { 29.462 - old_sw = sw; 29.463 - old_sw->callback.fn = NULL; 29.464 - sw = NULL; 29.465 - } 29.466 - } 29.467 -#endif 29.468 - 29.469 - if (!glue (conf.fixed_, TYPE).enabled && sw) { 29.470 - glue (AUD_close_, TYPE) (card, sw); 29.471 - sw = NULL; 29.472 - } 29.473 - 29.474 - if (sw) { 29.475 - HW *hw = sw->hw; 29.476 - 29.477 - if (!hw) { 29.478 - dolog ("Internal logic error voice `%s' has no hardware store\n", 29.479 - SW_NAME (sw)); 29.480 - goto fail; 29.481 - } 29.482 - 29.483 - glue (audio_pcm_sw_fini_, TYPE) (sw); 29.484 - if (glue (audio_pcm_sw_init_, TYPE) (sw, hw, name, as)) { 29.485 - goto fail; 29.486 - } 29.487 - } 29.488 - else { 29.489 - sw = glue (audio_pcm_create_voice_pair_, TYPE) (s, name, as); 29.490 - if (!sw) { 29.491 - dolog ("Failed to create voice `%s'\n", name); 29.492 - return NULL; 29.493 - } 29.494 - } 29.495 - 29.496 - if (sw) { 29.497 - sw->vol = nominal_volume; 29.498 - sw->callback.fn = callback_fn; 29.499 - sw->callback.opaque = callback_opaque; 29.500 - 29.501 -#ifdef DAC 29.502 - if (live) { 29.503 - int mixed = 29.504 - (live << old_sw->info.shift) 29.505 - * old_sw->info.bytes_per_second 29.506 - / sw->info.bytes_per_second; 29.507 - 29.508 -#ifdef DEBUG_PLIVE 29.509 - dolog ("Silence will be mixed %d\n", mixed); 29.510 -#endif 29.511 - sw->total_hw_samples_mixed += mixed; 29.512 - } 29.513 -#endif 29.514 - 29.515 -#ifdef DEBUG_AUDIO 29.516 - dolog ("%s\n", name); 29.517 - audio_pcm_print_info ("hw", &sw->hw->info); 29.518 - audio_pcm_print_info ("sw", &sw->info); 29.519 -#endif 29.520 - } 29.521 - 29.522 - return sw; 29.523 - 29.524 - fail: 29.525 - glue (AUD_close_, TYPE) (card, sw); 29.526 - return NULL; 29.527 -} 29.528 - 29.529 -int glue (AUD_is_active_, TYPE) (SW *sw) 29.530 -{ 29.531 - return sw ? sw->active : 0; 29.532 -} 29.533 - 29.534 -void glue (AUD_init_time_stamp_, TYPE) (SW *sw, QEMUAudioTimeStamp *ts) 29.535 -{ 29.536 - if (!sw) { 29.537 - return; 29.538 - } 29.539 - 29.540 - ts->old_ts = sw->hw->ts_helper; 29.541 -} 29.542 - 29.543 -uint64_t glue (AUD_get_elapsed_usec_, TYPE) (SW *sw, QEMUAudioTimeStamp *ts) 29.544 -{ 29.545 - uint64_t delta, cur_ts, old_ts; 29.546 - 29.547 - if (!sw) { 29.548 - return 0; 29.549 - } 29.550 - 29.551 - cur_ts = sw->hw->ts_helper; 29.552 - old_ts = ts->old_ts; 29.553 - /* dolog ("cur %lld old %lld\n", cur_ts, old_ts); */ 29.554 - 29.555 - if (cur_ts >= old_ts) { 29.556 - delta = cur_ts - old_ts; 29.557 - } 29.558 - else { 29.559 - delta = UINT64_MAX - old_ts + cur_ts; 29.560 - } 29.561 - 29.562 - if (!delta) { 29.563 - return 0; 29.564 - } 29.565 - 29.566 - return (delta * sw->hw->info.freq) / 1000000; 29.567 -} 29.568 - 29.569 -#undef TYPE 29.570 -#undef HW 29.571 -#undef SW 29.572 -#undef HWBUF 29.573 -#undef NAME
30.1 --- a/tools/ioemu/audio/coreaudio.c Wed Sep 17 14:16:02 2008 +0100 30.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 30.3 @@ -1,554 +0,0 @@ 30.4 -/* 30.5 - * QEMU OS X CoreAudio audio driver 30.6 - * 30.7 - * Copyright (c) 2005 Mike Kronenberg 30.8 - * 30.9 - * Permission is hereby granted, free of charge, to any person obtaining a copy 30.10 - * of this software and associated documentation files (the "Software"), to deal 30.11 - * in the Software without restriction, including without limitation the rights 30.12 - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 30.13 - * copies of the Software, and to permit persons to whom the Software is 30.14 - * furnished to do so, subject to the following conditions: 30.15 - * 30.16 - * The above copyright notice and this permission notice shall be included in 30.17 - * all copies or substantial portions of the Software. 30.18 - * 30.19 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 30.20 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 30.21 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 30.22 - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 30.23 - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30.24 - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 30.25 - * THE SOFTWARE. 30.26 - */ 30.27 - 30.28 -#include <CoreAudio/CoreAudio.h> 30.29 -#include <string.h> /* strerror */ 30.30 -#include <pthread.h> /* pthread_X */ 30.31 - 30.32 -#include "vl.h" 30.33 - 30.34 -#define AUDIO_CAP "coreaudio" 30.35 -#include "audio_int.h" 30.36 - 30.37 -struct { 30.38 - int buffer_frames; 30.39 - int nbuffers; 30.40 - int isAtexit; 30.41 -} conf = { 30.42 - .buffer_frames = 512, 30.43 - .nbuffers = 4, 30.44 - .isAtexit = 0 30.45 -}; 30.46 - 30.47 -typedef struct coreaudioVoiceOut { 30.48 - HWVoiceOut hw; 30.49 - pthread_mutex_t mutex; 30.50 - int isAtexit; 30.51 - AudioDeviceID outputDeviceID; 30.52 - UInt32 audioDevicePropertyBufferFrameSize; 30.53 - AudioStreamBasicDescription outputStreamBasicDescription; 30.54 - int live; 30.55 - int decr; 30.56 - int rpos; 30.57 -} coreaudioVoiceOut; 30.58 - 30.59 -static void coreaudio_logstatus (OSStatus status) 30.60 -{ 30.61 - char *str = "BUG"; 30.62 - 30.63 - switch(status) { 30.64 - case kAudioHardwareNoError: 30.65 - str = "kAudioHardwareNoError"; 30.66 - break; 30.67 - 30.68 - case kAudioHardwareNotRunningError: 30.69 - str = "kAudioHardwareNotRunningError"; 30.70 - break; 30.71 - 30.72 - case kAudioHardwareUnspecifiedError: 30.73 - str = "kAudioHardwareUnspecifiedError"; 30.74 - break; 30.75 - 30.76 - case kAudioHardwareUnknownPropertyError: 30.77 - str = "kAudioHardwareUnknownPropertyError"; 30.78 - break; 30.79 - 30.80 - case kAudioHardwareBadPropertySizeError: 30.81 - str = "kAudioHardwareBadPropertySizeError"; 30.82 - break; 30.83 - 30.84 - case kAudioHardwareIllegalOperationError: 30.85 - str = "kAudioHardwareIllegalOperationError"; 30.86 - break; 30.87 - 30.88 - case kAudioHardwareBadDeviceError: 30.89 - str = "kAudioHardwareBadDeviceError"; 30.90 - break; 30.91 - 30.92 - case kAudioHardwareBadStreamError: 30.93 - str = "kAudioHardwareBadStreamError"; 30.94 - break; 30.95 - 30.96 - case kAudioHardwareUnsupportedOperationError: 30.97 - str = "kAudioHardwareUnsupportedOperationError"; 30.98 - break; 30.99 - 30.100 - case kAudioDeviceUnsupportedFormatError: 30.101 - str = "kAudioDeviceUnsupportedFormatError"; 30.102 - break; 30.103 - 30.104 - case kAudioDevicePermissionsError: 30.105 - str = "kAudioDevicePermissionsError"; 30.106 - break; 30.107 - 30.108 - default: 30.109 - AUD_log (AUDIO_CAP, "Reason: status code %ld\n", status); 30.110 - return; 30.111 - } 30.112 - 30.113 - AUD_log (AUDIO_CAP, "Reason: %s\n", str); 30.114 -} 30.115 - 30.116 -static void GCC_FMT_ATTR (2, 3) coreaudio_logerr ( 30.117 - OSStatus status, 30.118 - const char *fmt, 30.119 - ... 30.120 - ) 30.121 -{ 30.122 - va_list ap; 30.123 - 30.124 - va_start (ap, fmt); 30.125 - AUD_log (AUDIO_CAP, fmt, ap); 30.126 - va_end (ap); 30.127 - 30.128 - coreaudio_logstatus (status); 30.129 -} 30.130 - 30.131 -static void GCC_FMT_ATTR (3, 4) coreaudio_logerr2 ( 30.132 - OSStatus status, 30.133 - const char *typ, 30.134 - const char *fmt, 30.135 - ... 30.136 - ) 30.137 -{ 30.138 - va_list ap; 30.139 - 30.140 - AUD_log (AUDIO_CAP, "Could not initialize %s\n", typ); 30.141 - 30.142 - va_start (ap, fmt); 30.143 - AUD_vlog (AUDIO_CAP, fmt, ap); 30.144 - va_end (ap); 30.145 - 30.146 - coreaudio_logstatus (status); 30.147 -} 30.148 - 30.149 -static inline UInt32 isPlaying (AudioDeviceID outputDeviceID) 30.150 -{ 30.151 - OSStatus status; 30.152 - UInt32 result = 0; 30.153 - UInt32 propertySize = sizeof(outputDeviceID); 30.154 - status = AudioDeviceGetProperty( 30.155 - outputDeviceID, 0, 0, 30.156 - kAudioDevicePropertyDeviceIsRunning, &propertySize, &result); 30.157 - if (status != kAudioHardwareNoError) { 30.158 - coreaudio_logerr(status, 30.159 - "Could not determine whether Device is playing\n"); 30.160 - } 30.161 - return result; 30.162 -} 30.163 - 30.164 -static void coreaudio_atexit (void) 30.165 -{ 30.166 - conf.isAtexit = 1; 30.167 -} 30.168 - 30.169 -static int coreaudio_lock (coreaudioVoiceOut *core, const char *fn_name) 30.170 -{ 30.171 - int err; 30.172 - 30.173 - err = pthread_mutex_lock (&core->mutex); 30.174 - if (err) { 30.175 - dolog ("Could not lock voice for %s\nReason: %s\n", 30.176 - fn_name, strerror (err)); 30.177 - return -1; 30.178 - } 30.179 - return 0; 30.180 -} 30.181 - 30.182 -static int coreaudio_unlock (coreaudioVoiceOut *core, const char *fn_name) 30.183 -{ 30.184 - int err; 30.185 - 30.186 - err = pthread_mutex_unlock (&core->mutex); 30.187 - if (err) { 30.188 - dolog ("Could not unlock voice for %s\nReason: %s\n", 30.189 - fn_name, strerror (err)); 30.190 - return -1; 30.191 - } 30.192 - return 0; 30.193 -} 30.194 - 30.195 -static int coreaudio_run_out (HWVoiceOut *hw) 30.196 -{ 30.197 - int live, decr; 30.198 - coreaudioVoiceOut *core = (coreaudioVoiceOut *) hw; 30.199 - 30.200 - if (coreaudio_lock (core, "coreaudio_run_out")) { 30.201 - return 0; 30.202 - } 30.203 - 30.204 - live = audio_pcm_hw_get_live_out (hw); 30.205 - 30.206 - if (core->decr > live) { 30.207 - ldebug ("core->decr %d live %d core->live %d\n", 30.208 - core->decr, 30.209 - live, 30.210 - core->live); 30.211 - } 30.212 - 30.213 - decr = audio_MIN (core->decr, live); 30.214 - core->decr -= decr; 30.215 - 30.216 - core->live = live - decr; 30.217 - hw->rpos = core->rpos; 30.218 - 30.219 - coreaudio_unlock (core, "coreaudio_run_out"); 30.220 - return decr; 30.221 -} 30.222 - 30.223 -/* callback to feed audiooutput buffer */ 30.224 -static OSStatus audioDeviceIOProc( 30.225 - AudioDeviceID inDevice, 30.226 - const AudioTimeStamp* inNow, 30.227 - const AudioBufferList* inInputData, 30.228 - const AudioTimeStamp* inInputTime, 30.229 - AudioBufferList* outOutputData, 30.230 - const AudioTimeStamp* inOutputTime, 30.231 - void* hwptr) 30.232 -{ 30.233 - UInt32 frame, frameCount; 30.234 - float *out = outOutputData->mBuffers[0].mData; 30.235 - HWVoiceOut *hw = hwptr; 30.236 - coreaudioVoiceOut *core = (coreaudioVoiceOut *) hwptr; 30.237 - int rpos, live; 30.238 - st_sample_t *src; 30.239 -#ifndef FLOAT_MIXENG 30.240 -#ifdef RECIPROCAL 30.241 - const float scale = 1.f / UINT_MAX; 30.242 -#else 30.243 - const float scale = UINT_MAX; 30.244 -#endif 30.245 -#endif 30.246 - 30.247 - if (coreaudio_lock (core, "audioDeviceIOProc")) { 30.248 - inInputTime = 0; 30.249 - return 0; 30.250 - } 30.251 - 30.252 - frameCount = core->audioDevicePropertyBufferFrameSize; 30.253 - live = core->live; 30.254 - 30.255 - /* if there are not enough samples, set signal and return */ 30.256 - if (live < frameCount) { 30.257 - inInputTime = 0; 30.258 - coreaudio_unlock (core, "audioDeviceIOProc(empty)"); 30.259 - return 0; 30.260 - } 30.261 - 30.262 - rpos = core->rpos; 30.263 - src = hw->mix_buf + rpos; 30.264 - 30.265 - /* fill buffer */ 30.266 - for (frame = 0; frame < frameCount; frame++) { 30.267 -#ifdef FLOAT_MIXENG 30.268 - *out++ = src[frame].l; /* left channel */ 30.269 - *out++ = src[frame].r; /* right channel */ 30.270 -#else 30.271 -#ifdef RECIPROCAL 30.272 - *out++ = src[frame].l * scale; /* left channel */ 30.273 - *out++ = src[frame].r * scale; /* right channel */ 30.274 -#else 30.275 - *out++ = src[frame].l / scale; /* left channel */ 30.276 - *out++ = src[frame].r / scale; /* right channel */ 30.277 -#endif 30.278 -#endif 30.279 - } 30.280 - 30.281 - rpos = (rpos + frameCount) % hw->samples; 30.282 - core->decr += frameCount; 30.283 - core->rpos = rpos; 30.284 - 30.285 - coreaudio_unlock (core, "audioDeviceIOProc"); 30.286 - return 0; 30.287 -} 30.288 - 30.289 -static int coreaudio_write (SWVoiceOut *sw, void *buf, int len) 30.290 -{ 30.291 - return audio_pcm_sw_write (sw, buf, len); 30.292 -} 30.293 - 30.294 -static int coreaudio_init_out (HWVoiceOut *hw, audsettings_t *as) 30.295 -{ 30.296 - OSStatus status; 30.297 - coreaudioVoiceOut *core = (coreaudioVoiceOut *) hw; 30.298 - UInt32 propertySize; 30.299 - int err; 30.300 - int bits = 8; 30.301 - const char *typ = "playback"; 30.302 - AudioValueRange frameRange; 30.303 - 30.304 - /* create mutex */ 30.305 - err = pthread_mutex_init(&core->mutex, NULL); 30.306 - if (err) { 30.307 - dolog("Could not create mutex\nReason: %s\n", strerror (err)); 30.308 - return -1; 30.309 - } 30.310 - 30.311 - if (as->fmt == AUD_FMT_S16 || as->fmt == AUD_FMT_U16) { 30.312 - bits = 16; 30.313 - } 30.314 - 30.315 - audio_pcm_init_info (&hw->info, as); 30.316 - 30.317 - /* open default output device */ 30.318 - propertySize = sizeof(core->outputDeviceID); 30.319 - status = AudioHardwareGetProperty( 30.320 - kAudioHardwarePropertyDefaultOutputDevice, 30.321 - &propertySize, 30.322 - &core->outputDeviceID); 30.323 - if (status != kAudioHardwareNoError) { 30.324 - coreaudio_logerr2 (status, typ, 30.325 - "Could not get default output Device\n"); 30.326 - return -1; 30.327 - } 30.328 - if (core->outputDeviceID == kAudioDeviceUnknown) { 30.329 - dolog ("Could not initialize %s - Unknown Audiodevice\n", typ); 30.330 - return -1; 30.331 - } 30.332 - 30.333 - /* get minimum and maximum buffer frame sizes */ 30.334 - propertySize = sizeof(frameRange); 30.335 - status = AudioDeviceGetProperty( 30.336 - core->outputDeviceID, 30.337 - 0, 30.338 - 0, 30.339 - kAudioDevicePropertyBufferFrameSizeRange, 30.340 - &propertySize, 30.341 - &frameRange); 30.342 - if (status != kAudioHardwareNoError) { 30.343 - coreaudio_logerr2 (status, typ, 30.344 - "Could not get device buffer frame range\n"); 30.345 - return -1; 30.346 - } 30.347 - 30.348 - if (frameRange.mMinimum > conf.buffer_frames) { 30.349 - core->audioDevicePropertyBufferFrameSize = (UInt32) frameRange.mMinimum; 30.350 - dolog ("warning: Upsizing Buffer Frames to %f\n", frameRange.mMinimum); 30.351 - } 30.352 - else if (frameRange.mMaximum < conf.buffer_frames) { 30.353 - core->audioDevicePropertyBufferFrameSize = (UInt32) frameRange.mMaximum; 30.354 - dolog ("warning: Downsizing Buffer Frames to %f\n", frameRange.mMaximum); 30.355 - } 30.356 - else { 30.357 - core->audioDevicePropertyBufferFrameSize = conf.buffer_frames; 30.358 - } 30.359 - 30.360 - /* set Buffer Frame Size */ 30.361 - propertySize = sizeof(core->audioDevicePropertyBufferFrameSize); 30.362 - status = AudioDeviceSetProperty( 30.363 - core->outputDeviceID, 30.364 - NULL, 30.365 - 0, 30.366 - false, 30.367 - kAudioDevicePropertyBufferFrameSize, 30.368 - propertySize, 30.369 - &core->audioDevicePropertyBufferFrameSize); 30.370 - if (status != kAudioHardwareNoError) { 30.371 - coreaudio_logerr2 (status, typ, 30.372 - "Could not set device buffer frame size %ld\n", 30.373 - core->audioDevicePropertyBufferFrameSize); 30.374 - return -1; 30.375 - } 30.376 - 30.377 - /* get Buffer Frame Size */ 30.378 - propertySize = sizeof(core->audioDevicePropertyBufferFrameSize); 30.379 - status = AudioDeviceGetProperty( 30.380 - core->outputDeviceID, 30.381 - 0, 30.382 - false, 30.383 - kAudioDevicePropertyBufferFrameSize, 30.384 - &propertySize, 30.385 - &core->audioDevicePropertyBufferFrameSize); 30.386 - if (status != kAudioHardwareNoError) { 30.387 - coreaudio_logerr2 (status, typ, 30.388 - "Could not get device buffer frame size\n"); 30.389 - return -1; 30.390 - } 30.391 - hw->samples = conf.nbuffers * core->audioDevicePropertyBufferFrameSize; 30.392 - 30.393 - /* get StreamFormat */ 30.394 - propertySize = sizeof(core->outputStreamBasicDescription); 30.395 - status = AudioDeviceGetProperty( 30.396 - core->outputDeviceID, 30.397 - 0, 30.398 - false, 30.399 - kAudioDevicePropertyStreamFormat, 30.400 - &propertySize, 30.401 - &core->outputStreamBasicDescription); 30.402 - if (status != kAudioHardwareNoError) { 30.403 - coreaudio_logerr2 (status, typ, 30.404 - "Could not get Device Stream properties\n"); 30.405 - core->outputDeviceID = kAudioDeviceUnknown; 30.406 - return -1; 30.407 - } 30.408 - 30.409 - /* set Samplerate */ 30.410 - core->outputStreamBasicDescription.mSampleRate = (Float64) as->freq; 30.411 - propertySize = sizeof(core->outputStreamBasicDescription); 30.412 - status = AudioDeviceSetProperty( 30.413 - core->outputDeviceID, 30.414 - 0, 30.415 - 0, 30.416 - 0, 30.417 - kAudioDevicePropertyStreamFormat, 30.418 - propertySize, 30.419 - &core->outputStreamBasicDescription); 30.420 - if (status != kAudioHardwareNoError) { 30.421 - coreaudio_logerr2 (status, typ, "Could not set samplerate %d\n", 30.422 - as->freq); 30.423 - core->outputDeviceID = kAudioDeviceUnknown; 30.424 - return -1; 30.425 - } 30.426 - 30.427 - /* set Callback */ 30.428 - status = AudioDeviceAddIOProc(core->outputDeviceID, audioDeviceIOProc, hw); 30.429 - if (status != kAudioHardwareNoError) { 30.430 - coreaudio_logerr2 (status, typ, "Could not set IOProc\n"); 30.431 - core->outputDeviceID = kAudioDeviceUnknown; 30.432 - return -1; 30.433 - } 30.434 - 30.435 - /* start Playback */ 30.436 - if (!isPlaying(core->outputDeviceID)) { 30.437 - status = AudioDeviceStart(core->outputDeviceID, audioDeviceIOProc); 30.438 - if (status != kAudioHardwareNoError) { 30.439 - coreaudio_logerr2 (status, typ, "Could not start playback\n"); 30.440 - AudioDeviceRemoveIOProc(core->outputDeviceID, audioDeviceIOProc); 30.441 - core->outputDeviceID = kAudioDeviceUnknown; 30.442 - return -1; 30.443 - } 30.444 - } 30.445 - 30.446 - return 0; 30.447 -} 30.448 - 30.449 -static void coreaudio_fini_out (HWVoiceOut *hw) 30.450 -{ 30.451 - OSStatus status; 30.452 - int err; 30.453 - coreaudioVoiceOut *core = (coreaudioVoiceOut *) hw; 30.454 - 30.455 - if (!conf.isAtexit) { 30.456 - /* stop playback */ 30.457 - if (isPlaying(core->outputDeviceID)) { 30.458 - status = AudioDeviceStop(core->outputDeviceID, audioDeviceIOProc); 30.459 - if (status != kAudioHardwareNoError) { 30.460 - coreaudio_logerr (status, "Could not stop playback\n"); 30.461 - } 30.462 - } 30.463 - 30.464 - /* remove callback */ 30.465 - status = AudioDeviceRemoveIOProc(core->outputDeviceID, 30.466 - audioDeviceIOProc); 30.467 - if (status != kAudioHardwareNoError) { 30.468 - coreaudio_logerr (status, "Could not remove IOProc\n"); 30.469 - } 30.470 - } 30.471 - core->outputDeviceID = kAudioDeviceUnknown; 30.472 - 30.473 - /* destroy mutex */ 30.474 - err = pthread_mutex_destroy(&core->mutex); 30.475 - if (err) { 30.476 - dolog("Could not destroy mutex\nReason: %s\n", strerror (err)); 30.477 - } 30.478 -} 30.479 - 30.480 -static int coreaudio_ctl_out (HWVoiceOut *hw, int cmd, ...) 30.481 -{ 30.482 - OSStatus status; 30.483 - coreaudioVoiceOut *core = (coreaudioVoiceOut *) hw; 30.484 - 30.485 - switch (cmd) { 30.486 - case VOICE_ENABLE: 30.487 - /* start playback */ 30.488 - if (!isPlaying(core->outputDeviceID)) { 30.489 - status = AudioDeviceStart(core->outputDeviceID, audioDeviceIOProc); 30.490 - if (status != kAudioHardwareNoError) { 30.491 - coreaudio_logerr (status, "Could not resume playback\n"); 30.492 - } 30.493 - } 30.494 - break; 30.495 - 30.496 - case VOICE_DISABLE: 30.497 - /* stop playback */ 30.498 - if (!conf.isAtexit) { 30.499 - if (isPlaying(core->outputDeviceID)) { 30.500 - status = AudioDeviceStop(core->outputDeviceID, audioDeviceIOProc); 30.501 - if (status != kAudioHardwareNoError) { 30.502 - coreaudio_logerr (status, "Could not pause playback\n"); 30.503 - } 30.504 - } 30.505 - } 30.506 - break; 30.507 - } 30.508 - return 0; 30.509 -} 30.510 - 30.511 -static void *coreaudio_audio_init (void) 30.512 -{ 30.513 - atexit(coreaudio_atexit); 30.514 - return &coreaudio_audio_init; 30.515 -} 30.516 - 30.517 -static void coreaudio_audio_fini (void *opaque) 30.518 -{ 30.519 - (void) opaque; 30.520 -} 30.521 - 30.522 -static struct audio_option coreaudio_options[] = { 30.523 - {"BUFFER_SIZE", AUD_OPT_INT, &conf.buffer_frames, 30.524 - "Size of the buffer in frames", NULL, 0}, 30.525 - {"BUFFER_COUNT", AUD_OPT_INT, &conf.nbuffers, 30.526 - "Number of buffers", NULL, 0}, 30.527 - {NULL, 0, NULL, NULL, NULL, 0} 30.528 -}; 30.529 - 30.530 -static struct audio_pcm_ops coreaudio_pcm_ops = { 30.531 - coreaudio_init_out, 30.532 - coreaudio_fini_out, 30.533 - coreaudio_run_out, 30.534 - coreaudio_write, 30.535 - coreaudio_ctl_out, 30.536 - 30.537 - NULL, 30.538 - NULL, 30.539 - NULL, 30.540 - NULL, 30.541 - NULL 30.542 -}; 30.543 - 30.544 -struct audio_driver coreaudio_audio_driver = { 30.545 - INIT_FIELD (name = ) "coreaudio", 30.546 - INIT_FIELD (descr = ) 30.547 - "CoreAudio http://developer.apple.com/audio/coreaudio.html", 30.548 - INIT_FIELD (options = ) coreaudio_options, 30.549 - INIT_FIELD (init = ) coreaudio_audio_init, 30.550 - INIT_FIELD (fini = ) coreaudio_audio_fini, 30.551 - INIT_FIELD (pcm_ops = ) &coreaudio_pcm_ops, 30.552 - INIT_FIELD (can_be_default = ) 1, 30.553 - INIT_FIELD (max_voices_out = ) 1, 30.554 - INIT_FIELD (max_voices_in = ) 0, 30.555 - INIT_FIELD (voice_size_out = ) sizeof (coreaudioVoiceOut), 30.556 - INIT_FIELD (voice_size_in = ) 0 30.557 -};
31.1 --- a/tools/ioemu/audio/dsound_template.h Wed Sep 17 14:16:02 2008 +0100 31.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 31.3 @@ -1,282 +0,0 @@ 31.4 -/* 31.5 - * QEMU DirectSound audio driver header 31.6 - * 31.7 - * Copyright (c) 2005 Vassili Karpov (malc) 31.8 - * 31.9 - * Permission is hereby granted, free of charge, to any person obtaining a copy 31.10 - * of this software and associated documentation files (the "Software"), to deal 31.11 - * in the Software without restriction, including without limitation the rights 31.12 - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 31.13 - * copies of the Software, and to permit persons to whom the Software is 31.14 - * furnished to do so, subject to the following conditions: 31.15 - * 31.16 - * The above copyright notice and this permission notice shall be included in 31.17 - * all copies or substantial portions of the Software. 31.18 - * 31.19 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 31.20 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 31.21 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 31.22 - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 31.23 - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 31.24 - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 31.25 - * THE SOFTWARE. 31.26 - */ 31.27 -#ifdef DSBTYPE_IN 31.28 -#define NAME "capture buffer" 31.29 -#define TYPE in 31.30 -#define IFACE IDirectSoundCaptureBuffer 31.31 -#define BUFPTR LPDIRECTSOUNDCAPTUREBUFFER 31.32 -#define FIELD dsound_capture_buffer 31.33 -#else 31.34 -#define NAME "playback buffer" 31.35 -#define TYPE out 31.36 -#define IFACE IDirectSoundBuffer 31.37 -#define BUFPTR LPDIRECTSOUNDBUFFER 31.38 -#define FIELD dsound_buffer 31.39 -#endif 31.40 - 31.41 -static int glue (dsound_unlock_, TYPE) ( 31.42 - BUFPTR buf, 31.43 - LPVOID p1, 31.44 - LPVOID p2, 31.45 - DWORD blen1, 31.46 - DWORD blen2 31.47 - ) 31.48 -{ 31.49 - HRESULT hr; 31.50 - 31.51 - hr = glue (IFACE, _Unlock) (buf, p1, blen1, p2, blen2); 31.52 - if (FAILED (hr)) { 31.53 - dsound_logerr (hr, "Could not unlock " NAME "\n"); 31.54 - return -1; 31.55 - } 31.56 - 31.57 - return 0; 31.58 -} 31.59 - 31.60 -static int glue (dsound_lock_, TYPE) ( 31.61 - BUFPTR buf, 31.62 - struct audio_pcm_info *info, 31.63 - DWORD pos, 31.64 - DWORD len, 31.65 - LPVOID *p1p, 31.66 - LPVOID *p2p, 31.67 - DWORD *blen1p, 31.68 - DWORD *blen2p, 31.69 - int entire 31.70 - ) 31.71 -{ 31.72 - HRESULT hr; 31.73 - int i; 31.74 - LPVOID p1 = NULL, p2 = NULL; 31.75 - DWORD blen1 = 0, blen2 = 0; 31.76 - DWORD flag; 31.77 - 31.78 -#ifdef DSBTYPE_IN 31.79 - flag = entire ? DSCBLOCK_ENTIREBUFFER : 0; 31.80 -#else 31.81 - flag = entire ? DSBLOCK_ENTIREBUFFER : 0; 31.82 -#endif 31.83 - for (i = 0; i < conf.lock_retries; ++i) { 31.84 - hr = glue (IFACE, _Lock) ( 31.85 - buf, 31.86 - pos, 31.87 - len, 31.88 - &p1, 31.89 - &blen1, 31.90 - &p2, 31.91 - &blen2, 31.92 - flag 31.93 - ); 31.94 - 31.95 - if (FAILED (hr)) { 31.96 -#ifndef DSBTYPE_IN 31.97 - if (hr == DSERR_BUFFERLOST) { 31.98 - if (glue (dsound_restore_, TYPE) (buf)) { 31.99 - dsound_logerr (hr, "Could not lock " NAME "\n"); 31.100 - goto fail; 31.101 - } 31.102 - continue; 31.103 - } 31.104 -#endif 31.105 - dsound_logerr (hr, "Could not lock " NAME "\n"); 31.106 - goto fail; 31.107 - } 31.108 - 31.109 - break; 31.110 - } 31.111 - 31.112 - if (i == conf.lock_retries) { 31.113 - dolog ("%d attempts to lock " NAME " failed\n", i); 31.114 - goto fail; 31.115 - } 31.116 - 31.117 - if ((p1 && (blen1 & info->align)) || (p2 && (blen2 & info->align))) { 31.118 - dolog ("DirectSound returned misaligned buffer %ld %ld\n", 31.119 - blen1, blen2); 31.120 - glue (dsound_unlock_, TYPE) (buf, p1, p2, blen1, blen2); 31.121 - goto fail; 31.122 - } 31.123 - 31.124 - if (!p1 && blen1) { 31.125 - dolog ("warning: !p1 && blen1=%ld\n", blen1); 31.126 - blen1 = 0; 31.127 - } 31.128 - 31.129 - if (!p2 && blen2) { 31.130 - dolog ("warning: !p2 && blen2=%ld\n", blen2); 31.131 - blen2 = 0; 31.132 - } 31.133 - 31.134 - *p1p = p1; 31.135 - *p2p = p2; 31.136 - *blen1p = blen1; 31.137 - *blen2p = blen2; 31.138 - return 0; 31.139 - 31.140 - fail: 31.141 - *p1p = NULL - 1; 31.142 - *p2p = NULL - 1; 31.143 - *blen1p = -1; 31.144 - *blen2p = -1; 31.145 - return -1; 31.146 -} 31.147 - 31.148 -#ifdef DSBTYPE_IN 31.149 -static void dsound_fini_in (HWVoiceIn *hw) 31.150 -#else 31.151 -static void dsound_fini_out (HWVoiceOut *hw) 31.152 -#endif 31.153 -{ 31.154 - HRESULT hr; 31.155 -#ifdef DSBTYPE_IN 31.156 - DSoundVoiceIn *ds = (DSoundVoiceIn *) hw; 31.157 -#else 31.158 - DSoundVoiceOut *ds = (DSoundVoiceOut *) hw; 31.159 -#endif 31.160 - 31.161 - if (ds->FIELD) { 31.162 - hr = glue (IFACE, _Stop) (ds->FIELD); 31.163 - if (FAILED (hr)) { 31.164 - dsound_logerr (hr, "Could not stop " NAME "\n"); 31.165 - } 31.166 - 31.167 - hr = glue (IFACE, _Release) (ds->FIELD); 31.168 - if (FAILED (hr)) { 31.169 - dsound_logerr (hr, "Could not release " NAME "\n"); 31.170 - } 31.171 - ds->FIELD = NULL; 31.172 - } 31.173 -} 31.174 - 31.175 -#ifdef DSBTYPE_IN 31.176 -static int dsound_init_in (HWVoiceIn *hw, audsettings_t *as) 31.177 -#else 31.178 -static int dsound_init_out (HWVoiceOut *hw, audsettings_t *as) 31.179 -#endif 31.180 -{ 31.181 - int err; 31.182 - HRESULT hr; 31.183 - dsound *s = &glob_dsound; 31.184 - WAVEFORMATEX wfx; 31.185 - audsettings_t obt_as; 31.186 -#ifdef DSBTYPE_IN 31.187 - const char *typ = "ADC"; 31.188 - DSoundVoiceIn *ds = (DSoundVoiceIn *) hw; 31.189 - DSCBUFFERDESC bd; 31.190 - DSCBCAPS bc; 31.191 -#else 31.192 - const char *typ = "DAC"; 31.193 - DSoundVoiceOut *ds = (DSoundVoiceOut *) hw; 31.194 - DSBUFFERDESC bd; 31.195 - DSBCAPS bc; 31.196 -#endif 31.197 - 31.198 - err = waveformat_from_audio_settings (&wfx, as); 31.199 - if (err) { 31.200 - return -1; 31.201 - } 31.202 - 31.203 - memset (&bd, 0, sizeof (bd)); 31.204 - bd.dwSize = sizeof (bd); 31.205 - bd.lpwfxFormat = &wfx; 31.206 -#ifdef DSBTYPE_IN 31.207 - bd.dwBufferBytes = conf.bufsize_in; 31.208 - hr = IDirectSoundCapture_CreateCaptureBuffer ( 31.209 - s->dsound_capture, 31.210 - &bd, 31.211 - &ds->dsound_capture_buffer, 31.212 - NULL 31.213 - ); 31.214 -#else 31.215 - bd.dwFlags = DSBCAPS_STICKYFOCUS | DSBCAPS_GETCURRENTPOSITION2; 31.216 - bd.dwBufferBytes = conf.bufsize_out; 31.217 - hr = IDirectSound_CreateSoundBuffer ( 31.218 - s->dsound, 31.219 - &bd, 31.220 - &ds->dsound_buffer, 31.221 - NULL 31.222 - ); 31.223 -#endif 31.224 - 31.225 - if (FAILED (hr)) { 31.226 - dsound_logerr2 (hr, typ, "Could not create " NAME "\n"); 31.227 - return -1; 31.228 - } 31.229 - 31.230 - hr = glue (IFACE, _GetFormat) (ds->FIELD, &wfx, sizeof (wfx), NULL); 31.231 - if (FAILED (hr)) { 31.232 - dsound_logerr2 (hr, typ, "Could not get " NAME " format\n"); 31.233 - goto fail0; 31.234 - } 31.235 - 31.236 -#ifdef DEBUG_DSOUND 31.237 - dolog (NAME "\n"); 31.238 - print_wave_format (&wfx); 31.239 -#endif 31.240 - 31.241 - memset (&bc, 0, sizeof (bc)); 31.242 - bc.dwSize = sizeof (bc); 31.243 - 31.244 - hr = glue (IFACE, _GetCaps) (ds->FIELD, &bc); 31.245 - if (FAILED (hr)) { 31.246 - dsound_logerr2 (hr, typ, "Could not get " NAME " format\n"); 31.247 - goto fail0; 31.248 - } 31.249 - 31.250 - err = waveformat_to_audio_settings (&wfx, &obt_as); 31.251 - if (err) { 31.252 - goto fail0; 31.253 - } 31.254 - 31.255 - ds->first_time = 1; 31.256 - obt_as.endianness = 0; 31.257 - audio_pcm_init_info (&hw->info, &obt_as); 31.258 - 31.259 - if (bc.dwBufferBytes & hw->info.align) { 31.260 - dolog ( 31.261 - "GetCaps returned misaligned buffer size %ld, alignment %d\n", 31.262 - bc.dwBufferBytes, hw->info.align + 1 31.263 - ); 31.264 - } 31.265 - hw->samples = bc.dwBufferBytes >> hw->info.shift; 31.266 - 31.267 -#ifdef DEBUG_DSOUND 31.268 - dolog ("caps %ld, desc %ld\n", 31.269 - bc.dwBufferBytes, bd.dwBufferBytes); 31.270 - 31.271 - dolog ("bufsize %d, freq %d, chan %d, fmt %d\n", 31.272 - hw->bufsize, settings.freq, settings.nchannels, settings.fmt); 31.273 -#endif 31.274 - return 0; 31.275 - 31.276 - fail0: 31.277 - glue (dsound_fini_, TYPE) (hw); 31.278 - return -1; 31.279 -} 31.280 - 31.281 -#undef NAME 31.282 -#undef TYPE 31.283 -#undef IFACE 31.284 -#undef BUFPTR 31.285 -#undef FIELD
32.1 --- a/tools/ioemu/audio/dsoundaudio.c Wed Sep 17 14:16:02 2008 +0100 32.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 32.3 @@ -1,1080 +0,0 @@ 32.4 -/* 32.5 - * QEMU DirectSound audio driver 32.6 - * 32.7 - * Copyright (c) 2005 Vassili Karpov (malc) 32.8 - * 32.9 - * Permission is hereby granted, free of charge, to any person obtaining a copy 32.10 - * of this software and associated documentation files (the "Software"), to deal 32.11 - * in the Software without restriction, including without limitation the rights 32.12 - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 32.13 - * copies of the Software, and to permit persons to whom the Software is 32.14 - * furnished to do so, subject to the following conditions: 32.15 - * 32.16 - * The above copyright notice and this permission notice shall be included in 32.17 - * all copies or substantial portions of the Software. 32.18 - * 32.19 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 32.20 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 32.21 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 32.22 - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 32.23 - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 32.24 - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 32.25 - * THE SOFTWARE. 32.26 - */ 32.27 - 32.28 -/* 32.29 - * SEAL 1.07 by Carlos 'pel' Hasan was used as documentation 32.30 - */ 32.31 - 32.32 -#include "vl.h" 32.33 - 32.34 -#define AUDIO_CAP "dsound" 32.35 -#include "audio_int.h" 32.36 - 32.37 -#include <windows.h> 32.38 -#include <objbase.h> 32.39 -#include <dsound.h> 32.40 - 32.41 -/* #define DEBUG_DSOUND */ 32.42 - 32.43 -static struct { 32.44 - int lock_retries; 32.45 - int restore_retries; 32.46 - int getstatus_retries; 32.47 - int set_primary; 32.48 - int bufsize_in; 32.49 - int bufsize_out; 32.50 - audsettings_t settings; 32.51 - int latency_millis; 32.52 -} conf = { 32.53 - 1, 32.54 - 1, 32.55 - 1, 32.56 - 0, 32.57 - 16384, 32.58 - 16384, 32.59 - { 32.60 - 44100, 32.61 - 2, 32.62 - AUD_FMT_S16 32.63 - }, 32.64 - 10 32.65 -}; 32.66 - 32.67 -typedef struct { 32.68 - LPDIRECTSOUND dsound; 32.69 - LPDIRECTSOUNDCAPTURE dsound_capture; 32.70 - LPDIRECTSOUNDBUFFER dsound_primary_buffer; 32.71 - audsettings_t settings; 32.72 -} dsound; 32.73 - 32.74 -static dsound glob_dsound; 32.75 - 32.76 -typedef struct { 32.77 - HWVoiceOut hw; 32.78 - LPDIRECTSOUNDBUFFER dsound_buffer; 32.79 - DWORD old_pos; 32.80 - int first_time; 32.81 -#ifdef DEBUG_DSOUND 32.82 - DWORD old_ppos; 32.83 - DWORD played; 32.84 - DWORD mixed; 32.85 -#endif 32.86 -} DSoundVoiceOut; 32.87 - 32.88 -typedef struct { 32.89 - HWVoiceIn hw; 32.90 - int first_time; 32.91 - LPDIRECTSOUNDCAPTUREBUFFER dsound_capture_buffer; 32.92 -} DSoundVoiceIn; 32.93 - 32.94 -static void dsound_log_hresult (HRESULT hr) 32.95 -{ 32.96 - const char *str = "BUG"; 32.97 - 32.98 - switch (hr) { 32.99 - case DS_OK: 32.100 - str = "The method succeeded"; 32.101 - break; 32.102 -#ifdef DS_NO_VIRTUALIZATION 32.103 - case DS_NO_VIRTUALIZATION: 32.104 - str = "The buffer was created, but another 3D algorithm was substituted"; 32.105 - break; 32.106 -#endif 32.107 -#ifdef DS_INCOMPLETE 32.108 - case DS_INCOMPLETE: 32.109 - str = "The method succeeded, but not all the optional effects were obtained"; 32.110 - break; 32.111 -#endif 32.112 -#ifdef DSERR_ACCESSDENIED 32.113 - case DSERR_ACCESSDENIED: 32.114 - str = "The request failed because access was denied"; 32.115 - break; 32.116 -#endif 32.117 -#ifdef DSERR_ALLOCATED 32.118 - case DSERR_ALLOCATED: 32.119 - str = "The request failed because resources, such as a priority level, were already in use by another caller"; 32.120 - break; 32.121 -#endif 32.122 -#ifdef DSERR_ALREADYINITIALIZED 32.123 - case DSERR_ALREADYINITIALIZED: 32.124 - str = "The object is already initialized"; 32.125 - break; 32.126 -#endif 32.127 -#ifdef DSERR_BADFORMAT 32.128 - case DSERR_BADFORMAT: 32.129 - str = "The specified wave format is not supported"; 32.130 - break; 32.131 -#endif 32.132 -#ifdef DSERR_BADSENDBUFFERGUID 32.133 - case DSERR_BADSENDBUFFERGUID: 32.134 - str = "The GUID specified in an audiopath file does not match a valid mix-in buffer"; 32.135 - break; 32.136 -#endif 32.137 -#ifdef DSERR_BUFFERLOST 32.138 - case DSERR_BUFFERLOST: 32.139 - str = "The buffer memory has been lost and must be restored"; 32.140 - break; 32.141 -#endif 32.142 -#ifdef DSERR_BUFFERTOOSMALL 32.143 - case DSERR_BUFFERTOOSMALL: 32.144 - str = "The buffer size is not great enough to enable effects processing"; 32.145 - break; 32.146 -#endif 32.147 -#ifdef DSERR_CONTROLUNAVAIL 32.148 - case DSERR_CONTROLUNAVAIL: 32.149 - str = "The buffer control (volume, pan, and so on) requested by the caller is not available. Controls must be specified when the buffer is created, using the dwFlags member of DSBUFFERDESC"; 32.150 - break; 32.151 -#endif 32.152 -#ifdef DSERR_DS8_REQUIRED 32.153 - case DSERR_DS8_REQUIRED: 32.154 - str = "A DirectSound object of class CLSID_DirectSound8 or later is required for the requested functionality. For more information, see IDirectSound8 Interface"; 32.155 - break; 32.156 -#endif 32.157 -#ifdef DSERR_FXUNAVAILABLE 32.158 - case DSERR_FXUNAVAILABLE: 32.159 - str = "The effects requested could not be found on the system, or they are in the wrong order or in the wrong location; for example, an effect expected in hardware was found in software"; 32.160 - break; 32.161 -#endif 32.162 -#ifdef DSERR_GENERIC 32.163 - case DSERR_GENERIC : 32.164 - str = "An undetermined error occurred inside the DirectSound subsystem"; 32.165 - break; 32.166 -#endif 32.167 -#ifdef DSERR_INVALIDCALL 32.168 - case DSERR_INVALIDCALL: 32.169 - str = "This function is not valid for the current state of this object"; 32.170 - break; 32.171 -#endif 32.172 -#ifdef DSERR_INVALIDPARAM 32.173 - case DSERR_INVALIDPARAM: 32.174 - str = "An invalid parameter was passed to the returning function"; 32.175 - break; 32.176 -#endif 32.177 -#ifdef DSERR_NOAGGREGATION 32.178 - case DSERR_NOAGGREGATION: 32.179 - str = "The object does not support aggregation"; 32.180 - break; 32.181 -#endif 32.182 -#ifdef DSERR_NODRIVER 32.183 - case DSERR_NODRIVER: 32.184 - str = "No sound driver is available for use, or the given GUID is not a valid DirectSound device ID"; 32.185 - break; 32.186 -#endif 32.187 -#ifdef DSERR_NOINTERFACE 32.188 - case DSERR_NOINTERFACE: 32.189 - str = "The requested COM interface is not available"; 32.190 - break; 32.191 -#endif 32.192 -#ifdef DSERR_OBJECTNOTFOUND 32.193 - case DSERR_OBJECTNOTFOUND: 32.194 - str = "The requested object was not found"; 32.195 - break; 32.196 -#endif 32.197 -#ifdef DSERR_OTHERAPPHASPRIO 32.198 - case DSERR_OTHERAPPHASPRIO: 32.199 - str = "Another application has a higher priority level, preventing this call from succeeding"; 32.200 - break; 32.201 -#endif 32.202 -#ifdef DSERR_OUTOFMEMORY 32.203 - case DSERR_OUTOFMEMORY: 32.204 - str = "The DirectSound subsystem could not allocate sufficient memory to complete the caller's request"; 32.205 - break; 32.206 -#endif 32.207 -#ifdef DSERR_PRIOLEVELNEEDED 32.208 - case DSERR_PRIOLEVELNEEDED: 32.209 - str = "A cooperative level of DSSCL_PRIORITY or higher is required"; 32.210 - break; 32.211 -#endif 32.212 -#ifdef DSERR_SENDLOOP 32.213 - case DSERR_SENDLOOP: 32.214 - str = "A circular loop of send effects was detected"; 32.215 - break; 32.216 -#endif 32.217 -#ifdef DSERR_UNINITIALIZED 32.218 - case DSERR_UNINITIALIZED: 32.219 - str = "The Initialize method has not been called or has not been called successfully before other methods were called"; 32.220 - break; 32.221 -#endif 32.222 -#ifdef DSERR_UNSUPPORTED 32.223 - case DSERR_UNSUPPORTED: 32.224 - str = "The function called is not supported at this time"; 32.225 - break; 32.226 -#endif 32.227 - default: 32.228 - AUD_log (AUDIO_CAP, "Reason: Unknown (HRESULT %#lx)\n", hr); 32.229 - return; 32.230 - } 32.231 - 32.232 - AUD_log (AUDIO_CAP, "Reason: %s\n", str); 32.233 -} 32.234 - 32.235 -static void GCC_FMT_ATTR (2, 3) dsound_logerr ( 32.236 - HRESULT hr, 32.237 - const char *fmt, 32.238 - ... 32.239 - ) 32.240 -{ 32.241 - va_list ap; 32.242 - 32.243 - va_start (ap, fmt); 32.244 - AUD_vlog (AUDIO_CAP, fmt, ap); 32.245 - va_end (ap); 32.246 - 32.247 - dsound_log_hresult (hr); 32.248 -} 32.249 - 32.250 -static void GCC_FMT_ATTR (3, 4) dsound_logerr2 ( 32.251 - HRESULT hr, 32.252 - const char *typ, 32.253 - const char *fmt, 32.254 - ... 32.255 - ) 32.256 -{ 32.257 - va_list ap; 32.258 - 32.259 - AUD_log (AUDIO_CAP, "Could not initialize %s\n", typ); 32.260 - va_start (ap, fmt); 32.261 - AUD_vlog (AUDIO_CAP, fmt, ap); 32.262 - va_end (ap); 32.263 - 32.264 - dsound_log_hresult (hr); 32.265 -} 32.266 - 32.267 -static DWORD millis_to_bytes (struct audio_pcm_info *info, DWORD millis) 32.268 -{ 32.269 - return (millis * info->bytes_per_second) / 1000; 32.270 -} 32.271 - 32.272 -#ifdef DEBUG_DSOUND 32.273 -static void print_wave_format (WAVEFORMATEX *wfx) 32.274 -{ 32.275 - dolog ("tag = %d\n", wfx->wFormatTag); 32.276 - dolog ("nChannels = %d\n", wfx->nChannels); 32.277 - dolog ("nSamplesPerSec = %ld\n", wfx->nSamplesPerSec); 32.278 - dolog ("nAvgBytesPerSec = %ld\n", wfx->nAvgBytesPerSec); 32.279 - dolog ("nBlockAlign = %d\n", wfx->nBlockAlign); 32.280 - dolog ("wBitsPerSample = %d\n", wfx->wBitsPerSample); 32.281 - dolog ("cbSize = %d\n", wfx->cbSize); 32.282 -} 32.283 -#endif 32.284 - 32.285 -static int dsound_restore_out (LPDIRECTSOUNDBUFFER dsb) 32.286 -{ 32.287 - HRESULT hr; 32.288 - int i; 32.289 - 32.290 - for (i = 0; i < conf.restore_retries; ++i) { 32.291 - hr = IDirectSoundBuffer_Restore (dsb); 32.292 - 32.293 - switch (hr) { 32.294 - case DS_OK: 32.295 - return 0; 32.296 - 32.297 - case DSERR_BUFFERLOST: 32.298