Patrick Georgi (patrick@georgi-clan.de) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/1057
-gerrit
commit 14e5867d08f6e6525eef9ef82422c5943c04ee7d Author: Patrick Georgi patrick@georgi-clan.de Date: Mon May 28 21:02:32 2012 +0200
Remove qemu 0.11.x fork
We're on 0.15.x now
Change-Id: I4eb0f1a67212a66f32c07194e3b6245ce5a412a1 Signed-off-by: Patrick Georgi patrick@georgi-clan.de --- Makefile | 2 +- qemu-0.11.0/.gitignore | 45 - qemu-0.11.0/CODING_STYLE | 78 - qemu-0.11.0/COPYING | 339 - qemu-0.11.0/COPYING.LIB | 504 - qemu-0.11.0/Changelog | 638 - qemu-0.11.0/LICENSE | 18 - qemu-0.11.0/MAINTAINERS | 86 - qemu-0.11.0/Makefile | 426 - qemu-0.11.0/Makefile.hw | 38 - qemu-0.11.0/Makefile.target | 700 - qemu-0.11.0/README | 3 - qemu-0.11.0/TODO | 37 - qemu-0.11.0/VERSION | 1 - qemu-0.11.0/a.out.h | 430 - qemu-0.11.0/acl.c | 185 - qemu-0.11.0/acl.h | 74 - qemu-0.11.0/aes.c | 1314 -- qemu-0.11.0/aes.h | 26 - qemu-0.11.0/aio.c | 198 - qemu-0.11.0/alpha-dis.c | 1959 -- qemu-0.11.0/alpha.ld | 128 - qemu-0.11.0/arm-dis.c | 4119 ----- qemu-0.11.0/arm-semi.c | 468 - qemu-0.11.0/arm.ld | 154 - qemu-0.11.0/audio/alsaaudio.c | 952 - qemu-0.11.0/audio/audio.c | 1954 -- qemu-0.11.0/audio/audio.h | 173 - qemu-0.11.0/audio/audio_int.h | 285 - qemu-0.11.0/audio/audio_pt_int.c | 149 - qemu-0.11.0/audio/audio_pt_int.h | 22 - qemu-0.11.0/audio/audio_template.h | 566 - qemu-0.11.0/audio/coreaudio.c | 550 - qemu-0.11.0/audio/dsound_template.h | 293 - qemu-0.11.0/audio/dsoundaudio.c | 1088 -- qemu-0.11.0/audio/esdaudio.c | 596 - qemu-0.11.0/audio/fmodaudio.c | 686 - qemu-0.11.0/audio/mixeng.c | 335 - qemu-0.11.0/audio/mixeng.h | 51 - qemu-0.11.0/audio/mixeng_template.h | 177 - qemu-0.11.0/audio/noaudio.c | 174 - qemu-0.11.0/audio/ossaudio.c | 780 - qemu-0.11.0/audio/paaudio.c | 515 - qemu-0.11.0/audio/rate_template.h | 111 - qemu-0.11.0/audio/sdlaudio.c | 454 - qemu-0.11.0/audio/wavaudio.c | 263 - qemu-0.11.0/audio/wavcapture.c | 161 - qemu-0.11.0/balloon.h | 27 - qemu-0.11.0/block.c | 1640 -- qemu-0.11.0/block.h | 168 - qemu-0.11.0/block/bochs.c | 259 - qemu-0.11.0/block/cloop.c | 171 - qemu-0.11.0/block/cow.c | 299 - qemu-0.11.0/block/curl.c | 562 - qemu-0.11.0/block/dmg.c | 301 - qemu-0.11.0/block/nbd.c | 196 - qemu-0.11.0/block/parallels.c | 181 - qemu-0.11.0/block/qcow.c | 954 - qemu-0.11.0/block/qcow2-cluster.c | 839 - qemu-0.11.0/block/qcow2-refcount.c | 894 - qemu-0.11.0/block/qcow2-snapshot.c | 405 - qemu-0.11.0/block/qcow2.c | 1062 -- qemu-0.11.0/block/qcow2.h | 214 - qemu-0.11.0/block/raw-posix.c | 1524 -- qemu-0.11.0/block/raw-win32.c | 419 - qemu-0.11.0/block/vmdk.c | 870 - qemu-0.11.0/block/vpc.c | 623 - qemu-0.11.0/block/vvfat.c | 2861 --- qemu-0.11.0/block_int.h | 185 - qemu-0.11.0/bsd-user/bsd-mman.h | 121 - qemu-0.11.0/bsd-user/bsdload.c | 204 - qemu-0.11.0/bsd-user/elfload.c | 1521 -- qemu-0.11.0/bsd-user/errno_defs.h | 149 - qemu-0.11.0/bsd-user/freebsd/strace.list | 170 - qemu-0.11.0/bsd-user/freebsd/syscall_nr.h | 373 - qemu-0.11.0/bsd-user/i386/syscall.h | 147 - qemu-0.11.0/bsd-user/i386/target_signal.h | 20 - qemu-0.11.0/bsd-user/main.c | 976 - qemu-0.11.0/bsd-user/mmap.c | 560 - qemu-0.11.0/bsd-user/netbsd/strace.list | 145 - qemu-0.11.0/bsd-user/netbsd/syscall_nr.h | 373 - qemu-0.11.0/bsd-user/openbsd/strace.list | 187 - qemu-0.11.0/bsd-user/openbsd/syscall_nr.h | 225 - qemu-0.11.0/bsd-user/path.c | 163 - qemu-0.11.0/bsd-user/qemu-types.h | 24 - qemu-0.11.0/bsd-user/qemu.h | 392 - qemu-0.11.0/bsd-user/signal.c | 38 - qemu-0.11.0/bsd-user/sparc/syscall.h | 9 - qemu-0.11.0/bsd-user/sparc/target_signal.h | 27 - qemu-0.11.0/bsd-user/sparc64/syscall.h | 10 - qemu-0.11.0/bsd-user/sparc64/target_signal.h | 27 - qemu-0.11.0/bsd-user/strace.c | 191 - qemu-0.11.0/bsd-user/syscall.c | 272 - qemu-0.11.0/bsd-user/syscall_defs.h | 108 - qemu-0.11.0/bsd-user/uaccess.c | 65 - qemu-0.11.0/bsd-user/x86_64/syscall.h | 98 - qemu-0.11.0/bsd-user/x86_64/target_signal.h | 19 - qemu-0.11.0/bswap.h | 217 - qemu-0.11.0/bt-host.c | 206 - qemu-0.11.0/bt-host.h | 9 - qemu-0.11.0/bt-vhci.c | 168 - qemu-0.11.0/buffered_file.c | 261 - qemu-0.11.0/buffered_file.h | 30 - qemu-0.11.0/build.sh | 5 - qemu-0.11.0/cache-utils.c | 73 - qemu-0.11.0/cache-utils.h | 41 - qemu-0.11.0/cmd.c | 583 - qemu-0.11.0/cmd.h | 79 - qemu-0.11.0/cocoa.m | 982 - qemu-0.11.0/configure | 2155 --- qemu-0.11.0/console.c | 1616 -- qemu-0.11.0/console.h | 330 - qemu-0.11.0/cpu-all.h | 1067 -- qemu-0.11.0/cpu-common.h | 95 - qemu-0.11.0/cpu-defs.h | 200 - qemu-0.11.0/cpu-exec.c | 1618 -- qemu-0.11.0/create_config | 55 - qemu-0.11.0/cris-dis.c | 2892 --- qemu-0.11.0/curses.c | 371 - qemu-0.11.0/curses_keys.h | 483 - qemu-0.11.0/cutils.c | 194 - qemu-0.11.0/d3des.c | 424 - qemu-0.11.0/d3des.h | 51 - qemu-0.11.0/darwin-user/commpage.c | 357 - qemu-0.11.0/darwin-user/ioctls.h | 4 - qemu-0.11.0/darwin-user/ioctls_types.h | 1 - qemu-0.11.0/darwin-user/machload.c | 902 - qemu-0.11.0/darwin-user/main.c | 1014 -- qemu-0.11.0/darwin-user/mmap.c | 409 - qemu-0.11.0/darwin-user/qemu.h | 178 - qemu-0.11.0/darwin-user/signal.c | 457 - qemu-0.11.0/darwin-user/syscall.c | 1566 -- qemu-0.11.0/darwin-user/syscalls.h | 384 - qemu-0.11.0/def-helper.h | 220 - qemu-0.11.0/device_tree.c | 109 - qemu-0.11.0/device_tree.h | 26 - qemu-0.11.0/dis-asm.h | 481 - qemu-0.11.0/disas.c | 411 - qemu-0.11.0/disas.h | 39 - qemu-0.11.0/dma-helpers.c | 184 - qemu-0.11.0/dma.h | 41 - qemu-0.11.0/dyngen-exec.h | 132 - qemu-0.11.0/elf.h | 1191 -- qemu-0.11.0/elf_ops.h | 271 - qemu-0.11.0/exec-all.h | 400 - qemu-0.11.0/exec.c | 3760 ---- qemu-0.11.0/feature_to_c.sh | 76 - qemu-0.11.0/fpu/softfloat-macros.h | 719 - qemu-0.11.0/fpu/softfloat-native.c | 531 - qemu-0.11.0/fpu/softfloat-native.h | 496 - qemu-0.11.0/fpu/softfloat-specialize.h | 581 - qemu-0.11.0/fpu/softfloat.c | 5670 ------ qemu-0.11.0/fpu/softfloat.h | 520 - qemu-0.11.0/gdb-xml/arm-core.xml | 31 - qemu-0.11.0/gdb-xml/arm-neon.xml | 88 - qemu-0.11.0/gdb-xml/arm-vfp.xml | 29 - qemu-0.11.0/gdb-xml/arm-vfp3.xml | 45 - qemu-0.11.0/gdb-xml/cf-core.xml | 29 - qemu-0.11.0/gdb-xml/cf-fp.xml | 22 - qemu-0.11.0/gdb-xml/power-altivec.xml | 57 - qemu-0.11.0/gdb-xml/power-core.xml | 49 - qemu-0.11.0/gdb-xml/power-fpu.xml | 44 - qemu-0.11.0/gdb-xml/power-spe.xml | 45 - qemu-0.11.0/gdb-xml/power64-core.xml | 49 - qemu-0.11.0/gdbstub.c | 2525 --- qemu-0.11.0/gdbstub.h | 35 - qemu-0.11.0/gen-icount.h | 55 - qemu-0.11.0/host-utils.c | 104 - qemu-0.11.0/host-utils.h | 236 - qemu-0.11.0/hostregs_helper.h | 61 - qemu-0.11.0/hpet.h | 22 - qemu-0.11.0/hppa-dis.c | 2831 --- qemu-0.11.0/hppa.ld | 214 - qemu-0.11.0/hw/ac97.c | 1379 -- qemu-0.11.0/hw/acpi.c | 937 - qemu-0.11.0/hw/adb.c | 481 - qemu-0.11.0/hw/adlib.c | 338 - qemu-0.11.0/hw/ads7846.c | 169 - qemu-0.11.0/hw/alpha_palcode.c | 1095 -- qemu-0.11.0/hw/an5206.c | 98 - qemu-0.11.0/hw/apb_pci.c | 276 - qemu-0.11.0/hw/apic.c | 1004 - qemu-0.11.0/hw/arm-misc.h | 41 - qemu-0.11.0/hw/arm_boot.c | 262 - qemu-0.11.0/hw/arm_gic.c | 732 - qemu-0.11.0/hw/arm_pic.c | 49 - qemu-0.11.0/hw/arm_sysctl.c | 237 - qemu-0.11.0/hw/arm_timer.c | 354 - qemu-0.11.0/hw/armv7m.c | 259 - qemu-0.11.0/hw/armv7m_nvic.c | 408 - qemu-0.11.0/hw/audiodev.h | 17 - qemu-0.11.0/hw/axis_dev88.c | 386 - qemu-0.11.0/hw/baum.c | 634 - qemu-0.11.0/hw/baum.h | 29 - qemu-0.11.0/hw/blizzard.c | 998 - qemu-0.11.0/hw/blizzard_template.h | 136 - qemu-0.11.0/hw/boards.h | 31 - qemu-0.11.0/hw/bt-hci-csr.c | 454 - qemu-0.11.0/hw/bt-hci.c | 2226 --- qemu-0.11.0/hw/bt-hid.c | 570 - qemu-0.11.0/hw/bt-l2cap.c | 1362 -- qemu-0.11.0/hw/bt-sdp.c | 967 - qemu-0.11.0/hw/bt.c | 121 - qemu-0.11.0/hw/bt.h | 2183 --- qemu-0.11.0/hw/cbus.c | 618 - qemu-0.11.0/hw/cdrom.c | 155 - qemu-0.11.0/hw/cirrus_vga.c | 3347 ---- qemu-0.11.0/hw/cirrus_vga_rop.h | 186 - qemu-0.11.0/hw/cirrus_vga_rop2.h | 281 - qemu-0.11.0/hw/cris_pic_cpu.c | 50 - qemu-0.11.0/hw/cs4231.c | 198 - qemu-0.11.0/hw/cs4231a.c | 664 - qemu-0.11.0/hw/cuda.c | 767 - qemu-0.11.0/hw/device-hotplug.c | 81 - qemu-0.11.0/hw/devices.h | 70 - qemu-0.11.0/hw/dma.c | 570 - qemu-0.11.0/hw/dp8393x.c | 902 - qemu-0.11.0/hw/ds1225y.c | 180 - qemu-0.11.0/hw/dummy_m68k.c | 77 - qemu-0.11.0/hw/e1000.c | 1148 -- qemu-0.11.0/hw/e1000_hw.h | 864 - qemu-0.11.0/hw/ecc.c | 91 - qemu-0.11.0/hw/eccmemctl.c | 375 - qemu-0.11.0/hw/eepro100.c | 1817 -- qemu-0.11.0/hw/eeprom93xx.c | 341 - qemu-0.11.0/hw/eeprom93xx.h | 40 - qemu-0.11.0/hw/es1370.c | 1067 -- qemu-0.11.0/hw/escc.c | 999 - qemu-0.11.0/hw/escc.h | 8 - qemu-0.11.0/hw/esp.c | 698 - qemu-0.11.0/hw/etraxfs.c | 178 - qemu-0.11.0/hw/etraxfs.h | 28 - qemu-0.11.0/hw/etraxfs_dma.c | 756 - qemu-0.11.0/hw/etraxfs_dma.h | 22 - qemu-0.11.0/hw/etraxfs_eth.c | 600 - qemu-0.11.0/hw/etraxfs_pic.c | 170 - qemu-0.11.0/hw/etraxfs_ser.c | 189 - qemu-0.11.0/hw/etraxfs_timer.c | 338 - qemu-0.11.0/hw/fdc.c | 2003 -- qemu-0.11.0/hw/fdc.h | 11 - qemu-0.11.0/hw/firmware_abi.h | 73 - qemu-0.11.0/hw/flash.h | 54 - qemu-0.11.0/hw/fmopl.c | 1389 -- qemu-0.11.0/hw/fmopl.h | 174 - qemu-0.11.0/hw/framebuffer.c | 116 - qemu-0.11.0/hw/framebuffer.h | 22 - qemu-0.11.0/hw/fw_cfg.c | 289 - qemu-0.11.0/hw/fw_cfg.h | 41 - qemu-0.11.0/hw/g364fb.c | 614 - qemu-0.11.0/hw/grackle_pci.c | 184 - qemu-0.11.0/hw/gt64xxx.c | 1167 -- qemu-0.11.0/hw/gumstix.c | 130 - qemu-0.11.0/hw/gus.c | 316 - qemu-0.11.0/hw/gusemu.h | 105 - qemu-0.11.0/hw/gusemu_hal.c | 554 - qemu-0.11.0/hw/gusemu_mixer.c | 240 - qemu-0.11.0/hw/gustate.h | 132 - qemu-0.11.0/hw/heathrow_pic.c | 236 - qemu-0.11.0/hw/hpet.c | 588 - qemu-0.11.0/hw/hpet_emul.h | 82 - qemu-0.11.0/hw/hw.h | 272 - qemu-0.11.0/hw/i2c.c | 182 - qemu-0.11.0/hw/i2c.h | 84 - qemu-0.11.0/hw/i8254.c | 507 - qemu-0.11.0/hw/i8259.c | 571 - qemu-0.11.0/hw/ide.c | 4435 ----- qemu-0.11.0/hw/integratorcp.c | 544 - qemu-0.11.0/hw/ioapic.c | 260 - qemu-0.11.0/hw/iommu.c | 421 - qemu-0.11.0/hw/irq.c | 77 - qemu-0.11.0/hw/irq.h | 35 - qemu-0.11.0/hw/isa.h | 22 - qemu-0.11.0/hw/isa_mmio.c | 103 - qemu-0.11.0/hw/jazz_led.c | 318 - qemu-0.11.0/hw/lm832x.c | 541 - qemu-0.11.0/hw/lsi53c895a.c | 2221 --- qemu-0.11.0/hw/m48t59.c | 695 - qemu-0.11.0/hw/mac_dbdma.c | 848 - qemu-0.11.0/hw/mac_dbdma.h | 43 - qemu-0.11.0/hw/mac_nvram.c | 195 - qemu-0.11.0/hw/macio.c | 119 - qemu-0.11.0/hw/mainstone.c | 149 - qemu-0.11.0/hw/mainstone.h | 38 - qemu-0.11.0/hw/max111x.c | 186 - qemu-0.11.0/hw/max7310.c | 234 - qemu-0.11.0/hw/mc146818rtc.c | 749 - qemu-0.11.0/hw/mcf.h | 21 - qemu-0.11.0/hw/mcf5206.c | 540 - qemu-0.11.0/hw/mcf5208.c | 301 - qemu-0.11.0/hw/mcf_fec.c | 470 - qemu-0.11.0/hw/mcf_intc.c | 156 - qemu-0.11.0/hw/mcf_uart.c | 309 - qemu-0.11.0/hw/microblaze_pic_cpu.c | 50 - qemu-0.11.0/hw/mips-bios.h | 8 - qemu-0.11.0/hw/mips.h | 43 - qemu-0.11.0/hw/mips_int.c | 45 - qemu-0.11.0/hw/mips_jazz.c | 315 - qemu-0.11.0/hw/mips_malta.c | 970 - qemu-0.11.0/hw/mips_mipssim.c | 197 - qemu-0.11.0/hw/mips_r4k.c | 296 - qemu-0.11.0/hw/mips_timer.c | 109 - qemu-0.11.0/hw/mipsnet.c | 277 - qemu-0.11.0/hw/mpcore.c | 344 - qemu-0.11.0/hw/msix.c | 384 - qemu-0.11.0/hw/msix.h | 34 - qemu-0.11.0/hw/msmouse.c | 78 - qemu-0.11.0/hw/msmouse.h | 2 - qemu-0.11.0/hw/mst_fpga.c | 239 - qemu-0.11.0/hw/musicpal.c | 1629 -- qemu-0.11.0/hw/nand.c | 656 - qemu-0.11.0/hw/ne2000.c | 846 - qemu-0.11.0/hw/nseries.c | 1423 -- qemu-0.11.0/hw/nvram.h | 42 - qemu-0.11.0/hw/omap.h | 1142 -- qemu-0.11.0/hw/omap1.c | 4802 ----- qemu-0.11.0/hw/omap2.c | 4873 ----- qemu-0.11.0/hw/omap_clk.c | 1260 -- qemu-0.11.0/hw/omap_dma.c | 2078 --- qemu-0.11.0/hw/omap_dss.c | 1068 -- qemu-0.11.0/hw/omap_i2c.c | 469 - qemu-0.11.0/hw/omap_lcd_template.h | 175 - qemu-0.11.0/hw/omap_lcdc.c | 461 - qemu-0.11.0/hw/omap_mmc.c | 640 - qemu-0.11.0/hw/omap_sx1.c | 243 - qemu-0.11.0/hw/onenand.c | 661 - qemu-0.11.0/hw/openpic.c | 1719 -- qemu-0.11.0/hw/openpic.h | 18 - qemu-0.11.0/hw/palm.c | 288 - qemu-0.11.0/hw/parallel.c | 549 - qemu-0.11.0/hw/pc.c | 1525 -- qemu-0.11.0/hw/pc.h | 169 - qemu-0.11.0/hw/pci-hotplug.c | 234 - qemu-0.11.0/hw/pci.c | 1050 -- qemu-0.11.0/hw/pci.h | 356 - qemu-0.11.0/hw/pci_host.h | 118 - qemu-0.11.0/hw/pci_ids.h | 100 - qemu-0.11.0/hw/pckbd.c | 442 - qemu-0.11.0/hw/pcmcia.h | 51 - qemu-0.11.0/hw/pcnet.c | 2173 --- qemu-0.11.0/hw/pcspk.c | 147 - qemu-0.11.0/hw/petalogix_s3adsp1800_mmu.c | 201 - qemu-0.11.0/hw/pflash_cfi01.c | 631 - qemu-0.11.0/hw/pflash_cfi02.c | 671 - qemu-0.11.0/hw/piix_pci.c | 374 - qemu-0.11.0/hw/pixel_ops.h | 53 - qemu-0.11.0/hw/pl011.c | 330 - qemu-0.11.0/hw/pl022.c | 310 - qemu-0.11.0/hw/pl031.c | 212 - qemu-0.11.0/hw/pl050.c | 160 - qemu-0.11.0/hw/pl061.c | 315 - qemu-0.11.0/hw/pl080.c | 353 - qemu-0.11.0/hw/pl110.c | 384 - qemu-0.11.0/hw/pl110_template.h | 307 - qemu-0.11.0/hw/pl181.c | 471 - qemu-0.11.0/hw/pl190.c | 250 - qemu-0.11.0/hw/poison.h | 50 - qemu-0.11.0/hw/ppc.c | 1278 -- qemu-0.11.0/hw/ppc.h | 44 - qemu-0.11.0/hw/ppc405.h | 105 - qemu-0.11.0/hw/ppc405_boards.c | 650 - qemu-0.11.0/hw/ppc405_uc.c | 2602 --- qemu-0.11.0/hw/ppc440.c | 100 - qemu-0.11.0/hw/ppc440.h | 21 - qemu-0.11.0/hw/ppc440_bamboo.c | 200 - qemu-0.11.0/hw/ppc4xx.h | 67 - qemu-0.11.0/hw/ppc4xx_devs.c | 886 - qemu-0.11.0/hw/ppc4xx_pci.c | 418 - qemu-0.11.0/hw/ppc_mac.h | 117 - qemu-0.11.0/hw/ppc_newworld.c | 377 - qemu-0.11.0/hw/ppc_oldworld.c | 408 - qemu-0.11.0/hw/ppc_prep.c | 779 - qemu-0.11.0/hw/ppce500.h | 22 - qemu-0.11.0/hw/ppce500_mpc8544ds.c | 296 - qemu-0.11.0/hw/ppce500_pci.c | 369 - qemu-0.11.0/hw/prep_pci.c | 169 - qemu-0.11.0/hw/primecell.h | 14 - qemu-0.11.0/hw/ps2.c | 637 - qemu-0.11.0/hw/ps2.h | 9 - qemu-0.11.0/hw/ptimer.c | 223 - qemu-0.11.0/hw/pxa.h | 220 - qemu-0.11.0/hw/pxa2xx.c | 2267 --- qemu-0.11.0/hw/pxa2xx_dma.c | 549 - qemu-0.11.0/hw/pxa2xx_gpio.c | 344 - qemu-0.11.0/hw/pxa2xx_keypad.c | 336 - qemu-0.11.0/hw/pxa2xx_lcd.c | 982 - qemu-0.11.0/hw/pxa2xx_mmci.c | 547 - qemu-0.11.0/hw/pxa2xx_pcmcia.c | 215 - qemu-0.11.0/hw/pxa2xx_pic.c | 312 - qemu-0.11.0/hw/pxa2xx_template.h | 435 - qemu-0.11.0/hw/pxa2xx_timer.c | 490 - qemu-0.11.0/hw/qdev-addr.c | 32 - qemu-0.11.0/hw/qdev-addr.h | 2 - qemu-0.11.0/hw/qdev-properties.c | 269 - qemu-0.11.0/hw/qdev.c | 304 - qemu-0.11.0/hw/qdev.h | 168 - qemu-0.11.0/hw/r2d.c | 272 - qemu-0.11.0/hw/rc4030.c | 823 - qemu-0.11.0/hw/realview.c | 211 - qemu-0.11.0/hw/realview_gic.c | 77 - qemu-0.11.0/hw/rtl8139.c | 3513 ---- qemu-0.11.0/hw/sb16.c | 1451 -- qemu-0.11.0/hw/sbi.c | 158 - qemu-0.11.0/hw/scsi-disk.c | 981 - qemu-0.11.0/hw/scsi-disk.h | 36 - qemu-0.11.0/hw/scsi-generic.c | 744 - qemu-0.11.0/hw/scsi.h | 7 - qemu-0.11.0/hw/sd.c | 1628 -- qemu-0.11.0/hw/sd.h | 79 - qemu-0.11.0/hw/serial.c | 840 - qemu-0.11.0/hw/sh.h | 58 - qemu-0.11.0/hw/sh7750.c | 809 - qemu-0.11.0/hw/sh7750_regnames.c | 97 - qemu-0.11.0/hw/sh7750_regnames.h | 6 - qemu-0.11.0/hw/sh7750_regs.h | 1277 -- qemu-0.11.0/hw/sh_intc.c | 481 - qemu-0.11.0/hw/sh_intc.h | 80 - qemu-0.11.0/hw/sh_pci.c | 200 - qemu-0.11.0/hw/sh_serial.c | 413 - qemu-0.11.0/hw/sh_timer.c | 326 - qemu-0.11.0/hw/sharpsl.h | 24 - qemu-0.11.0/hw/shix.c | 103 - qemu-0.11.0/hw/slavio_intctl.c | 472 - qemu-0.11.0/hw/slavio_misc.c | 581 - qemu-0.11.0/hw/slavio_timer.c | 463 - qemu-0.11.0/hw/sm501.c | 1105 -- qemu-0.11.0/hw/sm501_template.h | 103 - qemu-0.11.0/hw/smbios.c | 238 - qemu-0.11.0/hw/smbios.h | 162 - qemu-0.11.0/hw/smbus.c | 318 - qemu-0.11.0/hw/smbus.h | 68 - qemu-0.11.0/hw/smbus_eeprom.c | 129 - qemu-0.11.0/hw/smc91c111.c | 743 - qemu-0.11.0/hw/soc_dma.c | 365 - qemu-0.11.0/hw/soc_dma.h | 113 - qemu-0.11.0/hw/sparc32_dma.c | 303 - qemu-0.11.0/hw/sparc32_dma.h | 14 - qemu-0.11.0/hw/spitz.c | 1094 -- qemu-0.11.0/hw/ssd0303.c | 332 - qemu-0.11.0/hw/ssd0323.c | 353 - qemu-0.11.0/hw/ssi-sd.c | 255 - qemu-0.11.0/hw/ssi.c | 70 - qemu-0.11.0/hw/ssi.h | 45 - qemu-0.11.0/hw/stellaris.c | 1464 -- qemu-0.11.0/hw/stellaris_enet.c | 426 - qemu-0.11.0/hw/stellaris_input.c | 91 - qemu-0.11.0/hw/sun4c_intctl.c | 218 - qemu-0.11.0/hw/sun4m.c | 1631 -- qemu-0.11.0/hw/sun4m.h | 66 - qemu-0.11.0/hw/sun4u.c | 644 - qemu-0.11.0/hw/syborg.c | 112 - qemu-0.11.0/hw/syborg.h | 18 - qemu-0.11.0/hw/syborg_fb.c | 556 - qemu-0.11.0/hw/syborg_interrupt.c | 240 - qemu-0.11.0/hw/syborg_keyboard.c | 247 - qemu-0.11.0/hw/syborg_pointer.c | 250 - qemu-0.11.0/hw/syborg_rtc.c | 147 - qemu-0.11.0/hw/syborg_serial.c | 362 - qemu-0.11.0/hw/syborg_timer.c | 247 - qemu-0.11.0/hw/syborg_virtio.c | 285 - qemu-0.11.0/hw/sysbus.c | 172 - qemu-0.11.0/hw/sysbus.h | 62 - qemu-0.11.0/hw/tc58128.c | 182 - qemu-0.11.0/hw/tc6393xb.c | 608 - qemu-0.11.0/hw/tc6393xb_template.h | 69 - qemu-0.11.0/hw/tcx.c | 717 - qemu-0.11.0/hw/tmp105.c | 254 - qemu-0.11.0/hw/tosa.c | 276 - qemu-0.11.0/hw/tsc2005.c | 593 - qemu-0.11.0/hw/tsc210x.c | 1293 -- qemu-0.11.0/hw/tusb6010.c | 768 - qemu-0.11.0/hw/twl92230.c | 907 - qemu-0.11.0/hw/unin_pci.c | 273 - qemu-0.11.0/hw/usb-bt.c | 645 - qemu-0.11.0/hw/usb-hid.c | 916 - qemu-0.11.0/hw/usb-hub.c | 552 - qemu-0.11.0/hw/usb-msd.c | 582 - qemu-0.11.0/hw/usb-musb.c | 1449 -- qemu-0.11.0/hw/usb-net.c | 1478 -- qemu-0.11.0/hw/usb-ohci.c | 1759 -- qemu-0.11.0/hw/usb-serial.c | 592 - qemu-0.11.0/hw/usb-uhci.c | 1141 -- qemu-0.11.0/hw/usb-wacom.c | 412 - qemu-0.11.0/hw/usb.c | 231 - qemu-0.11.0/hw/usb.h | 299 - qemu-0.11.0/hw/versatile_pci.c | 170 - qemu-0.11.0/hw/versatilepb.c | 340 - qemu-0.11.0/hw/vga.c | 2614 --- qemu-0.11.0/hw/vga_int.h | 221 - qemu-0.11.0/hw/vga_template.h | 525 - qemu-0.11.0/hw/virtio-balloon.c | 192 - qemu-0.11.0/hw/virtio-balloon.h | 40 - qemu-0.11.0/hw/virtio-blk.c | 450 - qemu-0.11.0/hw/virtio-blk.h | 91 - qemu-0.11.0/hw/virtio-console.c | 143 - qemu-0.11.0/hw/virtio-console.h | 19 - qemu-0.11.0/hw/virtio-net.c | 757 - qemu-0.11.0/hw/virtio-net.h | 156 - qemu-0.11.0/hw/virtio-pci.c | 547 - qemu-0.11.0/hw/virtio.c | 722 - qemu-0.11.0/hw/virtio.h | 169 - qemu-0.11.0/hw/vmmouse.c | 288 - qemu-0.11.0/hw/vmport.c | 108 - qemu-0.11.0/hw/vmware_vga.c | 1242 -- qemu-0.11.0/hw/watchdog.c | 134 - qemu-0.11.0/hw/watchdog.h | 63 - qemu-0.11.0/hw/wdt_i6300esb.c | 468 - qemu-0.11.0/hw/wdt_ib700.c | 110 - qemu-0.11.0/hw/wm8750.c | 742 - qemu-0.11.0/hw/xen.h | 21 - qemu-0.11.0/hw/xen_backend.c | 714 - qemu-0.11.0/hw/xen_backend.h | 107 - qemu-0.11.0/hw/xen_blkif.h | 103 - qemu-0.11.0/hw/xen_common.h | 34 - qemu-0.11.0/hw/xen_console.c | 269 - qemu-0.11.0/hw/xen_devconfig.c | 171 - qemu-0.11.0/hw/xen_disk.c | 785 - qemu-0.11.0/hw/xen_domainbuild.c | 294 - qemu-0.11.0/hw/xen_domainbuild.h | 13 - qemu-0.11.0/hw/xen_machine_pv.c | 125 - qemu-0.11.0/hw/xen_nic.c | 407 - qemu-0.11.0/hw/xenfb.c | 1012 - qemu-0.11.0/hw/xilinx.h | 50 - qemu-0.11.0/hw/xilinx_ethlite.c | 251 - qemu-0.11.0/hw/xilinx_intc.c | 179 - qemu-0.11.0/hw/xilinx_timer.c | 242 - qemu-0.11.0/hw/xilinx_uartlite.c | 218 - qemu-0.11.0/hw/zaurus.c | 277 - qemu-0.11.0/hxtool | 44 - qemu-0.11.0/i386-dis.c | 6559 ------- qemu-0.11.0/i386.ld | 142 - qemu-0.11.0/ia64.ld | 211 - qemu-0.11.0/ioport-user.c | 60 - qemu-0.11.0/ioport.c | 259 - qemu-0.11.0/ioport.h | 57 - qemu-0.11.0/keymaps.c | 192 - qemu-0.11.0/keymaps.h | 60 - qemu-0.11.0/kqemu.c | 998 - qemu-0.11.0/kqemu.h | 154 - qemu-0.11.0/kvm-all.c | 1029 -- qemu-0.11.0/kvm.h | 141 - qemu-0.11.0/libfdt_env.h | 40 - qemu-0.11.0/linux-user/alpha/syscall.h | 41 - qemu-0.11.0/linux-user/alpha/syscall_nr.h | 413 - qemu-0.11.0/linux-user/alpha/target_signal.h | 29 - qemu-0.11.0/linux-user/alpha/termbits.h | 264 - qemu-0.11.0/linux-user/arm/nwfpe/double_cpdo.c | 296 - qemu-0.11.0/linux-user/arm/nwfpe/extended_cpdo.c | 273 - qemu-0.11.0/linux-user/arm/nwfpe/fpa11.c | 238 - qemu-0.11.0/linux-user/arm/nwfpe/fpa11.h | 131 - qemu-0.11.0/linux-user/arm/nwfpe/fpa11.inl | 51 - qemu-0.11.0/linux-user/arm/nwfpe/fpa11_cpdo.c | 113 - qemu-0.11.0/linux-user/arm/nwfpe/fpa11_cpdt.c | 382 - qemu-0.11.0/linux-user/arm/nwfpe/fpa11_cprt.c | 284 - qemu-0.11.0/linux-user/arm/nwfpe/fpopcode.c | 113 - qemu-0.11.0/linux-user/arm/nwfpe/fpopcode.h | 390 - qemu-0.11.0/linux-user/arm/nwfpe/fpsr.h | 108 - qemu-0.11.0/linux-user/arm/nwfpe/single_cpdo.c | 253 - qemu-0.11.0/linux-user/arm/syscall.h | 42 - qemu-0.11.0/linux-user/arm/syscall_nr.h | 367 - qemu-0.11.0/linux-user/arm/target_signal.h | 29 - qemu-0.11.0/linux-user/arm/termbits.h | 216 - qemu-0.11.0/linux-user/cris/syscall.h | 36 - qemu-0.11.0/linux-user/cris/syscall_nr.h | 335 - qemu-0.11.0/linux-user/cris/target_signal.h | 29 - qemu-0.11.0/linux-user/cris/termbits.h | 213 - qemu-0.11.0/linux-user/elfload.c | 2596 --- qemu-0.11.0/linux-user/elfload32.c | 30 - qemu-0.11.0/linux-user/envlist.c | 247 - qemu-0.11.0/linux-user/envlist.h | 22 - qemu-0.11.0/linux-user/errno_defs.h | 141 - qemu-0.11.0/linux-user/flat.h | 67 - qemu-0.11.0/linux-user/flatload.c | 813 - qemu-0.11.0/linux-user/i386/syscall.h | 146 - qemu-0.11.0/linux-user/i386/syscall_nr.h | 337 - qemu-0.11.0/linux-user/i386/target_signal.h | 29 - qemu-0.11.0/linux-user/i386/termbits.h | 226 - qemu-0.11.0/linux-user/ioctls.h | 316 - qemu-0.11.0/linux-user/linux_loop.h | 95 - qemu-0.11.0/linux-user/linuxload.c | 217 - qemu-0.11.0/linux-user/m68k-sim.c | 170 - qemu-0.11.0/linux-user/m68k/syscall.h | 21 - qemu-0.11.0/linux-user/m68k/syscall_nr.h | 330 - qemu-0.11.0/linux-user/m68k/target_signal.h | 29 - qemu-0.11.0/linux-user/m68k/termbits.h | 227 - qemu-0.11.0/linux-user/main.c | 2921 --- qemu-0.11.0/linux-user/microblaze/syscall.h | 45 - qemu-0.11.0/linux-user/microblaze/syscall_nr.h | 369 - qemu-0.11.0/linux-user/microblaze/target_signal.h | 29 - qemu-0.11.0/linux-user/microblaze/termbits.h | 213 - qemu-0.11.0/linux-user/mips/syscall.h | 227 - qemu-0.11.0/linux-user/mips/syscall_nr.h | 334 - qemu-0.11.0/linux-user/mips/target_signal.h | 29 - qemu-0.11.0/linux-user/mips/termbits.h | 245 - qemu-0.11.0/linux-user/mips64/syscall.h | 221 - qemu-0.11.0/linux-user/mips64/syscall_nr.h | 293 - qemu-0.11.0/linux-user/mips64/target_signal.h | 29 - qemu-0.11.0/linux-user/mips64/termbits.h | 245 - qemu-0.11.0/linux-user/mipsn32/syscall.h | 221 - qemu-0.11.0/linux-user/mipsn32/syscall_nr.h | 297 - qemu-0.11.0/linux-user/mipsn32/target_signal.h | 29 - qemu-0.11.0/linux-user/mipsn32/termbits.h | 245 - qemu-0.11.0/linux-user/mmap.c | 658 - qemu-0.11.0/linux-user/path.c | 159 - qemu-0.11.0/linux-user/ppc/syscall.h | 64 - qemu-0.11.0/linux-user/ppc/syscall_nr.h | 334 - qemu-0.11.0/linux-user/ppc/target_signal.h | 29 - qemu-0.11.0/linux-user/ppc/termbits.h | 236 - qemu-0.11.0/linux-user/qemu-types.h | 24 - qemu-0.11.0/linux-user/qemu.h | 445 - qemu-0.11.0/linux-user/sh4/syscall.h | 12 - qemu-0.11.0/linux-user/sh4/syscall_nr.h | 336 - qemu-0.11.0/linux-user/sh4/target_signal.h | 29 - qemu-0.11.0/linux-user/sh4/termbits.h | 274 - qemu-0.11.0/linux-user/signal.c | 4150 ----- qemu-0.11.0/linux-user/socket.h | 147 - qemu-0.11.0/linux-user/sparc/syscall.h | 9 - qemu-0.11.0/linux-user/sparc/syscall_nr.h | 287 - qemu-0.11.0/linux-user/sparc/target_signal.h | 36 - qemu-0.11.0/linux-user/sparc/termbits.h | 279 - qemu-0.11.0/linux-user/sparc64/syscall.h | 10 - qemu-0.11.0/linux-user/sparc64/syscall_nr.h | 324 - qemu-0.11.0/linux-user/sparc64/target_signal.h | 36 - qemu-0.11.0/linux-user/sparc64/termbits.h | 279 - qemu-0.11.0/linux-user/strace.c | 1351 -- qemu-0.11.0/linux-user/strace.list | 1520 -- qemu-0.11.0/linux-user/syscall.c | 6988 ------- qemu-0.11.0/linux-user/syscall_defs.h | 2140 --- qemu-0.11.0/linux-user/syscall_types.h | 116 - qemu-0.11.0/linux-user/uaccess.c | 65 - qemu-0.11.0/linux-user/vm86.c | 481 - qemu-0.11.0/linux-user/x86_64/syscall.h | 98 - qemu-0.11.0/linux-user/x86_64/syscall_nr.h | 295 - qemu-0.11.0/linux-user/x86_64/target_signal.h | 29 - qemu-0.11.0/linux-user/x86_64/termbits.h | 247 - qemu-0.11.0/loader.c | 541 - qemu-0.11.0/m68k-dis.c | 5045 ----- qemu-0.11.0/m68k-semi.c | 406 - qemu-0.11.0/m68k.ld | 177 - qemu-0.11.0/microblaze-dis.c | 844 - qemu-0.11.0/migration-exec.c | 141 - qemu-0.11.0/migration-tcp.c | 210 - qemu-0.11.0/migration.c | 342 - qemu-0.11.0/migration.h | 105 - qemu-0.11.0/mips-dis.c | 4842 ----- qemu-0.11.0/mips.ld | 225 - qemu-0.11.0/mipsel.ld | 225 - qemu-0.11.0/module.c | 80 - qemu-0.11.0/module.h | 38 - qemu-0.11.0/monitor.c | 3290 ---- qemu-0.11.0/monitor.h | 31 - qemu-0.11.0/nbd.c | 661 - qemu-0.11.0/nbd.h | 62 - qemu-0.11.0/net-checksum.c | 86 - qemu-0.11.0/net.c | 2992 --- qemu-0.11.0/net.h | 167 - qemu-0.11.0/osdep.c | 335 - qemu-0.11.0/osdep.h | 97 - qemu-0.11.0/pc-bios/Makefile | 19 - qemu-0.11.0/pc-bios/README | 51 - qemu-0.11.0/pc-bios/bamboo.dtb | Bin 3179 -> 0 bytes qemu-0.11.0/pc-bios/bamboo.dts | 234 - qemu-0.11.0/pc-bios/bios-pq/0001_bx-qemu.patch | 11 - ...te-smbios-table-to-report-memory-above-4g.patch | 55 - ...kvm-bios-generate-mptable-unconditionally.patch | 25 - ...ll-over-reporting--issues-with-32g-guests.patch | 184 - ...-memory-device-length-boundary--condition.patch | 23 - ...ios-use-preprocessor-for-pci-link-routing.patch | 73 - ...dd-26-pci-slots,-bringing-the-total-to-32.patch | 49 - .../0008_qemu-bios-provide-gpe-_l0x-methods.patch | 92 - .../0009_qemu-bios-pci-hotplug-support.patch | 128 - ...-acpi-sci-interrupt-as-connected-to-irq-9.patch | 26 - ...011_read-additional-acpi-tables-from-a-vm.patch | 150 - ...2-load-smbios-entries-and-files-from-qemu.patch | 470 - ...0013_fix-non-acpi-timer-interrupt-routing.patch | 60 - .../bios-pq/0014_add-srat-acpi-table-support.patch | 305 - .../0015_enable-power-button-even-generation.patch | 20 - ...e-correct-mask-to-size-pci-option-rom-bar.patch | 33 - ...bios-Move-QEMU_CFG-constants-to-rombios.h.patch | 59 - ...0018-bochs-bios-Make-boot-prompt-optional.patch | 68 - .../bios-pq/0019-bios-fix-multiple-calls.patch | 35 - qemu-0.11.0/pc-bios/bios-pq/HEAD | 1 - qemu-0.11.0/pc-bios/bios-pq/series | 19 - qemu-0.11.0/pc-bios/bios.bin | Bin 131072 -> 0 bytes qemu-0.11.0/pc-bios/keymaps/ar | 98 - qemu-0.11.0/pc-bios/keymaps/common | 157 - qemu-0.11.0/pc-bios/keymaps/da | 120 - qemu-0.11.0/pc-bios/keymaps/de | 114 - qemu-0.11.0/pc-bios/keymaps/de-ch | 169 - qemu-0.11.0/pc-bios/keymaps/en-gb | 119 - qemu-0.11.0/pc-bios/keymaps/en-us | 35 - qemu-0.11.0/pc-bios/keymaps/es | 105 - qemu-0.11.0/pc-bios/keymaps/et | 85 - qemu-0.11.0/pc-bios/keymaps/fi | 124 - qemu-0.11.0/pc-bios/keymaps/fo | 76 - qemu-0.11.0/pc-bios/keymaps/fr | 181 - qemu-0.11.0/pc-bios/keymaps/fr-be | 134 - qemu-0.11.0/pc-bios/keymaps/fr-ca | 50 - qemu-0.11.0/pc-bios/keymaps/fr-ch | 114 - qemu-0.11.0/pc-bios/keymaps/hr | 125 - qemu-0.11.0/pc-bios/keymaps/hu | 115 - qemu-0.11.0/pc-bios/keymaps/is | 139 - qemu-0.11.0/pc-bios/keymaps/it | 115 - qemu-0.11.0/pc-bios/keymaps/ja | 109 - qemu-0.11.0/pc-bios/keymaps/lt | 57 - qemu-0.11.0/pc-bios/keymaps/lv | 128 - qemu-0.11.0/pc-bios/keymaps/mk | 101 - qemu-0.11.0/pc-bios/keymaps/modifiers | 18 - qemu-0.11.0/pc-bios/keymaps/nl | 59 - qemu-0.11.0/pc-bios/keymaps/nl-be | 3 - qemu-0.11.0/pc-bios/keymaps/no | 119 - qemu-0.11.0/pc-bios/keymaps/pl | 122 - qemu-0.11.0/pc-bios/keymaps/pt | 113 - qemu-0.11.0/pc-bios/keymaps/pt-br | 69 - qemu-0.11.0/pc-bios/keymaps/ru | 109 - qemu-0.11.0/pc-bios/keymaps/sl | 110 - qemu-0.11.0/pc-bios/keymaps/sv | 81 - qemu-0.11.0/pc-bios/keymaps/th | 131 - qemu-0.11.0/pc-bios/keymaps/tr | 123 - qemu-0.11.0/pc-bios/mpc8544ds.dtb | Bin 12288 -> 0 bytes qemu-0.11.0/pc-bios/mpc8544ds.dts | 122 - qemu-0.11.0/pc-bios/multiboot.bin | Bin 512 -> 0 bytes qemu-0.11.0/pc-bios/ohw.diff | 1843 -- qemu-0.11.0/pc-bios/openbios-ppc | Bin 270952 -> 0 bytes qemu-0.11.0/pc-bios/openbios-sparc32 | Bin 238212 -> 0 bytes qemu-0.11.0/pc-bios/openbios-sparc64 | Bin 476064 -> 0 bytes qemu-0.11.0/pc-bios/optionrom/Makefile | 48 - qemu-0.11.0/pc-bios/optionrom/multiboot.S | 208 - qemu-0.11.0/pc-bios/optionrom/signrom.sh | 46 - qemu-0.11.0/pc-bios/petalogix-s3adsp1800.dtb | Bin 8259 -> 0 bytes qemu-0.11.0/pc-bios/ppc_rom.bin | Bin 524288 -> 0 bytes qemu-0.11.0/pc-bios/pxe-e1000.bin | Bin 32768 -> 0 bytes qemu-0.11.0/pc-bios/pxe-ne2k_pci.bin | Bin 32768 -> 0 bytes qemu-0.11.0/pc-bios/pxe-pcnet.bin | Bin 32768 -> 0 bytes qemu-0.11.0/pc-bios/pxe-rtl8139.bin | Bin 32768 -> 0 bytes qemu-0.11.0/pc-bios/vgabios-cirrus.bin | Bin 35840 -> 0 bytes qemu-0.11.0/pc-bios/vgabios-pq/HEAD | 1 - qemu-0.11.0/pc-bios/vgabios.bin | Bin 38400 -> 0 bytes qemu-0.11.0/pc-bios/video.x | Bin 12192 -> 0 bytes qemu-0.11.0/pci-ids.txt | 31 - qemu-0.11.0/posix-aio-compat.c | 433 - qemu-0.11.0/posix-aio-compat.h | 68 - qemu-0.11.0/ppc-dis.c | 5411 ------ qemu-0.11.0/ppc.ld | 228 - qemu-0.11.0/ppc64.ld | 226 - qemu-0.11.0/qemu-aio.h | 46 - qemu-0.11.0/qemu-binfmt-conf.sh | 59 - qemu-0.11.0/qemu-char.c | 2320 --- qemu-0.11.0/qemu-char.h | 103 - qemu-0.11.0/qemu-common.h | 231 - qemu-0.11.0/qemu-doc.texi | 2347 --- qemu-0.11.0/qemu-img-cmds.hx | 47 - qemu-0.11.0/qemu-img.c | 1068 -- qemu-0.11.0/qemu-img.texi | 161 - qemu-0.11.0/qemu-io.c | 1480 -- qemu-0.11.0/qemu-lock.h | 247 - qemu-0.11.0/qemu-log.h | 93 - qemu-0.11.0/qemu-malloc.c | 95 - qemu-0.11.0/qemu-monitor.hx | 661 - qemu-0.11.0/qemu-nbd.c | 479 - qemu-0.11.0/qemu-nbd.texi | 66 - qemu-0.11.0/qemu-option.c | 362 - qemu-0.11.0/qemu-option.h | 69 - qemu-0.11.0/qemu-options.hx | 1672 -- qemu-0.11.0/qemu-sockets.c | 417 - qemu-0.11.0/qemu-tech.texi | 687 - qemu-0.11.0/qemu-thread.c | 163 - qemu-0.11.0/qemu-thread.h | 40 - qemu-0.11.0/qemu-timer.h | 48 - qemu-0.11.0/qemu-tool.c | 90 - qemu-0.11.0/qemu.sasl | 34 - qemu-0.11.0/qemu_socket.h | 50 - qemu-0.11.0/readline.c | 475 - qemu-0.11.0/readline.h | 55 - qemu-0.11.0/rules.mak | 19 - qemu-0.11.0/s390-dis.c | 1704 -- qemu-0.11.0/s390.ld | 203 - qemu-0.11.0/savevm.c | 1281 -- qemu-0.11.0/sdl.c | 879 - qemu-0.11.0/sdl_keysym.h | 277 - qemu-0.11.0/sdl_zoom.c | 95 - qemu-0.11.0/sdl_zoom.h | 25 - qemu-0.11.0/sdl_zoom_template.h | 225 - qemu-0.11.0/serialice.c | 1304 -- qemu-0.11.0/serialice.h | 73 - qemu-0.11.0/serialice_banner.h |19237 -------------------- qemu-0.11.0/sh4-dis.c | 2095 --- qemu-0.11.0/slirp/COPYRIGHT | 61 - qemu-0.11.0/slirp/bootp.c | 312 - qemu-0.11.0/slirp/bootp.h | 122 - qemu-0.11.0/slirp/cksum.c | 137 - qemu-0.11.0/slirp/debug.h | 34 - qemu-0.11.0/slirp/if.c | 209 - qemu-0.11.0/slirp/if.h | 25 - qemu-0.11.0/slirp/ip.h | 253 - qemu-0.11.0/slirp/ip_icmp.c | 350 - qemu-0.11.0/slirp/ip_icmp.h | 161 - qemu-0.11.0/slirp/ip_input.c | 684 - qemu-0.11.0/slirp/ip_output.c | 172 - qemu-0.11.0/slirp/libslirp.h | 54 - qemu-0.11.0/slirp/main.h | 48 - qemu-0.11.0/slirp/mbuf.c | 218 - qemu-0.11.0/slirp/mbuf.h | 127 - qemu-0.11.0/slirp/misc.c | 454 - qemu-0.11.0/slirp/misc.h | 77 - qemu-0.11.0/slirp/sbuf.c | 181 - qemu-0.11.0/slirp/sbuf.h | 30 - qemu-0.11.0/slirp/slirp.c | 1103 -- qemu-0.11.0/slirp/slirp.h | 361 - qemu-0.11.0/slirp/slirp_config.h | 203 - qemu-0.11.0/slirp/socket.c | 728 - qemu-0.11.0/slirp/socket.h | 95 - qemu-0.11.0/slirp/tcp.h | 164 - qemu-0.11.0/slirp/tcp_input.c | 1492 -- qemu-0.11.0/slirp/tcp_output.c | 492 - qemu-0.11.0/slirp/tcp_subr.c | 914 - qemu-0.11.0/slirp/tcp_timer.c | 292 - qemu-0.11.0/slirp/tcp_timer.h | 127 - qemu-0.11.0/slirp/tcp_var.h | 161 - qemu-0.11.0/slirp/tcpip.h | 77 - qemu-0.11.0/slirp/tftp.c | 401 - qemu-0.11.0/slirp/tftp.h | 43 - qemu-0.11.0/slirp/udp.c | 646 - qemu-0.11.0/slirp/udp.h | 86 - qemu-0.11.0/softmmu-semi.h | 70 - qemu-0.11.0/softmmu_defs.h | 22 - qemu-0.11.0/softmmu_exec.h | 134 - qemu-0.11.0/softmmu_header.h | 198 - qemu-0.11.0/softmmu_template.h | 366 - qemu-0.11.0/sparc-dis.c | 3253 ---- qemu-0.11.0/sparc.ld | 131 - qemu-0.11.0/sparc64.ld | 139 - qemu-0.11.0/sys-queue.h | 343 - qemu-0.11.0/sysemu.h | 295 - qemu-0.11.0/tap-win32.c | 688 - qemu-0.11.0/target-alpha/STATUS | 28 - qemu-0.11.0/target-alpha/cpu.h | 460 - qemu-0.11.0/target-alpha/exec.h | 65 - qemu-0.11.0/target-alpha/helper.c | 437 - qemu-0.11.0/target-alpha/helper.h | 131 - qemu-0.11.0/target-alpha/op_helper.c | 1198 -- qemu-0.11.0/target-alpha/translate.c | 2516 --- qemu-0.11.0/target-arm/cpu.h | 449 - qemu-0.11.0/target-arm/exec.h | 62 - qemu-0.11.0/target-arm/helper.c | 2632 --- qemu-0.11.0/target-arm/helpers.h | 458 - qemu-0.11.0/target-arm/iwmmxt_helper.c | 681 - qemu-0.11.0/target-arm/machine.c | 191 - qemu-0.11.0/target-arm/neon_helper.c | 1457 -- qemu-0.11.0/target-arm/op_addsub.h | 103 - qemu-0.11.0/target-arm/op_helper.c | 555 - qemu-0.11.0/target-arm/translate.c | 9004 --------- qemu-0.11.0/target-cris/cpu.h | 258 - qemu-0.11.0/target-cris/crisv32-decode.h | 128 - qemu-0.11.0/target-cris/exec.h | 58 - qemu-0.11.0/target-cris/helper.c | 201 - qemu-0.11.0/target-cris/helper.h | 26 - qemu-0.11.0/target-cris/machine.c | 90 - qemu-0.11.0/target-cris/mmu.c | 364 - qemu-0.11.0/target-cris/mmu.h | 17 - qemu-0.11.0/target-cris/op_helper.c | 651 - qemu-0.11.0/target-cris/opcode-cris.h | 365 - qemu-0.11.0/target-cris/translate.c | 3484 ---- qemu-0.11.0/target-i386/TODO | 33 - qemu-0.11.0/target-i386/cpu.h | 921 - qemu-0.11.0/target-i386/exec.h | 375 - qemu-0.11.0/target-i386/helper.c | 1865 -- qemu-0.11.0/target-i386/helper.h | 218 - qemu-0.11.0/target-i386/helper_template.h | 334 - qemu-0.11.0/target-i386/kvm.c | 959 - qemu-0.11.0/target-i386/machine.c | 385 - qemu-0.11.0/target-i386/op_helper.c | 5730 ------ qemu-0.11.0/target-i386/ops_sse.h | 2031 --- qemu-0.11.0/target-i386/ops_sse_header.h | 342 - qemu-0.11.0/target-i386/svm.h | 222 - qemu-0.11.0/target-i386/translate.c | 7811 -------- qemu-0.11.0/target-m68k/cpu.h | 258 - qemu-0.11.0/target-m68k/exec.h | 56 - qemu-0.11.0/target-m68k/helper.c | 922 - qemu-0.11.0/target-m68k/helpers.h | 54 - qemu-0.11.0/target-m68k/m68k-qreg.h | 11 - qemu-0.11.0/target-m68k/op_helper.c | 225 - qemu-0.11.0/target-m68k/qregs.def | 13 - qemu-0.11.0/target-m68k/translate.c | 3124 ---- qemu-0.11.0/target-microblaze/cpu.h | 310 - qemu-0.11.0/target-microblaze/exec.h | 56 - qemu-0.11.0/target-microblaze/helper.c | 254 - qemu-0.11.0/target-microblaze/helper.h | 19 - qemu-0.11.0/target-microblaze/machine.c | 11 - qemu-0.11.0/target-microblaze/microblaze-decode.h | 51 - qemu-0.11.0/target-microblaze/mmu.c | 256 - qemu-0.11.0/target-microblaze/mmu.h | 87 - qemu-0.11.0/target-microblaze/op_helper.c | 215 - qemu-0.11.0/target-microblaze/translate.c | 1394 -- qemu-0.11.0/target-mips/TODO | 53 - qemu-0.11.0/target-mips/cpu.h | 610 - qemu-0.11.0/target-mips/exec.h | 95 - qemu-0.11.0/target-mips/helper.c | 618 - qemu-0.11.0/target-mips/helper.h | 272 - qemu-0.11.0/target-mips/machine.c | 308 - qemu-0.11.0/target-mips/mips-defs.h | 63 - qemu-0.11.0/target-mips/op_helper.c | 2910 --- qemu-0.11.0/target-mips/translate.c | 8648 --------- qemu-0.11.0/target-mips/translate_init.c | 580 - qemu-0.11.0/target-ppc/STATUS | 559 - qemu-0.11.0/target-ppc/cpu.h | 1594 -- qemu-0.11.0/target-ppc/exec.h | 63 - qemu-0.11.0/target-ppc/helper.c | 2842 --- qemu-0.11.0/target-ppc/helper.h | 402 - qemu-0.11.0/target-ppc/helper_regs.h | 111 - qemu-0.11.0/target-ppc/kvm.c | 204 - qemu-0.11.0/target-ppc/kvm_ppc.c | 106 - qemu-0.11.0/target-ppc/kvm_ppc.h | 17 - qemu-0.11.0/target-ppc/machine.c | 183 - qemu-0.11.0/target-ppc/mfrom_table.c | 79 - qemu-0.11.0/target-ppc/mfrom_table_gen.c | 33 - qemu-0.11.0/target-ppc/op_helper.c | 4151 ----- qemu-0.11.0/target-ppc/translate.c | 9104 --------- qemu-0.11.0/target-ppc/translate_init.c | 9752 ---------- qemu-0.11.0/target-sh4/README.sh4 | 150 - qemu-0.11.0/target-sh4/cpu.h | 320 - qemu-0.11.0/target-sh4/exec.h | 60 - qemu-0.11.0/target-sh4/helper.c | 695 - qemu-0.11.0/target-sh4/helper.h | 53 - qemu-0.11.0/target-sh4/op_helper.c | 668 - qemu-0.11.0/target-sh4/translate.c | 2037 --- qemu-0.11.0/target-sparc/TODO | 88 - qemu-0.11.0/target-sparc/cpu.h | 583 - qemu-0.11.0/target-sparc/exec.h | 57 - qemu-0.11.0/target-sparc/helper.c | 1448 -- qemu-0.11.0/target-sparc/helper.h | 162 - qemu-0.11.0/target-sparc/machine.c | 200 - qemu-0.11.0/target-sparc/op_helper.c | 3690 ---- qemu-0.11.0/target-sparc/translate.c | 4916 ----- qemu-0.11.0/targphys.h | 24 - qemu-0.11.0/tcg/LICENSE | 3 - qemu-0.11.0/tcg/README | 454 - qemu-0.11.0/tcg/TODO | 14 - qemu-0.11.0/tcg/arm/tcg-target.c | 1606 -- qemu-0.11.0/tcg/arm/tcg-target.h | 80 - qemu-0.11.0/tcg/hppa/tcg-target.c | 975 - qemu-0.11.0/tcg/hppa/tcg-target.h | 203 - qemu-0.11.0/tcg/i386/tcg-target.c | 1239 -- qemu-0.11.0/tcg/i386/tcg-target.h | 63 - qemu-0.11.0/tcg/ppc/tcg-target.c | 1537 -- qemu-0.11.0/tcg/ppc/tcg-target.h | 87 - qemu-0.11.0/tcg/ppc64/tcg-target.c | 1502 -- qemu-0.11.0/tcg/ppc64/tcg-target.h | 83 - qemu-0.11.0/tcg/sparc/tcg-target.c | 1276 -- qemu-0.11.0/tcg/sparc/tcg-target.h | 121 - qemu-0.11.0/tcg/tcg-op.h | 2165 --- qemu-0.11.0/tcg/tcg-opc.h | 257 - qemu-0.11.0/tcg/tcg-runtime.c | 68 - qemu-0.11.0/tcg/tcg.c | 2084 --- qemu-0.11.0/tcg/tcg.h | 473 - qemu-0.11.0/tcg/x86_64/tcg-target.c | 1353 -- qemu-0.11.0/tcg/x86_64/tcg-target.h | 83 - qemu-0.11.0/tests/Makefile | 108 - qemu-0.11.0/tests/alpha/Makefile | 35 - qemu-0.11.0/tests/alpha/crt.s | 26 - qemu-0.11.0/tests/alpha/hello-alpha.c | 5 - qemu-0.11.0/tests/alpha/test-cond.c | 87 - qemu-0.11.0/tests/alpha/test-ovf.c | 29 - qemu-0.11.0/tests/cris/.gdbinit | 11 - qemu-0.11.0/tests/cris/Makefile | 155 - qemu-0.11.0/tests/cris/README | 1 - qemu-0.11.0/tests/cris/check_abs.c | 39 - qemu-0.11.0/tests/cris/check_addc.c | 57 - qemu-0.11.0/tests/cris/check_addcm.c | 83 - qemu-0.11.0/tests/cris/check_addi.s | 57 - qemu-0.11.0/tests/cris/check_addiv32.s | 62 - qemu-0.11.0/tests/cris/check_addm.s | 96 - qemu-0.11.0/tests/cris/check_addo.c | 125 - qemu-0.11.0/tests/cris/check_addoq.c | 44 - qemu-0.11.0/tests/cris/check_addq.s | 47 - qemu-0.11.0/tests/cris/check_addr.s | 96 - qemu-0.11.0/tests/cris/check_addxc.s | 91 - qemu-0.11.0/tests/cris/check_addxm.s | 106 - qemu-0.11.0/tests/cris/check_addxr.s | 96 - qemu-0.11.0/tests/cris/check_andc.s | 80 - qemu-0.11.0/tests/cris/check_andm.s | 90 - qemu-0.11.0/tests/cris/check_andq.s | 46 - qemu-0.11.0/tests/cris/check_andr.s | 95 - qemu-0.11.0/tests/cris/check_asr.s | 230 - qemu-0.11.0/tests/cris/check_ba.s | 93 - qemu-0.11.0/tests/cris/check_bas.s | 102 - qemu-0.11.0/tests/cris/check_bcc.s | 197 - qemu-0.11.0/tests/cris/check_bound.c | 139 - qemu-0.11.0/tests/cris/check_boundc.s | 101 - qemu-0.11.0/tests/cris/check_boundr.s | 125 - qemu-0.11.0/tests/cris/check_btst.s | 96 - qemu-0.11.0/tests/cris/check_clearfv32.s | 19 - qemu-0.11.0/tests/cris/check_clrjmp1.s | 36 - qemu-0.11.0/tests/cris/check_cmp-2.s | 15 - qemu-0.11.0/tests/cris/check_cmpc.s | 86 - qemu-0.11.0/tests/cris/check_cmpm.s | 96 - qemu-0.11.0/tests/cris/check_cmpq.s | 75 - qemu-0.11.0/tests/cris/check_cmpr.s | 102 - qemu-0.11.0/tests/cris/check_cmpxc.s | 92 - qemu-0.11.0/tests/cris/check_cmpxm.s | 106 - qemu-0.11.0/tests/cris/check_dstep.s | 42 - qemu-0.11.0/tests/cris/check_ftag.c | 33 - .../tests/cris/check_gcctorture_pr28634-1.c | 15 - qemu-0.11.0/tests/cris/check_gcctorture_pr28634.c | 15 - qemu-0.11.0/tests/cris/check_glibc_kernelversion.c | 116 - qemu-0.11.0/tests/cris/check_hello.c | 7 - qemu-0.11.0/tests/cris/check_int64.c | 45 - qemu-0.11.0/tests/cris/check_jsr.s | 85 - qemu-0.11.0/tests/cris/check_lapc.s | 78 - qemu-0.11.0/tests/cris/check_lsl.s | 217 - qemu-0.11.0/tests/cris/check_lsr.s | 218 - qemu-0.11.0/tests/cris/check_lz.c | 49 - qemu-0.11.0/tests/cris/check_mapbrk.c | 39 - qemu-0.11.0/tests/cris/check_mcp.s | 49 - qemu-0.11.0/tests/cris/check_mmap1.c | 48 - qemu-0.11.0/tests/cris/check_mmap2.c | 48 - qemu-0.11.0/tests/cris/check_mmap3.c | 33 - qemu-0.11.0/tests/cris/check_movdelsr1.s | 33 - qemu-0.11.0/tests/cris/check_movecr.s | 37 - qemu-0.11.0/tests/cris/check_movei.s | 50 - qemu-0.11.0/tests/cris/check_movemr.s | 78 - qemu-0.11.0/tests/cris/check_movemrv32.s | 96 - qemu-0.11.0/tests/cris/check_moveq.c | 51 - qemu-0.11.0/tests/cris/check_mover.s | 28 - qemu-0.11.0/tests/cris/check_moverm.s | 45 - qemu-0.11.0/tests/cris/check_movmp.s | 131 - qemu-0.11.0/tests/cris/check_movpmv32.s | 35 - qemu-0.11.0/tests/cris/check_movpr.s | 28 - qemu-0.11.0/tests/cris/check_movprv32.s | 21 - qemu-0.11.0/tests/cris/check_movscr.s | 29 - qemu-0.11.0/tests/cris/check_movsm.s | 44 - qemu-0.11.0/tests/cris/check_movsr.s | 46 - qemu-0.11.0/tests/cris/check_movucr.s | 33 - qemu-0.11.0/tests/cris/check_movum.s | 40 - qemu-0.11.0/tests/cris/check_movur.s | 45 - qemu-0.11.0/tests/cris/check_mulv32.s | 51 - qemu-0.11.0/tests/cris/check_mulx.s | 246 - qemu-0.11.0/tests/cris/check_neg.s | 104 - qemu-0.11.0/tests/cris/check_not.s | 31 - qemu-0.11.0/tests/cris/check_openpf1.c | 38 - qemu-0.11.0/tests/cris/check_openpf2.c | 16 - qemu-0.11.0/tests/cris/check_openpf3.c | 49 - qemu-0.11.0/tests/cris/check_openpf4.c | 5 - qemu-0.11.0/tests/cris/check_openpf5.c | 56 - qemu-0.11.0/tests/cris/check_orc.s | 71 - qemu-0.11.0/tests/cris/check_orm.s | 75 - qemu-0.11.0/tests/cris/check_orq.s | 41 - qemu-0.11.0/tests/cris/check_orr.s | 84 - qemu-0.11.0/tests/cris/check_ret.s | 25 - qemu-0.11.0/tests/cris/check_scc.s | 95 - qemu-0.11.0/tests/cris/check_settls1.c | 39 - qemu-0.11.0/tests/cris/check_sigalrm.c | 26 - qemu-0.11.0/tests/cris/check_stat1.c | 16 - qemu-0.11.0/tests/cris/check_stat2.c | 20 - qemu-0.11.0/tests/cris/check_stat3.c | 25 - qemu-0.11.0/tests/cris/check_stat4.c | 27 - qemu-0.11.0/tests/cris/check_subc.s | 87 - qemu-0.11.0/tests/cris/check_subm.s | 96 - qemu-0.11.0/tests/cris/check_subq.s | 52 - qemu-0.11.0/tests/cris/check_subr.s | 102 - qemu-0.11.0/tests/cris/check_swap.c | 76 - qemu-0.11.0/tests/cris/check_time1.c | 46 - qemu-0.11.0/tests/cris/check_time2.c | 18 - qemu-0.11.0/tests/cris/check_xarith.s | 72 - qemu-0.11.0/tests/cris/crisutils.h | 71 - qemu-0.11.0/tests/cris/crt.s | 13 - qemu-0.11.0/tests/cris/sys.c | 51 - qemu-0.11.0/tests/cris/sys.h | 16 - qemu-0.11.0/tests/cris/testutils.inc | 117 - qemu-0.11.0/tests/hello-arm.c | 113 - qemu-0.11.0/tests/hello-i386.c | 26 - qemu-0.11.0/tests/hello-mips.c | 64 - qemu-0.11.0/tests/linux-test.c | 535 - qemu-0.11.0/tests/pi_10.com | Bin 54 -> 0 bytes qemu-0.11.0/tests/qruncom.c | 284 - qemu-0.11.0/tests/runcom.c | 195 - qemu-0.11.0/tests/sha1.c | 240 - qemu-0.11.0/tests/test-arm-iwmmxt.s | 49 - qemu-0.11.0/tests/test-i386-code16.S | 79 - qemu-0.11.0/tests/test-i386-muldiv.h | 76 - qemu-0.11.0/tests/test-i386-shift.h | 185 - qemu-0.11.0/tests/test-i386-ssse3.c | 57 - qemu-0.11.0/tests/test-i386-vm86.S | 103 - qemu-0.11.0/tests/test-i386.c | 2759 --- qemu-0.11.0/tests/test-i386.h | 152 - qemu-0.11.0/tests/test-mmap.c | 476 - qemu-0.11.0/tests/test_path.c | 151 - qemu-0.11.0/tests/testthread.c | 51 - qemu-0.11.0/texi2pod.pl | 477 - qemu-0.11.0/thunk.c | 288 - qemu-0.11.0/thunk.h | 161 - qemu-0.11.0/tool-osdep.c | 4 - qemu-0.11.0/translate-all.c | 194 - qemu-0.11.0/uboot_image.h | 158 - qemu-0.11.0/usb-bsd.c | 612 - qemu-0.11.0/usb-linux.c | 1688 -- qemu-0.11.0/usb-stub.c | 52 - qemu-0.11.0/vgafont.h | 4611 ----- qemu-0.11.0/vl.c | 6155 ------- qemu-0.11.0/vnc-auth-sasl.c | 636 - qemu-0.11.0/vnc-auth-sasl.h | 74 - qemu-0.11.0/vnc-auth-vencrypt.c | 175 - qemu-0.11.0/vnc-auth-vencrypt.h | 33 - qemu-0.11.0/vnc-tls.c | 450 - qemu-0.11.0/vnc-tls.h | 76 - qemu-0.11.0/vnc.c | 2429 --- qemu-0.11.0/vnc.h | 319 - qemu-0.11.0/vnc_keysym.h | 324 - qemu-0.11.0/vnchextile.h | 209 - qemu-0.11.0/x86_64.ld | 171 - qemu-0.11.0/x_keymap.c | 168 - qemu-0.11.0/x_keymap.h | 32 - 1111 files changed, 1 insertions(+), 566468 deletions(-)
diff --git a/Makefile b/Makefile index 009fa23..8a77582 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,7 @@ ##
# Qemu version -VERSION=0.11.0 +VERSION=0.15.x # SerialICE revision when plain Qemu $(VERSION) was checked in. REVISION=32
diff --git a/qemu-0.11.0/.gitignore b/qemu-0.11.0/.gitignore deleted file mode 100644 index 4165e51..0000000 --- a/qemu-0.11.0/.gitignore +++ /dev/null @@ -1,45 +0,0 @@ -config-host.* -i386 -*-softmmu -*-darwin-user -*-linux-user -*-bsd-user -libhw32 -libhw64 -qemu-doc.html -qemu-tech.html -qemu-doc.info -qemu-tech.info -qemu.1 -qemu.pod -qemu-img.1 -qemu-img.pod -qemu-img -qemu-nbd -qemu-nbd.8 -qemu-nbd.pod -qemu-options.texi -qemu-img-cmds.texi -qemu-img-cmds.h -qemu-io -qemu-monitor.texi -.gdbinit -*.a -*.aux -*.cp -*.dvi -*.exe -*.fn -*.ky -*.log -*.pg -*.toc -*.tp -*.vr -*.d -*.o -.pc -patches -pc-bios/bios-pq/status -pc-bios/vgabios-pq/status -.stgit-* diff --git a/qemu-0.11.0/CODING_STYLE b/qemu-0.11.0/CODING_STYLE deleted file mode 100644 index a579cb1..0000000 --- a/qemu-0.11.0/CODING_STYLE +++ /dev/null @@ -1,78 +0,0 @@ -Qemu Coding Style -================= - -1. Whitespace - -Of course, the most important aspect in any coding style is whitespace. -Crusty old coders who have trouble spotting the glasses on their noses -can tell the difference between a tab and eight spaces from a distance -of approximately fifteen parsecs. Many a flamewar have been fought and -lost on this issue. - -QEMU indents are four spaces. Tabs are never used, except in Makefiles -where they have been irreversibly coded into the syntax. -Spaces of course are superior to tabs because: - - - You have just one way to specify whitespace, not two. Ambiguity breeds - mistakes. - - The confusion surrounding 'use tabs to indent, spaces to justify' is gone. - - Tab indents push your code to the right, making your screen seriously - unbalanced. - - Tabs will be rendered incorrectly on editors who are misconfigured not - to use tab stops of eight positions. - - Tabs are rendered badly in patches, causing off-by-one errors in almost - every line. - - It is the QEMU coding style. - -Do not leave whitespace dangling off the ends of lines. - -2. Line width - -Lines are 80 characters; not longer. - -Rationale: - - Some people like to tile their 24" screens with a 6x4 matrix of 80x24 - xterms and use vi in all of them. The best way to punish them is to - let them keep doing it. - - Code and especially patches is much more readable if limited to a sane - line length. Eighty is traditional. - - It is the QEMU coding style. - -3. Naming - -Variables are lower_case_with_underscores; easy to type and read. Structured -type names are in CamelCase; harder to type but standing out. Scalar type -names are lower_case_with_underscores_ending_with_a_t, like the POSIX -uint64_t and family. Note that this last convention contradicts POSIX -and is therefore likely to be changed. - -Typedefs are used to eliminate the redundant 'struct' keyword. It is the -QEMU coding style. - -4. Block structure - -Every indented statement is braced; even if the block contains just one -statement. The opening brace is on the line that contains the control -flow statement that introduces the new block; the closing brace is on the -same line as the else keyword, or on a line by itself if there is no else -keyword. Example: - - if (a == 5) { - printf("a was 5.\n"); - } else if (a == 6) { - printf("a was 6.\n"); - } else { - printf("a was something else entirely.\n"); - } - -An exception is the opening brace for a function; for reasons of tradition -and clarity it comes on a line by itself: - - void a_function(void) - { - do_something(); - } - -Rationale: a consistent (except for functions...) bracing style reduces -ambiguity and avoids needless churn when lines are added or removed. -Furthermore, it is the QEMU coding style. diff --git a/qemu-0.11.0/COPYING b/qemu-0.11.0/COPYING deleted file mode 100644 index 00ccfbb..0000000 --- a/qemu-0.11.0/COPYING +++ /dev/null @@ -1,339 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Lesser General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - <signature of Ty Coon>, 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. diff --git a/qemu-0.11.0/COPYING.LIB b/qemu-0.11.0/COPYING.LIB deleted file mode 100644 index 48afc2e..0000000 --- a/qemu-0.11.0/COPYING.LIB +++ /dev/null @@ -1,504 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - <one line to give the library's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - <signature of Ty Coon>, 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! - - diff --git a/qemu-0.11.0/Changelog b/qemu-0.11.0/Changelog deleted file mode 100644 index 857cbb2..0000000 --- a/qemu-0.11.0/Changelog +++ /dev/null @@ -1,638 +0,0 @@ -version 0.11.0 - - fix rtc polling mode (Bernhard Kauer) - - qcow2: order concurrent aio requests (Kevin Wolf) - - qemu-io: port to win32 (Stefan Weil) - - alpha: fix extlh instruction (Vince Weaver) - - tcg: fix size of local variables in tcg_gen_bswap64_i64 (Stefan Weil) - - net: fix send ordering (Jan Kiszka) - - escc: fix IRQ routing (Aurelien Jarno) - - versatile: fix Linux task preemption (Aurelien Jarno) - - curses: reduce memory usage by 250MB (Aurelien Jarno) - -version 0.11.0-rc2 - - mips: fix conditional move off fp conditions codes (Nath Froyd) - - fix migration to obey -S (Paolo Bonzini) - - remove pc-0-10 machine type (Mark McLoughlin) - - vnc: fix copyrect screen corruption (Gerd Hoffman) - - fix vm state change handlers running order (Markus Armbruster) - - e1000: fix eerc and ics emulation (Bill Paul) - - fix sdl zooming with pl110 (Blue Swirl) - - sparc64: flush pending conditional evaluations (Igor Kovalenko) - - esp: fix interrupt register read (Blue Swirl) - - option rom makefile fixes (Paul Brook) - - fix sparse warnings (Blue Swirl) - - fix symfind (Laurent Desnogues) - - win32: fix default prefix (Stefan Weil) - - fix checksum writing in signboot (Alex Graf) - - fix sdl window resize (Stefano Stabellini) - - do not resize the screen on hw_invalidate (Stefano Stabellini) - - Add checks for -smbios option (Beth Kon) - - fix do_set_link (Luiz Capitulino) - - fix do_commit behavior (Luiz Capitulino) - - make windows notice media change (Gleb Natapov) - - check for PR_SET_NAME being defined (Nathan Froyd) - - fix migration for ide devices (Anthony Liguori) - - Use correct depth in vmware vga (Reimar Doffiner) - - support 32bpp cursors in sdl (Reimar Doffinger) - - fix device name completion for eject (Blue Swirl) - - make screendump use DisplayState properly (Stefano Stabellini) - - fix autostart with live migration (Avi Kivity) - - fix detached migration with exec (Chris Lalancette) - - fix segv when changing vnc password in sdl (Zach Amsden) - - fix vnc password clearing with stdio monitor (Zach Amsden) - - clean up VGA type selection (Zach Amsden) - - add missing linefeed in error message (Stefan Weil) - -version 0.11.0-rc1 - - add machine aliasing support (Mark McLoughlin) - - add getfd/closefd monitor commands (Mark McLoughlin) - - use correct headers for tap-win32 (Filip Navara) - - fix live migration (Glauber Costa) - - slirp: use monotonic clock if available (Ed Swierk) - - clear msix_entries_nr on error (Michael Tsirkin) - - HPET: fix reg writes (Beth Kon) - - slirp: fix guestfwd for incoming data (Jan Kiszka) - - fix build of qemu-thread.c on win32 (Sebastian Herbszt) - - improve signrom.sh portability (Christoph Egger) - - fix qemu-img convert to copy unallocated parts of the image - (Akkarit Sangpetch) - - vmdk: fix backing file handling (Kevin Wolf) - - scsi: add save/restore support (Nolan Leake) - - fix live migration for SCSI (Nolan Leake) - - various sparc build fixes (Blue Swirl) - - fix OpenBSD build (Blue Swirl) - - only allow -cpu host when using KVM (Anthony Liguori) - - fix build breakage when !KVM (Anthony Liguori) - -version 0.10.6: - - e1000: ignore reset command (Kevin Wolf) - - fix VNC memory allocation (Stefan Weil) - - fix raw_pread_aligned return value (Christoph Hellwig) - - allow monitor interaction when using -incoming exec: (Chris Lalancette) - - fix -net socket,listen (Jan Kiszka) - - live migration: don't send gratuitous packets all at once (Gleb Natapov) - - serial: fix lost characters after sysrq (Jason Wessel) - - Fix prototype of zfree (Stefan Weil) - - Handle EINTR with exec: migration (Uri Lublin) - - Delete io-handler before closing fd after migration (Uri Lublin) - - Fix qemu_aio_flush (Andrea Arcangeli) - - lsi53c895a: Implement additional registers (Sebastian Herbszt) - - virtio-blk: fix warning (Gerd Hoffman) - - i386: fix cpu reset (Nitin Kamble) - - kvm: fix irq injection into full queue (Jan Kiszka) - - Prevent CD-ROM eject while device is locked (Mark McLoughlin) - - Fix screen dump with blank screen (Eduardo Habkost) - - Fix memory leak with cpu_unregister_map_client (Isaku Yamahata) - - Fix memory leak in SDL (Jan Kiszka) - - Fix build on OS X 10.4 (John Arbuckle) - - Fix leak of vlan clients after hot remove (Mark McLoughlin) - - Fix migration after hot remove with eepro100 (Mark McLoughlin) - - Don't start a VM after failed migration if stopped (Anthony Liguori) - - Fix live migration under heavy IO load (Glauber Costa) - - Honor -S on incoming migration (Paolo Bonzini) - - Reset HPET config register on reset (Beth Kon) - - Reset PS2 keyboard/mouse on reset (Dinesh Subraveti) - -version 0.10.5: - - kvm: trim unsupported cpu features from cpuid (Avi Kivity) - - kvm: provide a better error message for -smp > 1 (Mark McLoughlin) - - Remove initrd printfs (Richard Jones) - - Initial variables found by valgrind (Jean-Christophe Dubois) - - Fix -initrd with > 4GB guests (Glauber Costa) - - Fix busy loop on live migration for certain platforms (Uri Lublin) - - Remove GCC 3.x requirements from docs (Hollis Blanchard) - - ETRAX: fixes for kernel command line, ethernet address, bmi (Edgar Iglesias) - - CRIS: Fix bmi (Edgar Iglesias) - - Fix bounce buffer errors (Avi Kivity) - - Fix regression in -kernel (Anthony Liguori) - -version 0.10.4: - - Improve block range checks to remove integer overflow (Kevin Wolf) - - e1000: do not re-init PCI config space 0 (Amit Shah) - - fix AIO deletion race (Alex Graf) - - reset option roms on reboot (Glauber Costa) - - fix qcow2 corruption in cluster freeing (Gleb Natapov) - - Enable power button event generation (Gleb Natapov) - -version 0.10.3: - - fix AIO cancellations (Avi Kivity) - - fix live migration error path on incoming - - avoid SEGV on pci hotplug failure (Chris Wright) - - fix serial option in -drive - - support DDIM for option roms (Glauber Costa) - - avoid fork/exec on pre-2.6.27 kernels with KVM (Jan Kiszka) - - block-vpc: don't silently create smaller images than requested (Kevin Wolf) - - Fix non-ACPI timer interrupt routing (Beth Kon) - - hpet: fix emulation of HPET_TN_SETVAL (Jan Kiszka) - - kvm: fix cpuid initialization (Jan Kiszka) - - qcow2: fix corruption on little endian hosts (Kevin Wolf) - - avoid leaing memory on hot unplug (Mark McLoughlin) - - fix savevm/migration after hot unplug (Mark McLoughlin) - - Fix keyboard mapping on newer Xords with non-default keymaps (balrog) - - Make PCI config status register read-only (Anthony Liguori) - - Fix crash on resolution change -> screen dump -> vga redraw (Avi Kivity) - -version 0.10.2: - - - fix savevm/loadvm (Anthony Liguori) - - live migration: fix dirty tracking windows (Glauber Costa) - - live migration: improve error propogation (Glauber Costa) - - qcow2: fix image creation for > ~2TB images (Chris Wright) - - hotplug: fix error handling for if= parameter (Eduardo Habkost) - - qcow2: fix data corruption (Nolan Leake) - - virtio: fix guest oops with 2.6.25 kernels (Rusty Russell) - - SH4: add support for -kernel (Takashi Yoshii, Aurelien Jarno) - - hotplug: fix closing of char devices (Jan Kiszka) - - hotplug: remove incorrect check for device name (Eduardo Habkost) - - enable -k on win32 (Herve Poussineau) - - configure: use LANG=C for grep (Andreas Faerber) - - fix VGA regression (malc) - -version 0.10.1: - - - virtio-net: check right return size on sg list (Alex Williamson) - - Make qemu_announce_self handle holes (live migration after hotplug) - (Marcelo Tosatti) - - Revert r6804-r6808 (qcow2 allocation info). This series of changes added - a high cost to startup for large qcow2 images (Anthony Liguori) - - qemu-img: fix help message (Aurelien Jarno) - - Fix build for non-default installs of SDL (Anthony Liguori) - - Fix race condition in env->interrupt_request. When using TCG and a dynticks - host timer, this condition could cause TCG to get stuck in an infinite - loop (Aurelien Jarno) - - Fix reading encrypted hard disk passwords during early startup (Jan Kiszka) - - Fix encrypted disk reporting in 'info block' (Jan Kiszka) - - Fix console size with tiny displays (MusicPal) (Jan Kiszka) - - Improve error handling in bdrv_open2 (Jan Kiszka) - - Avoid leaking data in mux'ed character devices (Jan Kiszka) - - Fix initial character device reset (no banner in monitor) (Jan Kiszka) - - Fix cpuid KVM crash on i386 host (Lubomir Rintel) - - Fix SLES10sp2 installation by adding ISTAT1 register to LSI SCSI emulation - (Ryan Harper) - -version 0.10.0: - - - TCG support (No longer requires GCC 3.x) - - Kernel Virtual Machine acceleration support - - BSD userspace emulation - - Bluetooth emulation and host passthrough support - - GDB XML register description support - - Intel e1000 emulation - - HPET emulation - - VirtIO paravirtual device support - - Marvell 88w8618 / MusicPal emulation - - Nokia N-series tablet emulation / OMAP2 processor emulation - - PCI hotplug support - - Live migration and new save/restore formats - - Curses display support - - qemu-nbd utility to mount supported block formats - - Altivec support in PPC emulation and new firmware (OpenBIOS) - - Multiple VNC clients are now supported - - TLS encryption is now supported in VNC - - MIPS Magnum R4000 machine (Hervé Poussineau) - - Braille support (Samuel Thibault) - - Freecom MusicPal system emulation (Jan Kiszka) - - OMAP242x and Nokia N800, N810 machines (Andrzej Zaborowski) - - EsounD audio driver (Frederick Reeve) - - Gravis Ultrasound GF1 sound card (Tibor "TS" Schütz) - - Many, many, bug fixes and new features - -version 0.9.1: - - - TFTP booting from host directory (Anthony Liguori, Erwan Velu) - - Tap device emulation for Solaris (Sittichai Palanisong) - - Monitor multiplexing to several I/O channels (Jason Wessel) - - ds1225y nvram support (Herve Poussineau) - - CPU model selection support (J. Mayer, Paul Brook, Herve Poussineau) - - Several Sparc fixes (Aurelien Jarno, Blue Swirl, Robert Reif) - - MIPS 64-bit FPU support (Thiemo Seufer) - - Xscale PDA emulation (Andrzej Zaborowski) - - ColdFire system emulation (Paul Brook) - - Improved SH4 support (Magnus Damm) - - MIPS64 support (Aurelien Jarno, Thiemo Seufer) - - Preliminary Alpha guest support (J. Mayer) - - Read-only support for Parallels disk images (Alex Beregszaszi) - - SVM (x86 virtualization) support (Alexander Graf) - - CRIS emulation (Edgar E. Iglesias) - - SPARC32PLUS execution support (Blue Swirl) - - MIPS mipssim pseudo machine (Thiemo Seufer) - - Strace for Linux userland emulation (Stuart Anderson, Thayne Harbaugh) - - OMAP310 MPU emulation plus Palm T|E machine (Andrzej Zaborowski) - - ARM v6, v7, NEON SIMD and SMP emulation (Paul Brook/CodeSourcery) - - Gumstix boards: connex and verdex emulation (Thorsten Zitterell) - - Intel mainstone II board emulation (Armin Kuster) - - VMware SVGA II graphics card support (Andrzej Zaborowski) - -version 0.9.0: - - - Support for relative paths in backing files for disk images - - Async file I/O API - - New qcow2 disk image format - - Support of multiple VM snapshots - - Linux: specific host CDROM and floppy support - - SMM support - - Moved PCI init, MP table init and ACPI table init to Bochs BIOS - - Support for MIPS32 Release 2 instruction set (Thiemo Seufer) - - MIPS Malta system emulation (Aurelien Jarno, Stefan Weil) - - Darwin userspace emulation (Pierre d'Herbemont) - - m68k user support (Paul Brook) - - several x86 and x86_64 emulation fixes - - Mouse relative offset VNC extension (Anthony Liguori) - - PXE boot support (Anthony Liguori) - - '-daemonize' option (Anthony Liguori) - -version 0.8.2: - - - ACPI support - - PC VGA BIOS fixes - - switch to OpenBios for SPARC targets (Blue Swirl) - - VNC server fixes - - MIPS FPU support (Marius Groeger) - - Solaris/SPARC host support (Juergen Keil) - - PPC breakpoints and single stepping (Jason Wessel) - - USB updates (Paul Brook) - - UDP/TCP/telnet character devices (Jason Wessel) - - Windows sparse file support (Frediano Ziglio) - - RTL8139 NIC TCP segmentation offloading (Igor Kovalenko) - - PCNET NIC support (Antony T Curtis) - - Support for variable frequency host CPUs - - Workaround for win32 SMP hosts - - Support for AMD Flash memories (Jocelyn Mayer) - - Audio capture to WAV files support (malc) - -version 0.8.1: - - - USB tablet support (Brad Campbell, Anthony Liguori) - - win32 host serial support (Kazu) - - PC speaker support (Joachim Henke) - - IDE LBA48 support (Jens Axboe) - - SSE3 support - - Solaris port (Juergen Keil) - - Preliminary SH4 target (Samuel Tardieu) - - VNC server (Anthony Liguori) - - slirp fixes (Ed Swierk et al.) - - USB fixes - - ARM Versatile Platform Baseboard emulation (Paul Brook) - -version 0.8.0: - - - ARM system emulation: Arm Integrator/CP board with an arm1026ej-s - cpu (Paul Brook) - - SMP support - - Mac OS X cocoa improvements (Mike Kronenberg) - - Mac OS X CoreAudio driver (Mike Kronenberg) - - DirectSound driver (malc) - - ALSA audio driver (malc) - - new audio options: '-soundhw' and '-audio-help' (malc) - - ES1370 PCI audio device (malc) - - Initial USB support - - Linux host serial port access - - Linux host low level parallel port access - - New network emulation code supporting VLANs. - - MIPS and MIPSel User Linux emulation - - MIPS fixes to boot Linux (Daniel Jacobowitz) - - NX bit support - - Initial SPARC SMP support (Blue Swirl) - - Major overhaul of the virtual FAT driver for read/write support - (Johannes Schindelin) - -version 0.7.2: - - - x86_64 fixes (Win2000 and Linux 2.6 boot in 32 bit) - - merge self modifying code handling in dirty ram page mecanism. - - MIPS fixes (Ralf Baechle) - - better user net performances - -version 0.7.1: - - - read-only Virtual FAT support (Johannes Schindelin) - - Windows 2000 install disk full hack (original idea from Vladimir - N. Oleynik) - - VMDK disk image creation (Filip Navara) - - SPARC64 progress (Blue Swirl) - - initial MIPS support (Jocelyn mayer) - - MIPS improvements (Ralf Baechle) - - 64 bit fixes in user networking (initial patch by Gwenole Beauchesne) - - IOAPIC support (Filip Navara) - -version 0.7.0: - - - better BIOS translation and HDD geometry auto-detection - - user mode networking bug fix - - undocumented FPU ops support - - Cirrus VGA: support for 1280x1024x[8,15,16] modes - - 'pidfile' option - - .dmg disk image format support (Johannes Schindelin) - - keymaps support (initial patch by Johannes Schindelin) - - big endian ARM support (Lennert Buytenhek) - - added generic 64 bit target support - - x86_64 target support - - initial APIC support - - MMX/SSE/SSE2/PNI support - - PC parallel port support (Mark Jonckheere) - - initial SPARC64 support (Blue Swirl) - - SPARC target boots Linux (Blue Swirl) - - armv5te user mode support (Paul Brook) - - ARM VFP support (Paul Brook) - - ARM "Angel" semihosting syscalls (Paul Brook) - - user mode gdb stub support (Paul Brook) - - Samba 3 support - - initial Cocoa support (Pierre d'Herbemont) - - generic FPU emulation code - - Virtual PC read-only disk image support (Alex Beregszaszi) - -version 0.6.1: - - - Mac OS X port (Pierre d'Herbemont) - - Virtual console support - - Better monitor line edition - - New block device layer - - New 'qcow' growable disk image support with AES encryption and - transparent decompression - - VMware 3 and 4 read-only disk image support (untested) - - Support for up to 4 serial ports - - TFTP server support (Magnus Damm) - - Port redirection support in user mode networking - - Support for not executable data sections - - Compressed loop disk image support (Johannes Schindelin) - - Level triggered IRQ fix (aka NE2000 PCI performance fix) (Steve - Wormley) - - Fixed Fedora Core 2 problems (now you can run qemu without any - LD_ASSUME_KERNEL tricks on FC2) - - DHCP fix for Windows (accept DHCPREQUEST alone) - - SPARC system emulation (Blue Swirl) - - Automatic Samba configuration for host file access from Windows. - - '-loadvm' and '-full-screen' options - - ne2000 savevm support (Johannes Schindelin) - - Ctrl-Alt is now the default grab key. Ctrl-Alt-[0-9] switches to - the virtual consoles. - - BIOS floppy fix for NT4 (Mike Nordell, Derek Fawcus, Volker Ruppert) - - Floppy fixes for NT4 and NT5 (Mike Nordell) - - NT4 IDE fixes (Ben Pfaf, Mike Nordell) - - SDL Audio support and SB16 fixes (malc) - - ENTER instruction bug fix (initial patch by Stefan Kisdaroczi) - - VGA font change fix - - VGA read-only CRTC register fix - -version 0.6.0: - - - minimalist FPU exception support (NetBSD FPU probe fix) - - cr0.ET fix (Win95 boot) - - *BSD port (Markus Niemisto) - - I/O access fix (signaled by Mark Jonckheere) - - IDE drives serial number fix (Mike Nordell) - - int13 CDROM BIOS fix (aka Solaris x86 install CD fix) - - int15, ah=86 BIOS fix (aka Solaris x86 hardware probe hang up fix) - - BSR/BSF "undefined behaviour" fix - - vmdk2raw: convert VMware disk images to raw images - - PCI support - - NE2K PCI support - - dummy VGA PCI support - - VGA font selection fix (Daniel Serpell) - - PIC reset fix (Hidemi KAWAI) - - PIC spurious irq support (aka Solaris install bug) - - added '-localtime' option - - Cirrus CL-GD54xx VGA support (initial patch by Makoto Suzuki (suzu)) - - APM and system shutdown support - - Fixed system reset - - Support for other PC BIOSes - - Initial PowerMac hardware emulation - - PowerMac/PREP OpenFirmware compatible BIOS (Jocelyn Mayer) - - initial IDE BMDMA support (needed for Darwin x86) - - Set the default memory size for PC emulation to 128 MB - -version 0.5.5: - - - SDL full screen support (initial patch by malc) - - VGA support on PowerPC PREP - - VBE fixes (Matthew Mastracci) - - PIT fixes (aka Win98 hardware probe and "VGA slowness" bug) - - IDE master only fixes (aka Win98 CD-ROM probe bug) - - ARM load/store half word fix (Ulrich Hecht) - - FDC fixes for Win98 - -version 0.5.4: - - - qemu-fast fixes - - BIOS area protection fix (aka EMM386.EXE fix) (Mike Nordell) - - keyboard/mouse fix (Mike Nordell) - - IDE fixes (Linux did not recognized slave drivers) - - VM86 EIP masking fix (aka NT5 install fix) (Mike Nordell) - - QEMU can now boot a PowerPC Linux kernel (Jocelyn Mayer) - - User mode network stack - - imul imm8 fix + 0x82 opcode support (Hidemi KAWAI) - - precise self modifying code (aka BeOS install bug) - -version 0.5.3: - - - added Bochs VESA VBE support - - VGA memory map mode 3 access fix (OS/2 install fix) - - IDE fixes (Jens Axboe) - - CPU interrupt fixes - - fixed various TLB invalidation cases (NT install) - - fixed cr0.WP semantics (XP install) - - direct chaining support for SPARC and PowerPC (faster) - - ARM NWFPE support (initial patch by Ulrich Hecht) - - added specific x86 to x86 translator (close to native performance - in qemu-i386 and qemu-fast) - - shm syscalls support (Paul McKerras) - - added accurate CR0.MP/ME/TS emulation - - fixed DMA memory write access (Win95 boot floppy fix) - - graphical x86 linux loader - - command line monitor - - generic removable device support - - support of CD-ROM change - - multiple network interface support - - initial x86-64 host support (Gwenole Beauchesne) - - lret to outer priviledge fix (OS/2 install fix) - - task switch fixes (SkyOS boot) - - VM save/restore commands - - new timer API - - more precise RTC emulation (periodic timers + time updates) - - Win32 port (initial patch by Kazu) - -version 0.5.2: - - - improved soft MMU speed (assembly functions and specializing) - - improved multitasking speed by avoiding flushing TBs when - switching tasks - - improved qemu-fast speed - - improved self modifying code handling (big performance gain in - softmmu mode). - - fixed IO checking - - fixed CD-ROM detection (win98 install CD) - - fixed addseg real mode bug (GRUB boot fix) - - added ROM memory support (win98 boot) - - fixed 'call Ev' in case of paging exception - - updated the script 'qemu-binfmt-conf.sh' to use QEMU automagically - when launching executables for the supported target CPUs. - - PowerPC system emulation update (Jocelyn Mayer) - - PC floppy emulation and DMA fixes (Jocelyn Mayer) - - polled mode for PIC (Jocelyn Mayer) - - fixed PTE dirty bit handling - - fixed xadd same reg bug - - fixed cmpxchg exception safeness - - access to virtual memory in gdb stub - - task gate and NT flag fixes - - eflags optimisation fix for string operations - -version 0.5.1: - - - float access fixes when using soft mmu - - PC emulation support on PowerPC - - A20 support - - IDE CD-ROM emulation - - ARM fixes (Ulrich Hecht) - - SB16 emulation (malc) - - IRET and INT fixes in VM86 mode with IOPL=3 - - Port I/Os use TSS io map - - Full task switching/task gate support - - added verr, verw, arpl, fcmovxx - - PowerPC target support (Jocelyn Mayer) - - Major SPARC target fixes (dynamically linked programs begin to work) - -version 0.5.0: - - - full hardware level VGA emulation - - graphical display with SDL - - added PS/2 mouse and keyboard emulation - - popw (%esp) fix - - mov to/from segment data width fix - - added real mode support - - added Bochs BIOS and LGPL'ed VGA BIOS loader in qemu - - m68k host port (Richard Zidlicky) - - partial soft MMU support for memory mapped I/Os - - multi-target build - - fixed: no error code in hardware interrupts - - fixed: pop ss, mov ss, x and sti disable hardware irqs for the next insn - - correct single stepping thru string operations - - preliminary SPARC target support (Thomas M. Ogrisegg) - - tun-fd option (Rusty Russell) - - automatic IDE geometry detection - - renamed 'vl' to qemu[-fast] and user qemu to qemu-{cpu}. - - added man page - - added full soft mmu mode to launch unpatched OSes. - -version 0.4.3: - - - x86 exception fix in case of nop instruction. - - gcc 3.2.2 bug workaround (RedHat 9 fix) - - sparc and Alpha host fixes - - many ARM target fixes: 'ls' and 'bash' can be launched. - -version 0.4.2: - - - many exception handling fixes (can compile a Linux kernel inside vl) - - IDE emulation support - - initial GDB stub support - - deferred update support for disk images (Rusty Russell) - - accept User Mode Linux Copy On Write disk images - - SMP kernels can at least be booted - -version 0.4.1: - - - more accurate timer support in vl. - - more reliable NE2000 probe in vl. - - added 2.5.66 kernel in vl-test. - - added VLTMPDIR environment variable in vl. - -version 0.4: - - - initial support for ring 0 x86 processor emulation - - fixed signal handling for correct dosemu DPMI emulation - - fast x86 MMU emulation with mmap() - - fixed popl (%esp) case - - Linux kernel can be executed by QEMU with the 'vl' command. - -version 0.3: - - - initial support for ARM emulation - - added fnsave, frstor, fnstenv, fldenv FPU instructions - - added FPU register save in signal emulation - - initial ARM port - - Sparc and Alpha ports work on the regression test - - generic ioctl number conversion - - fixed ioctl type conversion - -version 0.2: - - - PowerPC disassembly and ELF symbols output (Rusty Russell) - - flock support (Rusty Russell) - - ugetrlimit support (Rusty Russell) - - fstat64 fix (Rusty Russell) - - initial Alpha port (Falk Hueffner) - - initial IA64 port (Matt Wilson) - - initial Sparc and Sparc64 port (David S. Miller) - - added HLT instruction - - LRET instruction fix. - - added GPF generation for I/Os. - - added INT3 and TF flag support. - - SHL instruction C flag fix. - - mmap emulation for host page size > 4KB - - self-modifying code support - - better VM86 support (dosemu works on non trivial programs) - - precise exception support (EIP is computed correctly in most cases) - - more precise LDT/GDT/IDT emulation - - faster segment load in vm86 mode - - direct chaining of basic blocks (faster emulation) - -version 0.1.6: - - - automatic library search system. QEMU can now work with unpatched - ELF dynamic loader and libc (Rusty Russell). - - ISO C warning fixes (Alistair Strachan) - - first self-virtualizable version (works only as long as the - translation cache is not flushed) - - RH9 fixes - -version 0.1.5: - - - ppc64 support + personality() patch (Rusty Russell) - - first Alpha CPU patches (Falk Hueffner) - - removed bfd.h dependancy - - fixed shrd, shld, idivl and divl on PowerPC. - - fixed buggy glibc PowerPC rint() function (test-i386 passes now on PowerPC). - -version 0.1.4: - - - more accurate VM86 emulation (can launch small DOS 16 bit - executables in wine). - - fixed push/pop fs/gs - - added iret instruction. - - added times() syscall and SIOCATMARK ioctl. - -version 0.1.3: - - - S390 support (Ulrich Weigand) - - glibc 2.3.x compile fix (Ulrich Weigand) - - socketcall endian fix (Ulrich Weigand) - - struct sockaddr endian fix (Ulrich Weigand) - - sendmsg/recvmsg endian fix (Ulrich Weigand) - - execve endian fix (Ulrich Weigand) - - fdset endian fix (Ulrich Weigand) - - partial setsockopt syscall support (Ulrich Weigand) - - more accurate pushf/popf emulation - - first partial vm86() syscall support (can be used with runcom example). - - added bound, cmpxchg8b, cpuid instructions - - added 16 bit addressing support/override for string operations - - poll() fix - -version 0.1.2: - - - compile fixes - - xlat instruction - - xchg instruction memory lock - - added simple vm86 example (not working with QEMU yet). The 54 byte - DOS executable 'pi_10.com' program was released by Bertram - Felgenhauer (more information at http://www.boo.net/~jasonp/pipage.html). - -version 0.1.1: - - - glibc 2.2 compilation fixes - - added -s and -L options - - binary distribution of x86 glibc and wine - - big endian fixes in ELF loader and getdents. - -version 0.1: - - - initial public release. diff --git a/qemu-0.11.0/LICENSE b/qemu-0.11.0/LICENSE deleted file mode 100644 index cbd92c0..0000000 --- a/qemu-0.11.0/LICENSE +++ /dev/null @@ -1,18 +0,0 @@ -The following points clarify the QEMU license: - -1) QEMU as a whole is released under the GNU General Public License - -2) Parts of QEMU have specific licenses which are compatible with the -GNU General Public License. Hence each source file contains its own -licensing information. - -In particular, the QEMU virtual CPU core library (libqemu.a) is -released under the GNU Lesser General Public License. Many hardware -device emulation sources are released under the BSD license. - -3) The Tiny Code Generator (TCG) is released under the BSD license - (see license headers in files). - -4) QEMU is a trademark of Fabrice Bellard. - -Fabrice Bellard. diff --git a/qemu-0.11.0/MAINTAINERS b/qemu-0.11.0/MAINTAINERS deleted file mode 100644 index 080e1c0..0000000 --- a/qemu-0.11.0/MAINTAINERS +++ /dev/null @@ -1,86 +0,0 @@ -QEMU Maintainers -================ - -Project leaders: ----------------- - -Fabrice Bellard -Paul Brook - -CPU cores: ----------- - -x86 Fabrice Bellard -ARM Paul Brook -SPARC Blue Swirl -MIPS Thiemo Seufer -PowerPC ? -M68K Paul Brook -SH4 ? -CRIS Edgar E. Iglesias -Alpha ? -MicroBlaze Edgar E. Iglesias - -Machines (sorted by CPU): -------------------------- - -x86 - pc.c Fabrice Bellard (new maintainer needed) -ARM - integratorcp.c Paul Brook - versatilepb.c Paul Brook - Real View Paul Brook - spitz.c Andrzej Zaborowski - palm.c Andrzej Zaborowski - nseries.c Andrzej Zaborowski - stellaris.c Paul Brook - gumstix.c Thorsten Zitterell - mainstone.c Armin Kuster - musicpal.c Jan Kiszka -SPARC - sun4u.c Blue Swirl - sun4m.c Blue Swirl -MIPS - mips_r4k.c Aurelien Jarno - mips_malta.c Aurelien Jarno - mips_jazz.c Hervé Poussineau - mips_mipssim.c Thiemo Seufer -PowerPC - ppc_prep.c ? - ppc_oldworld.c Fabrice Bellard - ppc_chrp.c Fabrice Bellard - ppc405_boards.c ? -M86K - mcf5208.c Paul Brook - an5206.c Paul Brook - dummy_m68k.c Paul Brook -SH4 - shix.c ? - r2d.c Magnus Damm -CRIS - etraxfs.c Edgar E. Iglesias - axis_dev88.c Edgar E. Iglesias -Alpha -MicroBlaze - petalogix_s3adsp1800.c Edgar E. Iglesias - -Generic Subsystems: -------------------- - -Dynamic translator Fabrice Bellard -Main loop Fabrice Bellard (new maintainer needed) -TCG Fabrice Bellard -kqemu interface Fabrice Bellard -IDE device ? -SCSI device Paul Brook -PCI layer ? -USB layer ? -Block layer ? -Graphic layer ? -Audio device layer Vassili Karpov (malc) -Character device layer ? -Network device layer ? -GDB stub ? -Linux user ? -Darwin user ? -SLIRP ? diff --git a/qemu-0.11.0/Makefile b/qemu-0.11.0/Makefile deleted file mode 100644 index f78ca75..0000000 --- a/qemu-0.11.0/Makefile +++ /dev/null @@ -1,426 +0,0 @@ -# Makefile for QEMU. - -ifneq ($(wildcard config-host.mak),) -# Put the all: rule here so that config-host.mak can contain dependencies. -all: build-all -include config-host.mak -include $(SRC_PATH)/rules.mak -else -config-host.mak: - @echo "Please call configure before running make!" - @exit 1 -endif - -.PHONY: all clean cscope distclean dvi html info install install-doc \ - recurse-all speed tar tarbin test - -VPATH=$(SRC_PATH):$(SRC_PATH)/hw - -CPPFLAGS += -I. -I$(SRC_PATH) -MMD -MP -MT $@ -CPPFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -CPPFLAGS += -U_FORTIFY_SOURCE -LIBS= -ifdef CONFIG_STATIC -LDFLAGS += -static -endif -ifdef BUILD_DOCS -DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1 qemu-nbd.8 -else -DOCS= -endif - -LIBS+=$(PTHREADLIBS) -LIBS+=$(CLOCKLIBS) - -ifdef CONFIG_SOLARIS -LIBS+=-lsocket -lnsl -lresolv -endif - -ifdef CONFIG_WIN32 -LIBS+=-lwinmm -lws2_32 -liphlpapi -endif - -build-all: $(TOOLS) $(DOCS) recurse-all - -config-host.mak: configure -ifneq ($(wildcard config-host.mak),) - @echo $@ is out-of-date, running configure - @sed -n "/.*Configured with/s/[^:]*: //p" $@ | sh -endif - -SUBDIR_MAKEFLAGS=$(if $(V),,--no-print-directory) -SUBDIR_RULES=$(patsubst %,subdir-%, $(TARGET_DIRS)) - -subdir-%: - $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" TARGET_DIR="$*/" all,) - -$(filter %-softmmu,$(SUBDIR_RULES)): libqemu_common.a -$(filter %-user,$(SUBDIR_RULES)): libqemu_user.a - - -ROMSUBDIR_RULES=$(patsubst %,romsubdir-%, $(ROMS)) -romsubdir-%: - $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C pc-bios/$* V="$(V)" TARGET_DIR="$*/",) - -ALL_SUBDIRS=$(TARGET_DIRS) $(patsubst %,pc-bios/%, $(ROMS)) - -recurse-all: $(SUBDIR_RULES) $(ROMSUBDIR_RULES) - -####################################################################### -# block-obj-y is code used by both qemu system emulation and qemu-img - -block-obj-y = cutils.o cache-utils.o qemu-malloc.o qemu-option.o module.o -block-obj-y += nbd.o block.o aio.o aes.o - -block-nested-y += cow.o qcow.o vmdk.o cloop.o dmg.o bochs.o vpc.o vvfat.o -block-nested-y += qcow2.o qcow2-refcount.o qcow2-cluster.o qcow2-snapshot.o -block-nested-y += parallels.o nbd.o - - -ifdef CONFIG_WIN32 -block-nested-y += raw-win32.o -else -ifdef CONFIG_AIO -block-obj-y += posix-aio-compat.o -endif -block-nested-y += raw-posix.o -endif - -block-nested-$(CONFIG_CURL) += curl.o - -block-obj-y += $(addprefix block/, $(block-nested-y)) - -###################################################################### -# libqemu_common.a: Target independent part of system emulation. The -# long term path is to suppress *all* target specific code in case of -# system emulation, i.e. a single QEMU executable should support all -# CPUs and machines. - -obj-y = $(block-obj-y) -obj-y += readline.o console.o - -obj-y += irq.o ptimer.o -obj-y += i2c.o smbus.o smbus_eeprom.o max7310.o max111x.o wm8750.o -obj-y += ssd0303.o ssd0323.o ads7846.o stellaris_input.o twl92230.o -obj-y += tmp105.o lm832x.o eeprom93xx.o tsc2005.o -obj-y += scsi-disk.o cdrom.o -obj-y += scsi-generic.o -obj-y += usb.o usb-hub.o usb-$(HOST_USB).o usb-hid.o usb-msd.o usb-wacom.o -obj-y += usb-serial.o usb-net.o -obj-y += sd.o ssi-sd.o -obj-y += bt.o bt-host.o bt-vhci.o bt-l2cap.o bt-sdp.o bt-hci.o bt-hid.o usb-bt.o -obj-y += bt-hci-csr.o -obj-y += buffered_file.o migration.o migration-tcp.o net.o qemu-sockets.o -obj-y += qemu-char.o aio.o net-checksum.o savevm.o -obj-y += msmouse.o ps2.o -obj-y += qdev.o qdev-properties.o ssi.o - -obj-$(CONFIG_BRLAPI) += baum.o - -ifdef CONFIG_BRLAPI -LIBS+=-lbrlapi -endif - -ifdef CONFIG_WIN32 -obj-y += tap-win32.o -else -obj-y += migration-exec.o -endif - -ifdef CONFIG_COREAUDIO -AUDIO_PT = y -endif -ifdef CONFIG_FMOD -audio/audio.o audio/fmodaudio.o: CPPFLAGS := -I$(CONFIG_FMOD_INC) $(CPPFLAGS) -endif -ifdef CONFIG_ESD -AUDIO_PT = y -AUDIO_PT_INT = y -endif -ifdef CONFIG_PA -AUDIO_PT = y -AUDIO_PT_INT = y -endif -ifdef AUDIO_PT -LDFLAGS += -pthread -endif - -audio-obj-y = audio.o noaudio.o wavaudio.o mixeng.o -audio-obj-$(CONFIG_SDL) += sdlaudio.o -audio-obj-$(CONFIG_OSS) += ossaudio.o -audio-obj-$(CONFIG_COREAUDIO) += coreaudio.o -audio-obj-$(CONFIG_ALSA) += alsaaudio.o -audio-obj-$(CONFIG_DSOUND) += dsoundaudio.o -audio-obj-$(CONFIG_FMOD) += fmodaudio.o -audio-obj-$(CONFIG_ESD) += esdaudio.o -audio-obj-$(CONFIG_PA) += paaudio.o -audio-obj-$(AUDIO_PT_INT) += audio_pt_int.o -audio-obj-y += wavcapture.o -obj-y += $(addprefix audio/, $(audio-obj-y)) - -obj-y += keymaps.o -obj-$(CONFIG_SDL) += sdl.o sdl_zoom.o x_keymap.o -obj-$(CONFIG_CURSES) += curses.o -obj-y += vnc.o acl.o d3des.o -obj-$(CONFIG_VNC_TLS) += vnc-tls.o vnc-auth-vencrypt.o -obj-$(CONFIG_VNC_SASL) += vnc-auth-sasl.o -obj-$(CONFIG_COCOA) += cocoa.o -obj-$(CONFIG_IOTHREAD) += qemu-thread.o - -ifdef CONFIG_SLIRP -CPPFLAGS+=-I$(SRC_PATH)/slirp -endif - -slirp-obj-y = cksum.o if.o ip_icmp.o ip_input.o ip_output.o -slirp-obj-y += slirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_output.o -slirp-obj-y += tcp_subr.o tcp_timer.o udp.o bootp.o tftp.o -obj-$(CONFIG_SLIRP) += $(addprefix slirp/, $(slirp-obj-y)) - -LIBS+=$(VDE_LIBS) - -# xen backend driver support -obj-$(CONFIG_XEN) += xen_backend.o xen_devconfig.o -obj-$(CONFIG_XEN) += xen_console.o xenfb.o xen_disk.o xen_nic.o - -LIBS+=$(CURL_LIBS) - -cocoa.o: cocoa.m - -keymaps.o: keymaps.c keymaps.h - -sdl_zoom.o: sdl_zoom.c sdl_zoom.h sdl_zoom_template.h - -sdl.o: sdl.c keymaps.h sdl_keysym.h sdl_zoom.h - -sdl.o audio/sdlaudio.o sdl_zoom.o baum.o: CFLAGS += $(SDL_CFLAGS) - -acl.o: acl.h acl.c - -vnc.h: vnc-tls.h vnc-auth-vencrypt.h vnc-auth-sasl.h keymaps.h - -vnc.o: vnc.c vnc.h vnc_keysym.h vnchextile.h d3des.c d3des.h acl.h - -vnc.o: CFLAGS += $(CONFIG_VNC_TLS_CFLAGS) - -vnc-tls.o: vnc-tls.c vnc.h - -vnc-auth-vencrypt.o: vnc-auth-vencrypt.c vnc.h - -vnc-auth-sasl.o: vnc-auth-sasl.c vnc.h - -curses.o: curses.c keymaps.h curses_keys.h - -bt-host.o: CFLAGS += $(CONFIG_BLUEZ_CFLAGS) - -serialice.o: serialice.c serialice.h - -serialice.o: CFLAGS += $(CONFIG_SERIALICE_CFLAGS) - -libqemu_common.a: $(obj-y) - -####################################################################### -# user-obj-y is code used by qemu userspace emulation -user-obj-y = cutils.o cache-utils.o - -libqemu_user.a: $(user-obj-y) - -###################################################################### - -qemu-img.o: qemu-img-cmds.h - -qemu-img$(EXESUF): qemu-img.o qemu-tool.o tool-osdep.o $(block-obj-y) - -qemu-nbd$(EXESUF): qemu-nbd.o qemu-tool.o tool-osdep.o $(block-obj-y) - -qemu-io$(EXESUF): qemu-io.o qemu-tool.o tool-osdep.o cmd.o $(block-obj-y) - -qemu-img$(EXESUF) qemu-nbd$(EXESUF) qemu-io$(EXESUF): LIBS += -lz - -qemu-img-cmds.h: $(SRC_PATH)/qemu-img-cmds.hx - $(call quiet-command,sh $(SRC_PATH)/hxtool -h < $< > $@," GEN $@") - -clean: -# avoid old build problems by removing potentially incorrect old files - 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 - rm -f *.o *.d *.a $(TOOLS) TAGS cscope.* *.pod *~ */*~ - rm -f slirp/*.o slirp/*.d audio/*.o audio/*.d block/*.o block/*.d - rm -f qemu-img-cmds.h - $(MAKE) -C tests clean - for d in $(ALL_SUBDIRS) libhw32 libhw64; do \ - $(MAKE) -C $$d $@ || exit 1 ; \ - done - -distclean: clean - rm -f config-host.mak config-host.h $(DOCS) qemu-options.texi qemu-img-cmds.texi - rm -f qemu-{doc,tech}.{info,aux,cp,dvi,fn,info,ky,log,pg,toc,tp,vr} - for d in $(TARGET_DIRS) libhw32 libhw64; do \ - rm -rf $$d || exit 1 ; \ - done - -KEYMAPS=da en-gb et fr fr-ch is lt modifiers no pt-br sv \ -ar de en-us fi fr-be hr it lv nl pl ru th \ -common de-ch es fo fr-ca hu ja mk nl-be pt sl tr - -ifdef INSTALL_BLOBS -BLOBS=bios.bin vgabios.bin vgabios-cirrus.bin ppc_rom.bin \ -video.x openbios-sparc32 openbios-sparc64 openbios-ppc \ -pxe-ne2k_pci.bin pxe-rtl8139.bin pxe-pcnet.bin pxe-e1000.bin \ -bamboo.dtb petalogix-s3adsp1800.dtb \ -multiboot.bin -else -BLOBS= -endif - -install-doc: $(DOCS) - $(INSTALL_DIR) "$(DESTDIR)$(docdir)" - $(INSTALL_DATA) qemu-doc.html qemu-tech.html "$(DESTDIR)$(docdir)" -ifndef CONFIG_WIN32 - $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1" - $(INSTALL_DATA) qemu.1 qemu-img.1 "$(DESTDIR)$(mandir)/man1" - $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man8" - $(INSTALL_DATA) qemu-nbd.8 "$(DESTDIR)$(mandir)/man8" -endif - -install: all $(if $(BUILD_DOCS),install-doc) - $(INSTALL_DIR) "$(DESTDIR)$(bindir)" -ifneq ($(TOOLS),) - $(INSTALL_PROG) $(STRIP_OPT) $(TOOLS) "$(DESTDIR)$(bindir)" -endif -ifneq ($(BLOBS),) - $(INSTALL_DIR) "$(DESTDIR)$(datadir)" - set -e; for x in $(BLOBS); do \ - $(INSTALL_DATA) $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \ - done -endif - $(INSTALL_DIR) "$(DESTDIR)$(datadir)/keymaps" - set -e; for x in $(KEYMAPS); do \ - $(INSTALL_DATA) $(SRC_PATH)/pc-bios/keymaps/$$x "$(DESTDIR)$(datadir)/keymaps"; \ - done - for d in $(TARGET_DIRS); do \ - $(MAKE) -C $$d $@ || exit 1 ; \ - done - -# various test targets -test speed: all - $(MAKE) -C tests $@ - -TAGS: - etags *.[ch] tests/*.[ch] block/*.[ch] hw/*.[ch] - -cscope: - rm -f ./cscope.* - find . -name "*.[ch]" -print | sed 's,^./,,' > ./cscope.files - cscope -b - -# documentation -%.html: %.texi - $(call quiet-command,texi2html -I=. -monolithic -number $<," GEN $@") - -%.info: %.texi - $(call quiet-command,makeinfo -I . $< -o $@," GEN $@") - -%.dvi: %.texi - $(call quiet-command,texi2dvi -I . $<," GEN $@") - -qemu-options.texi: $(SRC_PATH)/qemu-options.hx - $(call quiet-command,sh $(SRC_PATH)/hxtool -t < $< > $@," GEN $@") - -qemu-monitor.texi: $(SRC_PATH)/qemu-monitor.hx - $(call quiet-command,sh $(SRC_PATH)/hxtool -t < $< > $@," GEN $@") - -qemu-img-cmds.texi: $(SRC_PATH)/qemu-img-cmds.hx - $(call quiet-command,sh $(SRC_PATH)/hxtool -t < $< > $@," GEN $@") - -qemu.1: qemu-doc.texi qemu-options.texi qemu-monitor.texi - $(call quiet-command, \ - perl -Ww -- $(SRC_PATH)/texi2pod.pl $< qemu.pod && \ - pod2man --section=1 --center=" " --release=" " qemu.pod > $@, \ - " GEN $@") - -qemu-img.1: qemu-img.texi qemu-img-cmds.texi - $(call quiet-command, \ - perl -Ww -- $(SRC_PATH)/texi2pod.pl $< qemu-img.pod && \ - pod2man --section=1 --center=" " --release=" " qemu-img.pod > $@, \ - " GEN $@") - -qemu-nbd.8: qemu-nbd.texi - $(call quiet-command, \ - perl -Ww -- $(SRC_PATH)/texi2pod.pl $< qemu-nbd.pod && \ - pod2man --section=8 --center=" " --release=" " qemu-nbd.pod > $@, \ - " GEN $@") - -info: qemu-doc.info qemu-tech.info - -dvi: qemu-doc.dvi qemu-tech.dvi - -html: qemu-doc.html qemu-tech.html - -qemu-doc.dvi qemu-doc.html qemu-doc.info: qemu-img.texi qemu-nbd.texi qemu-options.texi qemu-monitor.texi qemu-img-cmds.texi - -VERSION ?= $(shell cat VERSION) -FILE = qemu-$(VERSION) - -# tar release (use 'make -k tar' on a checkouted tree) -tar: - rm -rf /tmp/$(FILE) - cp -r . /tmp/$(FILE) - cd /tmp && tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude CVS --exclude .git --exclude .svn - rm -rf /tmp/$(FILE) - -# generate a binary distribution -tarbin: - cd / && tar zcvf ~/qemu-$(VERSION)-$(ARCH).tar.gz \ - $(bindir)/qemu \ - $(bindir)/qemu-system-x86_64 \ - $(bindir)/qemu-system-arm \ - $(bindir)/qemu-system-cris \ - $(bindir)/qemu-system-m68k \ - $(bindir)/qemu-system-mips \ - $(bindir)/qemu-system-mipsel \ - $(bindir)/qemu-system-mips64 \ - $(bindir)/qemu-system-mips64el \ - $(bindir)/qemu-system-ppc \ - $(bindir)/qemu-system-ppcemb \ - $(bindir)/qemu-system-ppc64 \ - $(bindir)/qemu-system-sh4 \ - $(bindir)/qemu-system-sh4eb \ - $(bindir)/qemu-system-sparc \ - $(bindir)/qemu-i386 \ - $(bindir)/qemu-x86_64 \ - $(bindir)/qemu-alpha \ - $(bindir)/qemu-arm \ - $(bindir)/qemu-armeb \ - $(bindir)/qemu-cris \ - $(bindir)/qemu-m68k \ - $(bindir)/qemu-mips \ - $(bindir)/qemu-mipsel \ - $(bindir)/qemu-ppc \ - $(bindir)/qemu-ppc64 \ - $(bindir)/qemu-ppc64abi32 \ - $(bindir)/qemu-sh4 \ - $(bindir)/qemu-sh4eb \ - $(bindir)/qemu-sparc \ - $(bindir)/qemu-sparc64 \ - $(bindir)/qemu-sparc32plus \ - $(bindir)/qemu-img \ - $(bindir)/qemu-nbd \ - $(datadir)/bios.bin \ - $(datadir)/vgabios.bin \ - $(datadir)/vgabios-cirrus.bin \ - $(datadir)/ppc_rom.bin \ - $(datadir)/video.x \ - $(datadir)/openbios-sparc32 \ - $(datadir)/openbios-sparc64 \ - $(datadir)/openbios-ppc \ - $(datadir)/pxe-ne2k_pci.bin \ - $(datadir)/pxe-rtl8139.bin \ - $(datadir)/pxe-pcnet.bin \ - $(datadir)/pxe-e1000.bin \ - $(docdir)/qemu-doc.html \ - $(docdir)/qemu-tech.html \ - $(mandir)/man1/qemu.1 \ - $(mandir)/man1/qemu-img.1 \ - $(mandir)/man8/qemu-nbd.8 - -# Include automatically generated dependency files --include $(wildcard *.d audio/*.d slirp/*.d block/*.d) diff --git a/qemu-0.11.0/Makefile.hw b/qemu-0.11.0/Makefile.hw deleted file mode 100644 index 17c73df..0000000 --- a/qemu-0.11.0/Makefile.hw +++ /dev/null @@ -1,38 +0,0 @@ -# Makefile for qemu target independent devices. - -include config.mak -include ../config-host.mak -include $(SRC_PATH)/rules.mak - -.PHONY: all - -VPATH=$(SRC_PATH):$(SRC_PATH)/hw - -CPPFLAGS += -I. -I.. -I$(SRC_PATH) -MMD -MP -MT $@ -CPPFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -CPPFLAGS+=-I$(SRC_PATH)/fpu - -obj-y = -obj-y += virtio.o virtio-pci.o -obj-y += fw_cfg.o -obj-y += watchdog.o -obj-y += nand.o ecc.o - -obj-y += m48t59.o escc.o - -# SCSI layer -obj-y += lsi53c895a.o esp.o - -obj-y += dma-helpers.o sysbus.o qdev-addr.o - -all: $(HWLIB) -# Dummy command so that make thinks it has done something - @true - -$(HWLIB): $(obj-y) - -clean: - rm -f *.o *.d *.a *~ - -# Include automatically generated dependency files --include $(wildcard *.d */*.d) diff --git a/qemu-0.11.0/Makefile.target b/qemu-0.11.0/Makefile.target deleted file mode 100644 index 15bf59f..0000000 --- a/qemu-0.11.0/Makefile.target +++ /dev/null @@ -1,700 +0,0 @@ -include config.mak -include $(SRC_PATH)/rules.mak - -TARGET_PATH=$(SRC_PATH)/target-$(TARGET_BASE_ARCH) -VPATH=$(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw -CPPFLAGS=-I. -I.. -I$(TARGET_PATH) -I$(SRC_PATH) -MMD -MT $@ -MP -DNEED_CPU_H -#CFLAGS+=-Werror -LIBS= - -ifdef CONFIG_USER_ONLY -# user emulator name -QEMU_PROG=qemu-$(TARGET_ARCH2) -else -# system emulator name -ifeq ($(TARGET_ARCH), i386) -QEMU_PROG=qemu$(EXESUF) -else -QEMU_PROG=qemu-system-$(TARGET_ARCH2)$(EXESUF) -endif -endif - -PROGS=$(QEMU_PROG) - -# cc-option -# Usage: CFLAGS+=$(call cc-option, $(CFLAGS), -falign-functions=0, -malign-functions=0) - -cc-option = $(shell if $(CC) $(1) $(2) -S -o /dev/null -xc /dev/null \ - > /dev/null 2>&1; then echo "$(2)"; else echo "$(3)"; fi ;) - -HELPER_CFLAGS= - -ifeq ($(ARCH),i386) -HELPER_CFLAGS+=-fomit-frame-pointer -endif - -ifeq ($(subst ppc64,ppc,$(ARCH))$(TARGET_BASE_ARCH),ppcppc) -translate.o: CFLAGS := $(CFLAGS) $(call cc-option, $(CFLAGS), -fno-unit-at-a-time,) -endif - -ifeq ($(ARCH),sparc) - ifneq ($(CONFIG_SOLARIS),y) - HELPER_CFLAGS+=-ffixed-i0 - endif -endif - -ifeq ($(ARCH),alpha) -# Ensure there's only a single GP -CFLAGS+=-msmall-data -endif - -ifeq ($(ARCH),ia64) -CFLAGS+=-mno-sdata -endif - -CPPFLAGS+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -CPPFLAGS+=-U_FORTIFY_SOURCE -LIBS+=-lm -ifdef CONFIG_WIN32 -LIBS+=-lwinmm -lws2_32 -liphlpapi -endif -ifdef CONFIG_SOLARIS -LIBS+=-lsocket -lnsl -lresolv -ifdef NEEDS_LIBSUNMATH -LIBS+=-lsunmath -LDFLAGS+=-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib -CFLAGS+=-I/opt/SUNWspro/prod/include/cc -endif -endif - -kvm.o: CFLAGS+=$(KVM_CFLAGS) -kvm-all.o: CFLAGS+=$(KVM_CFLAGS) - -all: $(PROGS) -# Dummy command so that make thinks it has done something - @true - -######################################################### -# cpu emulator library -libobj-y = exec.o translate-all.o cpu-exec.o translate.o host-utils.o -libobj-$(CONFIG_KQEMU) += kqemu.o -# TCG code generator -libobj-y += tcg/tcg.o tcg/tcg-runtime.o -CPPFLAGS+=-I$(SRC_PATH)/tcg -I$(SRC_PATH)/tcg/$(ARCH) -ifeq ($(ARCH),sparc64) -CPPFLAGS+=-I$(SRC_PATH)/tcg/sparc -endif -ifdef CONFIG_SOFTFLOAT -libobj-y += fpu/softfloat.o -else -libobj-y += fpu/softfloat-native.o -endif -CPPFLAGS+=-I$(SRC_PATH)/fpu -libobj-y += op_helper.o helper.o - -ifeq ($(TARGET_BASE_ARCH), arm) -libobj-y += neon_helper.o iwmmxt_helper.o -endif - -ifeq ($(TARGET_BASE_ARCH), alpha) -libobj-y += alpha_palcode.o -endif - -ifeq ($(TARGET_BASE_ARCH), cris) -libobj-y += cris-dis.o - -ifndef CONFIG_USER_ONLY -libobj-y += mmu.o -endif -endif - -# NOTE: the disassembler code is only needed for debugging -libobj-y += disas.o -ifeq ($(findstring i386, $(TARGET_ARCH) $(ARCH)),i386) -USE_I386_DIS=y -endif -ifeq ($(findstring x86_64, $(TARGET_ARCH) $(ARCH)),x86_64) -USE_I386_DIS=y -endif -libobj-$(USE_I386_DIS) += i386-dis.o -ifeq ($(findstring alpha, $(TARGET_ARCH) $(ARCH)),alpha) -libobj-y += alpha-dis.o -endif -ifeq ($(findstring ppc, $(TARGET_BASE_ARCH) $(ARCH)),ppc) -libobj-y += ppc-dis.o -endif -ifeq ($(findstring microblaze, $(TARGET_BASE_ARCH) $(ARCH)),microblaze) -libobj-y += microblaze-dis.o -ifndef CONFIG_USER_ONLY -libobj-y += mmu.o -endif -endif -ifeq ($(findstring mips, $(TARGET_BASE_ARCH) $(ARCH)),mips) -libobj-y += mips-dis.o -endif -ifeq ($(findstring sparc, $(TARGET_BASE_ARCH) $(ARCH)),sparc) -libobj-y += sparc-dis.o -endif -ifeq ($(findstring arm, $(TARGET_ARCH) $(ARCH)),arm) -libobj-y += arm-dis.o -endif -ifeq ($(findstring m68k, $(TARGET_ARCH) $(ARCH)),m68k) -libobj-y += m68k-dis.o -endif -ifeq ($(findstring sh4, $(TARGET_ARCH) $(ARCH)),sh4) -libobj-y += sh4-dis.o -endif -ifeq ($(findstring hppa, $(TARGET_BASE_ARCH) $(ARCH)),hppa) -libobj-y += hppa-dis.o -endif -ifeq ($(findstring s390, $(TARGET_ARCH) $(ARCH)),s390) -libobj-y += s390-dis.o -endif - -# libqemu - -libqemu.a: $(libobj-y) - -translate.o: translate.c cpu.h - -translate-all.o: translate-all.c cpu.h - -tcg/tcg.o: cpu.h - -# HELPER_CFLAGS is used for all the code compiled with static register -# variables -op_helper.o: CFLAGS += $(HELPER_CFLAGS) - -cpu-exec.o: CFLAGS += $(HELPER_CFLAGS) - -######################################################### -# Linux user emulator target - -ifdef CONFIG_LINUX_USER - -VPATH+=:$(SRC_PATH)/linux-user:$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR) -CPPFLAGS+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR) - -ifdef CONFIG_STATIC -LDFLAGS+=-static -endif - -ifeq ($(ARCH),i386) -ifdef TARGET_GPROF -USE_I386_LD=y -endif -ifdef CONFIG_STATIC -USE_I386_LD=y -endif -ifdef USE_I386_LD -LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -else -# WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object -# that the kernel ELF loader considers as an executable. I think this -# is the simplest way to make it self virtualizable! -LDFLAGS+=-Wl,-shared -endif -endif - -ifeq ($(ARCH),x86_64) -LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -endif - -ifeq ($(ARCH),ppc) -LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -endif - -ifeq ($(ARCH),ppc64) -LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -endif - -ifeq ($(ARCH),s390) -LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -endif - -ifeq ($(ARCH),sparc) -# -static is used to avoid g1/g3 usage by the dynamic linker -LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -static -endif - -ifeq ($(ARCH),sparc64) -LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -endif - -ifeq ($(ARCH),alpha) -LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -endif - -ifeq ($(ARCH),ia64) -LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld -endif - -ifeq ($(ARCH),arm) -LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -endif - -ifeq ($(ARCH),m68k) -LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -endif - -ifeq ($(ARCH),mips) -ifeq ($(WORDS_BIGENDIAN),yes) -LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -else -LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld -endif -endif - -ifeq ($(ARCH),mips64) -ifeq ($(WORDS_BIGENDIAN),yes) -LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -else -LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld -endif -endif - -# profiling code -ifdef TARGET_GPROF -LDFLAGS+=-p -CFLAGS+=-p -endif - -obj-y = main.o syscall.o strace.o mmap.o signal.o path.o thunk.o \ - elfload.o linuxload.o uaccess.o envlist.o gdbstub.o gdbstub-xml.o \ - ioport-user.o -obj-$(TARGET_HAS_BFLT) += flatload.o - -ifdef TARGET_HAS_ELFLOAD32 -elfload32.o: elfload.c -endif -obj-$(TARGET_HAS_ELFLOAD32) += elfload32.o - -ifeq ($(TARGET_ARCH), i386) -obj-y += vm86.o -endif - -nwfpe-obj-y := fpa11.o fpa11_cpdo.o fpa11_cpdt.o fpa11_cprt.o fpopcode.o -nwfpe-obj-y += single_cpdo.o double_cpdo.o extended_cpdo.o -obj-arm-y += $(addprefix nwfpe/, $(nwfpe-obj-y)) -obj-arm-y += arm-semi.o - -obj-m68k-y += m68k-sim.o m68k-semi.o - -# Note: this is a workaround. The real fix is to avoid compiling -# cpu_signal_handler() in cpu-exec.c. -signal.o: CFLAGS += $(HELPER_CFLAGS) - -ARLIBS=../libqemu_user.a libqemu.a -endif #CONFIG_LINUX_USER - -LIBS+= $(PTHREADLIBS) -LIBS+= $(CLOCKLIBS) - -######################################################### -# Darwin user emulator target - -ifdef CONFIG_DARWIN_USER - -VPATH+=:$(SRC_PATH)/darwin-user -CPPFLAGS+=-I$(SRC_PATH)/darwin-user -I$(SRC_PATH)/darwin-user/$(TARGET_ARCH) - -# Leave some space for the regular program loading zone -LDFLAGS+=-Wl,-segaddr,__STD_PROG_ZONE,0x1000 -image_base 0x0e000000 - -LIBS+=-lmx - -obj-y = main.o commpage.o machload.o mmap.o signal.o syscall.o thunk.o \ - gdbstub.o gdbstub-xml.o ioport-user.o - -# Note: this is a workaround. The real fix is to avoid compiling -# cpu_signal_handler() in cpu-exec.c. -signal.o: CFLAGS += $(HELPER_CFLAGS) - -ARLIBS=libqemu.a - -endif #CONFIG_DARWIN_USER - -######################################################### -# BSD user emulator target - -ifdef CONFIG_BSD_USER - -VPATH+=:$(SRC_PATH)/bsd-user -CPPFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ARCH) - -ifdef CONFIG_STATIC -LDFLAGS+=-static -endif - -ifeq ($(ARCH),i386) -ifdef TARGET_GPROF -USE_I386_LD=y -endif -ifdef CONFIG_STATIC -USE_I386_LD=y -endif -ifdef USE_I386_LD -LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -else -# WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object -# that the kernel ELF loader considers as an executable. I think this -# is the simplest way to make it self virtualizable! -LDFLAGS+=-Wl,-shared -endif -endif - -ifeq ($(ARCH),x86_64) -LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -endif - -ifeq ($(ARCH),ppc) -LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -endif - -ifeq ($(ARCH),ppc64) -LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -endif - -ifeq ($(ARCH),s390) -LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -endif - -ifeq ($(ARCH),sparc) -# -static is used to avoid g1/g3 usage by the dynamic linker -LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -static -endif - -ifeq ($(ARCH),sparc64) -LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -endif - -ifeq ($(ARCH),alpha) -LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -endif - -ifeq ($(ARCH),ia64) -LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld -endif - -ifeq ($(ARCH),arm) -LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -endif - -ifeq ($(ARCH),m68k) -LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -endif - -ifeq ($(ARCH),mips) -ifeq ($(WORDS_BIGENDIAN),yes) -LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -else -LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld -endif -endif - -ifeq ($(ARCH),mips64) -ifeq ($(WORDS_BIGENDIAN),yes) -LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -else -LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld -endif -endif - -obj-y = main.o bsdload.o elfload.o mmap.o path.o signal.o strace.o syscall.o \ - gdbstub.o gdbstub-xml.o ioport-user.o -obj-y += uaccess.o - -# Note: this is a workaround. The real fix is to avoid compiling -# cpu_signal_handler() in cpu-exec.c. -signal.o: CFLAGS += $(HELPER_CFLAGS) - -ARLIBS=libqemu.a ../libqemu_user.a - -endif #CONFIG_BSD_USER - -######################################################### -# System emulator target -ifndef CONFIG_USER_ONLY - -obj-y = vl.o osdep.o monitor.o pci.o loader.o isa_mmio.o machine.o \ - gdbstub.o gdbstub-xml.o msix.o ioport.o -# virtio has to be here due to weird dependency between PCI and virtio-net. -# need to fix this properly -obj-y += virtio-blk.o virtio-balloon.o virtio-net.o virtio-console.o -obj-$(CONFIG_KVM) += kvm.o kvm-all.o - -LIBS+=-lz -ifdef CONFIG_ALSA -LIBS += -lasound -endif -ifdef CONFIG_ESD -LIBS += -lesd -endif -ifdef CONFIG_PA -LIBS += -lpulse-simple -endif -ifdef CONFIG_DSOUND -LIBS += -lole32 -ldxguid -endif -ifdef CONFIG_FMOD -LIBS += $(CONFIG_FMOD_LIB) -endif -ifdef CONFIG_OSS -LIBS += $(CONFIG_OSS_LIB) -endif - -sound-obj-y = -sound-obj-$(CONFIG_SB16) += sb16.o -sound-obj-$(CONFIG_ES1370) += es1370.o -sound-obj-$(CONFIG_AC97) += ac97.o -sound-obj-$(CONFIG_ADLIB) += fmopl.o adlib.o -sound-obj-$(CONFIG_GUS) += gus.o gusemu_hal.o gusemu_mixer.o -sound-obj-$(CONFIG_CS4231A) += cs4231a.o - -ifdef CONFIG_ADLIB -adlib.o fmopl.o: CFLAGS := ${CFLAGS} -DBUILD_Y8950=0 -endif - -ifdef CONFIG_VNC_TLS -CPPFLAGS += $(CONFIG_VNC_TLS_CFLAGS) -LIBS += $(CONFIG_VNC_TLS_LIBS) -endif - -ifdef CONFIG_VNC_SASL -CPPFLAGS += $(CONFIG_VNC_SASL_CFLAGS) -LIBS += $(CONFIG_VNC_SASL_LIBS) -endif - -ifdef CONFIG_BLUEZ -LIBS += $(CONFIG_BLUEZ_LIBS) -endif - -# xen backend driver support -obj-$(CONFIG_XEN) += xen_machine_pv.o xen_domainbuild.o -ifeq ($(CONFIG_XEN), y) - LIBS += $(XEN_LIBS) -endif - -# USB layer -obj-y += usb-ohci.o - -# PCI network cards -obj-y += eepro100.o -obj-y += ne2000.o -obj-y += pcnet.o -obj-y += rtl8139.o -obj-y += e1000.o - -# Generic watchdog support and some watchdog devices -obj-y += wdt_ib700.o wdt_i6300esb.o - -# Generic SerialICE support -ifdef CONFIG_SERIALICE -CPPFLAGS += $(CONFIG_SERIALICE_CFLAGS) -LIBS += $(CONFIG_SERIALICE_LIBS) -endif -obj-$(CONFIG_SERIALICE) += serialice.o - -# Hardware support -obj-i386-y = ide.o pckbd.o vga.o $(sound-obj-y) dma.o -obj-i386-y += fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o -obj-i386-y += cirrus_vga.o apic.o ioapic.o parallel.o acpi.o piix_pci.o -obj-i386-y += usb-uhci.o vmmouse.o vmport.o vmware_vga.o hpet.o -obj-i386-y += device-hotplug.o pci-hotplug.o smbios.o - -ifeq ($(TARGET_BASE_ARCH), i386) -CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE -endif - -# shared objects -obj-ppc-y = ppc.o ide.o vga.o $(sound-obj-y) dma.o openpic.o -# PREP target -obj-ppc-y += pckbd.o serial.o i8259.o i8254.o fdc.o mc146818rtc.o -obj-ppc-y += prep_pci.o ppc_prep.o -# Mac shared devices -obj-ppc-y += macio.o cuda.o adb.o mac_nvram.o mac_dbdma.o -# OldWorld PowerMac -obj-ppc-y += heathrow_pic.o grackle_pci.o ppc_oldworld.o -# NewWorld PowerMac -obj-ppc-y += unin_pci.o ppc_newworld.o -# PowerPC 4xx boards -obj-ppc-y += pflash_cfi02.o ppc4xx_devs.o ppc4xx_pci.o ppc405_uc.o ppc405_boards.o -obj-ppc-y += ppc440.o ppc440_bamboo.o -# PowerPC E500 boards -obj-ppc-y += ppce500_pci.o ppce500_mpc8544ds.o -obj-ppc-$(CONFIG_KVM) += kvm_ppc.o - -ifeq ($(TARGET_BASE_ARCH), ppc) -CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE -endif - -ifdef FDT_LIBS -obj-ppc-y += device_tree.o -LIBS+= $(FDT_LIBS) -endif - -obj-mips-y = mips_r4k.o mips_jazz.o mips_malta.o mips_mipssim.o -obj-mips-y += mips_timer.o mips_int.o dma.o vga.o serial.o i8254.o i8259.o rc4030.o -obj-mips-y += g364fb.o jazz_led.o dp8393x.o -obj-mips-y += ide.o gt64xxx.o pckbd.o fdc.o mc146818rtc.o usb-uhci.o acpi.o ds1225y.o -obj-mips-y += piix_pci.o parallel.o cirrus_vga.o pcspk.o $(sound-obj-y) -obj-mips-y += mipsnet.o -obj-mips-y += pflash_cfi01.o -obj-mips-y += vmware_vga.o - -ifeq ($(TARGET_BASE_ARCH), mips) -CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE -endif - -obj-microblaze-y = petalogix_s3adsp1800_mmu.o - -obj-microblaze-y += microblaze_pic_cpu.o -obj-microblaze-y += xilinx_intc.o -obj-microblaze-y += xilinx_timer.o -obj-microblaze-y += xilinx_uartlite.o -obj-microblaze-y += xilinx_ethlite.o - -obj-microblaze-y += pflash_cfi02.o - -ifdef FDT_LIBS -obj-microblaze-y += device_tree.o -LIBS+= $(FDT_LIBS) -endif - -# Boards -obj-cris-y = cris_pic_cpu.o etraxfs.o axis_dev88.o - -# IO blocks -obj-cris-y += etraxfs_dma.o -obj-cris-y += etraxfs_pic.o -obj-cris-y += etraxfs_eth.o -obj-cris-y += etraxfs_timer.o -obj-cris-y += etraxfs_ser.o - -obj-cris-y += pflash_cfi02.o - -ifeq ($(TARGET_ARCH), sparc64) -obj-sparc-y = sun4u.o ide.o pckbd.o vga.o apb_pci.o -obj-sparc-y += fdc.o mc146818rtc.o serial.o -obj-sparc-y += cirrus_vga.o parallel.o -else -obj-sparc-y = sun4m.o tcx.o iommu.o slavio_intctl.o -obj-sparc-y += slavio_timer.o slavio_misc.o fdc.o sparc32_dma.o -obj-sparc-y += cs4231.o eccmemctl.o sbi.o sun4c_intctl.o -endif - -obj-arm-y = integratorcp.o versatilepb.o smc91c111.o arm_pic.o arm_timer.o -obj-arm-y += arm_boot.o pl011.o pl031.o pl050.o pl080.o pl110.o pl181.o pl190.o -obj-arm-y += versatile_pci.o -obj-arm-y += realview_gic.o realview.o arm_sysctl.o mpcore.o -obj-arm-y += armv7m.o armv7m_nvic.o stellaris.o pl022.o stellaris_enet.o -obj-arm-y += pl061.o -obj-arm-y += arm-semi.o -obj-arm-y += pxa2xx.o pxa2xx_pic.o pxa2xx_gpio.o pxa2xx_timer.o pxa2xx_dma.o -obj-arm-y += pxa2xx_lcd.o pxa2xx_mmci.o pxa2xx_pcmcia.o pxa2xx_keypad.o -obj-arm-y += pflash_cfi01.o gumstix.o -obj-arm-y += zaurus.o ide.o serial.o spitz.o tosa.o tc6393xb.o -obj-arm-y += omap1.o omap_lcdc.o omap_dma.o omap_clk.o omap_mmc.o omap_i2c.o -obj-arm-y += omap2.o omap_dss.o soc_dma.o -obj-arm-y += omap_sx1.o palm.o tsc210x.o -obj-arm-y += nseries.o blizzard.o onenand.o vga.o cbus.o tusb6010.o usb-musb.o -obj-arm-y += mst_fpga.o mainstone.o -obj-arm-y += musicpal.o pflash_cfi02.o -obj-arm-y += framebuffer.o -obj-arm-y += syborg.o syborg_fb.o syborg_interrupt.o syborg_keyboard.o -obj-arm-y += syborg_serial.o syborg_timer.o syborg_pointer.o syborg_rtc.o -obj-arm-y += syborg_virtio.o - -ifeq ($(TARGET_BASE_ARCH), arm) -CPPFLAGS += -DHAS_AUDIO -endif - -obj-sh4-y = shix.o r2d.o sh7750.o sh7750_regnames.o tc58128.o -obj-sh4-y += sh_timer.o sh_serial.o sh_intc.o sh_pci.o sm501.o serial.o -obj-sh4-y += ide.o - -obj-m68k-y = an5206.o mcf5206.o mcf_uart.o mcf_intc.o mcf5208.o mcf_fec.o -obj-m68k-y += m68k-semi.o dummy_m68k.o - -ifdef CONFIG_COCOA -COCOA_LIBS=-F/System/Library/Frameworks -framework Cocoa -framework IOKit -ifdef CONFIG_COREAUDIO -COCOA_LIBS+=-framework CoreAudio -endif -endif -ifdef CONFIG_SLIRP -CPPFLAGS+=-I$(SRC_PATH)/slirp -endif - -# specific flags are needed for non soft mmu emulator -ifdef CONFIG_STATIC -LDFLAGS+=-static -endif -ifndef CONFIG_DARWIN -ifndef CONFIG_WIN32 -ifndef CONFIG_SOLARIS -ifndef CONFIG_AIX -LIBS+=-lutil -endif -endif -endif -endif -ifdef TARGET_GPROF -vl.o: CFLAGS+=-p -LDFLAGS+=-p -endif - -ifeq ($(ARCH),ia64) -LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/ia64.ld -endif - -ifdef CONFIG_WIN32 -SDL_LIBS := $(filter-out -mwindows, $(SDL_LIBS)) -mconsole -endif - -# profiling code -ifdef TARGET_GPROF -LDFLAGS+=-p -main.o: CFLAGS+=-p -endif - -vl.o: CFLAGS+=$(SDL_CFLAGS) - -vl.o: qemu-options.h - -monitor.o: qemu-monitor.h - -LIBS += $(SDL_LIBS) $(COCOA_LIBS) $(CURSES_LIBS) $(BRLAPI_LIBS) $(VDE_LIBS) $(CURL_LIBS) -ARLIBS=../libqemu_common.a libqemu.a $(HWLIB) - -endif # !CONFIG_USER_ONLY - -$(QEMU_PROG): $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y) $(ARLIBS) - $(call LINK,$(obj-y) $(obj-$(TARGET_BASE_ARCH)-y)) - - -gdbstub-xml.c: $(TARGET_XML_FILES) feature_to_c.sh -ifeq ($(TARGET_XML_FILES),) - $(call quiet-command,rm -f $@ && echo > $@," GEN $(TARGET_DIR)$@") -else - $(call quiet-command,rm -f $@ && $(SHELL) $(SRC_PATH)/feature_to_c.sh $@ $(TARGET_XML_FILES)," GEN $(TARGET_DIR)$@") -endif - -qemu-options.h: $(SRC_PATH)/qemu-options.hx - $(call quiet-command,sh $(SRC_PATH)/hxtool -h < $< > $@," GEN $(TARGET_DIR)$@") - -qemu-monitor.h: $(SRC_PATH)/qemu-monitor.hx - $(call quiet-command,sh $(SRC_PATH)/hxtool -h < $< > $@," GEN $(TARGET_DIR)$@") - -clean: - rm -f *.o *.a *~ $(PROGS) nwfpe/*.o fpu/*.o - rm -f *.d */*.d tcg/*.o - rm -f qemu-options.h qemu-monitor.h gdbstub-xml.c - -install: all -ifneq ($(PROGS),) - $(INSTALL) -m 755 $(STRIP_OPT) $(PROGS) "$(DESTDIR)$(bindir)" -endif - -# Include automatically generated dependency files --include $(wildcard *.d */*.d) diff --git a/qemu-0.11.0/README b/qemu-0.11.0/README deleted file mode 100644 index dfd56f2..0000000 --- a/qemu-0.11.0/README +++ /dev/null @@ -1,3 +0,0 @@ -Read the documentation in qemu-doc.html. - -Fabrice Bellard. diff --git a/qemu-0.11.0/TODO b/qemu-0.11.0/TODO deleted file mode 100644 index 1d4c638..0000000 --- a/qemu-0.11.0/TODO +++ /dev/null @@ -1,37 +0,0 @@ -General: -------- -- cycle counter for all archs -- cpu_interrupt() win32/SMP fix -- merge PIC spurious interrupt patch -- warning for OS/2: must not use 128 MB memory (merge bochs cmos patch ?) -- config file (at least for windows/Mac OS X) -- update doc: PCI infos. -- basic VGA optimizations -- better code fetch -- do not resize vga if invalid size. -- TLB code protection support for PPC -- disable SMC handling for ARM/SPARC/PPC (not finished) -- see undefined flags for BTx insn -- keyboard output buffer filling timing emulation -- tests for each target CPU -- fix all remaining thread lock issues (must put TBs in a specific invalid - state, find a solution for tb_flush()). - -ppc specific: ------------- -- TLB invalidate not needed if msr_pr changes -- enable shift optimizations ? - -linux-user specific: -------------------- -- remove threading support as it cannot work at this point -- improve IPC syscalls -- more syscalls (in particular all 64 bit ones, IPCs, fix 64 bit - issues, fix 16 bit uid issues) -- use kernel traps for unaligned accesses on ARM ? - - -lower priority: --------------- -- int15 ah=86: use better timing -- use -msoft-float on ARM diff --git a/qemu-0.11.0/VERSION b/qemu-0.11.0/VERSION deleted file mode 100644 index d9df1bb..0000000 --- a/qemu-0.11.0/VERSION +++ /dev/null @@ -1 +0,0 @@ -0.11.0 diff --git a/qemu-0.11.0/a.out.h b/qemu-0.11.0/a.out.h deleted file mode 100644 index dfc104e..0000000 --- a/qemu-0.11.0/a.out.h +++ /dev/null @@ -1,430 +0,0 @@ -/* a.out.h - - Copyright 1997, 1998, 1999, 2001 Red Hat, Inc. - -This file is part of Cygwin. - -This software is a copyrighted work licensed under the terms of the -Cygwin license. Please consult the file "CYGWIN_LICENSE" for -details. */ - -#ifndef _A_OUT_H_ -#define _A_OUT_H_ - -#ifdef __cplusplus -extern "C" { -#endif -#define COFF_IMAGE_WITH_PE -#define COFF_LONG_SECTION_NAMES - -/*** coff information for Intel 386/486. */ - - -/********************** FILE HEADER **********************/ - -struct external_filehdr { - short f_magic; /* magic number */ - short f_nscns; /* number of sections */ - host_ulong f_timdat; /* time & date stamp */ - host_ulong f_symptr; /* file pointer to symtab */ - host_ulong f_nsyms; /* number of symtab entries */ - short f_opthdr; /* sizeof(optional hdr) */ - short f_flags; /* flags */ -}; - -/* Bits for f_flags: - * F_RELFLG relocation info stripped from file - * F_EXEC file is executable (no unresolved external references) - * F_LNNO line numbers stripped from file - * F_LSYMS local symbols stripped from file - * F_AR32WR file has byte ordering of an AR32WR machine (e.g. vax) - */ - -#define F_RELFLG (0x0001) -#define F_EXEC (0x0002) -#define F_LNNO (0x0004) -#define F_LSYMS (0x0008) - - - -#define I386MAGIC 0x14c -#define I386PTXMAGIC 0x154 -#define I386AIXMAGIC 0x175 - -/* This is Lynx's all-platform magic number for executables. */ - -#define LYNXCOFFMAGIC 0415 - -#define I386BADMAG(x) (((x).f_magic != I386MAGIC) \ - && (x).f_magic != I386AIXMAGIC \ - && (x).f_magic != I386PTXMAGIC \ - && (x).f_magic != LYNXCOFFMAGIC) - -#define FILHDR struct external_filehdr -#define FILHSZ 20 - - -/********************** AOUT "OPTIONAL HEADER"= - **********************/ - - -typedef struct -{ - unsigned short magic; /* type of file */ - unsigned short vstamp; /* version stamp */ - host_ulong tsize; /* text size in bytes, padded to FW bdry*/ - host_ulong dsize; /* initialized data " " */ - host_ulong bsize; /* uninitialized data " " */ - host_ulong entry; /* entry pt. */ - host_ulong text_start; /* base of text used for this file */ - host_ulong data_start; /* base of data used for this file= - */ -} -AOUTHDR; - -#define AOUTSZ 28 -#define AOUTHDRSZ 28 - -#define OMAGIC 0404 /* object files, eg as output */ -#define ZMAGIC 0413 /* demand load format, eg normal ld output */ -#define STMAGIC 0401 /* target shlib */ -#define SHMAGIC 0443 /* host shlib */ - - -/* define some NT default values */ -/* #define NT_IMAGE_BASE 0x400000 moved to internal.h */ -#define NT_SECTION_ALIGNMENT 0x1000 -#define NT_FILE_ALIGNMENT 0x200 -#define NT_DEF_RESERVE 0x100000 -#define NT_DEF_COMMIT 0x1000 - -/********************** SECTION HEADER **********************/ - - -struct external_scnhdr { - char s_name[8]; /* section name */ - host_ulong s_paddr; /* physical address, offset - of last addr in scn */ - host_ulong s_vaddr; /* virtual address */ - host_ulong s_size; /* section size */ - host_ulong s_scnptr; /* file ptr to raw data for section */ - host_ulong s_relptr; /* file ptr to relocation */ - host_ulong s_lnnoptr; /* file ptr to line numbers */ - unsigned short s_nreloc; /* number of relocation entries */ - unsigned short s_nlnno; /* number of line number entries*/ - host_ulong s_flags; /* flags */ -}; - -#define SCNHDR struct external_scnhdr -#define SCNHSZ 40 - -/* - * names of "special" sections - */ -#define _TEXT ".text" -#define _DATA ".data" -#define _BSS ".bss" -#define _COMMENT ".comment" -#define _LIB ".lib" - -/********************** LINE NUMBERS **********************/ - -/* 1 line number entry for every "breakpointable" source line in a section. - * Line numbers are grouped on a per function basis; first entry in a function - * grouping will have l_lnno = 0 and in place of physical address will be the - * symbol table index of the function name. - */ -struct external_lineno { - union { - host_ulong l_symndx; /* function name symbol index, iff l_lnno 0 */ - host_ulong l_paddr; /* (physical) address of line number */ - } l_addr; - unsigned short l_lnno; /* line number */ -}; - -#define LINENO struct external_lineno -#define LINESZ 6 - -/********************** SYMBOLS **********************/ - -#define E_SYMNMLEN 8 /* # characters in a symbol name */ -#define E_FILNMLEN 14 /* # characters in a file name */ -#define E_DIMNUM 4 /* # array dimensions in auxiliary entry */ - -struct __attribute__((packed)) external_syment -{ - union { - char e_name[E_SYMNMLEN]; - struct { - host_ulong e_zeroes; - host_ulong e_offset; - } e; - } e; - host_ulong e_value; - unsigned short e_scnum; - unsigned short e_type; - char e_sclass[1]; - char e_numaux[1]; -}; - -#define N_BTMASK (0xf) -#define N_TMASK (0x30) -#define N_BTSHFT (4) -#define N_TSHIFT (2) - -union external_auxent { - struct { - host_ulong x_tagndx; /* str, un, or enum tag indx */ - union { - struct { - unsigned short x_lnno; /* declaration line number */ - unsigned short x_size; /* str/union/array size */ - } x_lnsz; - host_ulong x_fsize; /* size of function */ - } x_misc; - union { - struct { /* if ISFCN, tag, or .bb */ - host_ulong x_lnnoptr;/* ptr to fcn line # */ - host_ulong x_endndx; /* entry ndx past block end */ - } x_fcn; - struct { /* if ISARY, up to 4 dimen. */ - char x_dimen[E_DIMNUM][2]; - } x_ary; - } x_fcnary; - unsigned short x_tvndx; /* tv index */ - } x_sym; - - union { - char x_fname[E_FILNMLEN]; - struct { - host_ulong x_zeroes; - host_ulong x_offset; - } x_n; - } x_file; - - struct { - host_ulong x_scnlen; /* section length */ - unsigned short x_nreloc; /* # relocation entries */ - unsigned short x_nlinno; /* # line numbers */ - host_ulong x_checksum; /* section COMDAT checksum */ - unsigned short x_associated;/* COMDAT associated section index */ - char x_comdat[1]; /* COMDAT selection number */ - } x_scn; - - struct { - host_ulong x_tvfill; /* tv fill value */ - unsigned short x_tvlen; /* length of .tv */ - char x_tvran[2][2]; /* tv range */ - } x_tv; /* info about .tv section (in auxent of symbol .tv)) */ - -}; - -#define SYMENT struct external_syment -#define SYMESZ 18 -#define AUXENT union external_auxent -#define AUXESZ 18 - -#define _ETEXT "etext" - -/********************** RELOCATION DIRECTIVES **********************/ - -struct external_reloc { - char r_vaddr[4]; - char r_symndx[4]; - char r_type[2]; -}; - -#define RELOC struct external_reloc -#define RELSZ 10 - -/* end of coff/i386.h */ - -/* PE COFF header information */ - -#ifndef _PE_H -#define _PE_H - -/* NT specific file attributes */ -#define IMAGE_FILE_RELOCS_STRIPPED 0x0001 -#define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002 -#define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004 -#define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008 -#define IMAGE_FILE_BYTES_REVERSED_LO 0x0080 -#define IMAGE_FILE_32BIT_MACHINE 0x0100 -#define IMAGE_FILE_DEBUG_STRIPPED 0x0200 -#define IMAGE_FILE_SYSTEM 0x1000 -#define IMAGE_FILE_DLL 0x2000 -#define IMAGE_FILE_BYTES_REVERSED_HI 0x8000 - -/* additional flags to be set for section headers to allow the NT loader to - read and write to the section data (to replace the addresses of data in - dlls for one thing); also to execute the section in .text's case= - */ -#define IMAGE_SCN_MEM_DISCARDABLE 0x02000000 -#define IMAGE_SCN_MEM_EXECUTE 0x20000000 -#define IMAGE_SCN_MEM_READ 0x40000000 -#define IMAGE_SCN_MEM_WRITE 0x80000000 - -/* - * Section characteristics added for ppc-nt - */ - -#define IMAGE_SCN_TYPE_NO_PAD 0x00000008 /* Reserved. */ - -#define IMAGE_SCN_CNT_CODE 0x00000020 /* Section contains code. */ -#define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040 /* Section contains initialized data. */ -#define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080 /* Section contains uninitialized data. */ - -#define IMAGE_SCN_LNK_OTHER 0x00000100 /* Reserved. */ -#define IMAGE_SCN_LNK_INFO 0x00000200 /* Section contains comments or some other type of information. */ -#define IMAGE_SCN_LNK_REMOVE 0x00000800 /* Section contents will not become part of image. */ -#define IMAGE_SCN_LNK_COMDAT 0x00001000 /* Section contents comdat. */ - -#define IMAGE_SCN_MEM_FARDATA 0x00008000 - -#define IMAGE_SCN_MEM_PURGEABLE 0x00020000 -#define IMAGE_SCN_MEM_16BIT 0x00020000 -#define IMAGE_SCN_MEM_LOCKED 0x00040000 -#define IMAGE_SCN_MEM_PRELOAD 0x00080000 - -#define IMAGE_SCN_ALIGN_1BYTES 0x00100000 -#define IMAGE_SCN_ALIGN_2BYTES 0x00200000 -#define IMAGE_SCN_ALIGN_4BYTES 0x00300000 -#define IMAGE_SCN_ALIGN_8BYTES 0x00400000 -#define IMAGE_SCN_ALIGN_16BYTES 0x00500000 /* Default alignment if no others are specified. */ -#define IMAGE_SCN_ALIGN_32BYTES 0x00600000 -#define IMAGE_SCN_ALIGN_64BYTES 0x00700000 - - -#define IMAGE_SCN_LNK_NRELOC_OVFL 0x01000000 /* Section contains extended relocations. */ -#define IMAGE_SCN_MEM_NOT_CACHED 0x04000000 /* Section is not cachable. */ -#define IMAGE_SCN_MEM_NOT_PAGED 0x08000000 /* Section is not pageable. */ -#define IMAGE_SCN_MEM_SHARED 0x10000000 /* Section is shareable. */ - -/* COMDAT selection codes. */ - -#define IMAGE_COMDAT_SELECT_NODUPLICATES (1) /* Warn if duplicates. */ -#define IMAGE_COMDAT_SELECT_ANY (2) /* No warning. */ -#define IMAGE_COMDAT_SELECT_SAME_SIZE (3) /* Warn if different size. */ -#define IMAGE_COMDAT_SELECT_EXACT_MATCH (4) /* Warn if different. */ -#define IMAGE_COMDAT_SELECT_ASSOCIATIVE (5) /* Base on other section. */ - -/* Magic values that are true for all dos/nt implementations */ -#define DOSMAGIC 0x5a4d -#define NT_SIGNATURE 0x00004550 - -/* NT allows long filenames, we want to accommodate this. This may break - some of the bfd functions */ -#undef FILNMLEN -#define FILNMLEN 18 /* # characters in a file name */ - - -#ifdef COFF_IMAGE_WITH_PE -/* The filehdr is only weired in images */ - -#undef FILHDR -struct external_PE_filehdr -{ - /* DOS header fields */ - unsigned short e_magic; /* Magic number, 0x5a4d */ - unsigned short e_cblp; /* Bytes on last page of file, 0x90 */ - unsigned short e_cp; /* Pages in file, 0x3 */ - unsigned short e_crlc; /* Relocations, 0x0 */ - unsigned short e_cparhdr; /* Size of header in paragraphs, 0x4 */ - unsigned short e_minalloc; /* Minimum extra paragraphs needed, 0x0 */ - unsigned short e_maxalloc; /* Maximum extra paragraphs needed, 0xFFFF */ - unsigned short e_ss; /* Initial (relative) SS value, 0x0 */ - unsigned short e_sp; /* Initial SP value, 0xb8 */ - unsigned short e_csum; /* Checksum, 0x0 */ - unsigned short e_ip; /* Initial IP value, 0x0 */ - unsigned short e_cs; /* Initial (relative) CS value, 0x0 */ - unsigned short e_lfarlc; /* File address of relocation table, 0x40 */ - unsigned short e_ovno; /* Overlay number, 0x0 */ - char e_res[4][2]; /* Reserved words, all 0x0 */ - unsigned short e_oemid; /* OEM identifier (for e_oeminfo), 0x0 */ - unsigned short e_oeminfo; /* OEM information; e_oemid specific, 0x0 */ - char e_res2[10][2]; /* Reserved words, all 0x0 */ - host_ulong e_lfanew; /* File address of new exe header, 0x80 */ - char dos_message[16][4]; /* other stuff, always follow DOS header */ - unsigned int nt_signature; /* required NT signature, 0x4550 */ - - /* From standard header */ - - unsigned short f_magic; /* magic number */ - unsigned short f_nscns; /* number of sections */ - host_ulong f_timdat; /* time & date stamp */ - host_ulong f_symptr; /* file pointer to symtab */ - host_ulong f_nsyms; /* number of symtab entries */ - unsigned short f_opthdr; /* sizeof(optional hdr) */ - unsigned short f_flags; /* flags */ -}; - - -#define FILHDR struct external_PE_filehdr -#undef FILHSZ -#define FILHSZ 152 - -#endif - -typedef struct -{ - unsigned short magic; /* type of file */ - unsigned short vstamp; /* version stamp */ - host_ulong tsize; /* text size in bytes, padded to FW bdry*/ - host_ulong dsize; /* initialized data " " */ - host_ulong bsize; /* uninitialized data " " */ - host_ulong entry; /* entry pt. */ - host_ulong text_start; /* base of text used for this file */ - host_ulong data_start; /* base of all data used for this file */ - - /* NT extra fields; see internal.h for descriptions */ - host_ulong ImageBase; - host_ulong SectionAlignment; - host_ulong FileAlignment; - unsigned short MajorOperatingSystemVersion; - unsigned short MinorOperatingSystemVersion; - unsigned short MajorImageVersion; - unsigned short MinorImageVersion; - unsigned short MajorSubsystemVersion; - unsigned short MinorSubsystemVersion; - char Reserved1[4]; - host_ulong SizeOfImage; - host_ulong SizeOfHeaders; - host_ulong CheckSum; - unsigned short Subsystem; - unsigned short DllCharacteristics; - host_ulong SizeOfStackReserve; - host_ulong SizeOfStackCommit; - host_ulong SizeOfHeapReserve; - host_ulong SizeOfHeapCommit; - host_ulong LoaderFlags; - host_ulong NumberOfRvaAndSizes; - /* IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]; */ - char DataDirectory[16][2][4]; /* 16 entries, 2 elements/entry, 4 chars */ - -} PEAOUTHDR; - - -#undef AOUTSZ -#define AOUTSZ (AOUTHDRSZ + 196) - -#undef E_FILNMLEN -#define E_FILNMLEN 18 /* # characters in a file name */ -#endif - -/* end of coff/pe.h */ - -#define DT_NON (0) /* no derived type */ -#define DT_PTR (1) /* pointer */ -#define DT_FCN (2) /* function */ -#define DT_ARY (3) /* array */ - -#define ISPTR(x) (((x) & N_TMASK) == (DT_PTR << N_BTSHFT)) -#define ISFCN(x) (((x) & N_TMASK) == (DT_FCN << N_BTSHFT)) -#define ISARY(x) (((x) & N_TMASK) == (DT_ARY << N_BTSHFT)) - -#ifdef __cplusplus -} -#endif - -#endif /* _A_OUT_H_ */ diff --git a/qemu-0.11.0/acl.c b/qemu-0.11.0/acl.c deleted file mode 100644 index f69db25..0000000 --- a/qemu-0.11.0/acl.c +++ /dev/null @@ -1,185 +0,0 @@ -/* - * QEMU access control list management - * - * Copyright (C) 2009 Red Hat, Inc - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - - -#include "qemu-common.h" -#include "sysemu.h" -#include "acl.h" - -#ifdef HAVE_FNMATCH_H -#include <fnmatch.h> -#endif - - -static unsigned int nacls = 0; -static qemu_acl **acls = NULL; - - - -qemu_acl *qemu_acl_find(const char *aclname) -{ - int i; - for (i = 0 ; i < nacls ; i++) { - if (strcmp(acls[i]->aclname, aclname) == 0) - return acls[i]; - } - - return NULL; -} - -qemu_acl *qemu_acl_init(const char *aclname) -{ - qemu_acl *acl; - - acl = qemu_acl_find(aclname); - if (acl) - return acl; - - acl = qemu_malloc(sizeof(*acl)); - acl->aclname = qemu_strdup(aclname); - /* Deny by default, so there is no window of "open - * access" between QEMU starting, and the user setting - * up ACLs in the monitor */ - acl->defaultDeny = 1; - - acl->nentries = 0; - TAILQ_INIT(&acl->entries); - - acls = qemu_realloc(acls, sizeof(*acls) * (nacls +1)); - acls[nacls] = acl; - nacls++; - - return acl; -} - -int qemu_acl_party_is_allowed(qemu_acl *acl, - const char *party) -{ - qemu_acl_entry *entry; - - TAILQ_FOREACH(entry, &acl->entries, next) { -#ifdef HAVE_FNMATCH_H - if (fnmatch(entry->match, party, 0) == 0) - return entry->deny ? 0 : 1; -#else - /* No fnmatch, so fallback to exact string matching - * instead of allowing wildcards */ - if (strcmp(entry->match, party) == 0) - return entry->deny ? 0 : 1; -#endif - } - - return acl->defaultDeny ? 0 : 1; -} - - -void qemu_acl_reset(qemu_acl *acl) -{ - qemu_acl_entry *entry; - - /* Put back to deny by default, so there is no window - * of "open access" while the user re-initializes the - * access control list */ - acl->defaultDeny = 1; - TAILQ_FOREACH(entry, &acl->entries, next) { - TAILQ_REMOVE(&acl->entries, entry, next); - free(entry->match); - free(entry); - } - acl->nentries = 0; -} - - -int qemu_acl_append(qemu_acl *acl, - int deny, - const char *match) -{ - qemu_acl_entry *entry; - - entry = qemu_malloc(sizeof(*entry)); - entry->match = qemu_strdup(match); - entry->deny = deny; - - TAILQ_INSERT_TAIL(&acl->entries, entry, next); - acl->nentries++; - - return acl->nentries; -} - - -int qemu_acl_insert(qemu_acl *acl, - int deny, - const char *match, - int index) -{ - qemu_acl_entry *entry; - qemu_acl_entry *tmp; - int i = 0; - - if (index <= 0) - return -1; - if (index >= acl->nentries) - return qemu_acl_append(acl, deny, match); - - - entry = qemu_malloc(sizeof(*entry)); - entry->match = qemu_strdup(match); - entry->deny = deny; - - TAILQ_FOREACH(tmp, &acl->entries, next) { - i++; - if (i == index) { - TAILQ_INSERT_BEFORE(tmp, entry, next); - acl->nentries++; - break; - } - } - - return i; -} - -int qemu_acl_remove(qemu_acl *acl, - const char *match) -{ - qemu_acl_entry *entry; - int i = 0; - - TAILQ_FOREACH(entry, &acl->entries, next) { - i++; - if (strcmp(entry->match, match) == 0) { - TAILQ_REMOVE(&acl->entries, entry, next); - return i; - } - } - return -1; -} - - -/* - * Local variables: - * c-indent-level: 4 - * c-basic-offset: 4 - * tab-width: 8 - * End: - */ diff --git a/qemu-0.11.0/acl.h b/qemu-0.11.0/acl.h deleted file mode 100644 index 62a5e56..0000000 --- a/qemu-0.11.0/acl.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * QEMU access control list management - * - * Copyright (C) 2009 Red Hat, Inc - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#ifndef __QEMU_ACL_H__ -#define __QEMU_ACL_H__ - -#include "sys-queue.h" - -typedef struct qemu_acl_entry qemu_acl_entry; -typedef struct qemu_acl qemu_acl; - -struct qemu_acl_entry { - char *match; - int deny; - - TAILQ_ENTRY(qemu_acl_entry) next; -}; - -struct qemu_acl { - char *aclname; - unsigned int nentries; - TAILQ_HEAD(,qemu_acl_entry) entries; - int defaultDeny; -}; - -qemu_acl *qemu_acl_init(const char *aclname); - -qemu_acl *qemu_acl_find(const char *aclname); - -int qemu_acl_party_is_allowed(qemu_acl *acl, - const char *party); - -void qemu_acl_reset(qemu_acl *acl); - -int qemu_acl_append(qemu_acl *acl, - int deny, - const char *match); -int qemu_acl_insert(qemu_acl *acl, - int deny, - const char *match, - int index); -int qemu_acl_remove(qemu_acl *acl, - const char *match); - -#endif /* __QEMU_ACL_H__ */ - -/* - * Local variables: - * c-indent-level: 4 - * c-basic-offset: 4 - * tab-width: 8 - * End: - */ diff --git a/qemu-0.11.0/aes.c b/qemu-0.11.0/aes.c deleted file mode 100644 index eb37adb..0000000 --- a/qemu-0.11.0/aes.c +++ /dev/null @@ -1,1314 +0,0 @@ -/** - * - * aes.c - integrated in QEMU by Fabrice Bellard from the OpenSSL project. - */ -/* - * rijndael-alg-fst.c - * - * @version 3.0 (December 2000) - * - * Optimised ANSI C code for the Rijndael cipher (now AES) - * - * @author Vincent Rijmen vincent.rijmen@esat.kuleuven.ac.be - * @author Antoon Bosselaers antoon.bosselaers@esat.kuleuven.ac.be - * @author Paulo Barreto paulo.barreto@terra.com.br - * - * This code is hereby placed in the public domain. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ''AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "qemu-common.h" -#include "aes.h" - -#ifndef NDEBUG -#define NDEBUG -#endif - -typedef uint32_t u32; -typedef uint16_t u16; -typedef uint8_t u8; - -/* This controls loop-unrolling in aes_core.c */ -#undef FULL_UNROLL -# define GETU32(pt) (((u32)(pt)[0] << 24) ^ ((u32)(pt)[1] << 16) ^ ((u32)(pt)[2] << 8) ^ ((u32)(pt)[3])) -# define PUTU32(ct, st) { (ct)[0] = (u8)((st) >> 24); (ct)[1] = (u8)((st) >> 16); (ct)[2] = (u8)((st) >> 8); (ct)[3] = (u8)(st); } - -/* -Te0[x] = S [x].[02, 01, 01, 03]; -Te1[x] = S [x].[03, 02, 01, 01]; -Te2[x] = S [x].[01, 03, 02, 01]; -Te3[x] = S [x].[01, 01, 03, 02]; -Te4[x] = S [x].[01, 01, 01, 01]; - -Td0[x] = Si[x].[0e, 09, 0d, 0b]; -Td1[x] = Si[x].[0b, 0e, 09, 0d]; -Td2[x] = Si[x].[0d, 0b, 0e, 09]; -Td3[x] = Si[x].[09, 0d, 0b, 0e]; -Td4[x] = Si[x].[01, 01, 01, 01]; -*/ - -static const u32 Te0[256] = { - 0xc66363a5U, 0xf87c7c84U, 0xee777799U, 0xf67b7b8dU, - 0xfff2f20dU, 0xd66b6bbdU, 0xde6f6fb1U, 0x91c5c554U, - 0x60303050U, 0x02010103U, 0xce6767a9U, 0x562b2b7dU, - 0xe7fefe19U, 0xb5d7d762U, 0x4dababe6U, 0xec76769aU, - 0x8fcaca45U, 0x1f82829dU, 0x89c9c940U, 0xfa7d7d87U, - 0xeffafa15U, 0xb25959ebU, 0x8e4747c9U, 0xfbf0f00bU, - 0x41adadecU, 0xb3d4d467U, 0x5fa2a2fdU, 0x45afafeaU, - 0x239c9cbfU, 0x53a4a4f7U, 0xe4727296U, 0x9bc0c05bU, - 0x75b7b7c2U, 0xe1fdfd1cU, 0x3d9393aeU, 0x4c26266aU, - 0x6c36365aU, 0x7e3f3f41U, 0xf5f7f702U, 0x83cccc4fU, - 0x6834345cU, 0x51a5a5f4U, 0xd1e5e534U, 0xf9f1f108U, - 0xe2717193U, 0xabd8d873U, 0x62313153U, 0x2a15153fU, - 0x0804040cU, 0x95c7c752U, 0x46232365U, 0x9dc3c35eU, - 0x30181828U, 0x379696a1U, 0x0a05050fU, 0x2f9a9ab5U, - 0x0e070709U, 0x24121236U, 0x1b80809bU, 0xdfe2e23dU, - 0xcdebeb26U, 0x4e272769U, 0x7fb2b2cdU, 0xea75759fU, - 0x1209091bU, 0x1d83839eU, 0x582c2c74U, 0x341a1a2eU, - 0x361b1b2dU, 0xdc6e6eb2U, 0xb45a5aeeU, 0x5ba0a0fbU, - 0xa45252f6U, 0x763b3b4dU, 0xb7d6d661U, 0x7db3b3ceU, - 0x5229297bU, 0xdde3e33eU, 0x5e2f2f71U, 0x13848497U, - 0xa65353f5U, 0xb9d1d168U, 0x00000000U, 0xc1eded2cU, - 0x40202060U, 0xe3fcfc1fU, 0x79b1b1c8U, 0xb65b5bedU, - 0xd46a6abeU, 0x8dcbcb46U, 0x67bebed9U, 0x7239394bU, - 0x944a4adeU, 0x984c4cd4U, 0xb05858e8U, 0x85cfcf4aU, - 0xbbd0d06bU, 0xc5efef2aU, 0x4faaaae5U, 0xedfbfb16U, - 0x864343c5U, 0x9a4d4dd7U, 0x66333355U, 0x11858594U, - 0x8a4545cfU, 0xe9f9f910U, 0x04020206U, 0xfe7f7f81U, - 0xa05050f0U, 0x783c3c44U, 0x259f9fbaU, 0x4ba8a8e3U, - 0xa25151f3U, 0x5da3a3feU, 0x804040c0U, 0x058f8f8aU, - 0x3f9292adU, 0x219d9dbcU, 0x70383848U, 0xf1f5f504U, - 0x63bcbcdfU, 0x77b6b6c1U, 0xafdada75U, 0x42212163U, - 0x20101030U, 0xe5ffff1aU, 0xfdf3f30eU, 0xbfd2d26dU, - 0x81cdcd4cU, 0x180c0c14U, 0x26131335U, 0xc3ecec2fU, - 0xbe5f5fe1U, 0x359797a2U, 0x884444ccU, 0x2e171739U, - 0x93c4c457U, 0x55a7a7f2U, 0xfc7e7e82U, 0x7a3d3d47U, - 0xc86464acU, 0xba5d5de7U, 0x3219192bU, 0xe6737395U, - 0xc06060a0U, 0x19818198U, 0x9e4f4fd1U, 0xa3dcdc7fU, - 0x44222266U, 0x542a2a7eU, 0x3b9090abU, 0x0b888883U, - 0x8c4646caU, 0xc7eeee29U, 0x6bb8b8d3U, 0x2814143cU, - 0xa7dede79U, 0xbc5e5ee2U, 0x160b0b1dU, 0xaddbdb76U, - 0xdbe0e03bU, 0x64323256U, 0x743a3a4eU, 0x140a0a1eU, - 0x924949dbU, 0x0c06060aU, 0x4824246cU, 0xb85c5ce4U, - 0x9fc2c25dU, 0xbdd3d36eU, 0x43acacefU, 0xc46262a6U, - 0x399191a8U, 0x319595a4U, 0xd3e4e437U, 0xf279798bU, - 0xd5e7e732U, 0x8bc8c843U, 0x6e373759U, 0xda6d6db7U, - 0x018d8d8cU, 0xb1d5d564U, 0x9c4e4ed2U, 0x49a9a9e0U, - 0xd86c6cb4U, 0xac5656faU, 0xf3f4f407U, 0xcfeaea25U, - 0xca6565afU, 0xf47a7a8eU, 0x47aeaee9U, 0x10080818U, - 0x6fbabad5U, 0xf0787888U, 0x4a25256fU, 0x5c2e2e72U, - 0x381c1c24U, 0x57a6a6f1U, 0x73b4b4c7U, 0x97c6c651U, - 0xcbe8e823U, 0xa1dddd7cU, 0xe874749cU, 0x3e1f1f21U, - 0x964b4bddU, 0x61bdbddcU, 0x0d8b8b86U, 0x0f8a8a85U, - 0xe0707090U, 0x7c3e3e42U, 0x71b5b5c4U, 0xcc6666aaU, - 0x904848d8U, 0x06030305U, 0xf7f6f601U, 0x1c0e0e12U, - 0xc26161a3U, 0x6a35355fU, 0xae5757f9U, 0x69b9b9d0U, - 0x17868691U, 0x99c1c158U, 0x3a1d1d27U, 0x279e9eb9U, - 0xd9e1e138U, 0xebf8f813U, 0x2b9898b3U, 0x22111133U, - 0xd26969bbU, 0xa9d9d970U, 0x078e8e89U, 0x339494a7U, - 0x2d9b9bb6U, 0x3c1e1e22U, 0x15878792U, 0xc9e9e920U, - 0x87cece49U, 0xaa5555ffU, 0x50282878U, 0xa5dfdf7aU, - 0x038c8c8fU, 0x59a1a1f8U, 0x09898980U, 0x1a0d0d17U, - 0x65bfbfdaU, 0xd7e6e631U, 0x844242c6U, 0xd06868b8U, - 0x824141c3U, 0x299999b0U, 0x5a2d2d77U, 0x1e0f0f11U, - 0x7bb0b0cbU, 0xa85454fcU, 0x6dbbbbd6U, 0x2c16163aU, -}; -static const u32 Te1[256] = { - 0xa5c66363U, 0x84f87c7cU, 0x99ee7777U, 0x8df67b7bU, - 0x0dfff2f2U, 0xbdd66b6bU, 0xb1de6f6fU, 0x5491c5c5U, - 0x50603030U, 0x03020101U, 0xa9ce6767U, 0x7d562b2bU, - 0x19e7fefeU, 0x62b5d7d7U, 0xe64dababU, 0x9aec7676U, - 0x458fcacaU, 0x9d1f8282U, 0x4089c9c9U, 0x87fa7d7dU, - 0x15effafaU, 0xebb25959U, 0xc98e4747U, 0x0bfbf0f0U, - 0xec41adadU, 0x67b3d4d4U, 0xfd5fa2a2U, 0xea45afafU, - 0xbf239c9cU, 0xf753a4a4U, 0x96e47272U, 0x5b9bc0c0U, - 0xc275b7b7U, 0x1ce1fdfdU, 0xae3d9393U, 0x6a4c2626U, - 0x5a6c3636U, 0x417e3f3fU, 0x02f5f7f7U, 0x4f83ccccU, - 0x5c683434U, 0xf451a5a5U, 0x34d1e5e5U, 0x08f9f1f1U, - 0x93e27171U, 0x73abd8d8U, 0x53623131U, 0x3f2a1515U, - 0x0c080404U, 0x5295c7c7U, 0x65462323U, 0x5e9dc3c3U, - 0x28301818U, 0xa1379696U, 0x0f0a0505U, 0xb52f9a9aU, - 0x090e0707U, 0x36241212U, 0x9b1b8080U, 0x3ddfe2e2U, - 0x26cdebebU, 0x694e2727U, 0xcd7fb2b2U, 0x9fea7575U, - 0x1b120909U, 0x9e1d8383U, 0x74582c2cU, 0x2e341a1aU, - 0x2d361b1bU, 0xb2dc6e6eU, 0xeeb45a5aU, 0xfb5ba0a0U, - 0xf6a45252U, 0x4d763b3bU, 0x61b7d6d6U, 0xce7db3b3U, - 0x7b522929U, 0x3edde3e3U, 0x715e2f2fU, 0x97138484U, - 0xf5a65353U, 0x68b9d1d1U, 0x00000000U, 0x2cc1ededU, - 0x60402020U, 0x1fe3fcfcU, 0xc879b1b1U, 0xedb65b5bU, - 0xbed46a6aU, 0x468dcbcbU, 0xd967bebeU, 0x4b723939U, - 0xde944a4aU, 0xd4984c4cU, 0xe8b05858U, 0x4a85cfcfU, - 0x6bbbd0d0U, 0x2ac5efefU, 0xe54faaaaU, 0x16edfbfbU, - 0xc5864343U, 0xd79a4d4dU, 0x55663333U, 0x94118585U, - 0xcf8a4545U, 0x10e9f9f9U, 0x06040202U, 0x81fe7f7fU, - 0xf0a05050U, 0x44783c3cU, 0xba259f9fU, 0xe34ba8a8U, - 0xf3a25151U, 0xfe5da3a3U, 0xc0804040U, 0x8a058f8fU, - 0xad3f9292U, 0xbc219d9dU, 0x48703838U, 0x04f1f5f5U, - 0xdf63bcbcU, 0xc177b6b6U, 0x75afdadaU, 0x63422121U, - 0x30201010U, 0x1ae5ffffU, 0x0efdf3f3U, 0x6dbfd2d2U, - 0x4c81cdcdU, 0x14180c0cU, 0x35261313U, 0x2fc3ececU, - 0xe1be5f5fU, 0xa2359797U, 0xcc884444U, 0x392e1717U, - 0x5793c4c4U, 0xf255a7a7U, 0x82fc7e7eU, 0x477a3d3dU, - 0xacc86464U, 0xe7ba5d5dU, 0x2b321919U, 0x95e67373U, - 0xa0c06060U, 0x98198181U, 0xd19e4f4fU, 0x7fa3dcdcU, - 0x66442222U, 0x7e542a2aU, 0xab3b9090U, 0x830b8888U, - 0xca8c4646U, 0x29c7eeeeU, 0xd36bb8b8U, 0x3c281414U, - 0x79a7dedeU, 0xe2bc5e5eU, 0x1d160b0bU, 0x76addbdbU, - 0x3bdbe0e0U, 0x56643232U, 0x4e743a3aU, 0x1e140a0aU, - 0xdb924949U, 0x0a0c0606U, 0x6c482424U, 0xe4b85c5cU, - 0x5d9fc2c2U, 0x6ebdd3d3U, 0xef43acacU, 0xa6c46262U, - 0xa8399191U, 0xa4319595U, 0x37d3e4e4U, 0x8bf27979U, - 0x32d5e7e7U, 0x438bc8c8U, 0x596e3737U, 0xb7da6d6dU, - 0x8c018d8dU, 0x64b1d5d5U, 0xd29c4e4eU, 0xe049a9a9U, - 0xb4d86c6cU, 0xfaac5656U, 0x07f3f4f4U, 0x25cfeaeaU, - 0xafca6565U, 0x8ef47a7aU, 0xe947aeaeU, 0x18100808U, - 0xd56fbabaU, 0x88f07878U, 0x6f4a2525U, 0x725c2e2eU, - 0x24381c1cU, 0xf157a6a6U, 0xc773b4b4U, 0x5197c6c6U, - 0x23cbe8e8U, 0x7ca1ddddU, 0x9ce87474U, 0x213e1f1fU, - 0xdd964b4bU, 0xdc61bdbdU, 0x860d8b8bU, 0x850f8a8aU, - 0x90e07070U, 0x427c3e3eU, 0xc471b5b5U, 0xaacc6666U, - 0xd8904848U, 0x05060303U, 0x01f7f6f6U, 0x121c0e0eU, - 0xa3c26161U, 0x5f6a3535U, 0xf9ae5757U, 0xd069b9b9U, - 0x91178686U, 0x5899c1c1U, 0x273a1d1dU, 0xb9279e9eU, - 0x38d9e1e1U, 0x13ebf8f8U, 0xb32b9898U, 0x33221111U, - 0xbbd26969U, 0x70a9d9d9U, 0x89078e8eU, 0xa7339494U, - 0xb62d9b9bU, 0x223c1e1eU, 0x92158787U, 0x20c9e9e9U, - 0x4987ceceU, 0xffaa5555U, 0x78502828U, 0x7aa5dfdfU, - 0x8f038c8cU, 0xf859a1a1U, 0x80098989U, 0x171a0d0dU, - 0xda65bfbfU, 0x31d7e6e6U, 0xc6844242U, 0xb8d06868U, - 0xc3824141U, 0xb0299999U, 0x775a2d2dU, 0x111e0f0fU, - 0xcb7bb0b0U, 0xfca85454U, 0xd66dbbbbU, 0x3a2c1616U, -}; -static const u32 Te2[256] = { - 0x63a5c663U, 0x7c84f87cU, 0x7799ee77U, 0x7b8df67bU, - 0xf20dfff2U, 0x6bbdd66bU, 0x6fb1de6fU, 0xc55491c5U, - 0x30506030U, 0x01030201U, 0x67a9ce67U, 0x2b7d562bU, - 0xfe19e7feU, 0xd762b5d7U, 0xabe64dabU, 0x769aec76U, - 0xca458fcaU, 0x829d1f82U, 0xc94089c9U, 0x7d87fa7dU, - 0xfa15effaU, 0x59ebb259U, 0x47c98e47U, 0xf00bfbf0U, - 0xadec41adU, 0xd467b3d4U, 0xa2fd5fa2U, 0xafea45afU, - 0x9cbf239cU, 0xa4f753a4U, 0x7296e472U, 0xc05b9bc0U, - 0xb7c275b7U, 0xfd1ce1fdU, 0x93ae3d93U, 0x266a4c26U, - 0x365a6c36U, 0x3f417e3fU, 0xf702f5f7U, 0xcc4f83ccU, - 0x345c6834U, 0xa5f451a5U, 0xe534d1e5U, 0xf108f9f1U, - 0x7193e271U, 0xd873abd8U, 0x31536231U, 0x153f2a15U, - 0x040c0804U, 0xc75295c7U, 0x23654623U, 0xc35e9dc3U, - 0x18283018U, 0x96a13796U, 0x050f0a05U, 0x9ab52f9aU, - 0x07090e07U, 0x12362412U, 0x809b1b80U, 0xe23ddfe2U, - 0xeb26cdebU, 0x27694e27U, 0xb2cd7fb2U, 0x759fea75U, - 0x091b1209U, 0x839e1d83U, 0x2c74582cU, 0x1a2e341aU, - 0x1b2d361bU, 0x6eb2dc6eU, 0x5aeeb45aU, 0xa0fb5ba0U, - 0x52f6a452U, 0x3b4d763bU, 0xd661b7d6U, 0xb3ce7db3U, - 0x297b5229U, 0xe33edde3U, 0x2f715e2fU, 0x84971384U, - 0x53f5a653U, 0xd168b9d1U, 0x00000000U, 0xed2cc1edU, - 0x20604020U, 0xfc1fe3fcU, 0xb1c879b1U, 0x5bedb65bU, - 0x6abed46aU, 0xcb468dcbU, 0xbed967beU, 0x394b7239U, - 0x4ade944aU, 0x4cd4984cU, 0x58e8b058U, 0xcf4a85cfU, - 0xd06bbbd0U, 0xef2ac5efU, 0xaae54faaU, 0xfb16edfbU, - 0x43c58643U, 0x4dd79a4dU, 0x33556633U, 0x85941185U, - 0x45cf8a45U, 0xf910e9f9U, 0x02060402U, 0x7f81fe7fU, - 0x50f0a050U, 0x3c44783cU, 0x9fba259fU, 0xa8e34ba8U, - 0x51f3a251U, 0xa3fe5da3U, 0x40c08040U, 0x8f8a058fU, - 0x92ad3f92U, 0x9dbc219dU, 0x38487038U, 0xf504f1f5U, - 0xbcdf63bcU, 0xb6c177b6U, 0xda75afdaU, 0x21634221U, - 0x10302010U, 0xff1ae5ffU, 0xf30efdf3U, 0xd26dbfd2U, - 0xcd4c81cdU, 0x0c14180cU, 0x13352613U, 0xec2fc3ecU, - 0x5fe1be5fU, 0x97a23597U, 0x44cc8844U, 0x17392e17U, - 0xc45793c4U, 0xa7f255a7U, 0x7e82fc7eU, 0x3d477a3dU, - 0x64acc864U, 0x5de7ba5dU, 0x192b3219U, 0x7395e673U, - 0x60a0c060U, 0x81981981U, 0x4fd19e4fU, 0xdc7fa3dcU, - 0x22664422U, 0x2a7e542aU, 0x90ab3b90U, 0x88830b88U, - 0x46ca8c46U, 0xee29c7eeU, 0xb8d36bb8U, 0x143c2814U, - 0xde79a7deU, 0x5ee2bc5eU, 0x0b1d160bU, 0xdb76addbU, - 0xe03bdbe0U, 0x32566432U, 0x3a4e743aU, 0x0a1e140aU, - 0x49db9249U, 0x060a0c06U, 0x246c4824U, 0x5ce4b85cU, - 0xc25d9fc2U, 0xd36ebdd3U, 0xacef43acU, 0x62a6c462U, - 0x91a83991U, 0x95a43195U, 0xe437d3e4U, 0x798bf279U, - 0xe732d5e7U, 0xc8438bc8U, 0x37596e37U, 0x6db7da6dU, - 0x8d8c018dU, 0xd564b1d5U, 0x4ed29c4eU, 0xa9e049a9U, - 0x6cb4d86cU, 0x56faac56U, 0xf407f3f4U, 0xea25cfeaU, - 0x65afca65U, 0x7a8ef47aU, 0xaee947aeU, 0x08181008U, - 0xbad56fbaU, 0x7888f078U, 0x256f4a25U, 0x2e725c2eU, - 0x1c24381cU, 0xa6f157a6U, 0xb4c773b4U, 0xc65197c6U, - 0xe823cbe8U, 0xdd7ca1ddU, 0x749ce874U, 0x1f213e1fU, - 0x4bdd964bU, 0xbddc61bdU, 0x8b860d8bU, 0x8a850f8aU, - 0x7090e070U, 0x3e427c3eU, 0xb5c471b5U, 0x66aacc66U, - 0x48d89048U, 0x03050603U, 0xf601f7f6U, 0x0e121c0eU, - 0x61a3c261U, 0x355f6a35U, 0x57f9ae57U, 0xb9d069b9U, - 0x86911786U, 0xc15899c1U, 0x1d273a1dU, 0x9eb9279eU, - 0xe138d9e1U, 0xf813ebf8U, 0x98b32b98U, 0x11332211U, - 0x69bbd269U, 0xd970a9d9U, 0x8e89078eU, 0x94a73394U, - 0x9bb62d9bU, 0x1e223c1eU, 0x87921587U, 0xe920c9e9U, - 0xce4987ceU, 0x55ffaa55U, 0x28785028U, 0xdf7aa5dfU, - 0x8c8f038cU, 0xa1f859a1U, 0x89800989U, 0x0d171a0dU, - 0xbfda65bfU, 0xe631d7e6U, 0x42c68442U, 0x68b8d068U, - 0x41c38241U, 0x99b02999U, 0x2d775a2dU, 0x0f111e0fU, - 0xb0cb7bb0U, 0x54fca854U, 0xbbd66dbbU, 0x163a2c16U, -}; -static const u32 Te3[256] = { - - 0x6363a5c6U, 0x7c7c84f8U, 0x777799eeU, 0x7b7b8df6U, - 0xf2f20dffU, 0x6b6bbdd6U, 0x6f6fb1deU, 0xc5c55491U, - 0x30305060U, 0x01010302U, 0x6767a9ceU, 0x2b2b7d56U, - 0xfefe19e7U, 0xd7d762b5U, 0xababe64dU, 0x76769aecU, - 0xcaca458fU, 0x82829d1fU, 0xc9c94089U, 0x7d7d87faU, - 0xfafa15efU, 0x5959ebb2U, 0x4747c98eU, 0xf0f00bfbU, - 0xadadec41U, 0xd4d467b3U, 0xa2a2fd5fU, 0xafafea45U, - 0x9c9cbf23U, 0xa4a4f753U, 0x727296e4U, 0xc0c05b9bU, - 0xb7b7c275U, 0xfdfd1ce1U, 0x9393ae3dU, 0x26266a4cU, - 0x36365a6cU, 0x3f3f417eU, 0xf7f702f5U, 0xcccc4f83U, - 0x34345c68U, 0xa5a5f451U, 0xe5e534d1U, 0xf1f108f9U, - 0x717193e2U, 0xd8d873abU, 0x31315362U, 0x15153f2aU, - 0x04040c08U, 0xc7c75295U, 0x23236546U, 0xc3c35e9dU, - 0x18182830U, 0x9696a137U, 0x05050f0aU, 0x9a9ab52fU, - 0x0707090eU, 0x12123624U, 0x80809b1bU, 0xe2e23ddfU, - 0xebeb26cdU, 0x2727694eU, 0xb2b2cd7fU, 0x75759feaU, - 0x09091b12U, 0x83839e1dU, 0x2c2c7458U, 0x1a1a2e34U, - 0x1b1b2d36U, 0x6e6eb2dcU, 0x5a5aeeb4U, 0xa0a0fb5bU, - 0x5252f6a4U, 0x3b3b4d76U, 0xd6d661b7U, 0xb3b3ce7dU, - 0x29297b52U, 0xe3e33eddU, 0x2f2f715eU, 0x84849713U, - 0x5353f5a6U, 0xd1d168b9U, 0x00000000U, 0xeded2cc1U, - 0x20206040U, 0xfcfc1fe3U, 0xb1b1c879U, 0x5b5bedb6U, - 0x6a6abed4U, 0xcbcb468dU, 0xbebed967U, 0x39394b72U, - 0x4a4ade94U, 0x4c4cd498U, 0x5858e8b0U, 0xcfcf4a85U, - 0xd0d06bbbU, 0xefef2ac5U, 0xaaaae54fU, 0xfbfb16edU, - 0x4343c586U, 0x4d4dd79aU, 0x33335566U, 0x85859411U, - 0x4545cf8aU, 0xf9f910e9U, 0x02020604U, 0x7f7f81feU, - 0x5050f0a0U, 0x3c3c4478U, 0x9f9fba25U, 0xa8a8e34bU, - 0x5151f3a2U, 0xa3a3fe5dU, 0x4040c080U, 0x8f8f8a05U, - 0x9292ad3fU, 0x9d9dbc21U, 0x38384870U, 0xf5f504f1U, - 0xbcbcdf63U, 0xb6b6c177U, 0xdada75afU, 0x21216342U, - 0x10103020U, 0xffff1ae5U, 0xf3f30efdU, 0xd2d26dbfU, - 0xcdcd4c81U, 0x0c0c1418U, 0x13133526U, 0xecec2fc3U, - 0x5f5fe1beU, 0x9797a235U, 0x4444cc88U, 0x1717392eU, - 0xc4c45793U, 0xa7a7f255U, 0x7e7e82fcU, 0x3d3d477aU, - 0x6464acc8U, 0x5d5de7baU, 0x19192b32U, 0x737395e6U, - 0x6060a0c0U, 0x81819819U, 0x4f4fd19eU, 0xdcdc7fa3U, - 0x22226644U, 0x2a2a7e54U, 0x9090ab3bU, 0x8888830bU, - 0x4646ca8cU, 0xeeee29c7U, 0xb8b8d36bU, 0x14143c28U, - 0xdede79a7U, 0x5e5ee2bcU, 0x0b0b1d16U, 0xdbdb76adU, - 0xe0e03bdbU, 0x32325664U, 0x3a3a4e74U, 0x0a0a1e14U, - 0x4949db92U, 0x06060a0cU, 0x24246c48U, 0x5c5ce4b8U, - 0xc2c25d9fU, 0xd3d36ebdU, 0xacacef43U, 0x6262a6c4U, - 0x9191a839U, 0x9595a431U, 0xe4e437d3U, 0x79798bf2U, - 0xe7e732d5U, 0xc8c8438bU, 0x3737596eU, 0x6d6db7daU, - 0x8d8d8c01U, 0xd5d564b1U, 0x4e4ed29cU, 0xa9a9e049U, - 0x6c6cb4d8U, 0x5656faacU, 0xf4f407f3U, 0xeaea25cfU, - 0x6565afcaU, 0x7a7a8ef4U, 0xaeaee947U, 0x08081810U, - 0xbabad56fU, 0x787888f0U, 0x25256f4aU, 0x2e2e725cU, - 0x1c1c2438U, 0xa6a6f157U, 0xb4b4c773U, 0xc6c65197U, - 0xe8e823cbU, 0xdddd7ca1U, 0x74749ce8U, 0x1f1f213eU, - 0x4b4bdd96U, 0xbdbddc61U, 0x8b8b860dU, 0x8a8a850fU, - 0x707090e0U, 0x3e3e427cU, 0xb5b5c471U, 0x6666aaccU, - 0x4848d890U, 0x03030506U, 0xf6f601f7U, 0x0e0e121cU, - 0x6161a3c2U, 0x35355f6aU, 0x5757f9aeU, 0xb9b9d069U, - 0x86869117U, 0xc1c15899U, 0x1d1d273aU, 0x9e9eb927U, - 0xe1e138d9U, 0xf8f813ebU, 0x9898b32bU, 0x11113322U, - 0x6969bbd2U, 0xd9d970a9U, 0x8e8e8907U, 0x9494a733U, - 0x9b9bb62dU, 0x1e1e223cU, 0x87879215U, 0xe9e920c9U, - 0xcece4987U, 0x5555ffaaU, 0x28287850U, 0xdfdf7aa5U, - 0x8c8c8f03U, 0xa1a1f859U, 0x89898009U, 0x0d0d171aU, - 0xbfbfda65U, 0xe6e631d7U, 0x4242c684U, 0x6868b8d0U, - 0x4141c382U, 0x9999b029U, 0x2d2d775aU, 0x0f0f111eU, - 0xb0b0cb7bU, 0x5454fca8U, 0xbbbbd66dU, 0x16163a2cU, -}; -static const u32 Te4[256] = { - 0x63636363U, 0x7c7c7c7cU, 0x77777777U, 0x7b7b7b7bU, - 0xf2f2f2f2U, 0x6b6b6b6bU, 0x6f6f6f6fU, 0xc5c5c5c5U, - 0x30303030U, 0x01010101U, 0x67676767U, 0x2b2b2b2bU, - 0xfefefefeU, 0xd7d7d7d7U, 0xababababU, 0x76767676U, - 0xcacacacaU, 0x82828282U, 0xc9c9c9c9U, 0x7d7d7d7dU, - 0xfafafafaU, 0x59595959U, 0x47474747U, 0xf0f0f0f0U, - 0xadadadadU, 0xd4d4d4d4U, 0xa2a2a2a2U, 0xafafafafU, - 0x9c9c9c9cU, 0xa4a4a4a4U, 0x72727272U, 0xc0c0c0c0U, - 0xb7b7b7b7U, 0xfdfdfdfdU, 0x93939393U, 0x26262626U, - 0x36363636U, 0x3f3f3f3fU, 0xf7f7f7f7U, 0xccccccccU, - 0x34343434U, 0xa5a5a5a5U, 0xe5e5e5e5U, 0xf1f1f1f1U, - 0x71717171U, 0xd8d8d8d8U, 0x31313131U, 0x15151515U, - 0x04040404U, 0xc7c7c7c7U, 0x23232323U, 0xc3c3c3c3U, - 0x18181818U, 0x96969696U, 0x05050505U, 0x9a9a9a9aU, - 0x07070707U, 0x12121212U, 0x80808080U, 0xe2e2e2e2U, - 0xebebebebU, 0x27272727U, 0xb2b2b2b2U, 0x75757575U, - 0x09090909U, 0x83838383U, 0x2c2c2c2cU, 0x1a1a1a1aU, - 0x1b1b1b1bU, 0x6e6e6e6eU, 0x5a5a5a5aU, 0xa0a0a0a0U, - 0x52525252U, 0x3b3b3b3bU, 0xd6d6d6d6U, 0xb3b3b3b3U, - 0x29292929U, 0xe3e3e3e3U, 0x2f2f2f2fU, 0x84848484U, - 0x53535353U, 0xd1d1d1d1U, 0x00000000U, 0xededededU, - 0x20202020U, 0xfcfcfcfcU, 0xb1b1b1b1U, 0x5b5b5b5bU, - 0x6a6a6a6aU, 0xcbcbcbcbU, 0xbebebebeU, 0x39393939U, - 0x4a4a4a4aU, 0x4c4c4c4cU, 0x58585858U, 0xcfcfcfcfU, - 0xd0d0d0d0U, 0xefefefefU, 0xaaaaaaaaU, 0xfbfbfbfbU, - 0x43434343U, 0x4d4d4d4dU, 0x33333333U, 0x85858585U, - 0x45454545U, 0xf9f9f9f9U, 0x02020202U, 0x7f7f7f7fU, - 0x50505050U, 0x3c3c3c3cU, 0x9f9f9f9fU, 0xa8a8a8a8U, - 0x51515151U, 0xa3a3a3a3U, 0x40404040U, 0x8f8f8f8fU, - 0x92929292U, 0x9d9d9d9dU, 0x38383838U, 0xf5f5f5f5U, - 0xbcbcbcbcU, 0xb6b6b6b6U, 0xdadadadaU, 0x21212121U, - 0x10101010U, 0xffffffffU, 0xf3f3f3f3U, 0xd2d2d2d2U, - 0xcdcdcdcdU, 0x0c0c0c0cU, 0x13131313U, 0xececececU, - 0x5f5f5f5fU, 0x97979797U, 0x44444444U, 0x17171717U, - 0xc4c4c4c4U, 0xa7a7a7a7U, 0x7e7e7e7eU, 0x3d3d3d3dU, - 0x64646464U, 0x5d5d5d5dU, 0x19191919U, 0x73737373U, - 0x60606060U, 0x81818181U, 0x4f4f4f4fU, 0xdcdcdcdcU, - 0x22222222U, 0x2a2a2a2aU, 0x90909090U, 0x88888888U, - 0x46464646U, 0xeeeeeeeeU, 0xb8b8b8b8U, 0x14141414U, - 0xdedededeU, 0x5e5e5e5eU, 0x0b0b0b0bU, 0xdbdbdbdbU, - 0xe0e0e0e0U, 0x32323232U, 0x3a3a3a3aU, 0x0a0a0a0aU, - 0x49494949U, 0x06060606U, 0x24242424U, 0x5c5c5c5cU, - 0xc2c2c2c2U, 0xd3d3d3d3U, 0xacacacacU, 0x62626262U, - 0x91919191U, 0x95959595U, 0xe4e4e4e4U, 0x79797979U, - 0xe7e7e7e7U, 0xc8c8c8c8U, 0x37373737U, 0x6d6d6d6dU, - 0x8d8d8d8dU, 0xd5d5d5d5U, 0x4e4e4e4eU, 0xa9a9a9a9U, - 0x6c6c6c6cU, 0x56565656U, 0xf4f4f4f4U, 0xeaeaeaeaU, - 0x65656565U, 0x7a7a7a7aU, 0xaeaeaeaeU, 0x08080808U, - 0xbabababaU, 0x78787878U, 0x25252525U, 0x2e2e2e2eU, - 0x1c1c1c1cU, 0xa6a6a6a6U, 0xb4b4b4b4U, 0xc6c6c6c6U, - 0xe8e8e8e8U, 0xddddddddU, 0x74747474U, 0x1f1f1f1fU, - 0x4b4b4b4bU, 0xbdbdbdbdU, 0x8b8b8b8bU, 0x8a8a8a8aU, - 0x70707070U, 0x3e3e3e3eU, 0xb5b5b5b5U, 0x66666666U, - 0x48484848U, 0x03030303U, 0xf6f6f6f6U, 0x0e0e0e0eU, - 0x61616161U, 0x35353535U, 0x57575757U, 0xb9b9b9b9U, - 0x86868686U, 0xc1c1c1c1U, 0x1d1d1d1dU, 0x9e9e9e9eU, - 0xe1e1e1e1U, 0xf8f8f8f8U, 0x98989898U, 0x11111111U, - 0x69696969U, 0xd9d9d9d9U, 0x8e8e8e8eU, 0x94949494U, - 0x9b9b9b9bU, 0x1e1e1e1eU, 0x87878787U, 0xe9e9e9e9U, - 0xcecececeU, 0x55555555U, 0x28282828U, 0xdfdfdfdfU, - 0x8c8c8c8cU, 0xa1a1a1a1U, 0x89898989U, 0x0d0d0d0dU, - 0xbfbfbfbfU, 0xe6e6e6e6U, 0x42424242U, 0x68686868U, - 0x41414141U, 0x99999999U, 0x2d2d2d2dU, 0x0f0f0f0fU, - 0xb0b0b0b0U, 0x54545454U, 0xbbbbbbbbU, 0x16161616U, -}; -static const u32 Td0[256] = { - 0x51f4a750U, 0x7e416553U, 0x1a17a4c3U, 0x3a275e96U, - 0x3bab6bcbU, 0x1f9d45f1U, 0xacfa58abU, 0x4be30393U, - 0x2030fa55U, 0xad766df6U, 0x88cc7691U, 0xf5024c25U, - 0x4fe5d7fcU, 0xc52acbd7U, 0x26354480U, 0xb562a38fU, - 0xdeb15a49U, 0x25ba1b67U, 0x45ea0e98U, 0x5dfec0e1U, - 0xc32f7502U, 0x814cf012U, 0x8d4697a3U, 0x6bd3f9c6U, - 0x038f5fe7U, 0x15929c95U, 0xbf6d7aebU, 0x955259daU, - 0xd4be832dU, 0x587421d3U, 0x49e06929U, 0x8ec9c844U, - 0x75c2896aU, 0xf48e7978U, 0x99583e6bU, 0x27b971ddU, - 0xbee14fb6U, 0xf088ad17U, 0xc920ac66U, 0x7dce3ab4U, - 0x63df4a18U, 0xe51a3182U, 0x97513360U, 0x62537f45U, - 0xb16477e0U, 0xbb6bae84U, 0xfe81a01cU, 0xf9082b94U, - 0x70486858U, 0x8f45fd19U, 0x94de6c87U, 0x527bf8b7U, - 0xab73d323U, 0x724b02e2U, 0xe31f8f57U, 0x6655ab2aU, - 0xb2eb2807U, 0x2fb5c203U, 0x86c57b9aU, 0xd33708a5U, - 0x302887f2U, 0x23bfa5b2U, 0x02036abaU, 0xed16825cU, - 0x8acf1c2bU, 0xa779b492U, 0xf307f2f0U, 0x4e69e2a1U, - 0x65daf4cdU, 0x0605bed5U, 0xd134621fU, 0xc4a6fe8aU, - 0x342e539dU, 0xa2f355a0U, 0x058ae132U, 0xa4f6eb75U, - 0x0b83ec39U, 0x4060efaaU, 0x5e719f06U, 0xbd6e1051U, - 0x3e218af9U, 0x96dd063dU, 0xdd3e05aeU, 0x4de6bd46U, - 0x91548db5U, 0x71c45d05U, 0x0406d46fU, 0x605015ffU, - 0x1998fb24U, 0xd6bde997U, 0x894043ccU, 0x67d99e77U, - 0xb0e842bdU, 0x07898b88U, 0xe7195b38U, 0x79c8eedbU, - 0xa17c0a47U, 0x7c420fe9U, 0xf8841ec9U, 0x00000000U, - 0x09808683U, 0x322bed48U, 0x1e1170acU, 0x6c5a724eU, - 0xfd0efffbU, 0x0f853856U, 0x3daed51eU, 0x362d3927U, - 0x0a0fd964U, 0x685ca621U, 0x9b5b54d1U, 0x24362e3aU, - 0x0c0a67b1U, 0x9357e70fU, 0xb4ee96d2U, 0x1b9b919eU, - 0x80c0c54fU, 0x61dc20a2U, 0x5a774b69U, 0x1c121a16U, - 0xe293ba0aU, 0xc0a02ae5U, 0x3c22e043U, 0x121b171dU, - 0x0e090d0bU, 0xf28bc7adU, 0x2db6a8b9U, 0x141ea9c8U, - 0x57f11985U, 0xaf75074cU, 0xee99ddbbU, 0xa37f60fdU, - 0xf701269fU, 0x5c72f5bcU, 0x44663bc5U, 0x5bfb7e34U, - 0x8b432976U, 0xcb23c6dcU, 0xb6edfc68U, 0xb8e4f163U, - 0xd731dccaU, 0x42638510U, 0x13972240U, 0x84c61120U, - 0x854a247dU, 0xd2bb3df8U, 0xaef93211U, 0xc729a16dU, - 0x1d9e2f4bU, 0xdcb230f3U, 0x0d8652ecU, 0x77c1e3d0U, - 0x2bb3166cU, 0xa970b999U, 0x119448faU, 0x47e96422U, - 0xa8fc8cc4U, 0xa0f03f1aU, 0x567d2cd8U, 0x223390efU, - 0x87494ec7U, 0xd938d1c1U, 0x8ccaa2feU, 0x98d40b36U, - 0xa6f581cfU, 0xa57ade28U, 0xdab78e26U, 0x3fadbfa4U, - 0x2c3a9de4U, 0x5078920dU, 0x6a5fcc9bU, 0x547e4662U, - 0xf68d13c2U, 0x90d8b8e8U, 0x2e39f75eU, 0x82c3aff5U, - 0x9f5d80beU, 0x69d0937cU, 0x6fd52da9U, 0xcf2512b3U, - 0xc8ac993bU, 0x10187da7U, 0xe89c636eU, 0xdb3bbb7bU, - 0xcd267809U, 0x6e5918f4U, 0xec9ab701U, 0x834f9aa8U, - 0xe6956e65U, 0xaaffe67eU, 0x21bccf08U, 0xef15e8e6U, - 0xbae79bd9U, 0x4a6f36ceU, 0xea9f09d4U, 0x29b07cd6U, - 0x31a4b2afU, 0x2a3f2331U, 0xc6a59430U, 0x35a266c0U, - 0x744ebc37U, 0xfc82caa6U, 0xe090d0b0U, 0x33a7d815U, - 0xf104984aU, 0x41ecdaf7U, 0x7fcd500eU, 0x1791f62fU, - 0x764dd68dU, 0x43efb04dU, 0xccaa4d54U, 0xe49604dfU, - 0x9ed1b5e3U, 0x4c6a881bU, 0xc12c1fb8U, 0x4665517fU, - 0x9d5eea04U, 0x018c355dU, 0xfa877473U, 0xfb0b412eU, - 0xb3671d5aU, 0x92dbd252U, 0xe9105633U, 0x6dd64713U, - 0x9ad7618cU, 0x37a10c7aU, 0x59f8148eU, 0xeb133c89U, - 0xcea927eeU, 0xb761c935U, 0xe11ce5edU, 0x7a47b13cU, - 0x9cd2df59U, 0x55f2733fU, 0x1814ce79U, 0x73c737bfU, - 0x53f7cdeaU, 0x5ffdaa5bU, 0xdf3d6f14U, 0x7844db86U, - 0xcaaff381U, 0xb968c43eU, 0x3824342cU, 0xc2a3405fU, - 0x161dc372U, 0xbce2250cU, 0x283c498bU, 0xff0d9541U, - 0x39a80171U, 0x080cb3deU, 0xd8b4e49cU, 0x6456c190U, - 0x7bcb8461U, 0xd532b670U, 0x486c5c74U, 0xd0b85742U, -}; -static const u32 Td1[256] = { - 0x5051f4a7U, 0x537e4165U, 0xc31a17a4U, 0x963a275eU, - 0xcb3bab6bU, 0xf11f9d45U, 0xabacfa58U, 0x934be303U, - 0x552030faU, 0xf6ad766dU, 0x9188cc76U, 0x25f5024cU, - 0xfc4fe5d7U, 0xd7c52acbU, 0x80263544U, 0x8fb562a3U, - 0x49deb15aU, 0x6725ba1bU, 0x9845ea0eU, 0xe15dfec0U, - 0x02c32f75U, 0x12814cf0U, 0xa38d4697U, 0xc66bd3f9U, - 0xe7038f5fU, 0x9515929cU, 0xebbf6d7aU, 0xda955259U, - 0x2dd4be83U, 0xd3587421U, 0x2949e069U, 0x448ec9c8U, - 0x6a75c289U, 0x78f48e79U, 0x6b99583eU, 0xdd27b971U, - 0xb6bee14fU, 0x17f088adU, 0x66c920acU, 0xb47dce3aU, - 0x1863df4aU, 0x82e51a31U, 0x60975133U, 0x4562537fU, - 0xe0b16477U, 0x84bb6baeU, 0x1cfe81a0U, 0x94f9082bU, - 0x58704868U, 0x198f45fdU, 0x8794de6cU, 0xb7527bf8U, - 0x23ab73d3U, 0xe2724b02U, 0x57e31f8fU, 0x2a6655abU, - 0x07b2eb28U, 0x032fb5c2U, 0x9a86c57bU, 0xa5d33708U, - 0xf2302887U, 0xb223bfa5U, 0xba02036aU, 0x5ced1682U, - 0x2b8acf1cU, 0x92a779b4U, 0xf0f307f2U, 0xa14e69e2U, - 0xcd65daf4U, 0xd50605beU, 0x1fd13462U, 0x8ac4a6feU, - 0x9d342e53U, 0xa0a2f355U, 0x32058ae1U, 0x75a4f6ebU, - 0x390b83ecU, 0xaa4060efU, 0x065e719fU, 0x51bd6e10U, - 0xf93e218aU, 0x3d96dd06U, 0xaedd3e05U, 0x464de6bdU, - 0xb591548dU, 0x0571c45dU, 0x6f0406d4U, 0xff605015U, - 0x241998fbU, 0x97d6bde9U, 0xcc894043U, 0x7767d99eU, - 0xbdb0e842U, 0x8807898bU, 0x38e7195bU, 0xdb79c8eeU, - 0x47a17c0aU, 0xe97c420fU, 0xc9f8841eU, 0x00000000U, - 0x83098086U, 0x48322bedU, 0xac1e1170U, 0x4e6c5a72U, - 0xfbfd0effU, 0x560f8538U, 0x1e3daed5U, 0x27362d39U, - 0x640a0fd9U, 0x21685ca6U, 0xd19b5b54U, 0x3a24362eU, - 0xb10c0a67U, 0x0f9357e7U, 0xd2b4ee96U, 0x9e1b9b91U, - 0x4f80c0c5U, 0xa261dc20U, 0x695a774bU, 0x161c121aU, - 0x0ae293baU, 0xe5c0a02aU, 0x433c22e0U, 0x1d121b17U, - 0x0b0e090dU, 0xadf28bc7U, 0xb92db6a8U, 0xc8141ea9U, - 0x8557f119U, 0x4caf7507U, 0xbbee99ddU, 0xfda37f60U, - 0x9ff70126U, 0xbc5c72f5U, 0xc544663bU, 0x345bfb7eU, - 0x768b4329U, 0xdccb23c6U, 0x68b6edfcU, 0x63b8e4f1U, - 0xcad731dcU, 0x10426385U, 0x40139722U, 0x2084c611U, - 0x7d854a24U, 0xf8d2bb3dU, 0x11aef932U, 0x6dc729a1U, - 0x4b1d9e2fU, 0xf3dcb230U, 0xec0d8652U, 0xd077c1e3U, - 0x6c2bb316U, 0x99a970b9U, 0xfa119448U, 0x2247e964U, - 0xc4a8fc8cU, 0x1aa0f03fU, 0xd8567d2cU, 0xef223390U, - 0xc787494eU, 0xc1d938d1U, 0xfe8ccaa2U, 0x3698d40bU, - 0xcfa6f581U, 0x28a57adeU, 0x26dab78eU, 0xa43fadbfU, - 0xe42c3a9dU, 0x0d507892U, 0x9b6a5fccU, 0x62547e46U, - 0xc2f68d13U, 0xe890d8b8U, 0x5e2e39f7U, 0xf582c3afU, - 0xbe9f5d80U, 0x7c69d093U, 0xa96fd52dU, 0xb3cf2512U, - 0x3bc8ac99U, 0xa710187dU, 0x6ee89c63U, 0x7bdb3bbbU, - 0x09cd2678U, 0xf46e5918U, 0x01ec9ab7U, 0xa8834f9aU, - 0x65e6956eU, 0x7eaaffe6U, 0x0821bccfU, 0xe6ef15e8U, - 0xd9bae79bU, 0xce4a6f36U, 0xd4ea9f09U, 0xd629b07cU, - 0xaf31a4b2U, 0x312a3f23U, 0x30c6a594U, 0xc035a266U, - 0x37744ebcU, 0xa6fc82caU, 0xb0e090d0U, 0x1533a7d8U, - 0x4af10498U, 0xf741ecdaU, 0x0e7fcd50U, 0x2f1791f6U, - 0x8d764dd6U, 0x4d43efb0U, 0x54ccaa4dU, 0xdfe49604U, - 0xe39ed1b5U, 0x1b4c6a88U, 0xb8c12c1fU, 0x7f466551U, - 0x049d5eeaU, 0x5d018c35U, 0x73fa8774U, 0x2efb0b41U, - 0x5ab3671dU, 0x5292dbd2U, 0x33e91056U, 0x136dd647U, - 0x8c9ad761U, 0x7a37a10cU, 0x8e59f814U, 0x89eb133cU, - 0xeecea927U, 0x35b761c9U, 0xede11ce5U, 0x3c7a47b1U, - 0x599cd2dfU, 0x3f55f273U, 0x791814ceU, 0xbf73c737U, - 0xea53f7cdU, 0x5b5ffdaaU, 0x14df3d6fU, 0x867844dbU, - 0x81caaff3U, 0x3eb968c4U, 0x2c382434U, 0x5fc2a340U, - 0x72161dc3U, 0x0cbce225U, 0x8b283c49U, 0x41ff0d95U, - 0x7139a801U, 0xde080cb3U, 0x9cd8b4e4U, 0x906456c1U, - 0x617bcb84U, 0x70d532b6U, 0x74486c5cU, 0x42d0b857U, -}; -static const u32 Td2[256] = { - 0xa75051f4U, 0x65537e41U, 0xa4c31a17U, 0x5e963a27U, - 0x6bcb3babU, 0x45f11f9dU, 0x58abacfaU, 0x03934be3U, - 0xfa552030U, 0x6df6ad76U, 0x769188ccU, 0x4c25f502U, - 0xd7fc4fe5U, 0xcbd7c52aU, 0x44802635U, 0xa38fb562U, - 0x5a49deb1U, 0x1b6725baU, 0x0e9845eaU, 0xc0e15dfeU, - 0x7502c32fU, 0xf012814cU, 0x97a38d46U, 0xf9c66bd3U, - 0x5fe7038fU, 0x9c951592U, 0x7aebbf6dU, 0x59da9552U, - 0x832dd4beU, 0x21d35874U, 0x692949e0U, 0xc8448ec9U, - 0x896a75c2U, 0x7978f48eU, 0x3e6b9958U, 0x71dd27b9U, - 0x4fb6bee1U, 0xad17f088U, 0xac66c920U, 0x3ab47dceU, - 0x4a1863dfU, 0x3182e51aU, 0x33609751U, 0x7f456253U, - 0x77e0b164U, 0xae84bb6bU, 0xa01cfe81U, 0x2b94f908U, - 0x68587048U, 0xfd198f45U, 0x6c8794deU, 0xf8b7527bU, - 0xd323ab73U, 0x02e2724bU, 0x8f57e31fU, 0xab2a6655U, - 0x2807b2ebU, 0xc2032fb5U, 0x7b9a86c5U, 0x08a5d337U, - 0x87f23028U, 0xa5b223bfU, 0x6aba0203U, 0x825ced16U, - 0x1c2b8acfU, 0xb492a779U, 0xf2f0f307U, 0xe2a14e69U, - 0xf4cd65daU, 0xbed50605U, 0x621fd134U, 0xfe8ac4a6U, - 0x539d342eU, 0x55a0a2f3U, 0xe132058aU, 0xeb75a4f6U, - 0xec390b83U, 0xefaa4060U, 0x9f065e71U, 0x1051bd6eU, - - 0x8af93e21U, 0x063d96ddU, 0x05aedd3eU, 0xbd464de6U, - 0x8db59154U, 0x5d0571c4U, 0xd46f0406U, 0x15ff6050U, - 0xfb241998U, 0xe997d6bdU, 0x43cc8940U, 0x9e7767d9U, - 0x42bdb0e8U, 0x8b880789U, 0x5b38e719U, 0xeedb79c8U, - 0x0a47a17cU, 0x0fe97c42U, 0x1ec9f884U, 0x00000000U, - 0x86830980U, 0xed48322bU, 0x70ac1e11U, 0x724e6c5aU, - 0xfffbfd0eU, 0x38560f85U, 0xd51e3daeU, 0x3927362dU, - 0xd9640a0fU, 0xa621685cU, 0x54d19b5bU, 0x2e3a2436U, - 0x67b10c0aU, 0xe70f9357U, 0x96d2b4eeU, 0x919e1b9bU, - 0xc54f80c0U, 0x20a261dcU, 0x4b695a77U, 0x1a161c12U, - 0xba0ae293U, 0x2ae5c0a0U, 0xe0433c22U, 0x171d121bU, - 0x0d0b0e09U, 0xc7adf28bU, 0xa8b92db6U, 0xa9c8141eU, - 0x198557f1U, 0x074caf75U, 0xddbbee99U, 0x60fda37fU, - 0x269ff701U, 0xf5bc5c72U, 0x3bc54466U, 0x7e345bfbU, - 0x29768b43U, 0xc6dccb23U, 0xfc68b6edU, 0xf163b8e4U, - 0xdccad731U, 0x85104263U, 0x22401397U, 0x112084c6U, - 0x247d854aU, 0x3df8d2bbU, 0x3211aef9U, 0xa16dc729U, - 0x2f4b1d9eU, 0x30f3dcb2U, 0x52ec0d86U, 0xe3d077c1U, - 0x166c2bb3U, 0xb999a970U, 0x48fa1194U, 0x642247e9U, - 0x8cc4a8fcU, 0x3f1aa0f0U, 0x2cd8567dU, 0x90ef2233U, - 0x4ec78749U, 0xd1c1d938U, 0xa2fe8ccaU, 0x0b3698d4U, - 0x81cfa6f5U, 0xde28a57aU, 0x8e26dab7U, 0xbfa43fadU, - 0x9de42c3aU, 0x920d5078U, 0xcc9b6a5fU, 0x4662547eU, - 0x13c2f68dU, 0xb8e890d8U, 0xf75e2e39U, 0xaff582c3U, - 0x80be9f5dU, 0x937c69d0U, 0x2da96fd5U, 0x12b3cf25U, - 0x993bc8acU, 0x7da71018U, 0x636ee89cU, 0xbb7bdb3bU, - 0x7809cd26U, 0x18f46e59U, 0xb701ec9aU, 0x9aa8834fU, - 0x6e65e695U, 0xe67eaaffU, 0xcf0821bcU, 0xe8e6ef15U, - 0x9bd9bae7U, 0x36ce4a6fU, 0x09d4ea9fU, 0x7cd629b0U, - 0xb2af31a4U, 0x23312a3fU, 0x9430c6a5U, 0x66c035a2U, - 0xbc37744eU, 0xcaa6fc82U, 0xd0b0e090U, 0xd81533a7U, - 0x984af104U, 0xdaf741ecU, 0x500e7fcdU, 0xf62f1791U, - 0xd68d764dU, 0xb04d43efU, 0x4d54ccaaU, 0x04dfe496U, - 0xb5e39ed1U, 0x881b4c6aU, 0x1fb8c12cU, 0x517f4665U, - 0xea049d5eU, 0x355d018cU, 0x7473fa87U, 0x412efb0bU, - 0x1d5ab367U, 0xd25292dbU, 0x5633e910U, 0x47136dd6U, - 0x618c9ad7U, 0x0c7a37a1U, 0x148e59f8U, 0x3c89eb13U, - 0x27eecea9U, 0xc935b761U, 0xe5ede11cU, 0xb13c7a47U, - 0xdf599cd2U, 0x733f55f2U, 0xce791814U, 0x37bf73c7U, - 0xcdea53f7U, 0xaa5b5ffdU, 0x6f14df3dU, 0xdb867844U, - 0xf381caafU, 0xc43eb968U, 0x342c3824U, 0x405fc2a3U, - 0xc372161dU, 0x250cbce2U, 0x498b283cU, 0x9541ff0dU, - 0x017139a8U, 0xb3de080cU, 0xe49cd8b4U, 0xc1906456U, - 0x84617bcbU, 0xb670d532U, 0x5c74486cU, 0x5742d0b8U, -}; -static const u32 Td3[256] = { - 0xf4a75051U, 0x4165537eU, 0x17a4c31aU, 0x275e963aU, - 0xab6bcb3bU, 0x9d45f11fU, 0xfa58abacU, 0xe303934bU, - 0x30fa5520U, 0x766df6adU, 0xcc769188U, 0x024c25f5U, - 0xe5d7fc4fU, 0x2acbd7c5U, 0x35448026U, 0x62a38fb5U, - 0xb15a49deU, 0xba1b6725U, 0xea0e9845U, 0xfec0e15dU, - 0x2f7502c3U, 0x4cf01281U, 0x4697a38dU, 0xd3f9c66bU, - 0x8f5fe703U, 0x929c9515U, 0x6d7aebbfU, 0x5259da95U, - 0xbe832dd4U, 0x7421d358U, 0xe0692949U, 0xc9c8448eU, - 0xc2896a75U, 0x8e7978f4U, 0x583e6b99U, 0xb971dd27U, - 0xe14fb6beU, 0x88ad17f0U, 0x20ac66c9U, 0xce3ab47dU, - 0xdf4a1863U, 0x1a3182e5U, 0x51336097U, 0x537f4562U, - 0x6477e0b1U, 0x6bae84bbU, 0x81a01cfeU, 0x082b94f9U, - 0x48685870U, 0x45fd198fU, 0xde6c8794U, 0x7bf8b752U, - 0x73d323abU, 0x4b02e272U, 0x1f8f57e3U, 0x55ab2a66U, - 0xeb2807b2U, 0xb5c2032fU, 0xc57b9a86U, 0x3708a5d3U, - 0x2887f230U, 0xbfa5b223U, 0x036aba02U, 0x16825cedU, - 0xcf1c2b8aU, 0x79b492a7U, 0x07f2f0f3U, 0x69e2a14eU, - 0xdaf4cd65U, 0x05bed506U, 0x34621fd1U, 0xa6fe8ac4U, - 0x2e539d34U, 0xf355a0a2U, 0x8ae13205U, 0xf6eb75a4U, - 0x83ec390bU, 0x60efaa40U, 0x719f065eU, 0x6e1051bdU, - 0x218af93eU, 0xdd063d96U, 0x3e05aeddU, 0xe6bd464dU, - 0x548db591U, 0xc45d0571U, 0x06d46f04U, 0x5015ff60U, - 0x98fb2419U, 0xbde997d6U, 0x4043cc89U, 0xd99e7767U, - 0xe842bdb0U, 0x898b8807U, 0x195b38e7U, 0xc8eedb79U, - 0x7c0a47a1U, 0x420fe97cU, 0x841ec9f8U, 0x00000000U, - 0x80868309U, 0x2bed4832U, 0x1170ac1eU, 0x5a724e6cU, - 0x0efffbfdU, 0x8538560fU, 0xaed51e3dU, 0x2d392736U, - 0x0fd9640aU, 0x5ca62168U, 0x5b54d19bU, 0x362e3a24U, - 0x0a67b10cU, 0x57e70f93U, 0xee96d2b4U, 0x9b919e1bU, - 0xc0c54f80U, 0xdc20a261U, 0x774b695aU, 0x121a161cU, - 0x93ba0ae2U, 0xa02ae5c0U, 0x22e0433cU, 0x1b171d12U, - 0x090d0b0eU, 0x8bc7adf2U, 0xb6a8b92dU, 0x1ea9c814U, - 0xf1198557U, 0x75074cafU, 0x99ddbbeeU, 0x7f60fda3U, - 0x01269ff7U, 0x72f5bc5cU, 0x663bc544U, 0xfb7e345bU, - 0x4329768bU, 0x23c6dccbU, 0xedfc68b6U, 0xe4f163b8U, - 0x31dccad7U, 0x63851042U, 0x97224013U, 0xc6112084U, - 0x4a247d85U, 0xbb3df8d2U, 0xf93211aeU, 0x29a16dc7U, - 0x9e2f4b1dU, 0xb230f3dcU, 0x8652ec0dU, 0xc1e3d077U, - 0xb3166c2bU, 0x70b999a9U, 0x9448fa11U, 0xe9642247U, - 0xfc8cc4a8U, 0xf03f1aa0U, 0x7d2cd856U, 0x3390ef22U, - 0x494ec787U, 0x38d1c1d9U, 0xcaa2fe8cU, 0xd40b3698U, - 0xf581cfa6U, 0x7ade28a5U, 0xb78e26daU, 0xadbfa43fU, - 0x3a9de42cU, 0x78920d50U, 0x5fcc9b6aU, 0x7e466254U, - 0x8d13c2f6U, 0xd8b8e890U, 0x39f75e2eU, 0xc3aff582U, - 0x5d80be9fU, 0xd0937c69U, 0xd52da96fU, 0x2512b3cfU, - 0xac993bc8U, 0x187da710U, 0x9c636ee8U, 0x3bbb7bdbU, - 0x267809cdU, 0x5918f46eU, 0x9ab701ecU, 0x4f9aa883U, - 0x956e65e6U, 0xffe67eaaU, 0xbccf0821U, 0x15e8e6efU, - 0xe79bd9baU, 0x6f36ce4aU, 0x9f09d4eaU, 0xb07cd629U, - 0xa4b2af31U, 0x3f23312aU, 0xa59430c6U, 0xa266c035U, - 0x4ebc3774U, 0x82caa6fcU, 0x90d0b0e0U, 0xa7d81533U, - 0x04984af1U, 0xecdaf741U, 0xcd500e7fU, 0x91f62f17U, - 0x4dd68d76U, 0xefb04d43U, 0xaa4d54ccU, 0x9604dfe4U, - 0xd1b5e39eU, 0x6a881b4cU, 0x2c1fb8c1U, 0x65517f46U, - 0x5eea049dU, 0x8c355d01U, 0x877473faU, 0x0b412efbU, - 0x671d5ab3U, 0xdbd25292U, 0x105633e9U, 0xd647136dU, - 0xd7618c9aU, 0xa10c7a37U, 0xf8148e59U, 0x133c89ebU, - 0xa927eeceU, 0x61c935b7U, 0x1ce5ede1U, 0x47b13c7aU, - 0xd2df599cU, 0xf2733f55U, 0x14ce7918U, 0xc737bf73U, - 0xf7cdea53U, 0xfdaa5b5fU, 0x3d6f14dfU, 0x44db8678U, - 0xaff381caU, 0x68c43eb9U, 0x24342c38U, 0xa3405fc2U, - 0x1dc37216U, 0xe2250cbcU, 0x3c498b28U, 0x0d9541ffU, - 0xa8017139U, 0x0cb3de08U, 0xb4e49cd8U, 0x56c19064U, - 0xcb84617bU, 0x32b670d5U, 0x6c5c7448U, 0xb85742d0U, -}; -static const u32 Td4[256] = { - 0x52525252U, 0x09090909U, 0x6a6a6a6aU, 0xd5d5d5d5U, - 0x30303030U, 0x36363636U, 0xa5a5a5a5U, 0x38383838U, - 0xbfbfbfbfU, 0x40404040U, 0xa3a3a3a3U, 0x9e9e9e9eU, - 0x81818181U, 0xf3f3f3f3U, 0xd7d7d7d7U, 0xfbfbfbfbU, - 0x7c7c7c7cU, 0xe3e3e3e3U, 0x39393939U, 0x82828282U, - 0x9b9b9b9bU, 0x2f2f2f2fU, 0xffffffffU, 0x87878787U, - 0x34343434U, 0x8e8e8e8eU, 0x43434343U, 0x44444444U, - 0xc4c4c4c4U, 0xdedededeU, 0xe9e9e9e9U, 0xcbcbcbcbU, - 0x54545454U, 0x7b7b7b7bU, 0x94949494U, 0x32323232U, - 0xa6a6a6a6U, 0xc2c2c2c2U, 0x23232323U, 0x3d3d3d3dU, - 0xeeeeeeeeU, 0x4c4c4c4cU, 0x95959595U, 0x0b0b0b0bU, - 0x42424242U, 0xfafafafaU, 0xc3c3c3c3U, 0x4e4e4e4eU, - 0x08080808U, 0x2e2e2e2eU, 0xa1a1a1a1U, 0x66666666U, - 0x28282828U, 0xd9d9d9d9U, 0x24242424U, 0xb2b2b2b2U, - 0x76767676U, 0x5b5b5b5bU, 0xa2a2a2a2U, 0x49494949U, - 0x6d6d6d6dU, 0x8b8b8b8bU, 0xd1d1d1d1U, 0x25252525U, - 0x72727272U, 0xf8f8f8f8U, 0xf6f6f6f6U, 0x64646464U, - 0x86868686U, 0x68686868U, 0x98989898U, 0x16161616U, - 0xd4d4d4d4U, 0xa4a4a4a4U, 0x5c5c5c5cU, 0xccccccccU, - 0x5d5d5d5dU, 0x65656565U, 0xb6b6b6b6U, 0x92929292U, - 0x6c6c6c6cU, 0x70707070U, 0x48484848U, 0x50505050U, - 0xfdfdfdfdU, 0xededededU, 0xb9b9b9b9U, 0xdadadadaU, - 0x5e5e5e5eU, 0x15151515U, 0x46464646U, 0x57575757U, - 0xa7a7a7a7U, 0x8d8d8d8dU, 0x9d9d9d9dU, 0x84848484U, - 0x90909090U, 0xd8d8d8d8U, 0xababababU, 0x00000000U, - 0x8c8c8c8cU, 0xbcbcbcbcU, 0xd3d3d3d3U, 0x0a0a0a0aU, - 0xf7f7f7f7U, 0xe4e4e4e4U, 0x58585858U, 0x05050505U, - 0xb8b8b8b8U, 0xb3b3b3b3U, 0x45454545U, 0x06060606U, - 0xd0d0d0d0U, 0x2c2c2c2cU, 0x1e1e1e1eU, 0x8f8f8f8fU, - 0xcacacacaU, 0x3f3f3f3fU, 0x0f0f0f0fU, 0x02020202U, - 0xc1c1c1c1U, 0xafafafafU, 0xbdbdbdbdU, 0x03030303U, - 0x01010101U, 0x13131313U, 0x8a8a8a8aU, 0x6b6b6b6bU, - 0x3a3a3a3aU, 0x91919191U, 0x11111111U, 0x41414141U, - 0x4f4f4f4fU, 0x67676767U, 0xdcdcdcdcU, 0xeaeaeaeaU, - 0x97979797U, 0xf2f2f2f2U, 0xcfcfcfcfU, 0xcecececeU, - 0xf0f0f0f0U, 0xb4b4b4b4U, 0xe6e6e6e6U, 0x73737373U, - 0x96969696U, 0xacacacacU, 0x74747474U, 0x22222222U, - 0xe7e7e7e7U, 0xadadadadU, 0x35353535U, 0x85858585U, - 0xe2e2e2e2U, 0xf9f9f9f9U, 0x37373737U, 0xe8e8e8e8U, - 0x1c1c1c1cU, 0x75757575U, 0xdfdfdfdfU, 0x6e6e6e6eU, - 0x47474747U, 0xf1f1f1f1U, 0x1a1a1a1aU, 0x71717171U, - 0x1d1d1d1dU, 0x29292929U, 0xc5c5c5c5U, 0x89898989U, - 0x6f6f6f6fU, 0xb7b7b7b7U, 0x62626262U, 0x0e0e0e0eU, - 0xaaaaaaaaU, 0x18181818U, 0xbebebebeU, 0x1b1b1b1bU, - 0xfcfcfcfcU, 0x56565656U, 0x3e3e3e3eU, 0x4b4b4b4bU, - 0xc6c6c6c6U, 0xd2d2d2d2U, 0x79797979U, 0x20202020U, - 0x9a9a9a9aU, 0xdbdbdbdbU, 0xc0c0c0c0U, 0xfefefefeU, - 0x78787878U, 0xcdcdcdcdU, 0x5a5a5a5aU, 0xf4f4f4f4U, - 0x1f1f1f1fU, 0xddddddddU, 0xa8a8a8a8U, 0x33333333U, - 0x88888888U, 0x07070707U, 0xc7c7c7c7U, 0x31313131U, - 0xb1b1b1b1U, 0x12121212U, 0x10101010U, 0x59595959U, - 0x27272727U, 0x80808080U, 0xececececU, 0x5f5f5f5fU, - 0x60606060U, 0x51515151U, 0x7f7f7f7fU, 0xa9a9a9a9U, - 0x19191919U, 0xb5b5b5b5U, 0x4a4a4a4aU, 0x0d0d0d0dU, - 0x2d2d2d2dU, 0xe5e5e5e5U, 0x7a7a7a7aU, 0x9f9f9f9fU, - 0x93939393U, 0xc9c9c9c9U, 0x9c9c9c9cU, 0xefefefefU, - 0xa0a0a0a0U, 0xe0e0e0e0U, 0x3b3b3b3bU, 0x4d4d4d4dU, - 0xaeaeaeaeU, 0x2a2a2a2aU, 0xf5f5f5f5U, 0xb0b0b0b0U, - 0xc8c8c8c8U, 0xebebebebU, 0xbbbbbbbbU, 0x3c3c3c3cU, - 0x83838383U, 0x53535353U, 0x99999999U, 0x61616161U, - 0x17171717U, 0x2b2b2b2bU, 0x04040404U, 0x7e7e7e7eU, - 0xbabababaU, 0x77777777U, 0xd6d6d6d6U, 0x26262626U, - 0xe1e1e1e1U, 0x69696969U, 0x14141414U, 0x63636363U, - 0x55555555U, 0x21212121U, 0x0c0c0c0cU, 0x7d7d7d7dU, -}; -static const u32 rcon[] = { - 0x01000000, 0x02000000, 0x04000000, 0x08000000, - 0x10000000, 0x20000000, 0x40000000, 0x80000000, - 0x1B000000, 0x36000000, /* for 128-bit blocks, Rijndael never uses more than 10 rcon values */ -}; - -/** - * Expand the cipher key into the encryption key schedule. - */ -int AES_set_encrypt_key(const unsigned char *userKey, const int bits, - AES_KEY *key) { - - u32 *rk; - int i = 0; - u32 temp; - - if (!userKey || !key) - return -1; - if (bits != 128 && bits != 192 && bits != 256) - return -2; - - rk = key->rd_key; - - if (bits==128) - key->rounds = 10; - else if (bits==192) - key->rounds = 12; - else - key->rounds = 14; - - rk[0] = GETU32(userKey ); - rk[1] = GETU32(userKey + 4); - rk[2] = GETU32(userKey + 8); - rk[3] = GETU32(userKey + 12); - if (bits == 128) { - while (1) { - temp = rk[3]; - rk[4] = rk[0] ^ - (Te4[(temp >> 16) & 0xff] & 0xff000000) ^ - (Te4[(temp >> 8) & 0xff] & 0x00ff0000) ^ - (Te4[(temp ) & 0xff] & 0x0000ff00) ^ - (Te4[(temp >> 24) ] & 0x000000ff) ^ - rcon[i]; - rk[5] = rk[1] ^ rk[4]; - rk[6] = rk[2] ^ rk[5]; - rk[7] = rk[3] ^ rk[6]; - if (++i == 10) { - return 0; - } - rk += 4; - } - } - rk[4] = GETU32(userKey + 16); - rk[5] = GETU32(userKey + 20); - if (bits == 192) { - while (1) { - temp = rk[ 5]; - rk[ 6] = rk[ 0] ^ - (Te4[(temp >> 16) & 0xff] & 0xff000000) ^ - (Te4[(temp >> 8) & 0xff] & 0x00ff0000) ^ - (Te4[(temp ) & 0xff] & 0x0000ff00) ^ - (Te4[(temp >> 24) ] & 0x000000ff) ^ - rcon[i]; - rk[ 7] = rk[ 1] ^ rk[ 6]; - rk[ 8] = rk[ 2] ^ rk[ 7]; - rk[ 9] = rk[ 3] ^ rk[ 8]; - if (++i == 8) { - return 0; - } - rk[10] = rk[ 4] ^ rk[ 9]; - rk[11] = rk[ 5] ^ rk[10]; - rk += 6; - } - } - rk[6] = GETU32(userKey + 24); - rk[7] = GETU32(userKey + 28); - if (bits == 256) { - while (1) { - temp = rk[ 7]; - rk[ 8] = rk[ 0] ^ - (Te4[(temp >> 16) & 0xff] & 0xff000000) ^ - (Te4[(temp >> 8) & 0xff] & 0x00ff0000) ^ - (Te4[(temp ) & 0xff] & 0x0000ff00) ^ - (Te4[(temp >> 24) ] & 0x000000ff) ^ - rcon[i]; - rk[ 9] = rk[ 1] ^ rk[ 8]; - rk[10] = rk[ 2] ^ rk[ 9]; - rk[11] = rk[ 3] ^ rk[10]; - if (++i == 7) { - return 0; - } - temp = rk[11]; - rk[12] = rk[ 4] ^ - (Te4[(temp >> 24) ] & 0xff000000) ^ - (Te4[(temp >> 16) & 0xff] & 0x00ff0000) ^ - (Te4[(temp >> 8) & 0xff] & 0x0000ff00) ^ - (Te4[(temp ) & 0xff] & 0x000000ff); - rk[13] = rk[ 5] ^ rk[12]; - rk[14] = rk[ 6] ^ rk[13]; - rk[15] = rk[ 7] ^ rk[14]; - - rk += 8; - } - } - return 0; -} - -/** - * Expand the cipher key into the decryption key schedule. - */ -int AES_set_decrypt_key(const unsigned char *userKey, const int bits, - AES_KEY *key) { - - u32 *rk; - int i, j, status; - u32 temp; - - /* first, start with an encryption schedule */ - status = AES_set_encrypt_key(userKey, bits, key); - if (status < 0) - return status; - - rk = key->rd_key; - - /* invert the order of the round keys: */ - for (i = 0, j = 4*(key->rounds); i < j; i += 4, j -= 4) { - temp = rk[i ]; rk[i ] = rk[j ]; rk[j ] = temp; - temp = rk[i + 1]; rk[i + 1] = rk[j + 1]; rk[j + 1] = temp; - temp = rk[i + 2]; rk[i + 2] = rk[j + 2]; rk[j + 2] = temp; - temp = rk[i + 3]; rk[i + 3] = rk[j + 3]; rk[j + 3] = temp; - } - /* apply the inverse MixColumn transform to all round keys but the first and the last: */ - for (i = 1; i < (key->rounds); i++) { - rk += 4; - rk[0] = - Td0[Te4[(rk[0] >> 24) ] & 0xff] ^ - Td1[Te4[(rk[0] >> 16) & 0xff] & 0xff] ^ - Td2[Te4[(rk[0] >> 8) & 0xff] & 0xff] ^ - Td3[Te4[(rk[0] ) & 0xff] & 0xff]; - rk[1] = - Td0[Te4[(rk[1] >> 24) ] & 0xff] ^ - Td1[Te4[(rk[1] >> 16) & 0xff] & 0xff] ^ - Td2[Te4[(rk[1] >> 8) & 0xff] & 0xff] ^ - Td3[Te4[(rk[1] ) & 0xff] & 0xff]; - rk[2] = - Td0[Te4[(rk[2] >> 24) ] & 0xff] ^ - Td1[Te4[(rk[2] >> 16) & 0xff] & 0xff] ^ - Td2[Te4[(rk[2] >> 8) & 0xff] & 0xff] ^ - Td3[Te4[(rk[2] ) & 0xff] & 0xff]; - rk[3] = - Td0[Te4[(rk[3] >> 24) ] & 0xff] ^ - Td1[Te4[(rk[3] >> 16) & 0xff] & 0xff] ^ - Td2[Te4[(rk[3] >> 8) & 0xff] & 0xff] ^ - Td3[Te4[(rk[3] ) & 0xff] & 0xff]; - } - return 0; -} - -#ifndef AES_ASM -/* - * Encrypt a single block - * in and out can overlap - */ -void AES_encrypt(const unsigned char *in, unsigned char *out, - const AES_KEY *key) { - - const u32 *rk; - u32 s0, s1, s2, s3, t0, t1, t2, t3; -#ifndef FULL_UNROLL - int r; -#endif /* ?FULL_UNROLL */ - - assert(in && out && key); - rk = key->rd_key; - - /* - * map byte array block to cipher state - * and add initial round key: - */ - s0 = GETU32(in ) ^ rk[0]; - s1 = GETU32(in + 4) ^ rk[1]; - s2 = GETU32(in + 8) ^ rk[2]; - s3 = GETU32(in + 12) ^ rk[3]; -#ifdef FULL_UNROLL - /* round 1: */ - t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >> 8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[ 4]; - t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >> 8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[ 5]; - t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >> 8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[ 6]; - t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >> 8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[ 7]; - /* round 2: */ - s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >> 8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[ 8]; - s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >> 8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[ 9]; - s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >> 8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[10]; - s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >> 8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[11]; - /* round 3: */ - t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >> 8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[12]; - t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >> 8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[13]; - t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >> 8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[14]; - t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >> 8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[15]; - /* round 4: */ - s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >> 8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[16]; - s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >> 8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[17]; - s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >> 8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[18]; - s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >> 8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[19]; - /* round 5: */ - t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >> 8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[20]; - t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >> 8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[21]; - t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >> 8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[22]; - t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >> 8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[23]; - /* round 6: */ - s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >> 8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[24]; - s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >> 8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[25]; - s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >> 8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[26]; - s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >> 8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[27]; - /* round 7: */ - t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >> 8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[28]; - t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >> 8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[29]; - t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >> 8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[30]; - t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >> 8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[31]; - /* round 8: */ - s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >> 8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[32]; - s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >> 8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[33]; - s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >> 8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[34]; - s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >> 8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[35]; - /* round 9: */ - t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >> 8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[36]; - t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >> 8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[37]; - t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >> 8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[38]; - t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >> 8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[39]; - if (key->rounds > 10) { - /* round 10: */ - s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >> 8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[40]; - s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >> 8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[41]; - s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >> 8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[42]; - s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >> 8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[43]; - /* round 11: */ - t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >> 8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[44]; - t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >> 8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[45]; - t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >> 8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[46]; - t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >> 8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[47]; - if (key->rounds > 12) { - /* round 12: */ - s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >> 8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[48]; - s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >> 8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[49]; - s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >> 8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[50]; - s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >> 8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[51]; - /* round 13: */ - t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >> 8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[52]; - t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >> 8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[53]; - t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >> 8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[54]; - t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >> 8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[55]; - } - } - rk += key->rounds << 2; -#else /* !FULL_UNROLL */ - /* - * Nr - 1 full rounds: - */ - r = key->rounds >> 1; - for (;;) { - t0 = - Te0[(s0 >> 24) ] ^ - Te1[(s1 >> 16) & 0xff] ^ - Te2[(s2 >> 8) & 0xff] ^ - Te3[(s3 ) & 0xff] ^ - rk[4]; - t1 = - Te0[(s1 >> 24) ] ^ - Te1[(s2 >> 16) & 0xff] ^ - Te2[(s3 >> 8) & 0xff] ^ - Te3[(s0 ) & 0xff] ^ - rk[5]; - t2 = - Te0[(s2 >> 24) ] ^ - Te1[(s3 >> 16) & 0xff] ^ - Te2[(s0 >> 8) & 0xff] ^ - Te3[(s1 ) & 0xff] ^ - rk[6]; - t3 = - Te0[(s3 >> 24) ] ^ - Te1[(s0 >> 16) & 0xff] ^ - Te2[(s1 >> 8) & 0xff] ^ - Te3[(s2 ) & 0xff] ^ - rk[7]; - - rk += 8; - if (--r == 0) { - break; - } - - s0 = - Te0[(t0 >> 24) ] ^ - Te1[(t1 >> 16) & 0xff] ^ - Te2[(t2 >> 8) & 0xff] ^ - Te3[(t3 ) & 0xff] ^ - rk[0]; - s1 = - Te0[(t1 >> 24) ] ^ - Te1[(t2 >> 16) & 0xff] ^ - Te2[(t3 >> 8) & 0xff] ^ - Te3[(t0 ) & 0xff] ^ - rk[1]; - s2 = - Te0[(t2 >> 24) ] ^ - Te1[(t3 >> 16) & 0xff] ^ - Te2[(t0 >> 8) & 0xff] ^ - Te3[(t1 ) & 0xff] ^ - rk[2]; - s3 = - Te0[(t3 >> 24) ] ^ - Te1[(t0 >> 16) & 0xff] ^ - Te2[(t1 >> 8) & 0xff] ^ - Te3[(t2 ) & 0xff] ^ - rk[3]; - } -#endif /* ?FULL_UNROLL */ - /* - * apply last round and - * map cipher state to byte array block: - */ - s0 = - (Te4[(t0 >> 24) ] & 0xff000000) ^ - (Te4[(t1 >> 16) & 0xff] & 0x00ff0000) ^ - (Te4[(t2 >> 8) & 0xff] & 0x0000ff00) ^ - (Te4[(t3 ) & 0xff] & 0x000000ff) ^ - rk[0]; - PUTU32(out , s0); - s1 = - (Te4[(t1 >> 24) ] & 0xff000000) ^ - (Te4[(t2 >> 16) & 0xff] & 0x00ff0000) ^ - (Te4[(t3 >> 8) & 0xff] & 0x0000ff00) ^ - (Te4[(t0 ) & 0xff] & 0x000000ff) ^ - rk[1]; - PUTU32(out + 4, s1); - s2 = - (Te4[(t2 >> 24) ] & 0xff000000) ^ - (Te4[(t3 >> 16) & 0xff] & 0x00ff0000) ^ - (Te4[(t0 >> 8) & 0xff] & 0x0000ff00) ^ - (Te4[(t1 ) & 0xff] & 0x000000ff) ^ - rk[2]; - PUTU32(out + 8, s2); - s3 = - (Te4[(t3 >> 24) ] & 0xff000000) ^ - (Te4[(t0 >> 16) & 0xff] & 0x00ff0000) ^ - (Te4[(t1 >> 8) & 0xff] & 0x0000ff00) ^ - (Te4[(t2 ) & 0xff] & 0x000000ff) ^ - rk[3]; - PUTU32(out + 12, s3); -} - -/* - * Decrypt a single block - * in and out can overlap - */ -void AES_decrypt(const unsigned char *in, unsigned char *out, - const AES_KEY *key) { - - const u32 *rk; - u32 s0, s1, s2, s3, t0, t1, t2, t3; -#ifndef FULL_UNROLL - int r; -#endif /* ?FULL_UNROLL */ - - assert(in && out && key); - rk = key->rd_key; - - /* - * map byte array block to cipher state - * and add initial round key: - */ - s0 = GETU32(in ) ^ rk[0]; - s1 = GETU32(in + 4) ^ rk[1]; - s2 = GETU32(in + 8) ^ rk[2]; - s3 = GETU32(in + 12) ^ rk[3]; -#ifdef FULL_UNROLL - /* round 1: */ - t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >> 8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[ 4]; - t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >> 8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[ 5]; - t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >> 8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[ 6]; - t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >> 8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[ 7]; - /* round 2: */ - s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >> 8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[ 8]; - s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >> 8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[ 9]; - s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >> 8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[10]; - s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >> 8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[11]; - /* round 3: */ - t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >> 8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[12]; - t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >> 8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[13]; - t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >> 8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[14]; - t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >> 8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[15]; - /* round 4: */ - s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >> 8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[16]; - s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >> 8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[17]; - s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >> 8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[18]; - s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >> 8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[19]; - /* round 5: */ - t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >> 8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[20]; - t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >> 8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[21]; - t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >> 8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[22]; - t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >> 8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[23]; - /* round 6: */ - s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >> 8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[24]; - s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >> 8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[25]; - s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >> 8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[26]; - s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >> 8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[27]; - /* round 7: */ - t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >> 8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[28]; - t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >> 8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[29]; - t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >> 8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[30]; - t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >> 8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[31]; - /* round 8: */ - s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >> 8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[32]; - s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >> 8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[33]; - s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >> 8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[34]; - s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >> 8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[35]; - /* round 9: */ - t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >> 8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[36]; - t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >> 8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[37]; - t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >> 8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[38]; - t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >> 8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[39]; - if (key->rounds > 10) { - /* round 10: */ - s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >> 8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[40]; - s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >> 8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[41]; - s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >> 8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[42]; - s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >> 8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[43]; - /* round 11: */ - t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >> 8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[44]; - t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >> 8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[45]; - t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >> 8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[46]; - t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >> 8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[47]; - if (key->rounds > 12) { - /* round 12: */ - s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >> 8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[48]; - s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >> 8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[49]; - s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >> 8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[50]; - s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >> 8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[51]; - /* round 13: */ - t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >> 8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[52]; - t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >> 8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[53]; - t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >> 8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[54]; - t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >> 8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[55]; - } - } - rk += key->rounds << 2; -#else /* !FULL_UNROLL */ - /* - * Nr - 1 full rounds: - */ - r = key->rounds >> 1; - for (;;) { - t0 = - Td0[(s0 >> 24) ] ^ - Td1[(s3 >> 16) & 0xff] ^ - Td2[(s2 >> 8) & 0xff] ^ - Td3[(s1 ) & 0xff] ^ - rk[4]; - t1 = - Td0[(s1 >> 24) ] ^ - Td1[(s0 >> 16) & 0xff] ^ - Td2[(s3 >> 8) & 0xff] ^ - Td3[(s2 ) & 0xff] ^ - rk[5]; - t2 = - Td0[(s2 >> 24) ] ^ - Td1[(s1 >> 16) & 0xff] ^ - Td2[(s0 >> 8) & 0xff] ^ - Td3[(s3 ) & 0xff] ^ - rk[6]; - t3 = - Td0[(s3 >> 24) ] ^ - Td1[(s2 >> 16) & 0xff] ^ - Td2[(s1 >> 8) & 0xff] ^ - Td3[(s0 ) & 0xff] ^ - rk[7]; - - rk += 8; - if (--r == 0) { - break; - } - - s0 = - Td0[(t0 >> 24) ] ^ - Td1[(t3 >> 16) & 0xff] ^ - Td2[(t2 >> 8) & 0xff] ^ - Td3[(t1 ) & 0xff] ^ - rk[0]; - s1 = - Td0[(t1 >> 24) ] ^ - Td1[(t0 >> 16) & 0xff] ^ - Td2[(t3 >> 8) & 0xff] ^ - Td3[(t2 ) & 0xff] ^ - rk[1]; - s2 = - Td0[(t2 >> 24) ] ^ - Td1[(t1 >> 16) & 0xff] ^ - Td2[(t0 >> 8) & 0xff] ^ - Td3[(t3 ) & 0xff] ^ - rk[2]; - s3 = - Td0[(t3 >> 24) ] ^ - Td1[(t2 >> 16) & 0xff] ^ - Td2[(t1 >> 8) & 0xff] ^ - Td3[(t0 ) & 0xff] ^ - rk[3]; - } -#endif /* ?FULL_UNROLL */ - /* - * apply last round and - * map cipher state to byte array block: - */ - s0 = - (Td4[(t0 >> 24) ] & 0xff000000) ^ - (Td4[(t3 >> 16) & 0xff] & 0x00ff0000) ^ - (Td4[(t2 >> 8) & 0xff] & 0x0000ff00) ^ - (Td4[(t1 ) & 0xff] & 0x000000ff) ^ - rk[0]; - PUTU32(out , s0); - s1 = - (Td4[(t1 >> 24) ] & 0xff000000) ^ - (Td4[(t0 >> 16) & 0xff] & 0x00ff0000) ^ - (Td4[(t3 >> 8) & 0xff] & 0x0000ff00) ^ - (Td4[(t2 ) & 0xff] & 0x000000ff) ^ - rk[1]; - PUTU32(out + 4, s1); - s2 = - (Td4[(t2 >> 24) ] & 0xff000000) ^ - (Td4[(t1 >> 16) & 0xff] & 0x00ff0000) ^ - (Td4[(t0 >> 8) & 0xff] & 0x0000ff00) ^ - (Td4[(t3 ) & 0xff] & 0x000000ff) ^ - rk[2]; - PUTU32(out + 8, s2); - s3 = - (Td4[(t3 >> 24) ] & 0xff000000) ^ - (Td4[(t2 >> 16) & 0xff] & 0x00ff0000) ^ - (Td4[(t1 >> 8) & 0xff] & 0x0000ff00) ^ - (Td4[(t0 ) & 0xff] & 0x000000ff) ^ - rk[3]; - PUTU32(out + 12, s3); -} - -#endif /* AES_ASM */ - -void AES_cbc_encrypt(const unsigned char *in, unsigned char *out, - const unsigned long length, const AES_KEY *key, - unsigned char *ivec, const int enc) -{ - - unsigned long n; - unsigned long len = length; - unsigned char tmp[AES_BLOCK_SIZE]; - - assert(in && out && key && ivec); - - if (enc) { - while (len >= AES_BLOCK_SIZE) { - for(n=0; n < AES_BLOCK_SIZE; ++n) - tmp[n] = in[n] ^ ivec[n]; - AES_encrypt(tmp, out, key); - memcpy(ivec, out, AES_BLOCK_SIZE); - len -= AES_BLOCK_SIZE; - in += AES_BLOCK_SIZE; - out += AES_BLOCK_SIZE; - } - if (len) { - for(n=0; n < len; ++n) - tmp[n] = in[n] ^ ivec[n]; - for(n=len; n < AES_BLOCK_SIZE; ++n) - tmp[n] = ivec[n]; - AES_encrypt(tmp, tmp, key); - memcpy(out, tmp, AES_BLOCK_SIZE); - memcpy(ivec, tmp, AES_BLOCK_SIZE); - } - } else { - while (len >= AES_BLOCK_SIZE) { - memcpy(tmp, in, AES_BLOCK_SIZE); - AES_decrypt(in, out, key); - for(n=0; n < AES_BLOCK_SIZE; ++n) - out[n] ^= ivec[n]; - memcpy(ivec, tmp, AES_BLOCK_SIZE); - len -= AES_BLOCK_SIZE; - in += AES_BLOCK_SIZE; - out += AES_BLOCK_SIZE; - } - if (len) { - memcpy(tmp, in, AES_BLOCK_SIZE); - AES_decrypt(tmp, tmp, key); - for(n=0; n < len; ++n) - out[n] = tmp[n] ^ ivec[n]; - memcpy(ivec, tmp, AES_BLOCK_SIZE); - } - } -} diff --git a/qemu-0.11.0/aes.h b/qemu-0.11.0/aes.h deleted file mode 100644 index a0167eb..0000000 --- a/qemu-0.11.0/aes.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef QEMU_AES_H -#define QEMU_AES_H - -#define AES_MAXNR 14 -#define AES_BLOCK_SIZE 16 - -struct aes_key_st { - uint32_t rd_key[4 *(AES_MAXNR + 1)]; - int rounds; -}; -typedef struct aes_key_st AES_KEY; - -int AES_set_encrypt_key(const unsigned char *userKey, const int bits, - AES_KEY *key); -int AES_set_decrypt_key(const unsigned char *userKey, const int bits, - AES_KEY *key); - -void AES_encrypt(const unsigned char *in, unsigned char *out, - const AES_KEY *key); -void AES_decrypt(const unsigned char *in, unsigned char *out, - const AES_KEY *key); -void AES_cbc_encrypt(const unsigned char *in, unsigned char *out, - const unsigned long length, const AES_KEY *key, - unsigned char *ivec, const int enc); - -#endif diff --git a/qemu-0.11.0/aio.c b/qemu-0.11.0/aio.c deleted file mode 100644 index efc63fd..0000000 --- a/qemu-0.11.0/aio.c +++ /dev/null @@ -1,198 +0,0 @@ -/* - * QEMU aio implementation - * - * Copyright IBM, Corp. 2008 - * - * Authors: - * Anthony Liguori aliguori@us.ibm.com - * - * This work is licensed under the terms of the GNU GPL, version 2. See - * the COPYING file in the top-level directory. - * - */ - -#include "qemu-common.h" -#include "block.h" -#include "sys-queue.h" -#include "qemu_socket.h" - -typedef struct AioHandler AioHandler; - -/* The list of registered AIO handlers */ -static LIST_HEAD(, AioHandler) aio_handlers; - -/* This is a simple lock used to protect the aio_handlers list. Specifically, - * it's used to ensure that no callbacks are removed while we're walking and - * dispatching callbacks. - */ -static int walking_handlers; - -struct AioHandler -{ - int fd; - IOHandler *io_read; - IOHandler *io_write; - AioFlushHandler *io_flush; - int deleted; - void *opaque; - LIST_ENTRY(AioHandler) node; -}; - -static AioHandler *find_aio_handler(int fd) -{ - AioHandler *node; - - LIST_FOREACH(node, &aio_handlers, node) { - if (node->fd == fd) - if (!node->deleted) - return node; - } - - return NULL; -} - -int qemu_aio_set_fd_handler(int fd, - IOHandler *io_read, - IOHandler *io_write, - AioFlushHandler *io_flush, - void *opaque) -{ - AioHandler *node; - - node = find_aio_handler(fd); - - /* Are we deleting the fd handler? */ - if (!io_read && !io_write) { - if (node) { - /* If the lock is held, just mark the node as deleted */ - if (walking_handlers) - node->deleted = 1; - else { - /* Otherwise, delete it for real. We can't just mark it as - * deleted because deleted nodes are only cleaned up after - * releasing the walking_handlers lock. - */ - LIST_REMOVE(node, node); - qemu_free(node); - } - } - } else { - if (node == NULL) { - /* Alloc and insert if it's not already there */ - node = qemu_mallocz(sizeof(AioHandler)); - node->fd = fd; - LIST_INSERT_HEAD(&aio_handlers, node, node); - } - /* Update handler with latest information */ - node->io_read = io_read; - node->io_write = io_write; - node->io_flush = io_flush; - node->opaque = opaque; - } - - qemu_set_fd_handler2(fd, NULL, io_read, io_write, opaque); - - return 0; -} - -void qemu_aio_flush(void) -{ - AioHandler *node; - int ret; - - do { - ret = 0; - - /* - * If there are pending emulated aio start them now so flush - * will be able to return 1. - */ - qemu_aio_wait(); - - LIST_FOREACH(node, &aio_handlers, node) { - ret |= node->io_flush(node->opaque); - } - } while (qemu_bh_poll() || ret > 0); -} - -void qemu_aio_wait(void) -{ - int ret; - - if (qemu_bh_poll()) - return; - - do { - AioHandler *node; - fd_set rdfds, wrfds; - int max_fd = -1; - - walking_handlers = 1; - - FD_ZERO(&rdfds); - FD_ZERO(&wrfds); - - /* fill fd sets */ - LIST_FOREACH(node, &aio_handlers, node) { - /* If there aren't pending AIO operations, don't invoke callbacks. - * Otherwise, if there are no AIO requests, qemu_aio_wait() would - * wait indefinitely. - */ - if (node->io_flush && node->io_flush(node->opaque) == 0) - continue; - - if (!node->deleted && node->io_read) { - FD_SET(node->fd, &rdfds); - max_fd = MAX(max_fd, node->fd + 1); - } - if (!node->deleted && node->io_write) { - FD_SET(node->fd, &wrfds); - max_fd = MAX(max_fd, node->fd + 1); - } - } - - walking_handlers = 0; - - /* No AIO operations? Get us out of here */ - if (max_fd == -1) - break; - - /* wait until next event */ - ret = select(max_fd, &rdfds, &wrfds, NULL, NULL); - if (ret == -1 && errno == EINTR) - continue; - - /* if we have any readable fds, dispatch event */ - if (ret > 0) { - walking_handlers = 1; - - /* we have to walk very carefully in case - * qemu_aio_set_fd_handler is called while we're walking */ - node = LIST_FIRST(&aio_handlers); - while (node) { - AioHandler *tmp; - - if (!node->deleted && - FD_ISSET(node->fd, &rdfds) && - node->io_read) { - node->io_read(node->opaque); - } - if (!node->deleted && - FD_ISSET(node->fd, &wrfds) && - node->io_write) { - node->io_write(node->opaque); - } - - tmp = node; - node = LIST_NEXT(node, node); - - if (tmp->deleted) { - LIST_REMOVE(tmp, node); - qemu_free(tmp); - } - } - - walking_handlers = 0; - } - } while (ret == 0); -} diff --git a/qemu-0.11.0/alpha-dis.c b/qemu-0.11.0/alpha-dis.c deleted file mode 100644 index 097f06b..0000000 --- a/qemu-0.11.0/alpha-dis.c +++ /dev/null @@ -1,1959 +0,0 @@ -/* alpha-dis.c -- Disassemble Alpha AXP instructions - Copyright 1996, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. - Contributed by Richard Henderson rth@tamu.edu, - patterned after the PPC opcode handling written by Ian Lance Taylor. - -This file is part of GDB, GAS, and the GNU binutils. - -GDB, GAS, and the GNU binutils are free software; you can redistribute -them and/or modify them under the terms of the GNU General Public -License as published by the Free Software Foundation; either version -2, or (at your option) any later version. - -GDB, GAS, and the GNU binutils are distributed in the hope that they -will be useful, but WITHOUT ANY WARRANTY; without even the implied -warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See -the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this file; see the file COPYING. If not, see -http://www.gnu.org/licenses/. */ - -#include <stdio.h> -#include "dis-asm.h" - -/* The opcode table is an array of struct alpha_opcode. */ - -struct alpha_opcode -{ - /* The opcode name. */ - const char *name; - - /* The opcode itself. Those bits which will be filled in with - operands are zeroes. */ - unsigned opcode; - - /* The opcode mask. This is used by the disassembler. This is a - mask containing ones indicating those bits which must match the - opcode field, and zeroes indicating those bits which need not - match (and are presumably filled in by operands). */ - unsigned mask; - - /* One bit flags for the opcode. These are primarily used to - indicate specific processors and environments support the - instructions. The defined values are listed below. */ - unsigned flags; - - /* An array of operand codes. Each code is an index into the - operand table. They appear in the order which the operands must - appear in assembly code, and are terminated by a zero. */ - unsigned char operands[4]; -}; - -/* The table itself is sorted by major opcode number, and is otherwise - in the order in which the disassembler should consider - instructions. */ -extern const struct alpha_opcode alpha_opcodes[]; -extern const unsigned alpha_num_opcodes; - -/* Values defined for the flags field of a struct alpha_opcode. */ - -/* CPU Availability */ -#define AXP_OPCODE_BASE 0x0001 /* Base architecture -- all cpus. */ -#define AXP_OPCODE_EV4 0x0002 /* EV4 specific PALcode insns. */ -#define AXP_OPCODE_EV5 0x0004 /* EV5 specific PALcode insns. */ -#define AXP_OPCODE_EV6 0x0008 /* EV6 specific PALcode insns. */ -#define AXP_OPCODE_BWX 0x0100 /* Byte/word extension (amask bit 0). */ -#define AXP_OPCODE_CIX 0x0200 /* "Count" extension (amask bit 1). */ -#define AXP_OPCODE_MAX 0x0400 /* Multimedia extension (amask bit 8). */ - -#define AXP_OPCODE_NOPAL (~(AXP_OPCODE_EV4|AXP_OPCODE_EV5|AXP_OPCODE_EV6)) - -/* A macro to extract the major opcode from an instruction. */ -#define AXP_OP(i) (((i) >> 26) & 0x3F) - -/* The total number of major opcodes. */ -#define AXP_NOPS 0x40 - - -/* The operands table is an array of struct alpha_operand. */ - -struct alpha_operand -{ - /* The number of bits in the operand. */ - unsigned int bits : 5; - - /* How far the operand is left shifted in the instruction. */ - unsigned int shift : 5; - - /* The default relocation type for this operand. */ - signed int default_reloc : 16; - - /* One bit syntax flags. */ - unsigned int flags : 16; - - /* Insertion function. This is used by the assembler. To insert an - operand value into an instruction, check this field. - - If it is NULL, execute - i |= (op & ((1 << o->bits) - 1)) << o->shift; - (i is the instruction which we are filling in, o is a pointer to - this structure, and op is the opcode value; this assumes twos - complement arithmetic). - - If this field is not NULL, then simply call it with the - instruction and the operand value. It will return the new value - of the instruction. If the ERRMSG argument is not NULL, then if - the operand value is illegal, *ERRMSG will be set to a warning - string (the operand will be inserted in any case). If the - operand value is legal, *ERRMSG will be unchanged (most operands - can accept any value). */ - unsigned (*insert) PARAMS ((unsigned instruction, int op, - const char **errmsg)); - - /* Extraction function. This is used by the disassembler. To - extract this operand type from an instruction, check this field. - - If it is NULL, compute - op = ((i) >> o->shift) & ((1 << o->bits) - 1); - if ((o->flags & AXP_OPERAND_SIGNED) != 0 - && (op & (1 << (o->bits - 1))) != 0) - op -= 1 << o->bits; - (i is the instruction, o is a pointer to this structure, and op - is the result; this assumes twos complement arithmetic). - - If this field is not NULL, then simply call it with the - instruction value. It will return the value of the operand. If - the INVALID argument is not NULL, *INVALID will be set to - non-zero if this operand type can not actually be extracted from - this operand (i.e., the instruction does not match). If the - operand is valid, *INVALID will not be changed. */ - int (*extract) PARAMS ((unsigned instruction, int *invalid)); -}; - -/* Elements in the table are retrieved by indexing with values from - the operands field of the alpha_opcodes table. */ - -extern const struct alpha_operand alpha_operands[]; -extern const unsigned alpha_num_operands; - -/* Values defined for the flags field of a struct alpha_operand. */ - -/* Mask for selecting the type for typecheck purposes */ -#define AXP_OPERAND_TYPECHECK_MASK \ - (AXP_OPERAND_PARENS | AXP_OPERAND_COMMA | AXP_OPERAND_IR | \ - AXP_OPERAND_FPR | AXP_OPERAND_RELATIVE | AXP_OPERAND_SIGNED | \ - AXP_OPERAND_UNSIGNED) - -/* This operand does not actually exist in the assembler input. This - is used to support extended mnemonics, for which two operands fields - are identical. The assembler should call the insert function with - any op value. The disassembler should call the extract function, - ignore the return value, and check the value placed in the invalid - argument. */ -#define AXP_OPERAND_FAKE 01 - -/* The operand should be wrapped in parentheses rather than separated - from the previous by a comma. This is used for the load and store - instructions which want their operands to look like "Ra,disp(Rb)". */ -#define AXP_OPERAND_PARENS 02 - -/* Used in combination with PARENS, this supresses the supression of - the comma. This is used for "jmp Ra,(Rb),hint". */ -#define AXP_OPERAND_COMMA 04 - -/* This operand names an integer register. */ -#define AXP_OPERAND_IR 010 - -/* This operand names a floating point register. */ -#define AXP_OPERAND_FPR 020 - -/* This operand is a relative branch displacement. The disassembler - prints these symbolically if possible. */ -#define AXP_OPERAND_RELATIVE 040 - -/* This operand takes signed values. */ -#define AXP_OPERAND_SIGNED 0100 - -/* This operand takes unsigned values. This exists primarily so that - a flags value of 0 can be treated as end-of-arguments. */ -#define AXP_OPERAND_UNSIGNED 0200 - -/* Supress overflow detection on this field. This is used for hints. */ -#define AXP_OPERAND_NOOVERFLOW 0400 - -/* Mask for optional argument default value. */ -#define AXP_OPERAND_OPTIONAL_MASK 07000 - -/* This operand defaults to zero. This is used for jump hints. */ -#define AXP_OPERAND_DEFAULT_ZERO 01000 - -/* This operand should default to the first (real) operand and is used - in conjunction with AXP_OPERAND_OPTIONAL. This allows - "and $0,3,$0" to be written as "and $0,3", etc. I don't like - it, but it's what DEC does. */ -#define AXP_OPERAND_DEFAULT_FIRST 02000 - -/* Similarly, this operand should default to the second (real) operand. - This allows "negl $0" instead of "negl $0,$0". */ -#define AXP_OPERAND_DEFAULT_SECOND 04000 - - -/* Register common names */ - -#define AXP_REG_V0 0 -#define AXP_REG_T0 1 -#define AXP_REG_T1 2 -#define AXP_REG_T2 3 -#define AXP_REG_T3 4 -#define AXP_REG_T4 5 -#define AXP_REG_T5 6 -#define AXP_REG_T6 7 -#define AXP_REG_T7 8 -#define AXP_REG_S0 9 -#define AXP_REG_S1 10 -#define AXP_REG_S2 11 -#define AXP_REG_S3 12 -#define AXP_REG_S4 13 -#define AXP_REG_S5 14 -#define AXP_REG_FP 15 -#define AXP_REG_A0 16 -#define AXP_REG_A1 17 -#define AXP_REG_A2 18 -#define AXP_REG_A3 19 -#define AXP_REG_A4 20 -#define AXP_REG_A5 21 -#define AXP_REG_T8 22 -#define AXP_REG_T9 23 -#define AXP_REG_T10 24 -#define AXP_REG_T11 25 -#define AXP_REG_RA 26 -#define AXP_REG_PV 27 -#define AXP_REG_T12 27 -#define AXP_REG_AT 28 -#define AXP_REG_GP 29 -#define AXP_REG_SP 30 -#define AXP_REG_ZERO 31 - -#define bfd_mach_alpha_ev4 0x10 -#define bfd_mach_alpha_ev5 0x20 -#define bfd_mach_alpha_ev6 0x30 - -enum bfd_reloc_code_real { - BFD_RELOC_23_PCREL_S2, - BFD_RELOC_ALPHA_HINT -}; - -/* This file holds the Alpha AXP opcode table. The opcode table includes - almost all of the extended instruction mnemonics. This permits the - disassembler to use them, and simplifies the assembler logic, at the - cost of increasing the table size. The table is strictly constant - data, so the compiler should be able to put it in the text segment. - - This file also holds the operand table. All knowledge about inserting - and extracting operands from instructions is kept in this file. - - The information for the base instruction set was compiled from the - _Alpha Architecture Handbook_, Digital Order Number EC-QD2KB-TE, - version 2. - - The information for the post-ev5 architecture extensions BWX, CIX and - MAX came from version 3 of this same document, which is also available - on-line at http://ftp.digital.com/pub/Digital/info/semiconductor - /literature/alphahb2.pdf - - The information for the EV4 PALcode instructions was compiled from - _DECchip 21064 and DECchip 21064A Alpha AXP Microprocessors Hardware - Reference Manual_, Digital Order Number EC-Q9ZUA-TE, preliminary - revision dated June 1994. - - The information for the EV5 PALcode instructions was compiled from - _Alpha 21164 Microprocessor Hardware Reference Manual_, Digital - Order Number EC-QAEQB-TE, preliminary revision dated April 1995. */ - -/* Local insertion and extraction functions */ - -static unsigned insert_rba PARAMS((unsigned, int, const char **)); -static unsigned insert_rca PARAMS((unsigned, int, const char **)); -static unsigned insert_za PARAMS((unsigned, int, const char **)); -static unsigned insert_zb PARAMS((unsigned, int, const char **)); -static unsigned insert_zc PARAMS((unsigned, int, const char **)); -static unsigned insert_bdisp PARAMS((unsigned, int, const char **)); -static unsigned insert_jhint PARAMS((unsigned, int, const char **)); -static unsigned insert_ev6hwjhint PARAMS((unsigned, int, const char **)); - -static int extract_rba PARAMS((unsigned, int *)); -static int extract_rca PARAMS((unsigned, int *)); -static int extract_za PARAMS((unsigned, int *)); -static int extract_zb PARAMS((unsigned, int *)); -static int extract_zc PARAMS((unsigned, int *)); -static int extract_bdisp PARAMS((unsigned, int *)); -static int extract_jhint PARAMS((unsigned, int *)); -static int extract_ev6hwjhint PARAMS((unsigned, int *)); - - -/* The operands table */ - -const struct alpha_operand alpha_operands[] = -{ - /* The fields are bits, shift, insert, extract, flags */ - /* The zero index is used to indicate end-of-list */ -#define UNUSED 0 - { 0, 0, 0, 0, 0, 0 }, - - /* The plain integer register fields */ -#define RA (UNUSED + 1) - { 5, 21, 0, AXP_OPERAND_IR, 0, 0 }, -#define RB (RA + 1) - { 5, 16, 0, AXP_OPERAND_IR, 0, 0 }, -#define RC (RB + 1) - { 5, 0, 0, AXP_OPERAND_IR, 0, 0 }, - - /* The plain fp register fields */ -#define FA (RC + 1) - { 5, 21, 0, AXP_OPERAND_FPR, 0, 0 }, -#define FB (FA + 1) - { 5, 16, 0, AXP_OPERAND_FPR, 0, 0 }, -#define FC (FB + 1) - { 5, 0, 0, AXP_OPERAND_FPR, 0, 0 }, - - /* The integer registers when they are ZERO */ -#define ZA (FC + 1) - { 5, 21, 0, AXP_OPERAND_FAKE, insert_za, extract_za }, -#define ZB (ZA + 1) - { 5, 16, 0, AXP_OPERAND_FAKE, insert_zb, extract_zb }, -#define ZC (ZB + 1) - { 5, 0, 0, AXP_OPERAND_FAKE, insert_zc, extract_zc }, - - /* The RB field when it needs parentheses */ -#define PRB (ZC + 1) - { 5, 16, 0, AXP_OPERAND_IR|AXP_OPERAND_PARENS, 0, 0 }, - - /* The RB field when it needs parentheses _and_ a preceding comma */ -#define CPRB (PRB + 1) - { 5, 16, 0, - AXP_OPERAND_IR|AXP_OPERAND_PARENS|AXP_OPERAND_COMMA, 0, 0 }, - - /* The RB field when it must be the same as the RA field */ -#define RBA (CPRB + 1) - { 5, 16, 0, AXP_OPERAND_FAKE, insert_rba, extract_rba }, - - /* The RC field when it must be the same as the RB field */ -#define RCA (RBA + 1) - { 5, 0, 0, AXP_OPERAND_FAKE, insert_rca, extract_rca }, - - /* The RC field when it can *default* to RA */ -#define DRC1 (RCA + 1) - { 5, 0, 0, - AXP_OPERAND_IR|AXP_OPERAND_DEFAULT_FIRST, 0, 0 }, - - /* The RC field when it can *default* to RB */ -#define DRC2 (DRC1 + 1) - { 5, 0, 0, - AXP_OPERAND_IR|AXP_OPERAND_DEFAULT_SECOND, 0, 0 }, - - /* The FC field when it can *default* to RA */ -#define DFC1 (DRC2 + 1) - { 5, 0, 0, - AXP_OPERAND_FPR|AXP_OPERAND_DEFAULT_FIRST, 0, 0 }, - - /* The FC field when it can *default* to RB */ -#define DFC2 (DFC1 + 1) - { 5, 0, 0, - AXP_OPERAND_FPR|AXP_OPERAND_DEFAULT_SECOND, 0, 0 }, - - /* The unsigned 8-bit literal of Operate format insns */ -#define LIT (DFC2 + 1) - { 8, 13, -LIT, AXP_OPERAND_UNSIGNED, 0, 0 }, - - /* The signed 16-bit displacement of Memory format insns. From here - we can't tell what relocation should be used, so don't use a default. */ -#define MDISP (LIT + 1) - { 16, 0, -MDISP, AXP_OPERAND_SIGNED, 0, 0 }, - - /* The signed "23-bit" aligned displacement of Branch format insns */ -#define BDISP (MDISP + 1) - { 21, 0, BFD_RELOC_23_PCREL_S2, - AXP_OPERAND_RELATIVE, insert_bdisp, extract_bdisp }, - - /* The 26-bit PALcode function */ -#define PALFN (BDISP + 1) - { 26, 0, -PALFN, AXP_OPERAND_UNSIGNED, 0, 0 }, - - /* The optional signed "16-bit" aligned displacement of the JMP/JSR hint */ -#define JMPHINT (PALFN + 1) - { 14, 0, BFD_RELOC_ALPHA_HINT, - AXP_OPERAND_RELATIVE|AXP_OPERAND_DEFAULT_ZERO|AXP_OPERAND_NOOVERFLOW, - insert_jhint, extract_jhint }, - - /* The optional hint to RET/JSR_COROUTINE */ -#define RETHINT (JMPHINT + 1) - { 14, 0, -RETHINT, - AXP_OPERAND_UNSIGNED|AXP_OPERAND_DEFAULT_ZERO, 0, 0 }, - - /* The 12-bit displacement for the ev[46] hw_{ld,st} (pal1b/pal1f) insns */ -#define EV4HWDISP (RETHINT + 1) -#define EV6HWDISP (EV4HWDISP) - { 12, 0, -EV4HWDISP, AXP_OPERAND_SIGNED, 0, 0 }, - - /* The 5-bit index for the ev4 hw_m[ft]pr (pal19/pal1d) insns */ -#define EV4HWINDEX (EV4HWDISP + 1) - { 5, 0, -EV4HWINDEX, AXP_OPERAND_UNSIGNED, 0, 0 }, - - /* The 8-bit index for the oddly unqualified hw_m[tf]pr insns - that occur in DEC PALcode. */ -#define EV4EXTHWINDEX (EV4HWINDEX + 1) - { 8, 0, -EV4EXTHWINDEX, AXP_OPERAND_UNSIGNED, 0, 0 }, - - /* The 10-bit displacement for the ev5 hw_{ld,st} (pal1b/pal1f) insns */ -#define EV5HWDISP (EV4EXTHWINDEX + 1) - { 10, 0, -EV5HWDISP, AXP_OPERAND_SIGNED, 0, 0 }, - - /* The 16-bit index for the ev5 hw_m[ft]pr (pal19/pal1d) insns */ -#define EV5HWINDEX (EV5HWDISP + 1) - { 16, 0, -EV5HWINDEX, AXP_OPERAND_UNSIGNED, 0, 0 }, - - /* The 16-bit combined index/scoreboard mask for the ev6 - hw_m[ft]pr (pal19/pal1d) insns */ -#define EV6HWINDEX (EV5HWINDEX + 1) - { 16, 0, -EV6HWINDEX, AXP_OPERAND_UNSIGNED, 0, 0 }, - - /* The 13-bit branch hint for the ev6 hw_jmp/jsr (pal1e) insn */ -#define EV6HWJMPHINT (EV6HWINDEX+ 1) - { 8, 0, -EV6HWJMPHINT, - AXP_OPERAND_RELATIVE|AXP_OPERAND_DEFAULT_ZERO|AXP_OPERAND_NOOVERFLOW, - insert_ev6hwjhint, extract_ev6hwjhint } -}; - -const unsigned alpha_num_operands = sizeof(alpha_operands)/sizeof(*alpha_operands); - -/* The RB field when it is the same as the RA field in the same insn. - This operand is marked fake. The insertion function just copies - the RA field into the RB field, and the extraction function just - checks that the fields are the same. */ - -/*ARGSUSED*/ -static unsigned -insert_rba(insn, value, errmsg) - unsigned insn; - int value ATTRIBUTE_UNUSED; - const char **errmsg ATTRIBUTE_UNUSED; -{ - return insn | (((insn >> 21) & 0x1f) << 16); -} - -static int -extract_rba(insn, invalid) - unsigned insn; - int *invalid; -{ - if (invalid != (int *) NULL - && ((insn >> 21) & 0x1f) != ((insn >> 16) & 0x1f)) - *invalid = 1; - return 0; -} - - -/* The same for the RC field */ - -/*ARGSUSED*/ -static unsigned -insert_rca(insn, value, errmsg) - unsigned insn; - int value ATTRIBUTE_UNUSED; - const char **errmsg ATTRIBUTE_UNUSED; -{ - return insn | ((insn >> 21) & 0x1f); -} - -static int -extract_rca(insn, invalid) - unsigned insn; - int *invalid; -{ - if (invalid != (int *) NULL - && ((insn >> 21) & 0x1f) != (insn & 0x1f)) - *invalid = 1; - return 0; -} - - -/* Fake arguments in which the registers must be set to ZERO */ - -/*ARGSUSED*/ -static unsigned -insert_za(insn, value, errmsg) - unsigned insn; - int value ATTRIBUTE_UNUSED; - const char **errmsg ATTRIBUTE_UNUSED; -{ - return insn | (31 << 21); -} - -static int -extract_za(insn, invalid) - unsigned insn; - int *invalid; -{ - if (invalid != (int *) NULL && ((insn >> 21) & 0x1f) != 31) - *invalid = 1; - return 0; -} - -/*ARGSUSED*/ -static unsigned -insert_zb(insn, value, errmsg) - unsigned insn; - int value ATTRIBUTE_UNUSED; - const char **errmsg ATTRIBUTE_UNUSED; -{ - return insn | (31 << 16); -} - -static int -extract_zb(insn, invalid) - unsigned insn; - int *invalid; -{ - if (invalid != (int *) NULL && ((insn >> 16) & 0x1f) != 31) - *invalid = 1; - return 0; -} - -/*ARGSUSED*/ -static unsigned -insert_zc(insn, value, errmsg) - unsigned insn; - int value ATTRIBUTE_UNUSED; - const char **errmsg ATTRIBUTE_UNUSED; -{ - return insn | 31; -} - -static int -extract_zc(insn, invalid) - unsigned insn; - int *invalid; -{ - if (invalid != (int *) NULL && (insn & 0x1f) != 31) - *invalid = 1; - return 0; -} - - -/* The displacement field of a Branch format insn. */ - -static unsigned -insert_bdisp(insn, value, errmsg) - unsigned insn; - int value; - const char **errmsg; -{ - if (errmsg != (const char **)NULL && (value & 3)) - *errmsg = _("branch operand unaligned"); - return insn | ((value / 4) & 0x1FFFFF); -} - -/*ARGSUSED*/ -static int -extract_bdisp(insn, invalid) - unsigned insn; - int *invalid ATTRIBUTE_UNUSED; -{ - return 4 * (((insn & 0x1FFFFF) ^ 0x100000) - 0x100000); -} - - -/* The hint field of a JMP/JSR insn. */ - -static unsigned -insert_jhint(insn, value, errmsg) - unsigned insn; - int value; - const char **errmsg; -{ - if (errmsg != (const char **)NULL && (value & 3)) - *errmsg = _("jump hint unaligned"); - return insn | ((value / 4) & 0x3FFF); -} - -/*ARGSUSED*/ -static int -extract_jhint(insn, invalid) - unsigned insn; - int *invalid ATTRIBUTE_UNUSED; -{ - return 4 * (((insn & 0x3FFF) ^ 0x2000) - 0x2000); -} - -/* The hint field of an EV6 HW_JMP/JSR insn. */ - -static unsigned -insert_ev6hwjhint(insn, value, errmsg) - unsigned insn; - int value; - const char **errmsg; -{ - if (errmsg != (const char **)NULL && (value & 3)) - *errmsg = _("jump hint unaligned"); - return insn | ((value / 4) & 0x1FFF); -} - -/*ARGSUSED*/ -static int -extract_ev6hwjhint(insn, invalid) - unsigned insn; - int *invalid ATTRIBUTE_UNUSED; -{ - return 4 * (((insn & 0x1FFF) ^ 0x1000) - 0x1000); -} - - -/* Macros used to form opcodes */ - -/* The main opcode */ -#define OP(x) (((x) & 0x3F) << 26) -#define OP_MASK 0xFC000000 - -/* Branch format instructions */ -#define BRA_(oo) OP(oo) -#define BRA_MASK OP_MASK -#define BRA(oo) BRA_(oo), BRA_MASK - -/* Floating point format instructions */ -#define FP_(oo,fff) (OP(oo) | (((fff) & 0x7FF) << 5)) -#define FP_MASK (OP_MASK | 0xFFE0) -#define FP(oo,fff) FP_(oo,fff), FP_MASK - -/* Memory format instructions */ -#define MEM_(oo) OP(oo) -#define MEM_MASK OP_MASK -#define MEM(oo) MEM_(oo), MEM_MASK - -/* Memory/Func Code format instructions */ -#define MFC_(oo,ffff) (OP(oo) | ((ffff) & 0xFFFF)) -#define MFC_MASK (OP_MASK | 0xFFFF) -#define MFC(oo,ffff) MFC_(oo,ffff), MFC_MASK - -/* Memory/Branch format instructions */ -#define MBR_(oo,h) (OP(oo) | (((h) & 3) << 14)) -#define MBR_MASK (OP_MASK | 0xC000) -#define MBR(oo,h) MBR_(oo,h), MBR_MASK - -/* Operate format instructions. The OPRL variant specifies a - literal second argument. */ -#define OPR_(oo,ff) (OP(oo) | (((ff) & 0x7F) << 5)) -#define OPRL_(oo,ff) (OPR_((oo),(ff)) | 0x1000) -#define OPR_MASK (OP_MASK | 0x1FE0) -#define OPR(oo,ff) OPR_(oo,ff), OPR_MASK -#define OPRL(oo,ff) OPRL_(oo,ff), OPR_MASK - -/* Generic PALcode format instructions */ -#define PCD_(oo) OP(oo) -#define PCD_MASK OP_MASK -#define PCD(oo) PCD_(oo), PCD_MASK - -/* Specific PALcode instructions */ -#define SPCD_(oo,ffff) (OP(oo) | ((ffff) & 0x3FFFFFF)) -#define SPCD_MASK 0xFFFFFFFF -#define SPCD(oo,ffff) SPCD_(oo,ffff), SPCD_MASK - -/* Hardware memory (hw_{ld,st}) instructions */ -#define EV4HWMEM_(oo,f) (OP(oo) | (((f) & 0xF) << 12)) -#define EV4HWMEM_MASK (OP_MASK | 0xF000) -#define EV4HWMEM(oo,f) EV4HWMEM_(oo,f), EV4HWMEM_MASK - -#define EV5HWMEM_(oo,f) (OP(oo) | (((f) & 0x3F) << 10)) -#define EV5HWMEM_MASK (OP_MASK | 0xF800) -#define EV5HWMEM(oo,f) EV5HWMEM_(oo,f), EV5HWMEM_MASK - -#define EV6HWMEM_(oo,f) (OP(oo) | (((f) & 0xF) << 12)) -#define EV6HWMEM_MASK (OP_MASK | 0xF000) -#define EV6HWMEM(oo,f) EV6HWMEM_(oo,f), EV6HWMEM_MASK - -#define EV6HWMBR_(oo,h) (OP(oo) | (((h) & 7) << 13)) -#define EV6HWMBR_MASK (OP_MASK | 0xE000) -#define EV6HWMBR(oo,h) EV6HWMBR_(oo,h), EV6HWMBR_MASK - -/* Abbreviations for instruction subsets. */ -#define BASE AXP_OPCODE_BASE -#define EV4 AXP_OPCODE_EV4 -#define EV5 AXP_OPCODE_EV5 -#define EV6 AXP_OPCODE_EV6 -#define BWX AXP_OPCODE_BWX -#define CIX AXP_OPCODE_CIX -#define MAX AXP_OPCODE_MAX - -/* Common combinations of arguments */ -#define ARG_NONE { 0 } -#define ARG_BRA { RA, BDISP } -#define ARG_FBRA { FA, BDISP } -#define ARG_FP { FA, FB, DFC1 } -#define ARG_FPZ1 { ZA, FB, DFC1 } -#define ARG_MEM { RA, MDISP, PRB } -#define ARG_FMEM { FA, MDISP, PRB } -#define ARG_OPR { RA, RB, DRC1 } -#define ARG_OPRL { RA, LIT, DRC1 } -#define ARG_OPRZ1 { ZA, RB, DRC1 } -#define ARG_OPRLZ1 { ZA, LIT, RC } -#define ARG_PCD { PALFN } -#define ARG_EV4HWMEM { RA, EV4HWDISP, PRB } -#define ARG_EV4HWMPR { RA, RBA, EV4HWINDEX } -#define ARG_EV5HWMEM { RA, EV5HWDISP, PRB } -#define ARG_EV6HWMEM { RA, EV6HWDISP, PRB } - -/* The opcode table. - - The format of the opcode table is: - - NAME OPCODE MASK { OPERANDS } - - NAME is the name of the instruction. - - OPCODE is the instruction opcode. - - MASK is the opcode mask; this is used to tell the disassembler - which bits in the actual opcode must match OPCODE. - - OPERANDS is the list of operands. - - The preceding macros merge the text of the OPCODE and MASK fields. - - The disassembler reads the table in order and prints the first - instruction which matches, so this table is sorted to put more - specific instructions before more general instructions. - - Otherwise, it is sorted by major opcode and minor function code. - - There are three classes of not-really-instructions in this table: - - ALIAS is another name for another instruction. Some of - these come from the Architecture Handbook, some - come from the original gas opcode tables. In all - cases, the functionality of the opcode is unchanged. - - PSEUDO a stylized code form endorsed by Chapter A.4 of the - Architecture Handbook. - - EXTRA a stylized code form found in the original gas tables. - - And two annotations: - - EV56 BUT opcodes that are officially introduced as of the ev56, - but with defined results on previous implementations. - - EV56 UNA opcodes that were introduced as of the ev56 with - presumably undefined results on previous implementations - that were not assigned to a particular extension. -*/ - -const struct alpha_opcode alpha_opcodes[] = { - { "halt", SPCD(0x00,0x0000), BASE, ARG_NONE }, - { "draina", SPCD(0x00,0x0002), BASE, ARG_NONE }, - { "bpt", SPCD(0x00,0x0080), BASE, ARG_NONE }, - { "bugchk", SPCD(0x00,0x0081), BASE, ARG_NONE }, - { "callsys", SPCD(0x00,0x0083), BASE, ARG_NONE }, - { "chmk", SPCD(0x00,0x0083), BASE, ARG_NONE }, - { "imb", SPCD(0x00,0x0086), BASE, ARG_NONE }, - { "rduniq", SPCD(0x00,0x009e), BASE, ARG_NONE }, - { "wruniq", SPCD(0x00,0x009f), BASE, ARG_NONE }, - { "gentrap", SPCD(0x00,0x00aa), BASE, ARG_NONE }, - { "call_pal", PCD(0x00), BASE, ARG_PCD }, - { "pal", PCD(0x00), BASE, ARG_PCD }, /* alias */ - - { "lda", MEM(0x08), BASE, { RA, MDISP, ZB } }, /* pseudo */ - { "lda", MEM(0x08), BASE, ARG_MEM }, - { "ldah", MEM(0x09), BASE, { RA, MDISP, ZB } }, /* pseudo */ - { "ldah", MEM(0x09), BASE, ARG_MEM }, - { "ldbu", MEM(0x0A), BWX, ARG_MEM }, - { "unop", MEM_(0x0B) | (30 << 16), - MEM_MASK, BASE, { ZA } }, /* pseudo */ - { "ldq_u", MEM(0x0B), BASE, ARG_MEM }, - { "ldwu", MEM(0x0C), BWX, ARG_MEM }, - { "stw", MEM(0x0D), BWX, ARG_MEM }, - { "stb", MEM(0x0E), BWX, ARG_MEM }, - { "stq_u", MEM(0x0F), BASE, ARG_MEM }, - - { "sextl", OPR(0x10,0x00), BASE, ARG_OPRZ1 }, /* pseudo */ - { "sextl", OPRL(0x10,0x00), BASE, ARG_OPRLZ1 }, /* pseudo */ - { "addl", OPR(0x10,0x00), BASE, ARG_OPR }, - { "addl", OPRL(0x10,0x00), BASE, ARG_OPRL }, - { "s4addl", OPR(0x10,0x02), BASE, ARG_OPR }, - { "s4addl", OPRL(0x10,0x02), BASE, ARG_OPRL }, - { "negl", OPR(0x10,0x09), BASE, ARG_OPRZ1 }, /* pseudo */ - { "negl", OPRL(0x10,0x09), BASE, ARG_OPRLZ1 }, /* pseudo */ - { "subl", OPR(0x10,0x09), BASE, ARG_OPR }, - { "subl", OPRL(0x10,0x09), BASE, ARG_OPRL }, - { "s4subl", OPR(0x10,0x0B), BASE, ARG_OPR }, - { "s4subl", OPRL(0x10,0x0B), BASE, ARG_OPRL }, - { "cmpbge", OPR(0x10,0x0F), BASE, ARG_OPR }, - { "cmpbge", OPRL(0x10,0x0F), BASE, ARG_OPRL }, - { "s8addl", OPR(0x10,0x12), BASE, ARG_OPR }, - { "s8addl", OPRL(0x10,0x12), BASE, ARG_OPRL }, - { "s8subl", OPR(0x10,0x1B), BASE, ARG_OPR }, - { "s8subl", OPRL(0x10,0x1B), BASE, ARG_OPRL }, - { "cmpult", OPR(0x10,0x1D), BASE, ARG_OPR }, - { "cmpult", OPRL(0x10,0x1D), BASE, ARG_OPRL }, - { "addq", OPR(0x10,0x20), BASE, ARG_OPR }, - { "addq", OPRL(0x10,0x20), BASE, ARG_OPRL }, - { "s4addq", OPR(0x10,0x22), BASE, ARG_OPR }, - { "s4addq", OPRL(0x10,0x22), BASE, ARG_OPRL }, - { "negq", OPR(0x10,0x29), BASE, ARG_OPRZ1 }, /* pseudo */ - { "negq", OPRL(0x10,0x29), BASE, ARG_OPRLZ1 }, /* pseudo */ - { "subq", OPR(0x10,0x29), BASE, ARG_OPR }, - { "subq", OPRL(0x10,0x29), BASE, ARG_OPRL }, - { "s4subq", OPR(0x10,0x2B), BASE, ARG_OPR }, - { "s4subq", OPRL(0x10,0x2B), BASE, ARG_OPRL }, - { "cmpeq", OPR(0x10,0x2D), BASE, ARG_OPR }, - { "cmpeq", OPRL(0x10,0x2D), BASE, ARG_OPRL }, - { "s8addq", OPR(0x10,0x32), BASE, ARG_OPR }, - { "s8addq", OPRL(0x10,0x32), BASE, ARG_OPRL }, - { "s8subq", OPR(0x10,0x3B), BASE, ARG_OPR }, - { "s8subq", OPRL(0x10,0x3B), BASE, ARG_OPRL }, - { "cmpule", OPR(0x10,0x3D), BASE, ARG_OPR }, - { "cmpule", OPRL(0x10,0x3D), BASE, ARG_OPRL }, - { "addl/v", OPR(0x10,0x40), BASE, ARG_OPR }, - { "addl/v", OPRL(0x10,0x40), BASE, ARG_OPRL }, - { "negl/v", OPR(0x10,0x49), BASE, ARG_OPRZ1 }, /* pseudo */ - { "negl/v", OPRL(0x10,0x49), BASE, ARG_OPRLZ1 }, /* pseudo */ - { "subl/v", OPR(0x10,0x49), BASE, ARG_OPR }, - { "subl/v", OPRL(0x10,0x49), BASE, ARG_OPRL }, - { "cmplt", OPR(0x10,0x4D), BASE, ARG_OPR }, - { "cmplt", OPRL(0x10,0x4D), BASE, ARG_OPRL }, - { "addq/v", OPR(0x10,0x60), BASE, ARG_OPR }, - { "addq/v", OPRL(0x10,0x60), BASE, ARG_OPRL }, - { "negq/v", OPR(0x10,0x69), BASE, ARG_OPRZ1 }, /* pseudo */ - { "negq/v", OPRL(0x10,0x69), BASE, ARG_OPRLZ1 }, /* pseudo */ - { "subq/v", OPR(0x10,0x69), BASE, ARG_OPR }, - { "subq/v", OPRL(0x10,0x69), BASE, ARG_OPRL }, - { "cmple", OPR(0x10,0x6D), BASE, ARG_OPR }, - { "cmple", OPRL(0x10,0x6D), BASE, ARG_OPRL }, - - { "and", OPR(0x11,0x00), BASE, ARG_OPR }, - { "and", OPRL(0x11,0x00), BASE, ARG_OPRL }, - { "andnot", OPR(0x11,0x08), BASE, ARG_OPR }, /* alias */ - { "andnot", OPRL(0x11,0x08), BASE, ARG_OPRL }, /* alias */ - { "bic", OPR(0x11,0x08), BASE, ARG_OPR }, - { "bic", OPRL(0x11,0x08), BASE, ARG_OPRL }, - { "cmovlbs", OPR(0x11,0x14), BASE, ARG_OPR }, - { "cmovlbs", OPRL(0x11,0x14), BASE, ARG_OPRL }, - { "cmovlbc", OPR(0x11,0x16), BASE, ARG_OPR }, - { "cmovlbc", OPRL(0x11,0x16), BASE, ARG_OPRL }, - { "nop", OPR(0x11,0x20), BASE, { ZA, ZB, ZC } }, /* pseudo */ - { "clr", OPR(0x11,0x20), BASE, { ZA, ZB, RC } }, /* pseudo */ - { "mov", OPR(0x11,0x20), BASE, { ZA, RB, RC } }, /* pseudo */ - { "mov", OPR(0x11,0x20), BASE, { RA, RBA, RC } }, /* pseudo */ - { "mov", OPRL(0x11,0x20), BASE, { ZA, LIT, RC } }, /* pseudo */ - { "or", OPR(0x11,0x20), BASE, ARG_OPR }, /* alias */ - { "or", OPRL(0x11,0x20), BASE, ARG_OPRL }, /* alias */ - { "bis", OPR(0x11,0x20), BASE, ARG_OPR }, - { "bis", OPRL(0x11,0x20), BASE, ARG_OPRL }, - { "cmoveq", OPR(0x11,0x24), BASE, ARG_OPR }, - { "cmoveq", OPRL(0x11,0x24), BASE, ARG_OPRL }, - { "cmovne", OPR(0x11,0x26), BASE, ARG_OPR }, - { "cmovne", OPRL(0x11,0x26), BASE, ARG_OPRL }, - { "not", OPR(0x11,0x28), BASE, ARG_OPRZ1 }, /* pseudo */ - { "not", OPRL(0x11,0x28), BASE, ARG_OPRLZ1 }, /* pseudo */ - { "ornot", OPR(0x11,0x28), BASE, ARG_OPR }, - { "ornot", OPRL(0x11,0x28), BASE, ARG_OPRL }, - { "xor", OPR(0x11,0x40), BASE, ARG_OPR }, - { "xor", OPRL(0x11,0x40), BASE, ARG_OPRL }, - { "cmovlt", OPR(0x11,0x44), BASE, ARG_OPR }, - { "cmovlt", OPRL(0x11,0x44), BASE, ARG_OPRL }, - { "cmovge", OPR(0x11,0x46), BASE, ARG_OPR }, - { "cmovge", OPRL(0x11,0x46), BASE, ARG_OPRL }, - { "eqv", OPR(0x11,0x48), BASE, ARG_OPR }, - { "eqv", OPRL(0x11,0x48), BASE, ARG_OPRL }, - { "xornot", OPR(0x11,0x48), BASE, ARG_OPR }, /* alias */ - { "xornot", OPRL(0x11,0x48), BASE, ARG_OPRL }, /* alias */ - { "amask", OPR(0x11,0x61), BASE, ARG_OPRZ1 }, /* ev56 but */ - { "amask", OPRL(0x11,0x61), BASE, ARG_OPRLZ1 }, /* ev56 but */ - { "cmovle", OPR(0x11,0x64), BASE, ARG_OPR }, - { "cmovle", OPRL(0x11,0x64), BASE, ARG_OPRL }, - { "cmovgt", OPR(0x11,0x66), BASE, ARG_OPR }, - { "cmovgt", OPRL(0x11,0x66), BASE, ARG_OPRL }, - { "implver", OPRL_(0x11,0x6C)|(31<<21)|(1<<13), - 0xFFFFFFE0, BASE, { RC } }, /* ev56 but */ - - { "mskbl", OPR(0x12,0x02), BASE, ARG_OPR }, - { "mskbl", OPRL(0x12,0x02), BASE, ARG_OPRL }, - { "extbl", OPR(0x12,0x06), BASE, ARG_OPR }, - { "extbl", OPRL(0x12,0x06), BASE, ARG_OPRL }, - { "insbl", OPR(0x12,0x0B), BASE, ARG_OPR }, - { "insbl", OPRL(0x12,0x0B), BASE, ARG_OPRL }, - { "mskwl", OPR(0x12,0x12), BASE, ARG_OPR }, - { "mskwl", OPRL(0x12,0x12), BASE, ARG_OPRL }, - { "extwl", OPR(0x12,0x16), BASE, ARG_OPR }, - { "extwl", OPRL(0x12,0x16), BASE, ARG_OPRL }, - { "inswl", OPR(0x12,0x1B), BASE, ARG_OPR }, - { "inswl", OPRL(0x12,0x1B), BASE, ARG_OPRL }, - { "mskll", OPR(0x12,0x22), BASE, ARG_OPR }, - { "mskll", OPRL(0x12,0x22), BASE, ARG_OPRL }, - { "extll", OPR(0x12,0x26), BASE, ARG_OPR }, - { "extll", OPRL(0x12,0x26), BASE, ARG_OPRL }, - { "insll", OPR(0x12,0x2B), BASE, ARG_OPR }, - { "insll", OPRL(0x12,0x2B), BASE, ARG_OPRL }, - { "zap", OPR(0x12,0x30), BASE, ARG_OPR }, - { "zap", OPRL(0x12,0x30), BASE, ARG_OPRL }, - { "zapnot", OPR(0x12,0x31), BASE, ARG_OPR }, - { "zapnot", OPRL(0x12,0x31), BASE, ARG_OPRL }, - { "mskql", OPR(0x12,0x32), BASE, ARG_OPR }, - { "mskql", OPRL(0x12,0x32), BASE, ARG_OPRL }, - { "srl", OPR(0x12,0x34), BASE, ARG_OPR }, - { "srl", OPRL(0x12,0x34), BASE, ARG_OPRL }, - { "extql", OPR(0x12,0x36), BASE, ARG_OPR }, - { "extql", OPRL(0x12,0x36), BASE, ARG_OPRL }, - { "sll", OPR(0x12,0x39), BASE, ARG_OPR }, - { "sll", OPRL(0x12,0x39), BASE, ARG_OPRL }, - { "insql", OPR(0x12,0x3B), BASE, ARG_OPR }, - { "insql", OPRL(0x12,0x3B), BASE, ARG_OPRL }, - { "sra", OPR(0x12,0x3C), BASE, ARG_OPR }, - { "sra", OPRL(0x12,0x3C), BASE, ARG_OPRL }, - { "mskwh", OPR(0x12,0x52), BASE, ARG_OPR }, - { "mskwh", OPRL(0x12,0x52), BASE, ARG_OPRL }, - { "inswh", OPR(0x12,0x57), BASE, ARG_OPR }, - { "inswh", OPRL(0x12,0x57), BASE, ARG_OPRL }, - { "extwh", OPR(0x12,0x5A), BASE, ARG_OPR }, - { "extwh", OPRL(0x12,0x5A), BASE, ARG_OPRL }, - { "msklh", OPR(0x12,0x62), BASE, ARG_OPR }, - { "msklh", OPRL(0x12,0x62), BASE, ARG_OPRL }, - { "inslh", OPR(0x12,0x67), BASE, ARG_OPR }, - { "inslh", OPRL(0x12,0x67), BASE, ARG_OPRL }, - { "extlh", OPR(0x12,0x6A), BASE, ARG_OPR }, - { "extlh", OPRL(0x12,0x6A), BASE, ARG_OPRL }, - { "mskqh", OPR(0x12,0x72), BASE, ARG_OPR }, - { "mskqh", OPRL(0x12,0x72), BASE, ARG_OPRL }, - { "insqh", OPR(0x12,0x77), BASE, ARG_OPR }, - { "insqh", OPRL(0x12,0x77), BASE, ARG_OPRL }, - { "extqh", OPR(0x12,0x7A), BASE, ARG_OPR }, - { "extqh", OPRL(0x12,0x7A), BASE, ARG_OPRL }, - - { "mull", OPR(0x13,0x00), BASE, ARG_OPR }, - { "mull", OPRL(0x13,0x00), BASE, ARG_OPRL }, - { "mulq", OPR(0x13,0x20), BASE, ARG_OPR }, - { "mulq", OPRL(0x13,0x20), BASE, ARG_OPRL }, - { "umulh", OPR(0x13,0x30), BASE, ARG_OPR }, - { "umulh", OPRL(0x13,0x30), BASE, ARG_OPRL }, - { "mull/v", OPR(0x13,0x40), BASE, ARG_OPR }, - { "mull/v", OPRL(0x13,0x40), BASE, ARG_OPRL }, - { "mulq/v", OPR(0x13,0x60), BASE, ARG_OPR }, - { "mulq/v", OPRL(0x13,0x60), BASE, ARG_OPRL }, - - { "itofs", FP(0x14,0x004), CIX, { RA, ZB, FC } }, - { "sqrtf/c", FP(0x14,0x00A), CIX, ARG_FPZ1 }, - { "sqrts/c", FP(0x14,0x00B), CIX, ARG_FPZ1 }, - { "itoff", FP(0x14,0x014), CIX, { RA, ZB, FC } }, - { "itoft", FP(0x14,0x024), CIX, { RA, ZB, FC } }, - { "sqrtg/c", FP(0x14,0x02A), CIX, ARG_FPZ1 }, - { "sqrtt/c", FP(0x14,0x02B), CIX, ARG_FPZ1 }, - { "sqrts/m", FP(0x14,0x04B), CIX, ARG_FPZ1 }, - { "sqrtt/m", FP(0x14,0x06B), CIX, ARG_FPZ1 }, - { "sqrtf", FP(0x14,0x08A), CIX, ARG_FPZ1 }, - { "sqrts", FP(0x14,0x08B), CIX, ARG_FPZ1 }, - { "sqrtg", FP(0x14,0x0AA), CIX, ARG_FPZ1 }, - { "sqrtt", FP(0x14,0x0AB), CIX, ARG_FPZ1 }, - { "sqrts/d", FP(0x14,0x0CB), CIX, ARG_FPZ1 }, - { "sqrtt/d", FP(0x14,0x0EB), CIX, ARG_FPZ1 }, - { "sqrtf/uc", FP(0x14,0x10A), CIX, ARG_FPZ1 }, - { "sqrts/uc", FP(0x14,0x10B), CIX, ARG_FPZ1 }, - { "sqrtg/uc", FP(0x14,0x12A), CIX, ARG_FPZ1 }, - { "sqrtt/uc", FP(0x14,0x12B), CIX, ARG_FPZ1 }, - { "sqrts/um", FP(0x14,0x14B), CIX, ARG_FPZ1 }, - { "sqrtt/um", FP(0x14,0x16B), CIX, ARG_FPZ1 }, - { "sqrtf/u", FP(0x14,0x18A), CIX, ARG_FPZ1 }, - { "sqrts/u", FP(0x14,0x18B), CIX, ARG_FPZ1 }, - { "sqrtg/u", FP(0x14,0x1AA), CIX, ARG_FPZ1 }, - { "sqrtt/u", FP(0x14,0x1AB), CIX, ARG_FPZ1 }, - { "sqrts/ud", FP(0x14,0x1CB), CIX, ARG_FPZ1 }, - { "sqrtt/ud", FP(0x14,0x1EB), CIX, ARG_FPZ1 }, - { "sqrtf/sc", FP(0x14,0x40A), CIX, ARG_FPZ1 }, - { "sqrtg/sc", FP(0x14,0x42A), CIX, ARG_FPZ1 }, - { "sqrtf/s", FP(0x14,0x48A), CIX, ARG_FPZ1 }, - { "sqrtg/s", FP(0x14,0x4AA), CIX, ARG_FPZ1 }, - { "sqrtf/suc", FP(0x14,0x50A), CIX, ARG_FPZ1 }, - { "sqrts/suc", FP(0x14,0x50B), CIX, ARG_FPZ1 }, - { "sqrtg/suc", FP(0x14,0x52A), CIX, ARG_FPZ1 }, - { "sqrtt/suc", FP(0x14,0x52B), CIX, ARG_FPZ1 }, - { "sqrts/sum", FP(0x14,0x54B), CIX, ARG_FPZ1 }, - { "sqrtt/sum", FP(0x14,0x56B), CIX, ARG_FPZ1 }, - { "sqrtf/su", FP(0x14,0x58A), CIX, ARG_FPZ1 }, - { "sqrts/su", FP(0x14,0x58B), CIX, ARG_FPZ1 }, - { "sqrtg/su", FP(0x14,0x5AA), CIX, ARG_FPZ1 }, - { "sqrtt/su", FP(0x14,0x5AB), CIX, ARG_FPZ1 }, - { "sqrts/sud", FP(0x14,0x5CB), CIX, ARG_FPZ1 }, - { "sqrtt/sud", FP(0x14,0x5EB), CIX, ARG_FPZ1 }, - { "sqrts/suic", FP(0x14,0x70B), CIX, ARG_FPZ1 }, - { "sqrtt/suic", FP(0x14,0x72B), CIX, ARG_FPZ1 }, - { "sqrts/suim", FP(0x14,0x74B), CIX, ARG_FPZ1 }, - { "sqrtt/suim", FP(0x14,0x76B), CIX, ARG_FPZ1 }, - { "sqrts/sui", FP(0x14,0x78B), CIX, ARG_FPZ1 }, - { "sqrtt/sui", FP(0x14,0x7AB), CIX, ARG_FPZ1 }, - { "sqrts/suid", FP(0x14,0x7CB), CIX, ARG_FPZ1 }, - { "sqrtt/suid", FP(0x14,0x7EB), CIX, ARG_FPZ1 }, - - { "addf/c", FP(0x15,0x000), BASE, ARG_FP }, - { "subf/c", FP(0x15,0x001), BASE, ARG_FP }, - { "mulf/c", FP(0x15,0x002), BASE, ARG_FP }, - { "divf/c", FP(0x15,0x003), BASE, ARG_FP }, - { "cvtdg/c", FP(0x15,0x01E), BASE, ARG_FPZ1 }, - { "addg/c", FP(0x15,0x020), BASE, ARG_FP }, - { "subg/c", FP(0x15,0x021), BASE, ARG_FP }, - { "mulg/c", FP(0x15,0x022), BASE, ARG_FP }, - { "divg/c", FP(0x15,0x023), BASE, ARG_FP }, - { "cvtgf/c", FP(0x15,0x02C), BASE, ARG_FPZ1 }, - { "cvtgd/c", FP(0x15,0x02D), BASE, ARG_FPZ1 }, - { "cvtgq/c", FP(0x15,0x02F), BASE, ARG_FPZ1 }, - { "cvtqf/c", FP(0x15,0x03C), BASE, ARG_FPZ1 }, - { "cvtqg/c", FP(0x15,0x03E), BASE, ARG_FPZ1 }, - { "addf", FP(0x15,0x080), BASE, ARG_FP }, - { "negf", FP(0x15,0x081), BASE, ARG_FPZ1 }, /* pseudo */ - { "subf", FP(0x15,0x081), BASE, ARG_FP }, - { "mulf", FP(0x15,0x082), BASE, ARG_FP }, - { "divf", FP(0x15,0x083), BASE, ARG_FP }, - { "cvtdg", FP(0x15,0x09E), BASE, ARG_FPZ1 }, - { "addg", FP(0x15,0x0A0), BASE, ARG_FP }, - { "negg", FP(0x15,0x0A1), BASE, ARG_FPZ1 }, /* pseudo */ - { "subg", FP(0x15,0x0A1), BASE, ARG_FP }, - { "mulg", FP(0x15,0x0A2), BASE, ARG_FP }, - { "divg", FP(0x15,0x0A3), BASE, ARG_FP }, - { "cmpgeq", FP(0x15,0x0A5), BASE, ARG_FP }, - { "cmpglt", FP(0x15,0x0A6), BASE, ARG_FP }, - { "cmpgle", FP(0x15,0x0A7), BASE, ARG_FP }, - { "cvtgf", FP(0x15,0x0AC), BASE, ARG_FPZ1 }, - { "cvtgd", FP(0x15,0x0AD), BASE, ARG_FPZ1 }, - { "cvtgq", FP(0x15,0x0AF), BASE, ARG_FPZ1 }, - { "cvtqf", FP(0x15,0x0BC), BASE, ARG_FPZ1 }, - { "cvtqg", FP(0x15,0x0BE), BASE, ARG_FPZ1 }, - { "addf/uc", FP(0x15,0x100), BASE, ARG_FP }, - { "subf/uc", FP(0x15,0x101), BASE, ARG_FP }, - { "mulf/uc", FP(0x15,0x102), BASE, ARG_FP }, - { "divf/uc", FP(0x15,0x103), BASE, ARG_FP }, - { "cvtdg/uc", FP(0x15,0x11E), BASE, ARG_FPZ1 }, - { "addg/uc", FP(0x15,0x120), BASE, ARG_FP }, - { "subg/uc", FP(0x15,0x121), BASE, ARG_FP }, - { "mulg/uc", FP(0x15,0x122), BASE, ARG_FP }, - { "divg/uc", FP(0x15,0x123), BASE, ARG_FP }, - { "cvtgf/uc", FP(0x15,0x12C), BASE, ARG_FPZ1 }, - { "cvtgd/uc", FP(0x15,0x12D), BASE, ARG_FPZ1 }, - { "cvtgq/vc", FP(0x15,0x12F), BASE, ARG_FPZ1 }, - { "addf/u", FP(0x15,0x180), BASE, ARG_FP }, - { "subf/u", FP(0x15,0x181), BASE, ARG_FP }, - { "mulf/u", FP(0x15,0x182), BASE, ARG_FP }, - { "divf/u", FP(0x15,0x183), BASE, ARG_FP }, - { "cvtdg/u", FP(0x15,0x19E), BASE, ARG_FPZ1 }, - { "addg/u", FP(0x15,0x1A0), BASE, ARG_FP }, - { "subg/u", FP(0x15,0x1A1), BASE, ARG_FP }, - { "mulg/u", FP(0x15,0x1A2), BASE, ARG_FP }, - { "divg/u", FP(0x15,0x1A3), BASE, ARG_FP }, - { "cvtgf/u", FP(0x15,0x1AC), BASE, ARG_FPZ1 }, - { "cvtgd/u", FP(0x15,0x1AD), BASE, ARG_FPZ1 }, - { "cvtgq/v", FP(0x15,0x1AF), BASE, ARG_FPZ1 }, - { "addf/sc", FP(0x15,0x400), BASE, ARG_FP }, - { "subf/sc", FP(0x15,0x401), BASE, ARG_FP }, - { "mulf/sc", FP(0x15,0x402), BASE, ARG_FP }, - { "divf/sc", FP(0x15,0x403), BASE, ARG_FP }, - { "cvtdg/sc", FP(0x15,0x41E), BASE, ARG_FPZ1 }, - { "addg/sc", FP(0x15,0x420), BASE, ARG_FP }, - { "subg/sc", FP(0x15,0x421), BASE, ARG_FP }, - { "mulg/sc", FP(0x15,0x422), BASE, ARG_FP }, - { "divg/sc", FP(0x15,0x423), BASE, ARG_FP }, - { "cvtgf/sc", FP(0x15,0x42C), BASE, ARG_FPZ1 }, - { "cvtgd/sc", FP(0x15,0x42D), BASE, ARG_FPZ1 }, - { "cvtgq/sc", FP(0x15,0x42F), BASE, ARG_FPZ1 }, - { "addf/s", FP(0x15,0x480), BASE, ARG_FP }, - { "negf/s", FP(0x15,0x481), BASE, ARG_FPZ1 }, /* pseudo */ - { "subf/s", FP(0x15,0x481), BASE, ARG_FP }, - { "mulf/s", FP(0x15,0x482), BASE, ARG_FP }, - { "divf/s", FP(0x15,0x483), BASE, ARG_FP }, - { "cvtdg/s", FP(0x15,0x49E), BASE, ARG_FPZ1 }, - { "addg/s", FP(0x15,0x4A0), BASE, ARG_FP }, - { "negg/s", FP(0x15,0x4A1), BASE, ARG_FPZ1 }, /* pseudo */ - { "subg/s", FP(0x15,0x4A1), BASE, ARG_FP }, - { "mulg/s", FP(0x15,0x4A2), BASE, ARG_FP }, - { "divg/s", FP(0x15,0x4A3), BASE, ARG_FP }, - { "cmpgeq/s", FP(0x15,0x4A5), BASE, ARG_FP }, - { "cmpglt/s", FP(0x15,0x4A6), BASE, ARG_FP }, - { "cmpgle/s", FP(0x15,0x4A7), BASE, ARG_FP }, - { "cvtgf/s", FP(0x15,0x4AC), BASE, ARG_FPZ1 }, - { "cvtgd/s", FP(0x15,0x4AD), BASE, ARG_FPZ1 }, - { "cvtgq/s", FP(0x15,0x4AF), BASE, ARG_FPZ1 }, - { "addf/suc", FP(0x15,0x500), BASE, ARG_FP }, - { "subf/suc", FP(0x15,0x501), BASE, ARG_FP }, - { "mulf/suc", FP(0x15,0x502), BASE, ARG_FP }, - { "divf/suc", FP(0x15,0x503), BASE, ARG_FP }, - { "cvtdg/suc", FP(0x15,0x51E), BASE, ARG_FPZ1 }, - { "addg/suc", FP(0x15,0x520), BASE, ARG_FP }, - { "subg/suc", FP(0x15,0x521), BASE, ARG_FP }, - { "mulg/suc", FP(0x15,0x522), BASE, ARG_FP }, - { "divg/suc", FP(0x15,0x523), BASE, ARG_FP }, - { "cvtgf/suc", FP(0x15,0x52C), BASE, ARG_FPZ1 }, - { "cvtgd/suc", FP(0x15,0x52D), BASE, ARG_FPZ1 }, - { "cvtgq/svc", FP(0x15,0x52F), BASE, ARG_FPZ1 }, - { "addf/su", FP(0x15,0x580), BASE, ARG_FP }, - { "subf/su", FP(0x15,0x581), BASE, ARG_FP }, - { "mulf/su", FP(0x15,0x582), BASE, ARG_FP }, - { "divf/su", FP(0x15,0x583), BASE, ARG_FP }, - { "cvtdg/su", FP(0x15,0x59E), BASE, ARG_FPZ1 }, - { "addg/su", FP(0x15,0x5A0), BASE, ARG_FP }, - { "subg/su", FP(0x15,0x5A1), BASE, ARG_FP }, - { "mulg/su", FP(0x15,0x5A2), BASE, ARG_FP }, - { "divg/su", FP(0x15,0x5A3), BASE, ARG_FP }, - { "cvtgf/su", FP(0x15,0x5AC), BASE, ARG_FPZ1 }, - { "cvtgd/su", FP(0x15,0x5AD), BASE, ARG_FPZ1 }, - { "cvtgq/sv", FP(0x15,0x5AF), BASE, ARG_FPZ1 }, - - { "adds/c", FP(0x16,0x000), BASE, ARG_FP }, - { "subs/c", FP(0x16,0x001), BASE, ARG_FP }, - { "muls/c", FP(0x16,0x002), BASE, ARG_FP }, - { "divs/c", FP(0x16,0x003), BASE, ARG_FP }, - { "addt/c", FP(0x16,0x020), BASE, ARG_FP }, - { "subt/c", FP(0x16,0x021), BASE, ARG_FP }, - { "mult/c", FP(0x16,0x022), BASE, ARG_FP }, - { "divt/c", FP(0x16,0x023), BASE, ARG_FP }, - { "cvtts/c", FP(0x16,0x02C), BASE, ARG_FPZ1 }, - { "cvttq/c", FP(0x16,0x02F), BASE, ARG_FPZ1 }, - { "cvtqs/c", FP(0x16,0x03C), BASE, ARG_FPZ1 }, - { "cvtqt/c", FP(0x16,0x03E), BASE, ARG_FPZ1 }, - { "adds/m", FP(0x16,0x040), BASE, ARG_FP }, - { "subs/m", FP(0x16,0x041), BASE, ARG_FP }, - { "muls/m", FP(0x16,0x042), BASE, ARG_FP }, - { "divs/m", FP(0x16,0x043), BASE, ARG_FP }, - { "addt/m", FP(0x16,0x060), BASE, ARG_FP }, - { "subt/m", FP(0x16,0x061), BASE, ARG_FP }, - { "mult/m", FP(0x16,0x062), BASE, ARG_FP }, - { "divt/m", FP(0x16,0x063), BASE, ARG_FP }, - { "cvtts/m", FP(0x16,0x06C), BASE, ARG_FPZ1 }, - { "cvttq/m", FP(0x16,0x06F), BASE, ARG_FPZ1 }, - { "cvtqs/m", FP(0x16,0x07C), BASE, ARG_FPZ1 }, - { "cvtqt/m", FP(0x16,0x07E), BASE, ARG_FPZ1 }, - { "adds", FP(0x16,0x080), BASE, ARG_FP }, - { "negs", FP(0x16,0x081), BASE, ARG_FPZ1 }, /* pseudo */ - { "subs", FP(0x16,0x081), BASE, ARG_FP }, - { "muls", FP(0x16,0x082), BASE, ARG_FP }, - { "divs", FP(0x16,0x083), BASE, ARG_FP }, - { "addt", FP(0x16,0x0A0), BASE, ARG_FP }, - { "negt", FP(0x16,0x0A1), BASE, ARG_FPZ1 }, /* pseudo */ - { "subt", FP(0x16,0x0A1), BASE, ARG_FP }, - { "mult", FP(0x16,0x0A2), BASE, ARG_FP }, - { "divt", FP(0x16,0x0A3), BASE, ARG_FP }, - { "cmptun", FP(0x16,0x0A4), BASE, ARG_FP }, - { "cmpteq", FP(0x16,0x0A5), BASE, ARG_FP }, - { "cmptlt", FP(0x16,0x0A6), BASE, ARG_FP }, - { "cmptle", FP(0x16,0x0A7), BASE, ARG_FP }, - { "cvtts", FP(0x16,0x0AC), BASE, ARG_FPZ1 }, - { "cvttq", FP(0x16,0x0AF), BASE, ARG_FPZ1 }, - { "cvtqs", FP(0x16,0x0BC), BASE, ARG_FPZ1 }, - { "cvtqt", FP(0x16,0x0BE), BASE, ARG_FPZ1 }, - { "adds/d", FP(0x16,0x0C0), BASE, ARG_FP }, - { "subs/d", FP(0x16,0x0C1), BASE, ARG_FP }, - { "muls/d", FP(0x16,0x0C2), BASE, ARG_FP }, - { "divs/d", FP(0x16,0x0C3), BASE, ARG_FP }, - { "addt/d", FP(0x16,0x0E0), BASE, ARG_FP }, - { "subt/d", FP(0x16,0x0E1), BASE, ARG_FP }, - { "mult/d", FP(0x16,0x0E2), BASE, ARG_FP }, - { "divt/d", FP(0x16,0x0E3), BASE, ARG_FP }, - { "cvtts/d", FP(0x16,0x0EC), BASE, ARG_FPZ1 }, - { "cvttq/d", FP(0x16,0x0EF), BASE, ARG_FPZ1 }, - { "cvtqs/d", FP(0x16,0x0FC), BASE, ARG_FPZ1 }, - { "cvtqt/d", FP(0x16,0x0FE), BASE, ARG_FPZ1 }, - { "adds/uc", FP(0x16,0x100), BASE, ARG_FP }, - { "subs/uc", FP(0x16,0x101), BASE, ARG_FP }, - { "muls/uc", FP(0x16,0x102), BASE, ARG_FP }, - { "divs/uc", FP(0x16,0x103), BASE, ARG_FP }, - { "addt/uc", FP(0x16,0x120), BASE, ARG_FP }, - { "subt/uc", FP(0x16,0x121), BASE, ARG_FP }, - { "mult/uc", FP(0x16,0x122), BASE, ARG_FP }, - { "divt/uc", FP(0x16,0x123), BASE, ARG_FP }, - { "cvtts/uc", FP(0x16,0x12C), BASE, ARG_FPZ1 }, - { "cvttq/vc", FP(0x16,0x12F), BASE, ARG_FPZ1 }, - { "adds/um", FP(0x16,0x140), BASE, ARG_FP }, - { "subs/um", FP(0x16,0x141), BASE, ARG_FP }, - { "muls/um", FP(0x16,0x142), BASE, ARG_FP }, - { "divs/um", FP(0x16,0x143), BASE, ARG_FP }, - { "addt/um", FP(0x16,0x160), BASE, ARG_FP }, - { "subt/um", FP(0x16,0x161), BASE, ARG_FP }, - { "mult/um", FP(0x16,0x162), BASE, ARG_FP }, - { "divt/um", FP(0x16,0x163), BASE, ARG_FP }, - { "cvtts/um", FP(0x16,0x16C), BASE, ARG_FPZ1 }, - { "cvttq/vm", FP(0x16,0x16F), BASE, ARG_FPZ1 }, - { "adds/u", FP(0x16,0x180), BASE, ARG_FP }, - { "subs/u", FP(0x16,0x181), BASE, ARG_FP }, - { "muls/u", FP(0x16,0x182), BASE, ARG_FP }, - { "divs/u", FP(0x16,0x183), BASE, ARG_FP }, - { "addt/u", FP(0x16,0x1A0), BASE, ARG_FP }, - { "subt/u", FP(0x16,0x1A1), BASE, ARG_FP }, - { "mult/u", FP(0x16,0x1A2), BASE, ARG_FP }, - { "divt/u", FP(0x16,0x1A3), BASE, ARG_FP }, - { "cvtts/u", FP(0x16,0x1AC), BASE, ARG_FPZ1 }, - { "cvttq/v", FP(0x16,0x1AF), BASE, ARG_FPZ1 }, - { "adds/ud", FP(0x16,0x1C0), BASE, ARG_FP }, - { "subs/ud", FP(0x16,0x1C1), BASE, ARG_FP }, - { "muls/ud", FP(0x16,0x1C2), BASE, ARG_FP }, - { "divs/ud", FP(0x16,0x1C3), BASE, ARG_FP }, - { "addt/ud", FP(0x16,0x1E0), BASE, ARG_FP }, - { "subt/ud", FP(0x16,0x1E1), BASE, ARG_FP }, - { "mult/ud", FP(0x16,0x1E2), BASE, ARG_FP }, - { "divt/ud", FP(0x16,0x1E3), BASE, ARG_FP }, - { "cvtts/ud", FP(0x16,0x1EC), BASE, ARG_FPZ1 }, - { "cvttq/vd", FP(0x16,0x1EF), BASE, ARG_FPZ1 }, - { "cvtst", FP(0x16,0x2AC), BASE, ARG_FPZ1 }, - { "adds/suc", FP(0x16,0x500), BASE, ARG_FP }, - { "subs/suc", FP(0x16,0x501), BASE, ARG_FP }, - { "muls/suc", FP(0x16,0x502), BASE, ARG_FP }, - { "divs/suc", FP(0x16,0x503), BASE, ARG_FP }, - { "addt/suc", FP(0x16,0x520), BASE, ARG_FP }, - { "subt/suc", FP(0x16,0x521), BASE, ARG_FP }, - { "mult/suc", FP(0x16,0x522), BASE, ARG_FP }, - { "divt/suc", FP(0x16,0x523), BASE, ARG_FP }, - { "cvtts/suc", FP(0x16,0x52C), BASE, ARG_FPZ1 }, - { "cvttq/svc", FP(0x16,0x52F), BASE, ARG_FPZ1 }, - { "adds/sum", FP(0x16,0x540), BASE, ARG_FP }, - { "subs/sum", FP(0x16,0x541), BASE, ARG_FP }, - { "muls/sum", FP(0x16,0x542), BASE, ARG_FP }, - { "divs/sum", FP(0x16,0x543), BASE, ARG_FP }, - { "addt/sum", FP(0x16,0x560), BASE, ARG_FP }, - { "subt/sum", FP(0x16,0x561), BASE, ARG_FP }, - { "mult/sum", FP(0x16,0x562), BASE, ARG_FP }, - { "divt/sum", FP(0x16,0x563), BASE, ARG_FP }, - { "cvtts/sum", FP(0x16,0x56C), BASE, ARG_FPZ1 }, - { "cvttq/svm", FP(0x16,0x56F), BASE, ARG_FPZ1 }, - { "adds/su", FP(0x16,0x580), BASE, ARG_FP }, - { "negs/su", FP(0x16,0x581), BASE, ARG_FPZ1 }, /* pseudo */ - { "subs/su", FP(0x16,0x581), BASE, ARG_FP }, - { "muls/su", FP(0x16,0x582), BASE, ARG_FP }, - { "divs/su", FP(0x16,0x583), BASE, ARG_FP }, - { "addt/su", FP(0x16,0x5A0), BASE, ARG_FP }, - { "negt/su", FP(0x16,0x5A1), BASE, ARG_FPZ1 }, /* pseudo */ - { "subt/su", FP(0x16,0x5A1), BASE, ARG_FP }, - { "mult/su", FP(0x16,0x5A2), BASE, ARG_FP }, - { "divt/su", FP(0x16,0x5A3), BASE, ARG_FP }, - { "cmptun/su", FP(0x16,0x5A4), BASE, ARG_FP }, - { "cmpteq/su", FP(0x16,0x5A5), BASE, ARG_FP }, - { "cmptlt/su", FP(0x16,0x5A6), BASE, ARG_FP }, - { "cmptle/su", FP(0x16,0x5A7), BASE, ARG_FP }, - { "cvtts/su", FP(0x16,0x5AC), BASE, ARG_FPZ1 }, - { "cvttq/sv", FP(0x16,0x5AF), BASE, ARG_FPZ1 }, - { "adds/sud", FP(0x16,0x5C0), BASE, ARG_FP }, - { "subs/sud", FP(0x16,0x5C1), BASE, ARG_FP }, - { "muls/sud", FP(0x16,0x5C2), BASE, ARG_FP }, - { "divs/sud", FP(0x16,0x5C3), BASE, ARG_FP }, - { "addt/sud", FP(0x16,0x5E0), BASE, ARG_FP }, - { "subt/sud", FP(0x16,0x5E1), BASE, ARG_FP }, - { "mult/sud", FP(0x16,0x5E2), BASE, ARG_FP }, - { "divt/sud", FP(0x16,0x5E3), BASE, ARG_FP }, - { "cvtts/sud", FP(0x16,0x5EC), BASE, ARG_FPZ1 }, - { "cvttq/svd", FP(0x16,0x5EF), BASE, ARG_FPZ1 }, - { "cvtst/s", FP(0x16,0x6AC), BASE, ARG_FPZ1 }, - { "adds/suic", FP(0x16,0x700), BASE, ARG_FP }, - { "subs/suic", FP(0x16,0x701), BASE, ARG_FP }, - { "muls/suic", FP(0x16,0x702), BASE, ARG_FP }, - { "divs/suic", FP(0x16,0x703), BASE, ARG_FP }, - { "addt/suic", FP(0x16,0x720), BASE, ARG_FP }, - { "subt/suic", FP(0x16,0x721), BASE, ARG_FP }, - { "mult/suic", FP(0x16,0x722), BASE, ARG_FP }, - { "divt/suic", FP(0x16,0x723), BASE, ARG_FP }, - { "cvtts/suic", FP(0x16,0x72C), BASE, ARG_FPZ1 }, - { "cvttq/svic", FP(0x16,0x72F), BASE, ARG_FPZ1 }, - { "cvtqs/suic", FP(0x16,0x73C), BASE, ARG_FPZ1 }, - { "cvtqt/suic", FP(0x16,0x73E), BASE, ARG_FPZ1 }, - { "adds/suim", FP(0x16,0x740), BASE, ARG_FP }, - { "subs/suim", FP(0x16,0x741), BASE, ARG_FP }, - { "muls/suim", FP(0x16,0x742), BASE, ARG_FP }, - { "divs/suim", FP(0x16,0x743), BASE, ARG_FP }, - { "addt/suim", FP(0x16,0x760), BASE, ARG_FP }, - { "subt/suim", FP(0x16,0x761), BASE, ARG_FP }, - { "mult/suim", FP(0x16,0x762), BASE, ARG_FP }, - { "divt/suim", FP(0x16,0x763), BASE, ARG_FP }, - { "cvtts/suim", FP(0x16,0x76C), BASE, ARG_FPZ1 }, - { "cvttq/svim", FP(0x16,0x76F), BASE, ARG_FPZ1 }, - { "cvtqs/suim", FP(0x16,0x77C), BASE, ARG_FPZ1 }, - { "cvtqt/suim", FP(0x16,0x77E), BASE, ARG_FPZ1 }, - { "adds/sui", FP(0x16,0x780), BASE, ARG_FP }, - { "negs/sui", FP(0x16,0x781), BASE, ARG_FPZ1 }, /* pseudo */ - { "subs/sui", FP(0x16,0x781), BASE, ARG_FP }, - { "muls/sui", FP(0x16,0x782), BASE, ARG_FP }, - { "divs/sui", FP(0x16,0x783), BASE, ARG_FP }, - { "addt/sui", FP(0x16,0x7A0), BASE, ARG_FP }, - { "negt/sui", FP(0x16,0x7A1), BASE, ARG_FPZ1 }, /* pseudo */ - { "subt/sui", FP(0x16,0x7A1), BASE, ARG_FP }, - { "mult/sui", FP(0x16,0x7A2), BASE, ARG_FP }, - { "divt/sui", FP(0x16,0x7A3), BASE, ARG_FP }, - { "cvtts/sui", FP(0x16,0x7AC), BASE, ARG_FPZ1 }, - { "cvttq/svi", FP(0x16,0x7AF), BASE, ARG_FPZ1 }, - { "cvtqs/sui", FP(0x16,0x7BC), BASE, ARG_FPZ1 }, - { "cvtqt/sui", FP(0x16,0x7BE), BASE, ARG_FPZ1 }, - { "adds/suid", FP(0x16,0x7C0), BASE, ARG_FP }, - { "subs/suid", FP(0x16,0x7C1), BASE, ARG_FP }, - { "muls/suid", FP(0x16,0x7C2), BASE, ARG_FP }, - { "divs/suid", FP(0x16,0x7C3), BASE, ARG_FP }, - { "addt/suid", FP(0x16,0x7E0), BASE, ARG_FP }, - { "subt/suid", FP(0x16,0x7E1), BASE, ARG_FP }, - { "mult/suid", FP(0x16,0x7E2), BASE, ARG_FP }, - { "divt/suid", FP(0x16,0x7E3), BASE, ARG_FP }, - { "cvtts/suid", FP(0x16,0x7EC), BASE, ARG_FPZ1 }, - { "cvttq/svid", FP(0x16,0x7EF), BASE, ARG_FPZ1 }, - { "cvtqs/suid", FP(0x16,0x7FC), BASE, ARG_FPZ1 }, - { "cvtqt/suid", FP(0x16,0x7FE), BASE, ARG_FPZ1 }, - - { "cvtlq", FP(0x17,0x010), BASE, ARG_FPZ1 }, - { "fnop", FP(0x17,0x020), BASE, { ZA, ZB, ZC } }, /* pseudo */ - { "fclr", FP(0x17,0x020), BASE, { ZA, ZB, FC } }, /* pseudo */ - { "fabs", FP(0x17,0x020), BASE, ARG_FPZ1 }, /* pseudo */ - { "fmov", FP(0x17,0x020), BASE, { FA, RBA, FC } }, /* pseudo */ - { "cpys", FP(0x17,0x020), BASE, ARG_FP }, - { "fneg", FP(0x17,0x021), BASE, { FA, RBA, FC } }, /* pseudo */ - { "cpysn", FP(0x17,0x021), BASE, ARG_FP }, - { "cpyse", FP(0x17,0x022), BASE, ARG_FP }, - { "mt_fpcr", FP(0x17,0x024), BASE, { FA, RBA, RCA } }, - { "mf_fpcr", FP(0x17,0x025), BASE, { FA, RBA, RCA } }, - { "fcmoveq", FP(0x17,0x02A), BASE, ARG_FP }, - { "fcmovne", FP(0x17,0x02B), BASE, ARG_FP }, - { "fcmovlt", FP(0x17,0x02C), BASE, ARG_FP }, - { "fcmovge", FP(0x17,0x02D), BASE, ARG_FP }, - { "fcmovle", FP(0x17,0x02E), BASE, ARG_FP }, - { "fcmovgt", FP(0x17,0x02F), BASE, ARG_FP }, - { "cvtql", FP(0x17,0x030), BASE, ARG_FPZ1 }, - { "cvtql/v", FP(0x17,0x130), BASE, ARG_FPZ1 }, - { "cvtql/sv", FP(0x17,0x530), BASE, ARG_FPZ1 }, - - { "trapb", MFC(0x18,0x0000), BASE, ARG_NONE }, - { "draint", MFC(0x18,0x0000), BASE, ARG_NONE }, /* alias */ - { "excb", MFC(0x18,0x0400), BASE, ARG_NONE }, - { "mb", MFC(0x18,0x4000), BASE, ARG_NONE }, - { "wmb", MFC(0x18,0x4400), BASE, ARG_NONE }, - { "fetch", MFC(0x18,0x8000), BASE, { ZA, PRB } }, - { "fetch_m", MFC(0x18,0xA000), BASE, { ZA, PRB } }, - { "rpcc", MFC(0x18,0xC000), BASE, { RA } }, - { "rc", MFC(0x18,0xE000), BASE, { RA } }, - { "ecb", MFC(0x18,0xE800), BASE, { ZA, PRB } }, /* ev56 una */ - { "rs", MFC(0x18,0xF000), BASE, { RA } }, - { "wh64", MFC(0x18,0xF800), BASE, { ZA, PRB } }, /* ev56 una */ - { "wh64en", MFC(0x18,0xFC00), BASE, { ZA, PRB } }, /* ev7 una */ - - { "hw_mfpr", OPR(0x19,0x00), EV4, { RA, RBA, EV4EXTHWINDEX } }, - { "hw_mfpr", OP(0x19), OP_MASK, EV5, { RA, RBA, EV5HWINDEX } }, - { "hw_mfpr", OP(0x19), OP_MASK, EV6, { RA, ZB, EV6HWINDEX } }, - { "hw_mfpr/i", OPR(0x19,0x01), EV4, ARG_EV4HWMPR }, - { "hw_mfpr/a", OPR(0x19,0x02), EV4, ARG_EV4HWMPR }, - { "hw_mfpr/ai", OPR(0x19,0x03), EV4, ARG_EV4HWMPR }, - { "hw_mfpr/p", OPR(0x19,0x04), EV4, ARG_EV4HWMPR }, - { "hw_mfpr/pi", OPR(0x19,0x05), EV4, ARG_EV4HWMPR }, - { "hw_mfpr/pa", OPR(0x19,0x06), EV4, ARG_EV4HWMPR }, - { "hw_mfpr/pai", OPR(0x19,0x07), EV4, ARG_EV4HWMPR }, - { "pal19", PCD(0x19), BASE, ARG_PCD }, - - { "jmp", MBR_(0x1A,0), MBR_MASK | 0x3FFF, /* pseudo */ - BASE, { ZA, CPRB } }, - { "jmp", MBR(0x1A,0), BASE, { RA, CPRB, JMPHINT } }, - { "jsr", MBR(0x1A,1), BASE, { RA, CPRB, JMPHINT } }, - { "ret", MBR_(0x1A,2) | (31 << 21) | (26 << 16) | 1,/* pseudo */ - 0xFFFFFFFF, BASE, { 0 } }, - { "ret", MBR(0x1A,2), BASE, { RA, CPRB, RETHINT } }, - { "jcr", MBR(0x1A,3), BASE, { RA, CPRB, RETHINT } }, /* alias */ - { "jsr_coroutine", MBR(0x1A,3), BASE, { RA, CPRB, RETHINT } }, - - { "hw_ldl", EV4HWMEM(0x1B,0x0), EV4, ARG_EV4HWMEM }, - { "hw_ldl", EV5HWMEM(0x1B,0x00), EV5, ARG_EV5HWMEM }, - { "hw_ldl", EV6HWMEM(0x1B,0x8), EV6, ARG_EV6HWMEM }, - { "hw_ldl/a", EV4HWMEM(0x1B,0x4), EV4, ARG_EV4HWMEM }, - { "hw_ldl/a", EV5HWMEM(0x1B,0x10), EV5, ARG_EV5HWMEM }, - { "hw_ldl/a", EV6HWMEM(0x1B,0xC), EV6, ARG_EV6HWMEM }, - { "hw_ldl/al", EV5HWMEM(0x1B,0x11), EV5, ARG_EV5HWMEM }, - { "hw_ldl/ar", EV4HWMEM(0x1B,0x6), EV4, ARG_EV4HWMEM }, - { "hw_ldl/av", EV5HWMEM(0x1B,0x12), EV5, ARG_EV5HWMEM }, - { "hw_ldl/avl", EV5HWMEM(0x1B,0x13), EV5, ARG_EV5HWMEM }, - { "hw_ldl/aw", EV5HWMEM(0x1B,0x18), EV5, ARG_EV5HWMEM }, - { "hw_ldl/awl", EV5HWMEM(0x1B,0x19), EV5, ARG_EV5HWMEM }, - { "hw_ldl/awv", EV5HWMEM(0x1B,0x1a), EV5, ARG_EV5HWMEM }, - { "hw_ldl/awvl", EV5HWMEM(0x1B,0x1b), EV5, ARG_EV5HWMEM }, - { "hw_ldl/l", EV5HWMEM(0x1B,0x01), EV5, ARG_EV5HWMEM }, - { "hw_ldl/p", EV4HWMEM(0x1B,0x8), EV4, ARG_EV4HWMEM }, - { "hw_ldl/p", EV5HWMEM(0x1B,0x20), EV5, ARG_EV5HWMEM }, - { "hw_ldl/p", EV6HWMEM(0x1B,0x0), EV6, ARG_EV6HWMEM }, - { "hw_ldl/pa", EV4HWMEM(0x1B,0xC), EV4, ARG_EV4HWMEM }, - { "hw_ldl/pa", EV5HWMEM(0x1B,0x30), EV5, ARG_EV5HWMEM }, - { "hw_ldl/pal", EV5HWMEM(0x1B,0x31), EV5, ARG_EV5HWMEM }, - { "hw_ldl/par", EV4HWMEM(0x1B,0xE), EV4, ARG_EV4HWMEM }, - { "hw_ldl/pav", EV5HWMEM(0x1B,0x32), EV5, ARG_EV5HWMEM }, - { "hw_ldl/pavl", EV5HWMEM(0x1B,0x33), EV5, ARG_EV5HWMEM }, - { "hw_ldl/paw", EV5HWMEM(0x1B,0x38), EV5, ARG_EV5HWMEM }, - { "hw_ldl/pawl", EV5HWMEM(0x1B,0x39), EV5, ARG_EV5HWMEM }, - { "hw_ldl/pawv", EV5HWMEM(0x1B,0x3a), EV5, ARG_EV5HWMEM }, - { "hw_ldl/pawvl", EV5HWMEM(0x1B,0x3b), EV5, ARG_EV5HWMEM }, - { "hw_ldl/pl", EV5HWMEM(0x1B,0x21), EV5, ARG_EV5HWMEM }, - { "hw_ldl/pr", EV4HWMEM(0x1B,0xA), EV4, ARG_EV4HWMEM }, - { "hw_ldl/pv", EV5HWMEM(0x1B,0x22), EV5, ARG_EV5HWMEM }, - { "hw_ldl/pvl", EV5HWMEM(0x1B,0x23), EV5, ARG_EV5HWMEM }, - { "hw_ldl/pw", EV5HWMEM(0x1B,0x28), EV5, ARG_EV5HWMEM }, - { "hw_ldl/pwl", EV5HWMEM(0x1B,0x29), EV5, ARG_EV5HWMEM }, - { "hw_ldl/pwv", EV5HWMEM(0x1B,0x2a), EV5, ARG_EV5HWMEM }, - { "hw_ldl/pwvl", EV5HWMEM(0x1B,0x2b), EV5, ARG_EV5HWMEM }, - { "hw_ldl/r", EV4HWMEM(0x1B,0x2), EV4, ARG_EV4HWMEM }, - { "hw_ldl/v", EV5HWMEM(0x1B,0x02), EV5, ARG_EV5HWMEM }, - { "hw_ldl/v", EV6HWMEM(0x1B,0x4), EV6, ARG_EV6HWMEM }, - { "hw_ldl/vl", EV5HWMEM(0x1B,0x03), EV5, ARG_EV5HWMEM }, - { "hw_ldl/w", EV5HWMEM(0x1B,0x08), EV5, ARG_EV5HWMEM }, - { "hw_ldl/w", EV6HWMEM(0x1B,0xA), EV6, ARG_EV6HWMEM }, - { "hw_ldl/wa", EV6HWMEM(0x1B,0xE), EV6, ARG_EV6HWMEM }, - { "hw_ldl/wl", EV5HWMEM(0x1B,0x09), EV5, ARG_EV5HWMEM }, - { "hw_ldl/wv", EV5HWMEM(0x1B,0x0a), EV5, ARG_EV5HWMEM }, - { "hw_ldl/wvl", EV5HWMEM(0x1B,0x0b), EV5, ARG_EV5HWMEM }, - { "hw_ldl_l", EV5HWMEM(0x1B,0x01), EV5, ARG_EV5HWMEM }, - { "hw_ldl_l/a", EV5HWMEM(0x1B,0x11), EV5, ARG_EV5HWMEM }, - { "hw_ldl_l/av", EV5HWMEM(0x1B,0x13), EV5, ARG_EV5HWMEM }, - { "hw_ldl_l/aw", EV5HWMEM(0x1B,0x19), EV5, ARG_EV5HWMEM }, - { "hw_ldl_l/awv", EV5HWMEM(0x1B,0x1b), EV5, ARG_EV5HWMEM }, - { "hw_ldl_l/p", EV5HWMEM(0x1B,0x21), EV5, ARG_EV5HWMEM }, - { "hw_ldl_l/p", EV6HWMEM(0x1B,0x2), EV6, ARG_EV6HWMEM }, - { "hw_ldl_l/pa", EV5HWMEM(0x1B,0x31), EV5, ARG_EV5HWMEM }, - { "hw_ldl_l/pav", EV5HWMEM(0x1B,0x33), EV5, ARG_EV5HWMEM }, - { "hw_ldl_l/paw", EV5HWMEM(0x1B,0x39), EV5, ARG_EV5HWMEM }, - { "hw_ldl_l/pawv", EV5HWMEM(0x1B,0x3b), EV5, ARG_EV5HWMEM }, - { "hw_ldl_l/pv", EV5HWMEM(0x1B,0x23), EV5, ARG_EV5HWMEM }, - { "hw_ldl_l/pw", EV5HWMEM(0x1B,0x29), EV5, ARG_EV5HWMEM }, - { "hw_ldl_l/pwv", EV5HWMEM(0x1B,0x2b), EV5, ARG_EV5HWMEM }, - { "hw_ldl_l/v", EV5HWMEM(0x1B,0x03), EV5, ARG_EV5HWMEM }, - { "hw_ldl_l/w", EV5HWMEM(0x1B,0x09), EV5, ARG_EV5HWMEM }, - { "hw_ldl_l/wv", EV5HWMEM(0x1B,0x0b), EV5, ARG_EV5HWMEM }, - { "hw_ldq", EV4HWMEM(0x1B,0x1), EV4, ARG_EV4HWMEM }, - { "hw_ldq", EV5HWMEM(0x1B,0x04), EV5, ARG_EV5HWMEM }, - { "hw_ldq", EV6HWMEM(0x1B,0x9), EV6, ARG_EV6HWMEM }, - { "hw_ldq/a", EV4HWMEM(0x1B,0x5), EV4, ARG_EV4HWMEM }, - { "hw_ldq/a", EV5HWMEM(0x1B,0x14), EV5, ARG_EV5HWMEM }, - { "hw_ldq/a", EV6HWMEM(0x1B,0xD), EV6, ARG_EV6HWMEM }, - { "hw_ldq/al", EV5HWMEM(0x1B,0x15), EV5, ARG_EV5HWMEM }, - { "hw_ldq/ar", EV4HWMEM(0x1B,0x7), EV4, ARG_EV4HWMEM }, - { "hw_ldq/av", EV5HWMEM(0x1B,0x16), EV5, ARG_EV5HWMEM }, - { "hw_ldq/avl", EV5HWMEM(0x1B,0x17), EV5, ARG_EV5HWMEM }, - { "hw_ldq/aw", EV5HWMEM(0x1B,0x1c), EV5, ARG_EV5HWMEM }, - { "hw_ldq/awl", EV5HWMEM(0x1B,0x1d), EV5, ARG_EV5HWMEM }, - { "hw_ldq/awv", EV5HWMEM(0x1B,0x1e), EV5, ARG_EV5HWMEM }, - { "hw_ldq/awvl", EV5HWMEM(0x1B,0x1f), EV5, ARG_EV5HWMEM }, - { "hw_ldq/l", EV5HWMEM(0x1B,0x05), EV5, ARG_EV5HWMEM }, - { "hw_ldq/p", EV4HWMEM(0x1B,0x9), EV4, ARG_EV4HWMEM }, - { "hw_ldq/p", EV5HWMEM(0x1B,0x24), EV5, ARG_EV5HWMEM }, - { "hw_ldq/p", EV6HWMEM(0x1B,0x1), EV6, ARG_EV6HWMEM }, - { "hw_ldq/pa", EV4HWMEM(0x1B,0xD), EV4, ARG_EV4HWMEM }, - { "hw_ldq/pa", EV5HWMEM(0x1B,0x34), EV5, ARG_EV5HWMEM }, - { "hw_ldq/pal", EV5HWMEM(0x1B,0x35), EV5, ARG_EV5HWMEM }, - { "hw_ldq/par", EV4HWMEM(0x1B,0xF), EV4, ARG_EV4HWMEM }, - { "hw_ldq/pav", EV5HWMEM(0x1B,0x36), EV5, ARG_EV5HWMEM }, - { "hw_ldq/pavl", EV5HWMEM(0x1B,0x37), EV5, ARG_EV5HWMEM }, - { "hw_ldq/paw", EV5HWMEM(0x1B,0x3c), EV5, ARG_EV5HWMEM }, - { "hw_ldq/pawl", EV5HWMEM(0x1B,0x3d), EV5, ARG_EV5HWMEM }, - { "hw_ldq/pawv", EV5HWMEM(0x1B,0x3e), EV5, ARG_EV5HWMEM }, - { "hw_ldq/pawvl", EV5HWMEM(0x1B,0x3f), EV5, ARG_EV5HWMEM }, - { "hw_ldq/pl", EV5HWMEM(0x1B,0x25), EV5, ARG_EV5HWMEM }, - { "hw_ldq/pr", EV4HWMEM(0x1B,0xB), EV4, ARG_EV4HWMEM }, - { "hw_ldq/pv", EV5HWMEM(0x1B,0x26), EV5, ARG_EV5HWMEM }, - { "hw_ldq/pvl", EV5HWMEM(0x1B,0x27), EV5, ARG_EV5HWMEM }, - { "hw_ldq/pw", EV5HWMEM(0x1B,0x2c), EV5, ARG_EV5HWMEM }, - { "hw_ldq/pwl", EV5HWMEM(0x1B,0x2d), EV5, ARG_EV5HWMEM }, - { "hw_ldq/pwv", EV5HWMEM(0x1B,0x2e), EV5, ARG_EV5HWMEM }, - { "hw_ldq/pwvl", EV5HWMEM(0x1B,0x2f), EV5, ARG_EV5HWMEM }, - { "hw_ldq/r", EV4HWMEM(0x1B,0x3), EV4, ARG_EV4HWMEM }, - { "hw_ldq/v", EV5HWMEM(0x1B,0x06), EV5, ARG_EV5HWMEM }, - { "hw_ldq/v", EV6HWMEM(0x1B,0x5), EV6, ARG_EV6HWMEM }, - { "hw_ldq/vl", EV5HWMEM(0x1B,0x07), EV5, ARG_EV5HWMEM }, - { "hw_ldq/w", EV5HWMEM(0x1B,0x0c), EV5, ARG_EV5HWMEM }, - { "hw_ldq/w", EV6HWMEM(0x1B,0xB), EV6, ARG_EV6HWMEM }, - { "hw_ldq/wa", EV6HWMEM(0x1B,0xF), EV6, ARG_EV6HWMEM }, - { "hw_ldq/wl", EV5HWMEM(0x1B,0x0d), EV5, ARG_EV5HWMEM }, - { "hw_ldq/wv", EV5HWMEM(0x1B,0x0e), EV5, ARG_EV5HWMEM }, - { "hw_ldq/wvl", EV5HWMEM(0x1B,0x0f), EV5, ARG_EV5HWMEM }, - { "hw_ldq_l", EV5HWMEM(0x1B,0x05), EV5, ARG_EV5HWMEM }, - { "hw_ldq_l/a", EV5HWMEM(0x1B,0x15), EV5, ARG_EV5HWMEM }, - { "hw_ldq_l/av", EV5HWMEM(0x1B,0x17), EV5, ARG_EV5HWMEM }, - { "hw_ldq_l/aw", EV5HWMEM(0x1B,0x1d), EV5, ARG_EV5HWMEM }, - { "hw_ldq_l/awv", EV5HWMEM(0x1B,0x1f), EV5, ARG_EV5HWMEM }, - { "hw_ldq_l/p", EV5HWMEM(0x1B,0x25), EV5, ARG_EV5HWMEM }, - { "hw_ldq_l/p", EV6HWMEM(0x1B,0x3), EV6, ARG_EV6HWMEM }, - { "hw_ldq_l/pa", EV5HWMEM(0x1B,0x35), EV5, ARG_EV5HWMEM }, - { "hw_ldq_l/pav", EV5HWMEM(0x1B,0x37), EV5, ARG_EV5HWMEM }, - { "hw_ldq_l/paw", EV5HWMEM(0x1B,0x3d), EV5, ARG_EV5HWMEM }, - { "hw_ldq_l/pawv", EV5HWMEM(0x1B,0x3f), EV5, ARG_EV5HWMEM }, - { "hw_ldq_l/pv", EV5HWMEM(0x1B,0x27), EV5, ARG_EV5HWMEM }, - { "hw_ldq_l/pw", EV5HWMEM(0x1B,0x2d), EV5, ARG_EV5HWMEM }, - { "hw_ldq_l/pwv", EV5HWMEM(0x1B,0x2f), EV5, ARG_EV5HWMEM }, - { "hw_ldq_l/v", EV5HWMEM(0x1B,0x07), EV5, ARG_EV5HWMEM }, - { "hw_ldq_l/w", EV5HWMEM(0x1B,0x0d), EV5, ARG_EV5HWMEM }, - { "hw_ldq_l/wv", EV5HWMEM(0x1B,0x0f), EV5, ARG_EV5HWMEM }, - { "hw_ld", EV4HWMEM(0x1B,0x0), EV4, ARG_EV4HWMEM }, - { "hw_ld", EV5HWMEM(0x1B,0x00), EV5, ARG_EV5HWMEM }, - { "hw_ld/a", EV4HWMEM(0x1B,0x4), EV4, ARG_EV4HWMEM }, - { "hw_ld/a", EV5HWMEM(0x1B,0x10), EV5, ARG_EV5HWMEM }, - { "hw_ld/al", EV5HWMEM(0x1B,0x11), EV5, ARG_EV5HWMEM }, - { "hw_ld/aq", EV4HWMEM(0x1B,0x5), EV4, ARG_EV4HWMEM }, - { "hw_ld/aq", EV5HWMEM(0x1B,0x14), EV5, ARG_EV5HWMEM }, - { "hw_ld/aql", EV5HWMEM(0x1B,0x15), EV5, ARG_EV5HWMEM }, - { "hw_ld/aqv", EV5HWMEM(0x1B,0x16), EV5, ARG_EV5HWMEM }, - { "hw_ld/aqvl", EV5HWMEM(0x1B,0x17), EV5, ARG_EV5HWMEM }, - { "hw_ld/ar", EV4HWMEM(0x1B,0x6), EV4, ARG_EV4HWMEM }, - { "hw_ld/arq", EV4HWMEM(0x1B,0x7), EV4, ARG_EV4HWMEM }, - { "hw_ld/av", EV5HWMEM(0x1B,0x12), EV5, ARG_EV5HWMEM }, - { "hw_ld/avl", EV5HWMEM(0x1B,0x13), EV5, ARG_EV5HWMEM }, - { "hw_ld/aw", EV5HWMEM(0x1B,0x18), EV5, ARG_EV5HWMEM }, - { "hw_ld/awl", EV5HWMEM(0x1B,0x19), EV5, ARG_EV5HWMEM }, - { "hw_ld/awq", EV5HWMEM(0x1B,0x1c), EV5, ARG_EV5HWMEM }, - { "hw_ld/awql", EV5HWMEM(0x1B,0x1d), EV5, ARG_EV5HWMEM }, - { "hw_ld/awqv", EV5HWMEM(0x1B,0x1e), EV5, ARG_EV5HWMEM }, - { "hw_ld/awqvl", EV5HWMEM(0x1B,0x1f), EV5, ARG_EV5HWMEM }, - { "hw_ld/awv", EV5HWMEM(0x1B,0x1a), EV5, ARG_EV5HWMEM }, - { "hw_ld/awvl", EV5HWMEM(0x1B,0x1b), EV5, ARG_EV5HWMEM }, - { "hw_ld/l", EV5HWMEM(0x1B,0x01), EV5, ARG_EV5HWMEM }, - { "hw_ld/p", EV4HWMEM(0x1B,0x8), EV4, ARG_EV4HWMEM }, - { "hw_ld/p", EV5HWMEM(0x1B,0x20), EV5, ARG_EV5HWMEM }, - { "hw_ld/pa", EV4HWMEM(0x1B,0xC), EV4, ARG_EV4HWMEM }, - { "hw_ld/pa", EV5HWMEM(0x1B,0x30), EV5, ARG_EV5HWMEM }, - { "hw_ld/pal", EV5HWMEM(0x1B,0x31), EV5, ARG_EV5HWMEM }, - { "hw_ld/paq", EV4HWMEM(0x1B,0xD), EV4, ARG_EV4HWMEM }, - { "hw_ld/paq", EV5HWMEM(0x1B,0x34), EV5, ARG_EV5HWMEM }, - { "hw_ld/paql", EV5HWMEM(0x1B,0x35), EV5, ARG_EV5HWMEM }, - { "hw_ld/paqv", EV5HWMEM(0x1B,0x36), EV5, ARG_EV5HWMEM }, - { "hw_ld/paqvl", EV5HWMEM(0x1B,0x37), EV5, ARG_EV5HWMEM }, - { "hw_ld/par", EV4HWMEM(0x1B,0xE), EV4, ARG_EV4HWMEM }, - { "hw_ld/parq", EV4HWMEM(0x1B,0xF), EV4, ARG_EV4HWMEM }, - { "hw_ld/pav", EV5HWMEM(0x1B,0x32), EV5, ARG_EV5HWMEM }, - { "hw_ld/pavl", EV5HWMEM(0x1B,0x33), EV5, ARG_EV5HWMEM }, - { "hw_ld/paw", EV5HWMEM(0x1B,0x38), EV5, ARG_EV5HWMEM }, - { "hw_ld/pawl", EV5HWMEM(0x1B,0x39), EV5, ARG_EV5HWMEM }, - { "hw_ld/pawq", EV5HWMEM(0x1B,0x3c), EV5, ARG_EV5HWMEM }, - { "hw_ld/pawql", EV5HWMEM(0x1B,0x3d), EV5, ARG_EV5HWMEM }, - { "hw_ld/pawqv", EV5HWMEM(0x1B,0x3e), EV5, ARG_EV5HWMEM }, - { "hw_ld/pawqvl", EV5HWMEM(0x1B,0x3f), EV5, ARG_EV5HWMEM }, - { "hw_ld/pawv", EV5HWMEM(0x1B,0x3a), EV5, ARG_EV5HWMEM }, - { "hw_ld/pawvl", EV5HWMEM(0x1B,0x3b), EV5, ARG_EV5HWMEM }, - { "hw_ld/pl", EV5HWMEM(0x1B,0x21), EV5, ARG_EV5HWMEM }, - { "hw_ld/pq", EV4HWMEM(0x1B,0x9), EV4, ARG_EV4HWMEM }, - { "hw_ld/pq", EV5HWMEM(0x1B,0x24), EV5, ARG_EV5HWMEM }, - { "hw_ld/pql", EV5HWMEM(0x1B,0x25), EV5, ARG_EV5HWMEM }, - { "hw_ld/pqv", EV5HWMEM(0x1B,0x26), EV5, ARG_EV5HWMEM }, - { "hw_ld/pqvl", EV5HWMEM(0x1B,0x27), EV5, ARG_EV5HWMEM }, - { "hw_ld/pr", EV4HWMEM(0x1B,0xA), EV4, ARG_EV4HWMEM }, - { "hw_ld/prq", EV4HWMEM(0x1B,0xB), EV4, ARG_EV4HWMEM }, - { "hw_ld/pv", EV5HWMEM(0x1B,0x22), EV5, ARG_EV5HWMEM }, - { "hw_ld/pvl", EV5HWMEM(0x1B,0x23), EV5, ARG_EV5HWMEM }, - { "hw_ld/pw", EV5HWMEM(0x1B,0x28), EV5, ARG_EV5HWMEM }, - { "hw_ld/pwl", EV5HWMEM(0x1B,0x29), EV5, ARG_EV5HWMEM }, - { "hw_ld/pwq", EV5HWMEM(0x1B,0x2c), EV5, ARG_EV5HWMEM }, - { "hw_ld/pwql", EV5HWMEM(0x1B,0x2d), EV5, ARG_EV5HWMEM }, - { "hw_ld/pwqv", EV5HWMEM(0x1B,0x2e), EV5, ARG_EV5HWMEM }, - { "hw_ld/pwqvl", EV5HWMEM(0x1B,0x2f), EV5, ARG_EV5HWMEM }, - { "hw_ld/pwv", EV5HWMEM(0x1B,0x2a), EV5, ARG_EV5HWMEM }, - { "hw_ld/pwvl", EV5HWMEM(0x1B,0x2b), EV5, ARG_EV5HWMEM }, - { "hw_ld/q", EV4HWMEM(0x1B,0x1), EV4, ARG_EV4HWMEM }, - { "hw_ld/q", EV5HWMEM(0x1B,0x04), EV5, ARG_EV5HWMEM }, - { "hw_ld/ql", EV5HWMEM(0x1B,0x05), EV5, ARG_EV5HWMEM }, - { "hw_ld/qv", EV5HWMEM(0x1B,0x06), EV5, ARG_EV5HWMEM }, - { "hw_ld/qvl", EV5HWMEM(0x1B,0x07), EV5, ARG_EV5HWMEM }, - { "hw_ld/r", EV4HWMEM(0x1B,0x2), EV4, ARG_EV4HWMEM }, - { "hw_ld/rq", EV4HWMEM(0x1B,0x3), EV4, ARG_EV4HWMEM }, - { "hw_ld/v", EV5HWMEM(0x1B,0x02), EV5, ARG_EV5HWMEM }, - { "hw_ld/vl", EV5HWMEM(0x1B,0x03), EV5, ARG_EV5HWMEM }, - { "hw_ld/w", EV5HWMEM(0x1B,0x08), EV5, ARG_EV5HWMEM }, - { "hw_ld/wl", EV5HWMEM(0x1B,0x09), EV5, ARG_EV5HWMEM }, - { "hw_ld/wq", EV5HWMEM(0x1B,0x0c), EV5, ARG_EV5HWMEM }, - { "hw_ld/wql", EV5HWMEM(0x1B,0x0d), EV5, ARG_EV5HWMEM }, - { "hw_ld/wqv", EV5HWMEM(0x1B,0x0e), EV5, ARG_EV5HWMEM }, - { "hw_ld/wqvl", EV5HWMEM(0x1B,0x0f), EV5, ARG_EV5HWMEM }, - { "hw_ld/wv", EV5HWMEM(0x1B,0x0a), EV5, ARG_EV5HWMEM }, - { "hw_ld/wvl", EV5HWMEM(0x1B,0x0b), EV5, ARG_EV5HWMEM }, - { "pal1b", PCD(0x1B), BASE, ARG_PCD }, - - { "sextb", OPR(0x1C, 0x00), BWX, ARG_OPRZ1 }, - { "sextw", OPR(0x1C, 0x01), BWX, ARG_OPRZ1 }, - { "ctpop", OPR(0x1C, 0x30), CIX, ARG_OPRZ1 }, - { "perr", OPR(0x1C, 0x31), MAX, ARG_OPR }, - { "ctlz", OPR(0x1C, 0x32), CIX, ARG_OPRZ1 }, - { "cttz", OPR(0x1C, 0x33), CIX, ARG_OPRZ1 }, - { "unpkbw", OPR(0x1C, 0x34), MAX, ARG_OPRZ1 }, - { "unpkbl", OPR(0x1C, 0x35), MAX, ARG_OPRZ1 }, - { "pkwb", OPR(0x1C, 0x36), MAX, ARG_OPRZ1 }, - { "pklb", OPR(0x1C, 0x37), MAX, ARG_OPRZ1 }, - { "minsb8", OPR(0x1C, 0x38), MAX, ARG_OPR }, - { "minsb8", OPRL(0x1C, 0x38), MAX, ARG_OPRL }, - { "minsw4", OPR(0x1C, 0x39), MAX, ARG_OPR }, - { "minsw4", OPRL(0x1C, 0x39), MAX, ARG_OPRL }, - { "minub8", OPR(0x1C, 0x3A), MAX, ARG_OPR }, - { "minub8", OPRL(0x1C, 0x3A), MAX, ARG_OPRL }, - { "minuw4", OPR(0x1C, 0x3B), MAX, ARG_OPR }, - { "minuw4", OPRL(0x1C, 0x3B), MAX, ARG_OPRL }, - { "maxub8", OPR(0x1C, 0x3C), MAX, ARG_OPR }, - { "maxub8", OPRL(0x1C, 0x3C), MAX, ARG_OPRL }, - { "maxuw4", OPR(0x1C, 0x3D), MAX, ARG_OPR }, - { "maxuw4", OPRL(0x1C, 0x3D), MAX, ARG_OPRL }, - { "maxsb8", OPR(0x1C, 0x3E), MAX, ARG_OPR }, - { "maxsb8", OPRL(0x1C, 0x3E), MAX, ARG_OPRL }, - { "maxsw4", OPR(0x1C, 0x3F), MAX, ARG_OPR }, - { "maxsw4", OPRL(0x1C, 0x3F), MAX, ARG_OPRL }, - { "ftoit", FP(0x1C, 0x70), CIX, { FA, ZB, RC } }, - { "ftois", FP(0x1C, 0x78), CIX, { FA, ZB, RC } }, - - { "hw_mtpr", OPR(0x1D,0x00), EV4, { RA, RBA, EV4EXTHWINDEX } }, - { "hw_mtpr", OP(0x1D), OP_MASK, EV5, { RA, RBA, EV5HWINDEX } }, - { "hw_mtpr", OP(0x1D), OP_MASK, EV6, { ZA, RB, EV6HWINDEX } }, - { "hw_mtpr/i", OPR(0x1D,0x01), EV4, ARG_EV4HWMPR }, - { "hw_mtpr/a", OPR(0x1D,0x02), EV4, ARG_EV4HWMPR }, - { "hw_mtpr/ai", OPR(0x1D,0x03), EV4, ARG_EV4HWMPR }, - { "hw_mtpr/p", OPR(0x1D,0x04), EV4, ARG_EV4HWMPR }, - { "hw_mtpr/pi", OPR(0x1D,0x05), EV4, ARG_EV4HWMPR }, - { "hw_mtpr/pa", OPR(0x1D,0x06), EV4, ARG_EV4HWMPR }, - { "hw_mtpr/pai", OPR(0x1D,0x07), EV4, ARG_EV4HWMPR }, - { "pal1d", PCD(0x1D), BASE, ARG_PCD }, - - { "hw_rei", SPCD(0x1E,0x3FF8000), EV4|EV5, ARG_NONE }, - { "hw_rei_stall", SPCD(0x1E,0x3FFC000), EV5, ARG_NONE }, - { "hw_jmp", EV6HWMBR(0x1E,0x0), EV6, { ZA, PRB, EV6HWJMPHINT } }, - { "hw_jsr", EV6HWMBR(0x1E,0x2), EV6, { ZA, PRB, EV6HWJMPHINT } }, - { "hw_ret", EV6HWMBR(0x1E,0x4), EV6, { ZA, PRB } }, - { "hw_jcr", EV6HWMBR(0x1E,0x6), EV6, { ZA, PRB } }, - { "hw_coroutine", EV6HWMBR(0x1E,0x6), EV6, { ZA, PRB } }, /* alias */ - { "hw_jmp/stall", EV6HWMBR(0x1E,0x1), EV6, { ZA, PRB, EV6HWJMPHINT } }, - { "hw_jsr/stall", EV6HWMBR(0x1E,0x3), EV6, { ZA, PRB, EV6HWJMPHINT } }, - { "hw_ret/stall", EV6HWMBR(0x1E,0x5), EV6, { ZA, PRB } }, - { "hw_jcr/stall", EV6HWMBR(0x1E,0x7), EV6, { ZA, PRB } }, - { "hw_coroutine/stall", EV6HWMBR(0x1E,0x7), EV6, { ZA, PRB } }, /* alias */ - { "pal1e", PCD(0x1E), BASE, ARG_PCD }, - - { "hw_stl", EV4HWMEM(0x1F,0x0), EV4, ARG_EV4HWMEM }, - { "hw_stl", EV5HWMEM(0x1F,0x00), EV5, ARG_EV5HWMEM }, - { "hw_stl", EV6HWMEM(0x1F,0x4), EV6, ARG_EV6HWMEM }, /* ??? 8 */ - { "hw_stl/a", EV4HWMEM(0x1F,0x4), EV4, ARG_EV4HWMEM }, - { "hw_stl/a", EV5HWMEM(0x1F,0x10), EV5, ARG_EV5HWMEM }, - { "hw_stl/a", EV6HWMEM(0x1F,0xC), EV6, ARG_EV6HWMEM }, - { "hw_stl/ac", EV5HWMEM(0x1F,0x11), EV5, ARG_EV5HWMEM }, - { "hw_stl/ar", EV4HWMEM(0x1F,0x6), EV4, ARG_EV4HWMEM }, - { "hw_stl/av", EV5HWMEM(0x1F,0x12), EV5, ARG_EV5HWMEM }, - { "hw_stl/avc", EV5HWMEM(0x1F,0x13), EV5, ARG_EV5HWMEM }, - { "hw_stl/c", EV5HWMEM(0x1F,0x01), EV5, ARG_EV5HWMEM }, - { "hw_stl/p", EV4HWMEM(0x1F,0x8), EV4, ARG_EV4HWMEM }, - { "hw_stl/p", EV5HWMEM(0x1F,0x20), EV5, ARG_EV5HWMEM }, - { "hw_stl/p", EV6HWMEM(0x1F,0x0), EV6, ARG_EV6HWMEM }, - { "hw_stl/pa", EV4HWMEM(0x1F,0xC), EV4, ARG_EV4HWMEM }, - { "hw_stl/pa", EV5HWMEM(0x1F,0x30), EV5, ARG_EV5HWMEM }, - { "hw_stl/pac", EV5HWMEM(0x1F,0x31), EV5, ARG_EV5HWMEM }, - { "hw_stl/pav", EV5HWMEM(0x1F,0x32), EV5, ARG_EV5HWMEM }, - { "hw_stl/pavc", EV5HWMEM(0x1F,0x33), EV5, ARG_EV5HWMEM }, - { "hw_stl/pc", EV5HWMEM(0x1F,0x21), EV5, ARG_EV5HWMEM }, - { "hw_stl/pr", EV4HWMEM(0x1F,0xA), EV4, ARG_EV4HWMEM }, - { "hw_stl/pv", EV5HWMEM(0x1F,0x22), EV5, ARG_EV5HWMEM }, - { "hw_stl/pvc", EV5HWMEM(0x1F,0x23), EV5, ARG_EV5HWMEM }, - { "hw_stl/r", EV4HWMEM(0x1F,0x2), EV4, ARG_EV4HWMEM }, - { "hw_stl/v", EV5HWMEM(0x1F,0x02), EV5, ARG_EV5HWMEM }, - { "hw_stl/vc", EV5HWMEM(0x1F,0x03), EV5, ARG_EV5HWMEM }, - { "hw_stl_c", EV5HWMEM(0x1F,0x01), EV5, ARG_EV5HWMEM }, - { "hw_stl_c/a", EV5HWMEM(0x1F,0x11), EV5, ARG_EV5HWMEM }, - { "hw_stl_c/av", EV5HWMEM(0x1F,0x13), EV5, ARG_EV5HWMEM }, - { "hw_stl_c/p", EV5HWMEM(0x1F,0x21), EV5, ARG_EV5HWMEM }, - { "hw_stl_c/p", EV6HWMEM(0x1F,0x2), EV6, ARG_EV6HWMEM }, - { "hw_stl_c/pa", EV5HWMEM(0x1F,0x31), EV5, ARG_EV5HWMEM }, - { "hw_stl_c/pav", EV5HWMEM(0x1F,0x33), EV5, ARG_EV5HWMEM }, - { "hw_stl_c/pv", EV5HWMEM(0x1F,0x23), EV5, ARG_EV5HWMEM }, - { "hw_stl_c/v", EV5HWMEM(0x1F,0x03), EV5, ARG_EV5HWMEM }, - { "hw_stq", EV4HWMEM(0x1F,0x1), EV4, ARG_EV4HWMEM }, - { "hw_stq", EV5HWMEM(0x1F,0x04), EV5, ARG_EV5HWMEM }, - { "hw_stq", EV6HWMEM(0x1F,0x5), EV6, ARG_EV6HWMEM }, /* ??? 9 */ - { "hw_stq/a", EV4HWMEM(0x1F,0x5), EV4, ARG_EV4HWMEM }, - { "hw_stq/a", EV5HWMEM(0x1F,0x14), EV5, ARG_EV5HWMEM }, - { "hw_stq/a", EV6HWMEM(0x1F,0xD), EV6, ARG_EV6HWMEM }, - { "hw_stq/ac", EV5HWMEM(0x1F,0x15), EV5, ARG_EV5HWMEM }, - { "hw_stq/ar", EV4HWMEM(0x1F,0x7), EV4, ARG_EV4HWMEM }, - { "hw_stq/av", EV5HWMEM(0x1F,0x16), EV5, ARG_EV5HWMEM }, - { "hw_stq/avc", EV5HWMEM(0x1F,0x17), EV5, ARG_EV5HWMEM }, - { "hw_stq/c", EV5HWMEM(0x1F,0x05), EV5, ARG_EV5HWMEM }, - { "hw_stq/p", EV4HWMEM(0x1F,0x9), EV4, ARG_EV4HWMEM }, - { "hw_stq/p", EV5HWMEM(0x1F,0x24), EV5, ARG_EV5HWMEM }, - { "hw_stq/p", EV6HWMEM(0x1F,0x1), EV6, ARG_EV6HWMEM }, - { "hw_stq/pa", EV4HWMEM(0x1F,0xD), EV4, ARG_EV4HWMEM }, - { "hw_stq/pa", EV5HWMEM(0x1F,0x34), EV5, ARG_EV5HWMEM }, - { "hw_stq/pac", EV5HWMEM(0x1F,0x35), EV5, ARG_EV5HWMEM }, - { "hw_stq/par", EV4HWMEM(0x1F,0xE), EV4, ARG_EV4HWMEM }, - { "hw_stq/par", EV4HWMEM(0x1F,0xF), EV4, ARG_EV4HWMEM }, - { "hw_stq/pav", EV5HWMEM(0x1F,0x36), EV5, ARG_EV5HWMEM }, - { "hw_stq/pavc", EV5HWMEM(0x1F,0x37), EV5, ARG_EV5HWMEM }, - { "hw_stq/pc", EV5HWMEM(0x1F,0x25), EV5, ARG_EV5HWMEM }, - { "hw_stq/pr", EV4HWMEM(0x1F,0xB), EV4, ARG_EV4HWMEM }, - { "hw_stq/pv", EV5HWMEM(0x1F,0x26), EV5, ARG_EV5HWMEM }, - { "hw_stq/pvc", EV5HWMEM(0x1F,0x27), EV5, ARG_EV5HWMEM }, - { "hw_stq/r", EV4HWMEM(0x1F,0x3), EV4, ARG_EV4HWMEM }, - { "hw_stq/v", EV5HWMEM(0x1F,0x06), EV5, ARG_EV5HWMEM }, - { "hw_stq/vc", EV5HWMEM(0x1F,0x07), EV5, ARG_EV5HWMEM }, - { "hw_stq_c", EV5HWMEM(0x1F,0x05), EV5, ARG_EV5HWMEM }, - { "hw_stq_c/a", EV5HWMEM(0x1F,0x15), EV5, ARG_EV5HWMEM }, - { "hw_stq_c/av", EV5HWMEM(0x1F,0x17), EV5, ARG_EV5HWMEM }, - { "hw_stq_c/p", EV5HWMEM(0x1F,0x25), EV5, ARG_EV5HWMEM }, - { "hw_stq_c/p", EV6HWMEM(0x1F,0x3), EV6, ARG_EV6HWMEM }, - { "hw_stq_c/pa", EV5HWMEM(0x1F,0x35), EV5, ARG_EV5HWMEM }, - { "hw_stq_c/pav", EV5HWMEM(0x1F,0x37), EV5, ARG_EV5HWMEM }, - { "hw_stq_c/pv", EV5HWMEM(0x1F,0x27), EV5, ARG_EV5HWMEM }, - { "hw_stq_c/v", EV5HWMEM(0x1F,0x07), EV5, ARG_EV5HWMEM }, - { "hw_st", EV4HWMEM(0x1F,0x0), EV4, ARG_EV4HWMEM }, - { "hw_st", EV5HWMEM(0x1F,0x00), EV5, ARG_EV5HWMEM }, - { "hw_st/a", EV4HWMEM(0x1F,0x4), EV4, ARG_EV4HWMEM }, - { "hw_st/a", EV5HWMEM(0x1F,0x10), EV5, ARG_EV5HWMEM }, - { "hw_st/ac", EV5HWMEM(0x1F,0x11), EV5, ARG_EV5HWMEM }, - { "hw_st/aq", EV4HWMEM(0x1F,0x5), EV4, ARG_EV4HWMEM }, - { "hw_st/aq", EV5HWMEM(0x1F,0x14), EV5, ARG_EV5HWMEM }, - { "hw_st/aqc", EV5HWMEM(0x1F,0x15), EV5, ARG_EV5HWMEM }, - { "hw_st/aqv", EV5HWMEM(0x1F,0x16), EV5, ARG_EV5HWMEM }, - { "hw_st/aqvc", EV5HWMEM(0x1F,0x17), EV5, ARG_EV5HWMEM }, - { "hw_st/ar", EV4HWMEM(0x1F,0x6), EV4, ARG_EV4HWMEM }, - { "hw_st/arq", EV4HWMEM(0x1F,0x7), EV4, ARG_EV4HWMEM }, - { "hw_st/av", EV5HWMEM(0x1F,0x12), EV5, ARG_EV5HWMEM }, - { "hw_st/avc", EV5HWMEM(0x1F,0x13), EV5, ARG_EV5HWMEM }, - { "hw_st/c", EV5HWMEM(0x1F,0x01), EV5, ARG_EV5HWMEM }, - { "hw_st/p", EV4HWMEM(0x1F,0x8), EV4, ARG_EV4HWMEM }, - { "hw_st/p", EV5HWMEM(0x1F,0x20), EV5, ARG_EV5HWMEM }, - { "hw_st/pa", EV4HWMEM(0x1F,0xC), EV4, ARG_EV4HWMEM }, - { "hw_st/pa", EV5HWMEM(0x1F,0x30), EV5, ARG_EV5HWMEM }, - { "hw_st/pac", EV5HWMEM(0x1F,0x31), EV5, ARG_EV5HWMEM }, - { "hw_st/paq", EV4HWMEM(0x1F,0xD), EV4, ARG_EV4HWMEM }, - { "hw_st/paq", EV5HWMEM(0x1F,0x34), EV5, ARG_EV5HWMEM }, - { "hw_st/paqc", EV5HWMEM(0x1F,0x35), EV5, ARG_EV5HWMEM }, - { "hw_st/paqv", EV5HWMEM(0x1F,0x36), EV5, ARG_EV5HWMEM }, - { "hw_st/paqvc", EV5HWMEM(0x1F,0x37), EV5, ARG_EV5HWMEM }, - { "hw_st/par", EV4HWMEM(0x1F,0xE), EV4, ARG_EV4HWMEM }, - { "hw_st/parq", EV4HWMEM(0x1F,0xF), EV4, ARG_EV4HWMEM }, - { "hw_st/pav", EV5HWMEM(0x1F,0x32), EV5, ARG_EV5HWMEM }, - { "hw_st/pavc", EV5HWMEM(0x1F,0x33), EV5, ARG_EV5HWMEM }, - { "hw_st/pc", EV5HWMEM(0x1F,0x21), EV5, ARG_EV5HWMEM }, - { "hw_st/pq", EV4HWMEM(0x1F,0x9), EV4, ARG_EV4HWMEM }, - { "hw_st/pq", EV5HWMEM(0x1F,0x24), EV5, ARG_EV5HWMEM }, - { "hw_st/pqc", EV5HWMEM(0x1F,0x25), EV5, ARG_EV5HWMEM }, - { "hw_st/pqv", EV5HWMEM(0x1F,0x26), EV5, ARG_EV5HWMEM }, - { "hw_st/pqvc", EV5HWMEM(0x1F,0x27), EV5, ARG_EV5HWMEM }, - { "hw_st/pr", EV4HWMEM(0x1F,0xA), EV4, ARG_EV4HWMEM }, - { "hw_st/prq", EV4HWMEM(0x1F,0xB), EV4, ARG_EV4HWMEM }, - { "hw_st/pv", EV5HWMEM(0x1F,0x22), EV5, ARG_EV5HWMEM }, - { "hw_st/pvc", EV5HWMEM(0x1F,0x23), EV5, ARG_EV5HWMEM }, - { "hw_st/q", EV4HWMEM(0x1F,0x1), EV4, ARG_EV4HWMEM }, - { "hw_st/q", EV5HWMEM(0x1F,0x04), EV5, ARG_EV5HWMEM }, - { "hw_st/qc", EV5HWMEM(0x1F,0x05), EV5, ARG_EV5HWMEM }, - { "hw_st/qv", EV5HWMEM(0x1F,0x06), EV5, ARG_EV5HWMEM }, - { "hw_st/qvc", EV5HWMEM(0x1F,0x07), EV5, ARG_EV5HWMEM }, - { "hw_st/r", EV4HWMEM(0x1F,0x2), EV4, ARG_EV4HWMEM }, - { "hw_st/v", EV5HWMEM(0x1F,0x02), EV5, ARG_EV5HWMEM }, - { "hw_st/vc", EV5HWMEM(0x1F,0x03), EV5, ARG_EV5HWMEM }, - { "pal1f", PCD(0x1F), BASE, ARG_PCD }, - - { "ldf", MEM(0x20), BASE, ARG_FMEM }, - { "ldg", MEM(0x21), BASE, ARG_FMEM }, - { "lds", MEM(0x22), BASE, ARG_FMEM }, - { "ldt", MEM(0x23), BASE, ARG_FMEM }, - { "stf", MEM(0x24), BASE, ARG_FMEM }, - { "stg", MEM(0x25), BASE, ARG_FMEM }, - { "sts", MEM(0x26), BASE, ARG_FMEM }, - { "stt", MEM(0x27), BASE, ARG_FMEM }, - - { "ldl", MEM(0x28), BASE, ARG_MEM }, - { "ldq", MEM(0x29), BASE, ARG_MEM }, - { "ldl_l", MEM(0x2A), BASE, ARG_MEM }, - { "ldq_l", MEM(0x2B), BASE, ARG_MEM }, - { "stl", MEM(0x2C), BASE, ARG_MEM }, - { "stq", MEM(0x2D), BASE, ARG_MEM }, - { "stl_c", MEM(0x2E), BASE, ARG_MEM }, - { "stq_c", MEM(0x2F), BASE, ARG_MEM }, - - { "br", BRA(0x30), BASE, { ZA, BDISP } }, /* pseudo */ - { "br", BRA(0x30), BASE, ARG_BRA }, - { "fbeq", BRA(0x31), BASE, ARG_FBRA }, - { "fblt", BRA(0x32), BASE, ARG_FBRA }, - { "fble", BRA(0x33), BASE, ARG_FBRA }, - { "bsr", BRA(0x34), BASE, ARG_BRA }, - { "fbne", BRA(0x35), BASE, ARG_FBRA }, - { "fbge", BRA(0x36), BASE, ARG_FBRA }, - { "fbgt", BRA(0x37), BASE, ARG_FBRA }, - { "blbc", BRA(0x38), BASE, ARG_BRA }, - { "beq", BRA(0x39), BASE, ARG_BRA }, - { "blt", BRA(0x3A), BASE, ARG_BRA }, - { "ble", BRA(0x3B), BASE, ARG_BRA }, - { "blbs", BRA(0x3C), BASE, ARG_BRA }, - { "bne", BRA(0x3D), BASE, ARG_BRA }, - { "bge", BRA(0x3E), BASE, ARG_BRA }, - { "bgt", BRA(0x3F), BASE, ARG_BRA }, -}; - -const unsigned alpha_num_opcodes = sizeof(alpha_opcodes)/sizeof(*alpha_opcodes); - -/* OSF register names. */ - -static const char * const osf_regnames[64] = { - "v0", "t0", "t1", "t2", "t3", "t4", "t5", "t6", - "t7", "s0", "s1", "s2", "s3", "s4", "s5", "fp", - "a0", "a1", "a2", "a3", "a4", "a5", "t8", "t9", - "t10", "t11", "ra", "t12", "at", "gp", "sp", "zero", - "$f0", "$f1", "$f2", "$f3", "$f4", "$f5", "$f6", "$f7", - "$f8", "$f9", "$f10", "$f11", "$f12", "$f13", "$f14", "$f15", - "$f16", "$f17", "$f18", "$f19", "$f20", "$f21", "$f22", "$f23", - "$f24", "$f25", "$f26", "$f27", "$f28", "$f29", "$f30", "$f31" -}; - -/* VMS register names. */ - -static const char * const vms_regnames[64] = { - "R0", "R1", "R2", "R3", "R4", "R5", "R6", "R7", - "R8", "R9", "R10", "R11", "R12", "R13", "R14", "R15", - "R16", "R17", "R18", "R19", "R20", "R21", "R22", "R23", - "R24", "AI", "RA", "PV", "AT", "FP", "SP", "RZ", - "F0", "F1", "F2", "F3", "F4", "F5", "F6", "F7", - "F8", "F9", "F10", "F11", "F12", "F13", "F14", "F15", - "F16", "F17", "F18", "F19", "F20", "F21", "F22", "F23", - "F24", "F25", "F26", "F27", "F28", "F29", "F30", "FZ" -}; - -/* Disassemble Alpha instructions. */ - -int -print_insn_alpha (memaddr, info) - bfd_vma memaddr; - struct disassemble_info *info; -{ - static const struct alpha_opcode *opcode_index[AXP_NOPS+1]; - const char * const * regnames; - const struct alpha_opcode *opcode, *opcode_end; - const unsigned char *opindex; - unsigned insn, op, isa_mask; - int need_comma; - - /* Initialize the majorop table the first time through */ - if (!opcode_index[0]) - { - opcode = alpha_opcodes; - opcode_end = opcode + alpha_num_opcodes; - - for (op = 0; op < AXP_NOPS; ++op) - { - opcode_index[op] = opcode; - while (opcode < opcode_end && op == AXP_OP (opcode->opcode)) - ++opcode; - } - opcode_index[op] = opcode; - } - - if (info->flavour == bfd_target_evax_flavour) - regnames = vms_regnames; - else - regnames = osf_regnames; - - isa_mask = AXP_OPCODE_NOPAL; - switch (info->mach) - { - case bfd_mach_alpha_ev4: - isa_mask |= AXP_OPCODE_EV4; - break; - case bfd_mach_alpha_ev5: - isa_mask |= AXP_OPCODE_EV5; - break; - case bfd_mach_alpha_ev6: - isa_mask |= AXP_OPCODE_EV6; - break; - } - - /* Read the insn into a host word */ - { - bfd_byte buffer[4]; - int status = (*info->read_memory_func) (memaddr, buffer, 4, info); - if (status != 0) - { - (*info->memory_error_func) (status, memaddr, info); - return -1; - } - insn = bfd_getl32 (buffer); - } - - /* Get the major opcode of the instruction. */ - op = AXP_OP (insn); - - /* Find the first match in the opcode table. */ - opcode_end = opcode_index[op + 1]; - for (opcode = opcode_index[op]; opcode < opcode_end; ++opcode) - { - if ((insn ^ opcode->opcode) & opcode->mask) - continue; - - if (!(opcode->flags & isa_mask)) - continue; - - /* Make two passes over the operands. First see if any of them - have extraction functions, and, if they do, make sure the - instruction is valid. */ - { - int invalid = 0; - for (opindex = opcode->operands; *opindex != 0; opindex++) - { - const struct alpha_operand *operand = alpha_operands + *opindex; - if (operand->extract) - (*operand->extract) (insn, &invalid); - } - if (invalid) - continue; - } - - /* The instruction is valid. */ - goto found; - } - - /* No instruction found */ - (*info->fprintf_func) (info->stream, ".long %#08x", insn); - - return 4; - -found: - (*info->fprintf_func) (info->stream, "%s", opcode->name); - if (opcode->operands[0] != 0) - (*info->fprintf_func) (info->stream, "\t"); - - /* Now extract and print the operands. */ - need_comma = 0; - for (opindex = opcode->operands; *opindex != 0; opindex++) - { - const struct alpha_operand *operand = alpha_operands + *opindex; - int value; - - /* Operands that are marked FAKE are simply ignored. We - already made sure that the extract function considered - the instruction to be valid. */ - if ((operand->flags & AXP_OPERAND_FAKE) != 0) - continue; - - /* Extract the value from the instruction. */ - if (operand->extract) - value = (*operand->extract) (insn, (int *) NULL); - else - { - value = (insn >> operand->shift) & ((1 << operand->bits) - 1); - if (operand->flags & AXP_OPERAND_SIGNED) - { - int signbit = 1 << (operand->bits - 1); - value = (value ^ signbit) - signbit; - } - } - - if (need_comma && - ((operand->flags & (AXP_OPERAND_PARENS | AXP_OPERAND_COMMA)) - != AXP_OPERAND_PARENS)) - { - (*info->fprintf_func) (info->stream, ","); - } - if (operand->flags & AXP_OPERAND_PARENS) - (*info->fprintf_func) (info->stream, "("); - - /* Print the operand as directed by the flags. */ - if (operand->flags & AXP_OPERAND_IR) - (*info->fprintf_func) (info->stream, "%s", regnames[value]); - else if (operand->flags & AXP_OPERAND_FPR) - (*info->fprintf_func) (info->stream, "%s", regnames[value + 32]); - else if (operand->flags & AXP_OPERAND_RELATIVE) - (*info->print_address_func) (memaddr + 4 + value, info); - else if (operand->flags & AXP_OPERAND_SIGNED) - (*info->fprintf_func) (info->stream, "%d", value); - else - (*info->fprintf_func) (info->stream, "%#x", value); - - if (operand->flags & AXP_OPERAND_PARENS) - (*info->fprintf_func) (info->stream, ")"); - need_comma = 1; - } - - return 4; -} diff --git a/qemu-0.11.0/alpha.ld b/qemu-0.11.0/alpha.ld deleted file mode 100644 index 0975443..0000000 --- a/qemu-0.11.0/alpha.ld +++ /dev/null @@ -1,128 +0,0 @@ -OUTPUT_FORMAT("elf64-alpha", "elf64-alpha", - "elf64-alpha") -OUTPUT_ARCH(alpha) -ENTRY(__start) -SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/alpha-unknown-linux-gnu/lib); -SECTIONS -{ - /* Read-only sections, merged into text segment: */ - . = 0x60000000 + SIZEOF_HEADERS; - .interp : { *(.interp) } - .hash : { *(.hash) } - .dynsym : { *(.dynsym) } - .dynstr : { *(.dynstr) } - .gnu.version : { *(.gnu.version) } - .gnu.version_d : { *(.gnu.version_d) } - .gnu.version_r : { *(.gnu.version_r) } - .rel.text : - { *(.rel.text) *(.rel.gnu.linkonce.t*) } - .rela.text : - { *(.rela.text) *(.rela.gnu.linkonce.t*) } - .rel.data : - { *(.rel.data) *(.rel.gnu.linkonce.d*) } - .rela.data : - { *(.rela.data) *(.rela.gnu.linkonce.d*) } - .rel.rodata : - { *(.rel.rodata) *(.rel.gnu.linkonce.r*) } - .rela.rodata : - { *(.rela.rodata) *(.rela.gnu.linkonce.r*) } - .rel.got : { *(.rel.got) } - .rela.got : { *(.rela.got) } - .rel.ctors : { *(.rel.ctors) } - .rela.ctors : { *(.rela.ctors) } - .rel.dtors : { *(.rel.dtors) } - .rela.dtors : { *(.rela.dtors) } - .rel.init : { *(.rel.init) } - .rela.init : { *(.rela.init) } - .rel.fini : { *(.rel.fini) } - .rela.fini : { *(.rela.fini) } - .rel.bss : { *(.rel.bss) } - .rela.bss : { *(.rela.bss) } - .rel.plt : { *(.rel.plt) } - .rela.plt : { *(.rela.plt) } - .init : { *(.init) } =0x47ff041f - .text : - { - *(.text) - /* .gnu.warning sections are handled specially by elf32.em. */ - *(.gnu.warning) - *(.gnu.linkonce.t*) - } =0x47ff041f - _etext = .; - PROVIDE (etext = .); - .fini : { *(.fini) } =0x47ff041f - .rodata : { *(.rodata) *(.gnu.linkonce.r*) } - .rodata1 : { *(.rodata1) } - .reginfo : { *(.reginfo) } - /* Adjust the address for the data segment. We want to adjust up to - the same address within the page on the next page up. */ - . = ALIGN(0x100000) + (. & (0x100000 - 1)); - .data : - { - *(.data) - *(.gnu.linkonce.d*) - CONSTRUCTORS - } - .data1 : { *(.data1) } - .ctors : - { - *(.ctors) - } - .dtors : - { - *(.dtors) - } - .plt : { *(.plt) } - .got : { *(.got.plt) *(.got) } - .dynamic : { *(.dynamic) } - /* We want the small data sections together, so single-instruction offsets - can access them all, and initialized data all before uninitialized, so - we can shorten the on-disk segment size. */ - .sdata : { *(.sdata) } - _edata = .; - PROVIDE (edata = .); - __bss_start = .; - .sbss : { *(.sbss) *(.scommon) } - .bss : - { - *(.dynbss) - *(.bss) - *(COMMON) - } - _end = . ; - PROVIDE (end = .); - /* Stabs debugging sections. */ - .stab 0 : { *(.stab) } - .stabstr 0 : { *(.stabstr) } - .stab.excl 0 : { *(.stab.excl) } - .stab.exclstr 0 : { *(.stab.exclstr) } - .stab.index 0 : { *(.stab.index) } - .stab.indexstr 0 : { *(.stab.indexstr) } - .comment 0 : { *(.comment) } - /* DWARF debug sections. - Symbols in the DWARF debugging sections are relative to the beginning - of the section so we begin them at 0. */ - /* DWARF 1 */ - .debug 0 : { *(.debug) } - .line 0 : { *(.line) } - /* GNU DWARF 1 extensions */ - .debug_srcinfo 0 : { *(.debug_srcinfo) } - .debug_sfnames 0 : { *(.debug_sfnames) } - /* DWARF 1.1 and DWARF 2 */ - .debug_aranges 0 : { *(.debug_aranges) } - .debug_pubnames 0 : { *(.debug_pubnames) } - /* DWARF 2 */ - .debug_info 0 : { *(.debug_info) } - .debug_abbrev 0 : { *(.debug_abbrev) } - .debug_line 0 : { *(.debug_line) } - .debug_frame 0 : { *(.debug_frame) } - .debug_str 0 : { *(.debug_str) } - .debug_loc 0 : { *(.debug_loc) } - .debug_macinfo 0 : { *(.debug_macinfo) } - /* SGI/MIPS DWARF 2 extensions */ - .debug_weaknames 0 : { *(.debug_weaknames) } - .debug_funcnames 0 : { *(.debug_funcnames) } - .debug_typenames 0 : { *(.debug_typenames) } - .debug_varnames 0 : { *(.debug_varnames) } - /* These must appear regardless of . */ -} diff --git a/qemu-0.11.0/arm-dis.c b/qemu-0.11.0/arm-dis.c deleted file mode 100644 index 5c736c1..0000000 --- a/qemu-0.11.0/arm-dis.c +++ /dev/null @@ -1,4119 +0,0 @@ -/* Instruction printing code for the ARM - Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 - 2007, Free Software Foundation, Inc. - Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org) - Modification by James G. Smith (jsmith@cygnus.co.uk) - - This file is part of libopcodes. - - This program is free software; you can redistribute it and/or modify it under - the terms of the GNU General Public License as published by the Free - Software Foundation; either version 2 of the License, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, see http://www.gnu.org/licenses/. */ - -/* Start of qemu specific additions. Mostly this is stub definitions - for things we don't care about. */ - -#include "dis-asm.h" -#define FALSE 0 -#define TRUE (!FALSE) -#define ATTRIBUTE_UNUSED __attribute__((unused)) -#define ISSPACE(x) ((x) == ' ' || (x) == '\t' || (x) == '\n') - -#define ARM_EXT_V1 0 -#define ARM_EXT_V2 0 -#define ARM_EXT_V2S 0 -#define ARM_EXT_V3 0 -#define ARM_EXT_V3M 0 -#define ARM_EXT_V4 0 -#define ARM_EXT_V4T 0 -#define ARM_EXT_V5 0 -#define ARM_EXT_V5T 0 -#define ARM_EXT_V5ExP 0 -#define ARM_EXT_V5E 0 -#define ARM_EXT_V5J 0 -#define ARM_EXT_V6 0 -#define ARM_EXT_V6K 0 -#define ARM_EXT_V6Z 0 -#define ARM_EXT_V6T2 0 -#define ARM_EXT_V7 0 -#define ARM_EXT_DIV 0 - -/* Co-processor space extensions. */ -#define ARM_CEXT_XSCALE 0 -#define ARM_CEXT_MAVERICK 0 -#define ARM_CEXT_IWMMXT 0 - -#define FPU_FPA_EXT_V1 0 -#define FPU_FPA_EXT_V2 0 -#define FPU_VFP_EXT_NONE 0 -#define FPU_VFP_EXT_V1xD 0 -#define FPU_VFP_EXT_V1 0 -#define FPU_VFP_EXT_V2 0 -#define FPU_MAVERICK 0 -#define FPU_VFP_EXT_V3 0 -#define FPU_NEON_EXT_V1 0 - -int floatformat_ieee_single_little; -/* Assume host uses ieee float. */ -static void floatformat_to_double (int *ignored, unsigned char *data, - double *dest) -{ - union { - uint32_t i; - float f; - } u; - u.i = data[0] | (data[1] << 8) | (data[2] << 16) | (data[3] << 24); - *dest = u.f; -} - -/* End of qemu specific additions. */ - -/* FIXME: Belongs in global header. */ -#ifndef strneq -#define strneq(a,b,n) (strncmp ((a), (b), (n)) == 0) -#endif - -#ifndef NUM_ELEM -#define NUM_ELEM(a) (sizeof (a) / sizeof (a)[0]) -#endif - -struct opcode32 -{ - unsigned long arch; /* Architecture defining this insn. */ - unsigned long value, mask; /* Recognise insn if (op&mask)==value. */ - const char *assembler; /* How to disassemble this insn. */ -}; - -struct opcode16 -{ - unsigned long arch; /* Architecture defining this insn. */ - unsigned short value, mask; /* Recognise insn if (op&mask)==value. */ - const char *assembler; /* How to disassemble this insn. */ -}; - -/* print_insn_coprocessor recognizes the following format control codes: - - %% % - - %c print condition code (always bits 28-31 in ARM mode) - %q print shifter argument - %u print condition code (unconditional in ARM mode) - %A print address for ldc/stc/ldf/stf instruction - %B print vstm/vldm register list - %C print vstr/vldr address operand - %I print cirrus signed shift immediate: bits 0..3|4..6 - %F print the COUNT field of a LFM/SFM instruction. - %P print floating point precision in arithmetic insn - %Q print floating point precision in ldf/stf insn - %R print floating point rounding mode - - %<bitfield>r print as an ARM register - %<bitfield>d print the bitfield in decimal - %<bitfield>k print immediate for VFPv3 conversion instruction - %<bitfield>x print the bitfield in hex - %<bitfield>X print the bitfield as 1 hex digit without leading "0x" - %<bitfield>f print a floating point constant if >7 else a - floating point register - %<bitfield>w print as an iWMMXt width field - [bhwd]ss/us - %<bitfield>g print as an iWMMXt 64-bit register - %<bitfield>G print as an iWMMXt general purpose or control register - %<bitfield>D print as a NEON D register - %<bitfield>Q print as a NEON Q register - - %y<code> print a single precision VFP reg. - Codes: 0=>Sm, 1=>Sd, 2=>Sn, 3=>multi-list, 4=>Sm pair - %z<code> print a double precision VFP reg - Codes: 0=>Dm, 1=>Dd, 2=>Dn, 3=>multi-list - - %<bitfield>'c print specified char iff bitfield is all ones - %<bitfield>`c print specified char iff bitfield is all zeroes - %<bitfield>?ab... select from array of values in big endian order - - %L print as an iWMMXt N/M width field. - %Z print the Immediate of a WSHUFH instruction. - %l like 'A' except use byte offsets for 'B' & 'H' - versions. - %i print 5-bit immediate in bits 8,3..0 - (print "32" when 0) - %r print register offset address for wldt/wstr instruction -*/ - -/* Common coprocessor opcodes shared between Arm and Thumb-2. */ - -static const struct opcode32 coprocessor_opcodes[] = -{ - /* XScale instructions. */ - {ARM_CEXT_XSCALE, 0x0e200010, 0x0fff0ff0, "mia%c\tacc0, %0-3r, %12-15r"}, - {ARM_CEXT_XSCALE, 0x0e280010, 0x0fff0ff0, "miaph%c\tacc0, %0-3r, %12-15r"}, - {ARM_CEXT_XSCALE, 0x0e2c0010, 0x0ffc0ff0, "mia%17'T%17`B%16'T%16`B%c\tacc0, %0-3r, %12-15r"}, - {ARM_CEXT_XSCALE, 0x0c400000, 0x0ff00fff, "mar%c\tacc0, %12-15r, %16-19r"}, - {ARM_CEXT_XSCALE, 0x0c500000, 0x0ff00fff, "mra%c\t%12-15r, %16-19r, acc0"}, - - /* Intel Wireless MMX technology instructions. */ -#define FIRST_IWMMXT_INSN 0x0e130130 -#define IWMMXT_INSN_COUNT 73 - {ARM_CEXT_IWMMXT, 0x0e130130, 0x0f3f0fff, "tandc%22-23w%c\t%12-15r"}, - {ARM_CEXT_XSCALE, 0x0e400010, 0x0ff00f3f, "tbcst%6-7w%c\t%16-19g, %12-15r"}, - {ARM_CEXT_XSCALE, 0x0e130170, 0x0f3f0ff8, "textrc%22-23w%c\t%12-15r, #%0-2d"}, - {ARM_CEXT_XSCALE, 0x0e100070, 0x0f300ff0, "textrm%3?su%22-23w%c\t%12-15r, %16-19g, #%0-2d"}, - {ARM_CEXT_XSCALE, 0x0e600010, 0x0ff00f38, "tinsr%6-7w%c\t%16-19g, %12-15r, #%0-2d"}, - {ARM_CEXT_XSCALE, 0x0e000110, 0x0ff00fff, "tmcr%c\t%16-19G, %12-15r"}, - {ARM_CEXT_XSCALE, 0x0c400000, 0x0ff00ff0, "tmcrr%c\t%0-3g, %12-15r, %16-19r"}, - {ARM_CEXT_XSCALE, 0x0e2c0010, 0x0ffc0e10, "tmia%17?tb%16?tb%c\t%5-8g, %0-3r, %12-15r"}, - {ARM_CEXT_XSCALE, 0x0e200010, 0x0fff0e10, "tmia%c\t%5-8g, %0-3r, %12-15r"}, - {ARM_CEXT_XSCALE, 0x0e280010, 0x0fff0e10, "tmiaph%c\t%5-8g, %0-3r, %12-15r"}, - {ARM_CEXT_XSCALE, 0x0e100030, 0x0f300fff, "tmovmsk%22-23w%c\t%12-15r, %16-19g"}, - {ARM_CEXT_XSCALE, 0x0e100110, 0x0ff00ff0, "tmrc%c\t%12-15r, %16-19G"}, - {ARM_CEXT_XSCALE, 0x0c500000, 0x0ff00ff0, "tmrrc%c\t%12-15r, %16-19r, %0-3g"}, - {ARM_CEXT_XSCALE, 0x0e130150, 0x0f3f0fff, "torc%22-23w%c\t%12-15r"}, - {ARM_CEXT_XSCALE, 0x0e130190, 0x0f3f0fff, "torvsc%22-23w%c\t%12-15r"}, - {ARM_CEXT_XSCALE, 0x0e2001c0, 0x0f300fff, "wabs%22-23w%c\t%12-15g, %16-19g"}, - {ARM_CEXT_XSCALE, 0x0e0001c0, 0x0f300fff, "wacc%22-23w%c\t%12-15g, %16-19g"}, - {ARM_CEXT_XSCALE, 0x0e000180, 0x0f000ff0, "wadd%20-23w%c\t%12-15g, %16-19g, %0-3g"}, - {ARM_CEXT_XSCALE, 0x0e2001a0, 0x0f300ff0, "waddbhus%22?ml%c\t%12-15g, %16-19g, %0-3g"}, - {ARM_CEXT_XSCALE, 0x0ea001a0, 0x0ff00ff0, "waddsubhx%c\t%12-15g, %16-19g, %0-3g"}, - {ARM_CEXT_XSCALE, 0x0e000020, 0x0f800ff0, "waligni%c\t%12-15g, %16-19g, %0-3g, #%20-22d"}, - {ARM_CEXT_XSCALE, 0x0e800020, 0x0fc00ff0, "walignr%20-21d%c\t%12-15g, %16-19g, %0-3g"}, - {ARM_CEXT_XSCALE, 0x0e200000, 0x0fe00ff0, "wand%20'n%c\t%12-15g, %16-19g, %0-3g"}, - {ARM_CEXT_XSCALE, 0x0e800000, 0x0fa00ff0, "wavg2%22?hb%20'r%c\t%12-15g, %16-19g, %0-3g"}, - {ARM_CEXT_XSCALE, 0x0e400000, 0x0fe00ff0, "wavg4%20'r%c\t%12-15g, %16-19g, %0-3g"}, - {ARM_CEXT_XSCALE, 0x0e000060, 0x0f300ff0, "wcmpeq%22-23w%c\t%12-15g, %16-19g, %0-3g"}, - {ARM_CEXT_XSCALE, 0x0e100060, 0x0f100ff0, "wcmpgt%21?su%22-23w%c\t%12-15g, %16-19g, %0-3g"}, - {ARM_CEXT_XSCALE, 0xfc500100, 0xfe500f00, "wldrd\t%12-15g, %r"}, - {ARM_CEXT_XSCALE, 0xfc100100, 0xfe500f00, "wldrw\t%12-15G, %A"}, - {ARM_CEXT_XSCALE, 0x0c100000, 0x0e100e00, "wldr%L%c\t%12-15g, %l"}, - {ARM_CEXT_XSCALE, 0x0e400100, 0x0fc00ff0, "wmac%21?su%20'z%c\t%12-15g, %16-19g, %0-3g"}, - {ARM_CEXT_XSCALE, 0x0e800100, 0x0fc00ff0, "wmadd%21?su%20'x%c\t%12-15g, %16-19g, %0-3g"}, - {ARM_CEXT_XSCALE, 0x0ec00100, 0x0fd00ff0, "wmadd%21?sun%c\t%12-15g, %16-19g, %0-3g"}, - {ARM_CEXT_XSCALE, 0x0e000160, 0x0f100ff0, "wmax%21?su%22-23w%c\t%12-15g, %16-19g, %0-3g"}, - {ARM_CEXT_XSCALE, 0x0e000080, 0x0f100fe0, "wmerge%c\t%12-15g, %16-19g, %0-3g, #%21-23d"}, - {ARM_CEXT_XSCALE, 0x0e0000a0, 0x0f800ff0, "wmia%21?tb%20?tb%22'n%c\t%12-15g, %16-19g, %0-3g"}, - {ARM_CEXT_XSCALE, 0x0e800120, 0x0f800ff0, "wmiaw%21?tb%20?tb%22'n%c\t%12-15g, %16-19g, %0-3g"}, - {ARM_CEXT_XSCALE, 0x0e100160, 0x0f100ff0, "wmin%21?su%22-23w%c\t%12-15g, %16-19g, %0-3g"}, - {ARM_CEXT_XSCALE, 0x0e000100, 0x0fc00ff0, "wmul%21?su%20?ml%23'r%c\t%12-15g, %16-19g, %0-3g"}, - {ARM_CEXT_XSCALE, 0x0ed00100, 0x0fd00ff0, "wmul%21?sumr%c\t%12-15g, %16-19g, %0-3g"}, - {ARM_CEXT_XSCALE, 0x0ee000c0, 0x0fe00ff0, "wmulwsm%20`r%c\t%12-15g, %16-19g, %0-3g"}, - {ARM_CEXT_XSCALE, 0x0ec000c0, 0x0fe00ff0, "wmulwum%20`r%c\t%12-15g, %16-19g, %0-3g"}, - {ARM_CEXT_XSCALE, 0x0eb000c0, 0x0ff00ff0, "wmulwl%c\t%12-15g, %16-19g, %0-3g"}, - {ARM_CEXT_XSCALE, 0x0e8000a0, 0x0f800ff0, "wqmia%21?tb%20?tb%22'n%c\t%12-15g, %16-19g, %0-3g"}, - {ARM_CEXT_XSCALE, 0x0e100080, 0x0fd00ff0, "wqmulm%21'r%c\t%12-15g, %16-19g, %0-3g"}, - {ARM_CEXT_XSCALE, 0x0ec000e0, 0x0fd00ff0, "wqmulwm%21'r%c\t%12-15g, %16-19g, %0-3g"}, - {ARM_CEXT_XSCALE, 0x0e000000, 0x0ff00ff0, "wor%c\t%12-15g, %16-19g, %0-3g"}, - {ARM_CEXT_XSCALE, 0x0e000080, 0x0f000ff0, "wpack%20-23w%c\t%12-15g, %16-19g, %0-3g"}, - {ARM_CEXT_XSCALE, 0xfe300040, 0xff300ef0, "wror%22-23w\t%12-15g, %16-19g, #%i"}, - {ARM_CEXT_XSCALE, 0x0e300040, 0x0f300ff0, "wror%22-23w%c\t%12-15g, %16-19g, %0-3g"}, - {ARM_CEXT_XSCALE, 0x0e300140, 0x0f300ff0, "wror%22-23wg%c\t%12-15g, %16-19g, %0-3G"}, - {ARM_CEXT_XSCALE, 0x0e000120, 0x0fa00ff0, "wsad%22?hb%20'z%c\t%12-15g, %16-19g, %0-3g"}, - {ARM_CEXT_XSCALE, 0x0e0001e0, 0x0f000ff0, "wshufh%c\t%12-15g, %16-19g, #%Z"}, - {ARM_CEXT_XSCALE, 0xfe100040, 0xff300ef0, "wsll%22-23w\t%12-15g, %16-19g, #%i"}, - {ARM_CEXT_XSCALE, 0x0e100040, 0x0f300ff0, "wsll%22-23w%8'g%c\t%12-15g, %16-19g, %0-3g"}, - {ARM_CEXT_XSCALE, 0x0e100148, 0x0f300ffc, "wsll%22-23w%8'g%c\t%12-15g, %16-19g, %0-3G"}, - {ARM_CEXT_XSCALE, 0xfe000040, 0xff300ef0, "wsra%22-23w\t%12-15g, %16-19g, #%i"}, - {ARM_CEXT_XSCALE, 0x0e000040, 0x0f300ff0, "wsra%22-23w%8'g%c\t%12-15g, %16-19g, %0-3g"}, - {ARM_CEXT_XSCALE, 0x0e000148, 0x0f300ffc, "wsra%22-23w%8'g%c\t%12-15g, %16-19g, %0-3G"}, - {ARM_CEXT_XSCALE, 0xfe200040, 0xff300ef0, "wsrl%22-23w\t%12-15g, %16-19g, #%i"}, - {ARM_CEXT_XSCALE, 0x0e200040, 0x0f300ff0, "wsrl%22-23w%8'g%c\t%12-15g, %16-19g, %0-3g"}, - {ARM_CEXT_XSCALE, 0x0e200148, 0x0f300ffc, "wsrl%22-23w%8'g%c\t%12-15g, %16-19g, %0-3G"}, - {ARM_CEXT_XSCALE, 0xfc400100, 0xfe500f00, "wstrd\t%12-15g, %r"}, - {ARM_CEXT_XSCALE, 0xfc000100, 0xfe500f00, "wstrw\t%12-15G, %A"}, - {ARM_CEXT_XSCALE, 0x0c000000, 0x0e100e00, "wstr%L%c\t%12-15g, %l"}, - {ARM_CEXT_XSCALE, 0x0e0001a0, 0x0f000ff0, "wsub%20-23w%c\t%12-15g, %16-19g, %0-3g"}, - {ARM_CEXT_XSCALE, 0x0ed001c0, 0x0ff00ff0, "wsubaddhx%c\t%12-15g, %16-19g, %0-3g"}, - {ARM_CEXT_XSCALE, 0x0e1001c0, 0x0f300ff0, "wabsdiff%22-23w%c\t%12-15g, %16-19g, %0-3g"}, - {ARM_CEXT_XSCALE, 0x0e0000c0, 0x0fd00fff, "wunpckeh%21?sub%c\t%12-15g, %16-19g"}, - {ARM_CEXT_XSCALE, 0x0e4000c0, 0x0fd00fff, "wunpckeh%21?suh%c\t%12-15g, %16-19g"}, - {ARM_CEXT_XSCALE, 0x0e8000c0, 0x0fd00fff, "wunpckeh%21?suw%c\t%12-15g, %16-19g"}, - {ARM_CEXT_XSCALE, 0x0e0000e0, 0x0f100fff, "wunpckel%21?su%22-23w%c\t%12-15g, %16-19g"}, - {ARM_CEXT_XSCALE, 0x0e1000c0, 0x0f300ff0, "wunpckih%22-23w%c\t%12-15g, %16-19g, %0-3g"}, - {ARM_CEXT_XSCALE, 0x0e1000e0, 0x0f300ff0, "wunpckil%22-23w%c\t%12-15g, %16-19g, %0-3g"}, - {ARM_CEXT_XSCALE, 0x0e100000, 0x0ff00ff0, "wxor%c\t%12-15g, %16-19g, %0-3g"}, - - /* Floating point coprocessor (FPA) instructions */ - {FPU_FPA_EXT_V1, 0x0e000100, 0x0ff08f10, "adf%c%P%R\t%12-14f, %16-18f, %0-3f"}, - {FPU_FPA_EXT_V1, 0x0e100100, 0x0ff08f10, "muf%c%P%R\t%12-14f, %16-18f, %0-3f"}, - {FPU_FPA_EXT_V1, 0x0e200100, 0x0ff08f10, "suf%c%P%R\t%12-14f, %16-18f, %0-3f"}, - {FPU_FPA_EXT_V1, 0x0e300100, 0x0ff08f10, "rsf%c%P%R\t%12-14f, %16-18f, %0-3f"}, - {FPU_FPA_EXT_V1, 0x0e400100, 0x0ff08f10, "dvf%c%P%R\t%12-14f, %16-18f, %0-3f"}, - {FPU_FPA_EXT_V1, 0x0e500100, 0x0ff08f10, "rdf%c%P%R\t%12-14f, %16-18f, %0-3f"}, - {FPU_FPA_EXT_V1, 0x0e600100, 0x0ff08f10, "pow%c%P%R\t%12-14f, %16-18f, %0-3f"}, - {FPU_FPA_EXT_V1, 0x0e700100, 0x0ff08f10, "rpw%c%P%R\t%12-14f, %16-18f, %0-3f"}, - {FPU_FPA_EXT_V1, 0x0e800100, 0x0ff08f10, "rmf%c%P%R\t%12-14f, %16-18f, %0-3f"}, - {FPU_FPA_EXT_V1, 0x0e900100, 0x0ff08f10, "fml%c%P%R\t%12-14f, %16-18f, %0-3f"}, - {FPU_FPA_EXT_V1, 0x0ea00100, 0x0ff08f10, "fdv%c%P%R\t%12-14f, %16-18f, %0-3f"}, - {FPU_FPA_EXT_V1, 0x0eb00100, 0x0ff08f10, "frd%c%P%R\t%12-14f, %16-18f, %0-3f"}, - {FPU_FPA_EXT_V1, 0x0ec00100, 0x0ff08f10, "pol%c%P%R\t%12-14f, %16-18f, %0-3f"}, - {FPU_FPA_EXT_V1, 0x0e008100, 0x0ff08f10, "mvf%c%P%R\t%12-14f, %0-3f"}, - {FPU_FPA_EXT_V1, 0x0e108100, 0x0ff08f10, "mnf%c%P%R\t%12-14f, %0-3f"}, - {FPU_FPA_EXT_V1, 0x0e208100, 0x0ff08f10, "abs%c%P%R\t%12-14f, %0-3f"}, - {FPU_FPA_EXT_V1, 0x0e308100, 0x0ff08f10, "rnd%c%P%R\t%12-14f, %0-3f"}, - {FPU_FPA_EXT_V1, 0x0e408100, 0x0ff08f10, "sqt%c%P%R\t%12-14f, %0-3f"}, - {FPU_FPA_EXT_V1, 0x0e508100, 0x0ff08f10, "log%c%P%R\t%12-14f, %0-3f"}, - {FPU_FPA_EXT_V1, 0x0e608100, 0x0ff08f10, "lgn%c%P%R\t%12-14f, %0-3f"}, - {FPU_FPA_EXT_V1, 0x0e708100, 0x0ff08f10, "exp%c%P%R\t%12-14f, %0-3f"}, - {FPU_FPA_EXT_V1, 0x0e808100, 0x0ff08f10, "sin%c%P%R\t%12-14f, %0-3f"}, - {FPU_FPA_EXT_V1, 0x0e908100, 0x0ff08f10, "cos%c%P%R\t%12-14f, %0-3f"}, - {FPU_FPA_EXT_V1, 0x0ea08100, 0x0ff08f10, "tan%c%P%R\t%12-14f, %0-3f"}, - {FPU_FPA_EXT_V1, 0x0eb08100, 0x0ff08f10, "asn%c%P%R\t%12-14f, %0-3f"}, - {FPU_FPA_EXT_V1, 0x0ec08100, 0x0ff08f10, "acs%c%P%R\t%12-14f, %0-3f"}, - {FPU_FPA_EXT_V1, 0x0ed08100, 0x0ff08f10, "atn%c%P%R\t%12-14f, %0-3f"}, - {FPU_FPA_EXT_V1, 0x0ee08100, 0x0ff08f10, "urd%c%P%R\t%12-14f, %0-3f"}, - {FPU_FPA_EXT_V1, 0x0ef08100, 0x0ff08f10, "nrm%c%P%R\t%12-14f, %0-3f"}, - {FPU_FPA_EXT_V1, 0x0e000110, 0x0ff00f1f, "flt%c%P%R\t%16-18f, %12-15r"}, - {FPU_FPA_EXT_V1, 0x0e100110, 0x0fff0f98, "fix%c%R\t%12-15r, %0-2f"}, - {FPU_FPA_EXT_V1, 0x0e200110, 0x0fff0fff, "wfs%c\t%12-15r"}, - {FPU_FPA_EXT_V1, 0x0e300110, 0x0fff0fff, "rfs%c\t%12-15r"}, - {FPU_FPA_EXT_V1, 0x0e400110, 0x0fff0fff, "wfc%c\t%12-15r"}, - {FPU_FPA_EXT_V1, 0x0e500110, 0x0fff0fff, "rfc%c\t%12-15r"}, - {FPU_FPA_EXT_V1, 0x0e90f110, 0x0ff8fff0, "cmf%c\t%16-18f, %0-3f"}, - {FPU_FPA_EXT_V1, 0x0eb0f110, 0x0ff8fff0, "cnf%c\t%16-18f, %0-3f"}, - {FPU_FPA_EXT_V1, 0x0ed0f110, 0x0ff8fff0, "cmfe%c\t%16-18f, %0-3f"}, - {FPU_FPA_EXT_V1, 0x0ef0f110, 0x0ff8fff0, "cnfe%c\t%16-18f, %0-3f"}, - {FPU_FPA_EXT_V1, 0x0c000100, 0x0e100f00, "stf%c%Q\t%12-14f, %A"}, - {FPU_FPA_EXT_V1, 0x0c100100, 0x0e100f00, "ldf%c%Q\t%12-14f, %A"}, - {FPU_FPA_EXT_V2, 0x0c000200, 0x0e100f00, "sfm%c\t%12-14f, %F, %A"}, - {FPU_FPA_EXT_V2, 0x0c100200, 0x0e100f00, "lfm%c\t%12-14f, %F, %A"}, - - /* Register load/store */ - {FPU_NEON_EXT_V1, 0x0d200b00, 0x0fb00f01, "vstmdb%c\t%16-19r%21'!, %B"}, - {FPU_NEON_EXT_V1, 0x0d300b00, 0x0fb00f01, "vldmdb%c\t%16-19r%21'!, %B"}, - {FPU_NEON_EXT_V1, 0x0c800b00, 0x0f900f01, "vstmia%c\t%16-19r%21'!, %B"}, - {FPU_NEON_EXT_V1, 0x0c900b00, 0x0f900f01, "vldmia%c\t%16-19r%21'!, %B"}, - {FPU_NEON_EXT_V1, 0x0d000b00, 0x0f300f00, "vstr%c\t%12-15,22D, %C"}, - {FPU_NEON_EXT_V1, 0x0d100b00, 0x0f300f00, "vldr%c\t%12-15,22D, %C"}, - - /* Data transfer between ARM and NEON registers */ - {FPU_NEON_EXT_V1, 0x0e800b10, 0x0ff00f70, "vdup%c.32\t%16-19,7D, %12-15r"}, - {FPU_NEON_EXT_V1, 0x0e800b30, 0x0ff00f70, "vdup%c.16\t%16-19,7D, %12-15r"}, - {FPU_NEON_EXT_V1, 0x0ea00b10, 0x0ff00f70, "vdup%c.32\t%16-19,7Q, %12-15r"}, - {FPU_NEON_EXT_V1, 0x0ea00b30, 0x0ff00f70, "vdup%c.16\t%16-19,7Q, %12-15r"}, - {FPU_NEON_EXT_V1, 0x0ec00b10, 0x0ff00f70, "vdup%c.8\t%16-19,7D, %12-15r"}, - {FPU_NEON_EXT_V1, 0x0ee00b10, 0x0ff00f70, "vdup%c.8\t%16-19,7Q, %12-15r"}, - {FPU_NEON_EXT_V1, 0x0c400b10, 0x0ff00fd0, "vmov%c\t%0-3,5D, %12-15r, %16-19r"}, - {FPU_NEON_EXT_V1, 0x0c500b10, 0x0ff00fd0, "vmov%c\t%12-15r, %16-19r, %0-3,5D"}, - {FPU_NEON_EXT_V1, 0x0e000b10, 0x0fd00f70, "vmov%c.32\t%16-19,7D[%21d], %12-15r"}, - {FPU_NEON_EXT_V1, 0x0e100b10, 0x0f500f70, "vmov%c.32\t%12-15r, %16-19,7D[%21d]"}, - {FPU_NEON_EXT_V1, 0x0e000b30, 0x0fd00f30, "vmov%c.16\t%16-19,7D[%6,21d], %12-15r"}, - {FPU_NEON_EXT_V1, 0x0e100b30, 0x0f500f30, "vmov%c.%23?us16\t%12-15r, %16-19,7D[%6,21d]"}, - {FPU_NEON_EXT_V1, 0x0e400b10, 0x0fd00f10, "vmov%c.8\t%16-19,7D[%5,6,21d], %12-15r"}, - {FPU_NEON_EXT_V1, 0x0e500b10, 0x0f500f10, "vmov%c.%23?us8\t%12-15r, %16-19,7D[%5,6,21d]"}, - - /* Floating point coprocessor (VFP) instructions */ - {FPU_VFP_EXT_V1xD, 0x0ef1fa10, 0x0fffffff, "fmstat%c"}, - {FPU_VFP_EXT_V1xD, 0x0ee00a10, 0x0fff0fff, "fmxr%c\tfpsid, %12-15r"}, - {FPU_VFP_EXT_V1xD, 0x0ee10a10, 0x0fff0fff, "fmxr%c\tfpscr, %12-15r"}, - {FPU_VFP_EXT_V1xD, 0x0ee60a10, 0x0fff0fff, "fmxr%c\tmvfr1, %12-15r"}, - {FPU_VFP_EXT_V1xD, 0x0ee70a10, 0x0fff0fff, "fmxr%c\tmvfr0, %12-15r"}, - {FPU_VFP_EXT_V1xD, 0x0ee80a10, 0x0fff0fff, "fmxr%c\tfpexc, %12-15r"}, - {FPU_VFP_EXT_V1xD, 0x0ee90a10, 0x0fff0fff, "fmxr%c\tfpinst, %12-15r\t@ Impl def"}, - {FPU_VFP_EXT_V1xD, 0x0eea0a10, 0x0fff0fff, "fmxr%c\tfpinst2, %12-15r\t@ Impl def"}, - {FPU_VFP_EXT_V1xD, 0x0ef00a10, 0x0fff0fff, "fmrx%c\t%12-15r, fpsid"}, - {FPU_VFP_EXT_V1xD, 0x0ef10a10, 0x0fff0fff, "fmrx%c\t%12-15r, fpscr"}, - {FPU_VFP_EXT_V1xD, 0x0ef60a10, 0x0fff0fff, "fmrx%c\t%12-15r, mvfr1"}, - {FPU_VFP_EXT_V1xD, 0x0ef70a10, 0x0fff0fff, "fmrx%c\t%12-15r, mvfr0"}, - {FPU_VFP_EXT_V1xD, 0x0ef80a10, 0x0fff0fff, "fmrx%c\t%12-15r, fpexc"}, - {FPU_VFP_EXT_V1xD, 0x0ef90a10, 0x0fff0fff, "fmrx%c\t%12-15r, fpinst\t@ Impl def"}, - {FPU_VFP_EXT_V1xD, 0x0efa0a10, 0x0fff0fff, "fmrx%c\t%12-15r, fpinst2\t@ Impl def"}, - {FPU_VFP_EXT_V1, 0x0e000b10, 0x0ff00fff, "fmdlr%c\t%z2, %12-15r"}, - {FPU_VFP_EXT_V1, 0x0e100b10, 0x0ff00fff, "fmrdl%c\t%12-15r, %z2"}, - {FPU_VFP_EXT_V1, 0x0e200b10, 0x0ff00fff, "fmdhr%c\t%z2, %12-15r"}, - {FPU_VFP_EXT_V1, 0x0e300b10, 0x0ff00fff, "fmrdh%c\t%12-15r, %z2"}, - {FPU_VFP_EXT_V1xD, 0x0ee00a10, 0x0ff00fff, "fmxr%c\t<impl def %16-19x>, %12-15r"}, - {FPU_VFP_EXT_V1xD, 0x0ef00a10, 0x0ff00fff, "fmrx%c\t%12-15r, <impl def %16-19x>"}, - {FPU_VFP_EXT_V1xD, 0x0e000a10, 0x0ff00f7f, "fmsr%c\t%y2, %12-15r"}, - {FPU_VFP_EXT_V1xD, 0x0e100a10, 0x0ff00f7f, "fmrs%c\t%12-15r, %y2"}, - {FPU_VFP_EXT_V1xD, 0x0eb50a40, 0x0fbf0f70, "fcmp%7'ezs%c\t%y1"}, - {FPU_VFP_EXT_V1, 0x0eb50b40, 0x0fbf0f70, "fcmp%7'ezd%c\t%z1"}, - {FPU_VFP_EXT_V1xD, 0x0eb00a40, 0x0fbf0fd0, "fcpys%c\t%y1, %y0"}, - {FPU_VFP_EXT_V1xD, 0x0eb00ac0, 0x0fbf0fd0, "fabss%c\t%y1, %y0"}, - {FPU_VFP_EXT_V1, 0x0eb00b40, 0x0fbf0fd0, "fcpyd%c\t%z1, %z0"}, - {FPU_VFP_EXT_V1, 0x0eb00bc0, 0x0fbf0fd0, "fabsd%c\t%z1, %z0"}, - {FPU_VFP_EXT_V1xD, 0x0eb10a40, 0x0fbf0fd0, "fnegs%c\t%y1, %y0"}, - {FPU_VFP_EXT_V1xD, 0x0eb10ac0, 0x0fbf0fd0, "fsqrts%c\t%y1, %y0"}, - {FPU_VFP_EXT_V1, 0x0eb10b40, 0x0fbf0fd0, "fnegd%c\t%z1, %z0"}, - {FPU_VFP_EXT_V1, 0x0eb10bc0, 0x0fbf0fd0, "fsqrtd%c\t%z1, %z0"}, - {FPU_VFP_EXT_V1, 0x0eb70ac0, 0x0fbf0fd0, "fcvtds%c\t%z1, %y0"}, - {FPU_VFP_EXT_V1, 0x0eb70bc0, 0x0fbf0fd0, "fcvtsd%c\t%y1, %z0"}, - {FPU_VFP_EXT_V1xD, 0x0eb80a40, 0x0fbf0fd0, "fuitos%c\t%y1, %y0"}, - {FPU_VFP_EXT_V1xD, 0x0eb80ac0, 0x0fbf0fd0, "fsitos%c\t%y1, %y0"}, - {FPU_VFP_EXT_V1, 0x0eb80b40, 0x0fbf0fd0, "fuitod%c\t%z1, %y0"}, - {FPU_VFP_EXT_V1, 0x0eb80bc0, 0x0fbf0fd0, "fsitod%c\t%z1, %y0"}, - {FPU_VFP_EXT_V1xD, 0x0eb40a40, 0x0fbf0f50, "fcmp%7'es%c\t%y1, %y0"}, - {FPU_VFP_EXT_V1, 0x0eb40b40, 0x0fbf0f50, "fcmp%7'ed%c\t%z1, %z0"}, - {FPU_VFP_EXT_V3, 0x0eba0a40, 0x0fbe0f50, "f%16?us%7?lhtos%c\t%y1, #%5,0-3k"}, - {FPU_VFP_EXT_V3, 0x0eba0b40, 0x0fbe0f50, "f%16?us%7?lhtod%c\t%z1, #%5,0-3k"}, - {FPU_VFP_EXT_V1xD, 0x0ebc0a40, 0x0fbe0f50, "fto%16?sui%7'zs%c\t%y1, %y0"}, - {FPU_VFP_EXT_V1, 0x0ebc0b40, 0x0fbe0f50, "fto%16?sui%7'zd%c\t%y1, %z0"}, - {FPU_VFP_EXT_V3, 0x0ebe0a40, 0x0fbe0f50, "fto%16?us%7?lhs%c\t%y1, #%5,0-3k"}, - {FPU_VFP_EXT_V3, 0x0ebe0b40, 0x0fbe0f50, "fto%16?us%7?lhd%c\t%z1, #%5,0-3k"}, - {FPU_VFP_EXT_V1, 0x0c500b10, 0x0fb00ff0, "fmrrd%c\t%12-15r, %16-19r, %z0"}, - {FPU_VFP_EXT_V3, 0x0eb00a00, 0x0fb00ff0, "fconsts%c\t%y1, #%0-3,16-19d"}, - {FPU_VFP_EXT_V3, 0x0eb00b00, 0x0fb00ff0, "fconstd%c\t%z1, #%0-3,16-19d"}, - {FPU_VFP_EXT_V2, 0x0c400a10, 0x0ff00fd0, "fmsrr%c\t%y4, %12-15r, %16-19r"}, - {FPU_VFP_EXT_V2, 0x0c400b10, 0x0ff00fd0, "fmdrr%c\t%z0, %12-15r, %16-19r"}, - {FPU_VFP_EXT_V2, 0x0c500a10, 0x0ff00fd0, "fmrrs%c\t%12-15r, %16-19r, %y4"}, - {FPU_VFP_EXT_V1xD, 0x0e000a00, 0x0fb00f50, "fmacs%c\t%y1, %y2, %y0"}, - {FPU_VFP_EXT_V1xD, 0x0e000a40, 0x0fb00f50, "fnmacs%c\t%y1, %y2, %y0"}, - {FPU_VFP_EXT_V1, 0x0e000b00, 0x0fb00f50, "fmacd%c\t%z1, %z2, %z0"}, - {FPU_VFP_EXT_V1, 0x0e000b40, 0x0fb00f50, "fnmacd%c\t%z1, %z2, %z0"}, - {FPU_VFP_EXT_V1xD, 0x0e100a00, 0x0fb00f50, "fmscs%c\t%y1, %y2, %y0"}, - {FPU_VFP_EXT_V1xD, 0x0e100a40, 0x0fb00f50, "fnmscs%c\t%y1, %y2, %y0"}, - {FPU_VFP_EXT_V1, 0x0e100b00, 0x0fb00f50, "fmscd%c\t%z1, %z2, %z0"}, - {FPU_VFP_EXT_V1, 0x0e100b40, 0x0fb00f50, "fnmscd%c\t%z1, %z2, %z0"}, - {FPU_VFP_EXT_V1xD, 0x0e200a00, 0x0fb00f50, "fmuls%c\t%y1, %y2, %y0"}, - {FPU_VFP_EXT_V1xD, 0x0e200a40, 0x0fb00f50, "fnmuls%c\t%y1, %y2, %y0"}, - {FPU_VFP_EXT_V1, 0x0e200b00, 0x0fb00f50, "fmuld%c\t%z1, %z2, %z0"}, - {FPU_VFP_EXT_V1, 0x0e200b40, 0x0fb00f50, "fnmuld%c\t%z1, %z2, %z0"}, - {FPU_VFP_EXT_V1xD, 0x0e300a00, 0x0fb00f50, "fadds%c\t%y1, %y2, %y0"}, - {FPU_VFP_EXT_V1xD, 0x0e300a40, 0x0fb00f50, "fsubs%c\t%y1, %y2, %y0"}, - {FPU_VFP_EXT_V1, 0x0e300b00, 0x0fb00f50, "faddd%c\t%z1, %z2, %z0"}, - {FPU_VFP_EXT_V1, 0x0e300b40, 0x0fb00f50, "fsubd%c\t%z1, %z2, %z0"}, - {FPU_VFP_EXT_V1xD, 0x0e800a00, 0x0fb00f50, "fdivs%c\t%y1, %y2, %y0"}, - {FPU_VFP_EXT_V1, 0x0e800b00, 0x0fb00f50, "fdivd%c\t%z1, %z2, %z0"}, - {FPU_VFP_EXT_V1xD, 0x0d200a00, 0x0fb00f00, "fstmdbs%c\t%16-19r!, %y3"}, - {FPU_VFP_EXT_V1xD, 0x0d200b00, 0x0fb00f00, "fstmdb%0?xd%c\t%16-19r!, %z3"}, - {FPU_VFP_EXT_V1xD, 0x0d300a00, 0x0fb00f00, "fldmdbs%c\t%16-19r!, %y3"}, - {FPU_VFP_EXT_V1xD, 0x0d300b00, 0x0fb00f00, "fldmdb%0?xd%c\t%16-19r!, %z3"}, - {FPU_VFP_EXT_V1xD, 0x0d000a00, 0x0f300f00, "fsts%c\t%y1, %A"}, - {FPU_VFP_EXT_V1, 0x0d000b00, 0x0f300f00, "fstd%c\t%z1, %A"}, - {FPU_VFP_EXT_V1xD, 0x0d100a00, 0x0f300f00, "flds%c\t%y1, %A"}, - {FPU_VFP_EXT_V1, 0x0d100b00, 0x0f300f00, "fldd%c\t%z1, %A"}, - {FPU_VFP_EXT_V1xD, 0x0c800a00, 0x0f900f00, "fstmias%c\t%16-19r%21'!, %y3"}, - {FPU_VFP_EXT_V1xD, 0x0c800b00, 0x0f900f00, "fstmia%0?xd%c\t%16-19r%21'!, %z3"}, - {FPU_VFP_EXT_V1xD, 0x0c900a00, 0x0f900f00, "fldmias%c\t%16-19r%21'!, %y3"}, - {FPU_VFP_EXT_V1xD, 0x0c900b00, 0x0f900f00, "fldmia%0?xd%c\t%16-19r%21'!, %z3"}, - - /* Cirrus coprocessor instructions. */ - {ARM_CEXT_MAVERICK, 0x0d100400, 0x0f500f00, "cfldrs%c\tmvf%12-15d, %A"}, - {ARM_CEXT_MAVERICK, 0x0c100400, 0x0f500f00, "cfldrs%c\tmvf%12-15d, %A"}, - {ARM_CEXT_MAVERICK, 0x0d500400, 0x0f500f00, "cfldrd%c\tmvd%12-15d, %A"}, - {ARM_CEXT_MAVERICK, 0x0c500400, 0x0f500f00, "cfldrd%c\tmvd%12-15d, %A"}, - {ARM_CEXT_MAVERICK, 0x0d100500, 0x0f500f00, "cfldr32%c\tmvfx%12-15d, %A"}, - {ARM_CEXT_MAVERICK, 0x0c100500, 0x0f500f00, "cfldr32%c\tmvfx%12-15d, %A"}, - {ARM_CEXT_MAVERICK, 0x0d500500, 0x0f500f00, "cfldr64%c\tmvdx%12-15d, %A"}, - {ARM_CEXT_MAVERICK, 0x0c500500, 0x0f500f00, "cfldr64%c\tmvdx%12-15d, %A"}, - {ARM_CEXT_MAVERICK, 0x0d000400, 0x0f500f00, "cfstrs%c\tmvf%12-15d, %A"}, - {ARM_CEXT_MAVERICK, 0x0c000400, 0x0f500f00, "cfstrs%c\tmvf%12-15d, %A"}, - {ARM_CEXT_MAVERICK, 0x0d400400, 0x0f500f00, "cfstrd%c\tmvd%12-15d, %A"}, - {ARM_CEXT_MAVERICK, 0x0c400400, 0x0f500f00, "cfstrd%c\tmvd%12-15d, %A"}, - {ARM_CEXT_MAVERICK, 0x0d000500, 0x0f500f00, "cfstr32%c\tmvfx%12-15d, %A"}, - {ARM_CEXT_MAVERICK, 0x0c000500, 0x0f500f00, "cfstr32%c\tmvfx%12-15d, %A"}, - {ARM_CEXT_MAVERICK, 0x0d400500, 0x0f500f00, "cfstr64%c\tmvdx%12-15d, %A"}, - {ARM_CEXT_MAVERICK, 0x0c400500, 0x0f500f00, "cfstr64%c\tmvdx%12-15d, %A"}, - {ARM_CEXT_MAVERICK, 0x0e000450, 0x0ff00ff0, "cfmvsr%c\tmvf%16-19d, %12-15r"}, - {ARM_CEXT_MAVERICK, 0x0e100450, 0x0ff00ff0, "cfmvrs%c\t%12-15r, mvf%16-19d"}, - {ARM_CEXT_MAVERICK, 0x0e000410, 0x0ff00ff0, "cfmvdlr%c\tmvd%16-19d, %12-15r"}, - {ARM_CEXT_MAVERICK, 0x0e100410, 0x0ff00ff0, "cfmvrdl%c\t%12-15r, mvd%16-19d"}, - {ARM_CEXT_MAVERICK, 0x0e000430, 0x0ff00ff0, "cfmvdhr%c\tmvd%16-19d, %12-15r"}, - {ARM_CEXT_MAVERICK, 0x0e100430, 0x0ff00fff, "cfmvrdh%c\t%12-15r, mvd%16-19d"}, - {ARM_CEXT_MAVERICK, 0x0e000510, 0x0ff00fff, "cfmv64lr%c\tmvdx%16-19d, %12-15r"}, - {ARM_CEXT_MAVERICK, 0x0e100510, 0x0ff00fff, "cfmvr64l%c\t%12-15r, mvdx%16-19d"}, - {ARM_CEXT_MAVERICK, 0x0e000530, 0x0ff00fff, "cfmv64hr%c\tmvdx%16-19d, %12-15r"}, - {ARM_CEXT_MAVERICK, 0x0e100530, 0x0ff00fff, "cfmvr64h%c\t%12-15r, mvdx%16-19d"}, - {ARM_CEXT_MAVERICK, 0x0e200440, 0x0ff00fff, "cfmval32%c\tmvax%12-15d, mvfx%16-19d"}, - {ARM_CEXT_MAVERICK, 0x0e100440, 0x0ff00fff, "cfmv32al%c\tmvfx%12-15d, mvax%16-19d"}, - {ARM_CEXT_MAVERICK, 0x0e200460, 0x0ff00fff, "cfmvam32%c\tmvax%12-15d, mvfx%16-19d"}, - {ARM_CEXT_MAVERICK, 0x0e100460, 0x0ff00fff, "cfmv32am%c\tmvfx%12-15d, mvax%16-19d"}, - {ARM_CEXT_MAVERICK, 0x0e200480, 0x0ff00fff, "cfmvah32%c\tmvax%12-15d, mvfx%16-19d"}, - {ARM_CEXT_MAVERICK, 0x0e100480, 0x0ff00fff, "cfmv32ah%c\tmvfx%12-15d, mvax%16-19d"}, - {ARM_CEXT_MAVERICK, 0x0e2004a0, 0x0ff00fff, "cfmva32%c\tmvax%12-15d, mvfx%16-19d"}, - {ARM_CEXT_MAVERICK, 0x0e1004a0, 0x0ff00fff, "cfmv32a%c\tmvfx%12-15d, mvax%16-19d"}, - {ARM_CEXT_MAVERICK, 0x0e2004c0, 0x0ff00fff, "cfmva64%c\tmvax%12-15d, mvdx%16-19d"}, - {ARM_CEXT_MAVERICK, 0x0e1004c0, 0x0ff00fff, "cfmv64a%c\tmvdx%12-15d, mvax%16-19d"}, - {ARM_CEXT_MAVERICK, 0x0e2004e0, 0x0fff0fff, "cfmvsc32%c\tdspsc, mvdx%12-15d"}, - {ARM_CEXT_MAVERICK, 0x0e1004e0, 0x0fff0fff, "cfmv32sc%c\tmvdx%12-15d, dspsc"}, - {ARM_CEXT_MAVERICK, 0x0e000400, 0x0ff00fff, "cfcpys%c\tmvf%12-15d, mvf%16-19d"}, - {ARM_CEXT_MAVERICK, 0x0e000420, 0x0ff00fff, "cfcpyd%c\tmvd%12-15d, mvd%16-19d"}, - {ARM_CEXT_MAVERICK, 0x0e000460, 0x0ff00fff, "cfcvtsd%c\tmvd%12-15d, mvf%16-19d"}, - {ARM_CEXT_MAVERICK, 0x0e000440, 0x0ff00fff, "cfcvtds%c\tmvf%12-15d, mvd%16-19d"}, - {ARM_CEXT_MAVERICK, 0x0e000480, 0x0ff00fff, "cfcvt32s%c\tmvf%12-15d, mvfx%16-19d"}, - {ARM_CEXT_MAVERICK, 0x0e0004a0, 0x0ff00fff, "cfcvt32d%c\tmvd%12-15d, mvfx%16-19d"}, - {ARM_CEXT_MAVERICK, 0x0e0004c0, 0x0ff00fff, "cfcvt64s%c\tmvf%12-15d, mvdx%16-19d"}, - {ARM_CEXT_MAVERICK, 0x0e0004e0, 0x0ff00fff, "cfcvt64d%c\tmvd%12-15d, mvdx%16-19d"}, - {ARM_CEXT_MAVERICK, 0x0e100580, 0x0ff00fff, "cfcvts32%c\tmvfx%12-15d, mvf%16-19d"}, - {ARM_CEXT_MAVERICK, 0x0e1005a0, 0x0ff00fff, "cfcvtd32%c\tmvfx%12-15d, mvd%16-19d"}, - {ARM_CEXT_MAVERICK, 0x0e1005c0, 0x0ff00fff, "cftruncs32%c\tmvfx%12-15d, mvf%16-19d"}, - {ARM_CEXT_MAVERICK, 0x0e1005e0, 0x0ff00fff, "cftruncd32%c\tmvfx%12-15d, mvd%16-19d"}, - {ARM_CEXT_MAVERICK, 0x0e000550, 0x0ff00ff0, "cfrshl32%c\tmvfx%16-19d, mvfx%0-3d, %12-15r"}, - {ARM_CEXT_MAVERICK, 0x0e000570, 0x0ff00ff0, "cfrshl64%c\tmvdx%16-19d, mvdx%0-3d, %12-15r"}, - {ARM_CEXT_MAVERICK, 0x0e000500, 0x0ff00f10, "cfsh32%c\tmvfx%12-15d, mvfx%16-19d, #%I"}, - {ARM_CEXT_MAVERICK, 0x0e200500, 0x0ff00f10, "cfsh64%c\tmvdx%12-15d, mvdx%16-19d, #%I"}, - {ARM_CEXT_MAVERICK, 0x0e100490, 0x0ff00ff0, "cfcmps%c\t%12-15r, mvf%16-19d, mvf%0-3d"}, - {ARM_CEXT_MAVERICK, 0x0e1004b0, 0x0ff00ff0, "cfcmpd%c\t%12-15r, mvd%16-19d, mvd%0-3d"}, - {ARM_CEXT_MAVERICK, 0x0e100590, 0x0ff00ff0, "cfcmp32%c\t%12-15r, mvfx%16-19d, mvfx%0-3d"}, - {ARM_CEXT_MAVERICK, 0x0e1005b0, 0x0ff00ff0, "cfcmp64%c\t%12-15r, mvdx%16-19d, mvdx%0-3d"}, - {ARM_CEXT_MAVERICK, 0x0e300400, 0x0ff00fff, "cfabss%c\tmvf%12-15d, mvf%16-19d"}, - {ARM_CEXT_MAVERICK, 0x0e300420, 0x0ff00fff, "cfabsd%c\tmvd%12-15d, mvd%16-19d"}, - {ARM_CEXT_MAVERICK, 0x0e300440, 0x0ff00fff, "cfnegs%c\tmvf%12-15d, mvf%16-19d"}, - {ARM_CEXT_MAVERICK, 0x0e300460, 0x0ff00fff, "cfnegd%c\tmvd%12-15d, mvd%16-19d"}, - {ARM_CEXT_MAVERICK, 0x0e300480, 0x0ff00ff0, "cfadds%c\tmvf%12-15d, mvf%16-19d, mvf%0-3d"}, - {ARM_CEXT_MAVERICK, 0x0e3004a0, 0x0ff00ff0, "cfaddd%c\tmvd%12-15d, mvd%16-19d, mvd%0-3d"}, - {ARM_CEXT_MAVERICK, 0x0e3004c0, 0x0ff00ff0, "cfsubs%c\tmvf%12-15d, mvf%16-19d, mvf%0-3d"}, - {ARM_CEXT_MAVERICK, 0x0e3004e0, 0x0ff00ff0, "cfsubd%c\tmvd%12-15d, mvd%16-19d, mvd%0-3d"}, - {ARM_CEXT_MAVERICK, 0x0e100400, 0x0ff00ff0, "cfmuls%c\tmvf%12-15d, mvf%16-19d, mvf%0-3d"}, - {ARM_CEXT_MAVERICK, 0x0e100420, 0x0ff00ff0, "cfmuld%c\tmvd%12-15d, mvd%16-19d, mvd%0-3d"}, - {ARM_CEXT_MAVERICK, 0x0e300500, 0x0ff00fff, "cfabs32%c\tmvfx%12-15d, mvfx%16-19d"}, - {ARM_CEXT_MAVERICK, 0x0e300520, 0x0ff00fff, "cfabs64%c\tmvdx%12-15d, mvdx%16-19d"}, - {ARM_CEXT_MAVERICK, 0x0e300540, 0x0ff00fff, "cfneg32%c\tmvfx%12-15d, mvfx%16-19d"}, - {ARM_CEXT_MAVERICK, 0x0e300560, 0x0ff00fff, "cfneg64%c\tmvdx%12-15d, mvdx%16-19d"}, - {ARM_CEXT_MAVERICK, 0x0e300580, 0x0ff00ff0, "cfadd32%c\tmvfx%12-15d, mvfx%16-19d, mvfx%0-3d"}, - {ARM_CEXT_MAVERICK, 0x0e3005a0, 0x0ff00ff0, "cfadd64%c\tmvdx%12-15d, mvdx%16-19d, mvdx%0-3d"}, - {ARM_CEXT_MAVERICK, 0x0e3005c0, 0x0ff00ff0, "cfsub32%c\tmvfx%12-15d, mvfx%16-19d, mvfx%0-3d"}, - {ARM_CEXT_MAVERICK, 0x0e3005e0, 0x0ff00ff0, "cfsub64%c\tmvdx%12-15d, mvdx%16-19d, mvdx%0-3d"}, - {ARM_CEXT_MAVERICK, 0x0e100500, 0x0ff00ff0, "cfmul32%c\tmvfx%12-15d, mvfx%16-19d, mvfx%0-3d"}, - {ARM_CEXT_MAVERICK, 0x0e100520, 0x0ff00ff0, "cfmul64%c\tmvdx%12-15d, mvdx%16-19d, mvdx%0-3d"}, - {ARM_CEXT_MAVERICK, 0x0e100540, 0x0ff00ff0, "cfmac32%c\tmvfx%12-15d, mvfx%16-19d, mvfx%0-3d"}, - {ARM_CEXT_MAVERICK, 0x0e100560, 0x0ff00ff0, "cfmsc32%c\tmvfx%12-15d, mvfx%16-19d, mvfx%0-3d"}, - {ARM_CEXT_MAVERICK, 0x0e000600, 0x0ff00f10, "cfmadd32%c\tmvax%5-7d, mvfx%12-15d, mvfx%16-19d, mvfx%0-3d"}, - {ARM_CEXT_MAVERICK, 0x0e100600, 0x0ff00f10, "cfmsub32%c\tmvax%5-7d, mvfx%12-15d, mvfx%16-19d, mvfx%0-3d"}, - {ARM_CEXT_MAVERICK, 0x0e200600, 0x0ff00f10, "cfmadda32%c\tmvax%5-7d, mvax%12-15d, mvfx%16-19d, mvfx%0-3d"}, - {ARM_CEXT_MAVERICK, 0x0e300600, 0x0ff00f10, "cfmsuba32%c\tmvax%5-7d, mvax%12-15d, mvfx%16-19d, mvfx%0-3d"}, - - /* Generic coprocessor instructions */ - {ARM_EXT_V2, 0x0c400000, 0x0ff00000, "mcrr%c\t%8-11d, %4-7d, %12-15r, %16-19r, cr%0-3d"}, - {ARM_EXT_V2, 0x0c500000, 0x0ff00000, "mrrc%c\t%8-11d, %4-7d, %12-15r, %16-19r, cr%0-3d"}, - {ARM_EXT_V2, 0x0e000000, 0x0f000010, "cdp%c\t%8-11d, %20-23d, cr%12-15d, cr%16-19d, cr%0-3d, {%5-7d}"}, - {ARM_EXT_V2, 0x0e100010, 0x0f100010, "mrc%c\t%8-11d, %21-23d, %12-15r, cr%16-19d, cr%0-3d, {%5-7d}"}, - {ARM_EXT_V2, 0x0e000010, 0x0f100010, "mcr%c\t%8-11d, %21-23d, %12-15r, cr%16-19d, cr%0-3d, {%5-7d}"}, - {ARM_EXT_V2, 0x0c000000, 0x0e100000, "stc%22'l%c\t%8-11d, cr%12-15d, %A"}, - {ARM_EXT_V2, 0x0c100000, 0x0e100000, "ldc%22'l%c\t%8-11d, cr%12-15d, %A"}, - - /* V6 coprocessor instructions */ - {ARM_EXT_V6, 0xfc500000, 0xfff00000, "mrrc2%c\t%8-11d, %4-7d, %12-15r, %16-19r, cr%0-3d"}, - {ARM_EXT_V6, 0xfc400000, 0xfff00000, "mcrr2%c\t%8-11d, %4-7d, %12-15r, %16-19r, cr%0-3d"}, - - /* V5 coprocessor instructions */ - {ARM_EXT_V5, 0xfc100000, 0xfe100000, "ldc2%22'l%c\t%8-11d, cr%12-15d, %A"}, - {ARM_EXT_V5, 0xfc000000, 0xfe100000, "stc2%22'l%c\t%8-11d, cr%12-15d, %A"}, - {ARM_EXT_V5, 0xfe000000, 0xff000010, "cdp2%c\t%8-11d, %20-23d, cr%12-15d, cr%16-19d, cr%0-3d, {%5-7d}"}, - {ARM_EXT_V5, 0xfe000010, 0xff100010, "mcr2%c\t%8-11d, %21-23d, %12-15r, cr%16-19d, cr%0-3d, {%5-7d}"}, - {ARM_EXT_V5, 0xfe100010, 0xff100010, "mrc2%c\t%8-11d, %21-23d, %12-15r, cr%16-19d, cr%0-3d, {%5-7d}"}, - - {0, 0, 0, 0} -}; - -/* Neon opcode table: This does not encode the top byte -- that is - checked by the print_insn_neon routine, as it depends on whether we are - doing thumb32 or arm32 disassembly. */ - -/* print_insn_neon recognizes the following format control codes: - - %% % - - %c print condition code - %A print v{st,ld}[1234] operands - %B print v{st,ld}[1234] any one operands - %C print v{st,ld}[1234] single->all operands - %D print scalar - %E print vmov, vmvn, vorr, vbic encoded constant - %F print vtbl,vtbx register list - - %<bitfield>r print as an ARM register - %<bitfield>d print the bitfield in decimal - %<bitfield>e print the 2^N - bitfield in decimal - %<bitfield>D print as a NEON D register - %<bitfield>Q print as a NEON Q register - %<bitfield>R print as a NEON D or Q register - %<bitfield>Sn print byte scaled width limited by n - %<bitfield>Tn print short scaled width limited by n - %<bitfield>Un print long scaled width limited by n - - %<bitfield>'c print specified char iff bitfield is all ones - %<bitfield>`c print specified char iff bitfield is all zeroes - %<bitfield>?ab... select from array of values in big endian order */ - -static const struct opcode32 neon_opcodes[] = -{ - /* Extract */ - {FPU_NEON_EXT_V1, 0xf2b00840, 0xffb00850, "vext%c.8\t%12-15,22R, %16-19,7R, %0-3,5R, #%8-11d"}, - {FPU_NEON_EXT_V1, 0xf2b00000, 0xffb00810, "vext%c.8\t%12-15,22R, %16-19,7R, %0-3,5R, #%8-11d"}, - - /* Move data element to all lanes */ - {FPU_NEON_EXT_V1, 0xf3b40c00, 0xffb70f90, "vdup%c.32\t%12-15,22R, %0-3,5D[%19d]"}, - {FPU_NEON_EXT_V1, 0xf3b20c00, 0xffb30f90, "vdup%c.16\t%12-15,22R, %0-3,5D[%18-19d]"}, - {FPU_NEON_EXT_V1, 0xf3b10c00, 0xffb10f90, "vdup%c.8\t%12-15,22R, %0-3,5D[%17-19d]"}, - - /* Table lookup */ - {FPU_NEON_EXT_V1, 0xf3b00800, 0xffb00c50, "vtbl%c.8\t%12-15,22D, %F, %0-3,5D"}, - {FPU_NEON_EXT_V1, 0xf3b00840, 0xffb00c50, "vtbx%c.8\t%12-15,22D, %F, %0-3,5D"}, - - /* Two registers, miscellaneous */ - {FPU_NEON_EXT_V1, 0xf2880a10, 0xfebf0fd0, "vmovl%c.%24?us8\t%12-15,22Q, %0-3,5D"}, - {FPU_NEON_EXT_V1, 0xf2900a10, 0xfebf0fd0, "vmovl%c.%24?us16\t%12-15,22Q, %0-3,5D"}, - {FPU_NEON_EXT_V1, 0xf2a00a10, 0xfebf0fd0, "vmovl%c.%24?us32\t%12-15,22Q, %0-3,5D"}, - {FPU_NEON_EXT_V1, 0xf3b00500, 0xffbf0f90, "vcnt%c.8\t%12-15,22R, %0-3,5R"}, - {FPU_NEON_EXT_V1, 0xf3b00580, 0xffbf0f90, "vmvn%c\t%12-15,22R, %0-3,5R"}, - {FPU_NEON_EXT_V1, 0xf3b20000, 0xffbf0f90, "vswp%c\t%12-15,22R, %0-3,5R"}, - {FPU_NEON_EXT_V1, 0xf3b20200, 0xffb30fd0, "vmovn%c.i%18-19T2\t%12-15,22D, %0-3,5Q"}, - {FPU_NEON_EXT_V1, 0xf3b20240, 0xffb30fd0, "vqmovun%c.s%18-19T2\t%12-15,22D, %0-3,5Q"}, - {FPU_NEON_EXT_V1, 0xf3b20280, 0xffb30fd0, "vqmovn%c.s%18-19T2\t%12-15,22D, %0-3,5Q"}, - {FPU_NEON_EXT_V1, 0xf3b202c0, 0xffb30fd0, "vqmovn%c.u%18-19T2\t%12-15,22D, %0-3,5Q"}, - {FPU_NEON_EXT_V1, 0xf3b20300, 0xffb30fd0, "vshll%c.i%18-19S2\t%12-15,22Q, %0-3,5D, #%18-19S2"}, - {FPU_NEON_EXT_V1, 0xf3bb0400, 0xffbf0e90, "vrecpe%c.%8?fu%18-19S2\t%12-15,22R, %0-3,5R"}, - {FPU_NEON_EXT_V1, 0xf3bb0480, 0xffbf0e90, "vrsqrte%c.%8?fu%18-19S2\t%12-15,22R, %0-3,5R"}, - {FPU_NEON_EXT_V1, 0xf3b00000, 0xffb30f90, "vrev64%c.%18-19S2\t%12-15,22R, %0-3,5R"}, - {FPU_NEON_EXT_V1, 0xf3b00080, 0xffb30f90, "vrev32%c.%18-19S2\t%12-15,22R, %0-3,5R"}, - {FPU_NEON_EXT_V1, 0xf3b00100, 0xffb30f90, "vrev16%c.%18-19S2\t%12-15,22R, %0-3,5R"}, - {FPU_NEON_EXT_V1, 0xf3b00400, 0xffb30f90, "vcls%c.s%18-19S2\t%12-15,22R, %0-3,5R"}, - {FPU_NEON_EXT_V1, 0xf3b00480, 0xffb30f90, "vclz%c.i%18-19S2\t%12-15,22R, %0-3,5R"}, - {FPU_NEON_EXT_V1, 0xf3b00700, 0xffb30f90, "vqabs%c.s%18-19S2\t%12-15,22R, %0-3,5R"}, - {FPU_NEON_EXT_V1, 0xf3b00780, 0xffb30f90, "vqneg%c.s%18-19S2\t%12-15,22R, %0-3,5R"}, - {FPU_NEON_EXT_V1, 0xf3b20080, 0xffb30f90, "vtrn%c.%18-19S2\t%12-15,22R, %0-3,5R"}, - {FPU_NEON_EXT_V1, 0xf3b20100, 0xffb30f90, "vuzp%c.%18-19S2\t%12-15,22R, %0-3,5R"}, - {FPU_NEON_EXT_V1, 0xf3b20180, 0xffb30f90, "vzip%c.%18-19S2\t%12-15,22R, %0-3,5R"}, - {FPU_NEON_EXT_V1, 0xf3b10000, 0xffb30b90, "vcgt%c.%10?fs%18-19S2\t%12-15,22R, %0-3,5R, #0"}, - {FPU_NEON_EXT_V1, 0xf3b10080, 0xffb30b90, "vcge%c.%10?fs%18-19S2\t%12-15,22R, %0-3,5R, #0"}, - {FPU_NEON_EXT_V1, 0xf3b10100, 0xffb30b90, "vceq%c.%10?fi%18-19S2\t%12-15,22R, %0-3,5R, #0"}, - {FPU_NEON_EXT_V1, 0xf3b10180, 0xffb30b90, "vcle%c.%10?fs%18-19S2\t%12-15,22R, %0-3,5R, #0"}, - {FPU_NEON_EXT_V1, 0xf3b10200, 0xffb30b90, "vclt%c.%10?fs%18-19S2\t%12-15,22R, %0-3,5R, #0"}, - {FPU_NEON_EXT_V1, 0xf3b10300, 0xffb30b90, "vabs%c.%10?fs%18-19S2\t%12-15,22R, %0-3,5R"}, - {FPU_NEON_EXT_V1, 0xf3b10380, 0xffb30b90, "vneg%c.%10?fs%18-19S2\t%12-15,22R, %0-3,5R"}, - {FPU_NEON_EXT_V1, 0xf3b00200, 0xffb30f10, "vpaddl%c.%7?us%18-19S2\t%12-15,22R, %0-3,5R"}, - {FPU_NEON_EXT_V1, 0xf3b00600, 0xffb30f10, "vpadal%c.%7?us%18-19S2\t%12-15,22R, %0-3,5R"}, - {FPU_NEON_EXT_V1, 0xf3b30600, 0xffb30e10, "vcvt%c.%7-8?usff%18-19Sa.%7-8?ffus%18-19Sa\t%12-15,22R, %0-3,5R"}, - - /* Three registers of the same length */ - {FPU_NEON_EXT_V1, 0xf2000110, 0xffb00f10, "vand%c\t%12-15,22R, %16-19,7R, %0-3,5R"}, - {FPU_NEON_EXT_V1, 0xf2100110, 0xffb00f10, "vbic%c\t%12-15,22R, %16-19,7R, %0-3,5R"}, - {FPU_NEON_EXT_V1, 0xf2200110, 0xffb00f10, "vorr%c\t%12-15,22R, %16-19,7R, %0-3,5R"}, - {FPU_NEON_EXT_V1, 0xf2300110, 0xffb00f10, "vorn%c\t%12-15,22R, %16-19,7R, %0-3,5R"}, - {FPU_NEON_EXT_V1, 0xf3000110, 0xffb00f10, "veor%c\t%12-15,22R, %16-19,7R, %0-3,5R"}, - {FPU_NEON_EXT_V1, 0xf3100110, 0xffb00f10, "vbsl%c\t%12-15,22R, %16-19,7R, %0-3,5R"}, - {FPU_NEON_EXT_V1, 0xf3200110, 0xffb00f10, "vbit%c\t%12-15,22R, %16-19,7R, %0-3,5R"}, - {FPU_NEON_EXT_V1, 0xf3300110, 0xffb00f10, "vbif%c\t%12-15,22R, %16-19,7R, %0-3,5R"}, - {FPU_NEON_EXT_V1, 0xf2000d00, 0xffa00f10, "vadd%c.f%20U0\t%12-15,22R, %16-19,7R, %0-3,5R"}, - {FPU_NEON_EXT_V1, 0xf2000d10, 0xffa00f10, "vmla%c.f%20U0\t%12-15,22R, %16-19,7R, %0-3,5R"}, - {FPU_NEON_EXT_V1, 0xf2000e00, 0xffa00f10, "vceq%c.f%20U0\t%12-15,22R, %16-19,7R, %0-3,5R"}, - {FPU_NEON_EXT_V1, 0xf2000f00, 0xffa00f10, "vmax%c.f%20U0\t%12-15,22R, %16-19,7R, %0-3,5R"}, - {FPU_NEON_EXT_V1, 0xf2000f10, 0xffa00f10, "vrecps%c.f%20U0\t%12-15,22R, %16-19,7R, %0-3,5R"}, - {FPU_NEON_EXT_V1, 0xf2200d00, 0xffa00f10, "vsub%c.f%20U0\t%12-15,22R, %16-19,7R, %0-3,5R"}, - {FPU_NEON_EXT_V1, 0xf2200d10, 0xffa00f10, "vmls%c.f%20U0\t%12-15,22R, %16-19,7R, %0-3,5R"}, - {FPU_NEON_EXT_V1, 0xf2200f00, 0xffa00f10, "vmin%c.f%20U0\t%12-15,22R, %16-19,7R, %0-3,5R"}, - {FPU_NEON_EXT_V1, 0xf2200f10, 0xffa00f10, "vrsqrts%c.f%20U0\t%12-15,22R, %16-19,7R, %0-3,5R"}, - {FPU_NEON_EXT_V1, 0xf3000d00, 0xffa00f10, "vpadd%c.f%20U0\t%12-15,22R, %16-19,7R, %0-3,5R"}, - {FPU_NEON_EXT_V1, 0xf3000d10, 0xffa00f10, "vmul%c.f%20U0\t%12-15,22R, %16-19,7R, %0-3,5R"}, - {FPU_NEON_EXT_V1, 0xf3000e00, 0xffa00f10, "vcge%c.f%20U0\t%12-15,22R, %16-19,7R, %0-3,5R"}, - {FPU_NEON_EXT_V1, 0xf3000e10, 0xffa00f10, "vacge%c.f%20U0\t%12-15,22R, %16-19,7R, %0-3,5R"}, - {FPU_NEON_EXT_V1, 0xf3000f00, 0xffa00f10, "vpmax%c.f%20U0\t%12-15,22R, %16-19,7R, %0-3,5R"}, - {FPU_NEON_EXT_V1, 0xf3200d00, 0xffa00f10, "vabd%c.f%20U0\t%12-15,22R, %16-19,7R, %0-3,5R"}, - {FPU_NEON_EXT_V1, 0xf3200e00, 0xffa00f10, "vcgt%c.f%20U0\t%12-15,22R, %16-19,7R, %0-3,5R"}, - {FPU_NEON_EXT_V1, 0xf3200e10, 0xffa00f10, "vacgt%c.f%20U0\t%12-15,22R, %16-19,7R, %0-3,5R"}, - {FPU_NEON_EXT_V1, 0xf3200f00, 0xffa00f10, "vpmin%c.f%20U0\t%12-15,22R, %16-19,7R, %0-3,5R"}, - {FPU_NEON_EXT_V1, 0xf2000800, 0xff800f10, "vadd%c.i%20-21S3\t%12-15,22R, %16-19,7R, %0-3,5R"}, - {FPU_NEON_EXT_V1, 0xf2000810, 0xff800f10, "vtst%c.%20-21S2\t%12-15,22R, %16-19,7R, %0-3,5R"}, - {FPU_NEON_EXT_V1, 0xf2000900, 0xff800f10, "vmla%c.i%20-21S2\t%12-15,22R, %16-19,7R, %0-3,5R"}, - {FPU_NEON_EXT_V1, 0xf2000b00, 0xff800f10, "vqdmulh%c.s%20-21S6\t%12-15,22R, %16-19,7R, %0-3,5R"}, - {FPU_NEON_EXT_V1, 0xf2000b10, 0xff800f10, "vpadd%c.i%20-21S2\t%12-15,22R, %16-19,7R, %0-3,5R"}, - {FPU_NEON_EXT_V1, 0xf3000800, 0xff800f10, "vsub%c.i%20-21S3\t%12-15,22R, %16-19,7R, %0-3,5R"}, - {FPU_NEON_EXT_V1, 0xf3000810, 0xff800f10, "vceq%c.i%20-21S2\t%12-15,22R, %16-19,7R, %0-3,5R"}, - {FPU_NEON_EXT_V1, 0xf3000900, 0xff800f10, "vmls%c.i%20-21S2\t%12-15,22R, %16-19,7R, %0-3,5R"}, - {FPU_NEON_EXT_V1, 0xf3000b00, 0xff800f10, "vqrdmulh%c.s%20-21S6\t%12-15,22R, %16-19,7R, %0-3,5R"}, - {FPU_NEON_EXT_V1, 0xf2000000, 0xfe800f10, "vhadd%c.%24?us%20-21S2\t%12-15,22R, %16-19,7R, %0-3,5R"}, - {FPU_NEON_EXT_V1, 0xf2000010, 0xfe800f10, "vqadd%c.%24?us%20-21S3\t%12-15,22R, %16-19,7R, %0-3,5R"}, - {FPU_NEON_EXT_V1, 0xf2000100, 0xfe800f10, "vrhadd%c.%24?us%20-21S2\t%12-15,22R, %16-19,7R, %0-3,5R"}, - {FPU_NEON_EXT_V1, 0xf2000200, 0xfe800f10, "vhsub%c.%24?us%20-21S2\t%12-15,22R, %16-19,7R, %0-3,5R"}, - {FPU_NEON_EXT_V1, 0xf2000210, 0xfe800f10, "vqsub%c.%24?us%20-21S3\t%12-15,22R, %16-19,7R, %0-3,5R"}, - {FPU_NEON_EXT_V1, 0xf2000300, 0xfe800f10, "vcgt%c.%24?us%20-21S2\t%12-15,22R, %16-19,7R, %0-3,5R"}, - {FPU_NEON_EXT_V1, 0xf2000310, 0xfe800f10, "vcge%c.%24?us%20-21S2\t%12-15,22R, %16-19,7R, %0-3,5R"}, - {FPU_NEON_EXT_V1, 0xf2000400, 0xfe800f10, "vshl%c.%24?us%20-21S3\t%12-15,22R, %0-3,5R, %16-19,7R"}, - {FPU_NEON_EXT_V1, 0xf2000410, 0xfe800f10, "vqshl%c.%24?us%20-21S3\t%12-15,22R, %0-3,5R, %16-19,7R"}, - {FPU_NEON_EXT_V1, 0xf2000500, 0xfe800f10, "vrshl%c.%24?us%20-21S3\t%12-15,22R, %0-3,5R, %16-19,7R"}, - {FPU_NEON_EXT_V1, 0xf2000510, 0xfe800f10, "vqrshl%c.%24?us%20-21S3\t%12-15,22R, %0-3,5R, %16-19,7R"}, - {FPU_NEON_EXT_V1, 0xf2000600, 0xfe800f10, "vmax%c.%24?us%20-21S2\t%12-15,22R, %16-19,7R, %0-3,5R"}, - {FPU_NEON_EXT_V1, 0xf2000610, 0xfe800f10, "vmin%c.%24?us%20-21S2\t%12-15,22R, %16-19,7R, %0-3,5R"}, - {FPU_NEON_EXT_V1, 0xf2000700, 0xfe800f10, "vabd%c.%24?us%20-21S2\t%12-15,22R, %16-19,7R, %0-3,5R"}, - {FPU_NEON_EXT_V1, 0xf2000710, 0xfe800f10, "vaba%c.%24?us%20-21S2\t%12-15,22R, %16-19,7R, %0-3,5R"}, - {FPU_NEON_EXT_V1, 0xf2000910, 0xfe800f10, "vmul%c.%24?pi%20-21S2\t%12-15,22R, %16-19,7R, %0-3,5R"}, - {FPU_NEON_EXT_V1, 0xf2000a00, 0xfe800f10, "vpmax%c.%24?us%20-21S2\t%12-15,22R, %16-19,7R, %0-3,5R"}, - {FPU_NEON_EXT_V1, 0xf2000a10, 0xfe800f10, "vpmin%c.%24?us%20-21S2\t%12-15,22R, %16-19,7R, %0-3,5R"}, - - /* One register and an immediate value */ - {FPU_NEON_EXT_V1, 0xf2800e10, 0xfeb80fb0, "vmov%c.i8\t%12-15,22R, %E"}, - {FPU_NEON_EXT_V1, 0xf2800e30, 0xfeb80fb0, "vmov%c.i64\t%12-15,22R, %E"}, - {FPU_NEON_EXT_V1, 0xf2800f10, 0xfeb80fb0, "vmov%c.f32\t%12-15,22R, %E"}, - {FPU_NEON_EXT_V1, 0xf2800810, 0xfeb80db0, "vmov%c.i16\t%12-15,22R, %E"}, - {FPU_NEON_EXT_V1, 0xf2800830, 0xfeb80db0, "vmvn%c.i16\t%12-15,22R, %E"}, - {FPU_NEON_EXT_V1, 0xf2800910, 0xfeb80db0, "vorr%c.i16\t%12-15,22R, %E"}, - {FPU_NEON_EXT_V1, 0xf2800930, 0xfeb80db0, "vbic%c.i16\t%12-15,22R, %E"}, - {FPU_NEON_EXT_V1, 0xf2800c10, 0xfeb80eb0, "vmov%c.i32\t%12-15,22R, %E"}, - {FPU_NEON_EXT_V1, 0xf2800c30, 0xfeb80eb0, "vmvn%c.i32\t%12-15,22R, %E"}, - {FPU_NEON_EXT_V1, 0xf2800110, 0xfeb809b0, "vorr%c.i32\t%12-15,22R, %E"}, - {FPU_NEON_EXT_V1, 0xf2800130, 0xfeb809b0, "vbic%c.i32\t%12-15,22R, %E"}, - {FPU_NEON_EXT_V1, 0xf2800010, 0xfeb808b0, "vmov%c.i32\t%12-15,22R, %E"}, - {FPU_NEON_EXT_V1, 0xf2800030, 0xfeb808b0, "vmvn%c.i32\t%12-15,22R, %E"}, - - /* Two registers and a shift amount */ - {FPU_NEON_EXT_V1, 0xf2880810, 0xffb80fd0, "vshrn%c.i16\t%12-15,22D, %0-3,5Q, #%16-18e"}, - {FPU_NEON_EXT_V1, 0xf2880850, 0xffb80fd0, "vrshrn%c.i16\t%12-15,22D, %0-3,5Q, #%16-18e"}, - {FPU_NEON_EXT_V1, 0xf2880810, 0xfeb80fd0, "vqshrun%c.s16\t%12-15,22D, %0-3,5Q, #%16-18e"}, - {FPU_NEON_EXT_V1, 0xf2880850, 0xfeb80fd0, "vqrshrun%c.s16\t%12-15,22D, %0-3,5Q, #%16-18e"}, - {FPU_NEON_EXT_V1, 0xf2880910, 0xfeb80fd0, "vqshrn%c.%24?us16\t%12-15,22D, %0-3,5Q, #%16-18e"}, - {FPU_NEON_EXT_V1, 0xf2880950, 0xfeb80fd0, "vqrshrn%c.%24?us16\t%12-15,22D, %0-3,5Q, #%16-18e"}, - {FPU_NEON_EXT_V1, 0xf2880a10, 0xfeb80fd0, "vshll%c.%24?us8\t%12-15,22D, %0-3,5Q, #%16-18d"}, - {FPU_NEON_EXT_V1, 0xf2900810, 0xffb00fd0, "vshrn%c.i32\t%12-15,22D, %0-3,5Q, #%16-19e"}, - {FPU_NEON_EXT_V1, 0xf2900850, 0xffb00fd0, "vrshrn%c.i32\t%12-15,22D, %0-3,5Q, #%16-19e"}, - {FPU_NEON_EXT_V1, 0xf2880510, 0xffb80f90, "vshl%c.%24?us8\t%12-15,22R, %0-3,5R, #%16-18d"}, - {FPU_NEON_EXT_V1, 0xf3880410, 0xffb80f90, "vsri%c.8\t%12-15,22R, %0-3,5R, #%16-18e"}, - {FPU_NEON_EXT_V1, 0xf3880510, 0xffb80f90, "vsli%c.8\t%12-15,22R, %0-3,5R, #%16-18d"}, - {FPU_NEON_EXT_V1, 0xf3880610, 0xffb80f90, "vqshlu%c.s8\t%12-15,22R, %0-3,5R, #%16-18d"}, - {FPU_NEON_EXT_V1, 0xf2900810, 0xfeb00fd0, "vqshrun%c.s32\t%12-15,22D, %0-3,5Q, #%16-19e"}, - {FPU_NEON_EXT_V1, 0xf2900850, 0xfeb00fd0, "vqrshrun%c.s32\t%12-15,22D, %0-3,5Q, #%16-19e"}, - {FPU_NEON_EXT_V1, 0xf2900910, 0xfeb00fd0, "vqshrn%c.%24?us32\t%12-15,22D, %0-3,5Q, #%16-19e"}, - {FPU_NEON_EXT_V1, 0xf2900950, 0xfeb00fd0, "vqrshrn%c.%24?us32\t%12-15,22D, %0-3,5Q, #%16-19e"}, - {FPU_NEON_EXT_V1, 0xf2900a10, 0xfeb00fd0, "vshll%c.%24?us16\t%12-15,22D, %0-3,5Q, #%16-19d"}, - {FPU_NEON_EXT_V1, 0xf2880010, 0xfeb80f90, "vshr%c.%24?us8\t%12-15,22R, %0-3,5R, #%16-18e"}, - {FPU_NEON_EXT_V1, 0xf2880110, 0xfeb80f90, "vsra%c.%24?us8\t%12-15,22R, %0-3,5R, #%16-18e"}, - {FPU_NEON_EXT_V1, 0xf2880210, 0xfeb80f90, "vrshr%c.%24?us8\t%12-15,22R, %0-3,5R, #%16-18e"}, - {FPU_NEON_EXT_V1, 0xf2880310, 0xfeb80f90, "vrsra%c.%24?us8\t%12-15,22R, %0-3,5R, #%16-18e"}, - {FPU_NEON_EXT_V1, 0xf2880710, 0xfeb80f90, "vqshl%c.%24?us8\t%12-15,22R, %0-3,5R, #%16-18d"}, - {FPU_NEON_EXT_V1, 0xf2a00810, 0xffa00fd0, "vshrn%c.i64\t%12-15,22D, %0-3,5Q, #%16-20e"}, - {FPU_NEON_EXT_V1, 0xf2a00850, 0xffa00fd0, "vrshrn%c.i64\t%12-15,22D, %0-3,5Q, #%16-20e"}, - {FPU_NEON_EXT_V1, 0xf2900510, 0xffb00f90, "vshl%c.%24?us16\t%12-15,22R, %0-3,5R, #%16-19d"}, - {FPU_NEON_EXT_V1, 0xf3900410, 0xffb00f90, "vsri%c.16\t%12-15,22R, %0-3,5R, #%16-19e"}, - {FPU_NEON_EXT_V1, 0xf3900510, 0xffb00f90, "vsli%c.16\t%12-15,22R, %0-3,5R, #%16-19d"}, - {FPU_NEON_EXT_V1, 0xf3900610, 0xffb00f90, "vqshlu%c.s16\t%12-15,22R, %0-3,5R, #%16-19d"}, - {FPU_NEON_EXT_V1, 0xf2a00a10, 0xfea00fd0, "vshll%c.%24?us32\t%12-15,22D, %0-3,5Q, #%16-20d"}, - {FPU_NEON_EXT_V1, 0xf2900010, 0xfeb00f90, "vshr%c.%24?us16\t%12-15,22R, %0-3,5R, #%16-19e"}, - {FPU_NEON_EXT_V1, 0xf2900110, 0xfeb00f90, "vsra%c.%24?us16\t%12-15,22R, %0-3,5R, #%16-19e"}, - {FPU_NEON_EXT_V1, 0xf2900210, 0xfeb00f90, "vrshr%c.%24?us16\t%12-15,22R, %0-3,5R, #%16-19e"}, - {FPU_NEON_EXT_V1, 0xf2900310, 0xfeb00f90, "vrsra%c.%24?us16\t%12-15,22R, %0-3,5R, #%16-19e"}, - {FPU_NEON_EXT_V1, 0xf2900710, 0xfeb00f90, "vqshl%c.%24?us16\t%12-15,22R, %0-3,5R, #%16-19d"}, - {FPU_NEON_EXT_V1, 0xf2800810, 0xfec00fd0, "vqshrun%c.s64\t%12-15,22D, %0-3,5Q, #%16-20e"}, - {FPU_NEON_EXT_V1, 0xf2800850, 0xfec00fd0, "vqrshrun%c.s64\t%12-15,22D, %0-3,5Q, #%16-20e"}, - {FPU_NEON_EXT_V1, 0xf2800910, 0xfec00fd0, "vqshrn%c.%24?us64\t%12-15,22D, %0-3,5Q, #%16-20e"}, - {FPU_NEON_EXT_V1, 0xf2800950, 0xfec00fd0, "vqrshrn%c.%24?us64\t%12-15,22D, %0-3,5Q, #%16-20e"}, - {FPU_NEON_EXT_V1, 0xf2a00510, 0xffa00f90, "vshl%c.%24?us32\t%12-15,22R, %0-3,5R, #%16-20d"}, - {FPU_NEON_EXT_V1, 0xf3a00410, 0xffa00f90, "vsri%c.32\t%12-15,22R, %0-3,5R, #%16-20e"}, - {FPU_NEON_EXT_V1, 0xf3a00510, 0xffa00f90, "vsli%c.32\t%12-15,22R, %0-3,5R, #%16-20d"}, - {FPU_NEON_EXT_V1, 0xf3a00610, 0xffa00f90, "vqshlu%c.s32\t%12-15,22R, %0-3,5R, #%16-20d"}, - {FPU_NEON_EXT_V1, 0xf2a00010, 0xfea00f90, "vshr%c.%24?us32\t%12-15,22R, %0-3,5R, #%16-20e"}, - {FPU_NEON_EXT_V1, 0xf2a00110, 0xfea00f90, "vsra%c.%24?us32\t%12-15,22R, %0-3,5R, #%16-20e"}, - {FPU_NEON_EXT_V1, 0xf2a00210, 0xfea00f90, "vrshr%c.%24?us32\t%12-15,22R, %0-3,5R, #%16-20e"}, - {FPU_NEON_EXT_V1, 0xf2a00310, 0xfea00f90, "vrsra%c.%24?us32\t%12-15,22R, %0-3,5R, #%16-20e"}, - {FPU_NEON_EXT_V1, 0xf2a00710, 0xfea00f90, "vqshl%c.%24?us32\t%12-15,22R, %0-3,5R, #%16-20d"}, - {FPU_NEON_EXT_V1, 0xf2800590, 0xff800f90, "vshl%c.%24?us64\t%12-15,22R, %0-3,5R, #%16-21d"}, - {FPU_NEON_EXT_V1, 0xf3800490, 0xff800f90, "vsri%c.64\t%12-15,22R, %0-3,5R, #%16-21e"}, - {FPU_NEON_EXT_V1, 0xf3800590, 0xff800f90, "vsli%c.64\t%12-15,22R, %0-3,5R, #%16-21d"}, - {FPU_NEON_EXT_V1, 0xf3800690, 0xff800f90, "vqshlu%c.s64\t%12-15,22R, %0-3,5R, #%16-21d"}, - {FPU_NEON_EXT_V1, 0xf2800090, 0xfe800f90, "vshr%c.%24?us64\t%12-15,22R, %0-3,5R, #%16-21e"}, - {FPU_NEON_EXT_V1, 0xf2800190, 0xfe800f90, "vsra%c.%24?us64\t%12-15,22R, %0-3,5R, #%16-21e"}, - {FPU_NEON_EXT_V1, 0xf2800290, 0xfe800f90, "vrshr%c.%24?us64\t%12-15,22R, %0-3,5R, #%16-21e"}, - {FPU_NEON_EXT_V1, 0xf2800390, 0xfe800f90, "vrsra%c.%24?us64\t%12-15,22R, %0-3,5R, #%16-21e"}, - {FPU_NEON_EXT_V1, 0xf2800790, 0xfe800f90, "vqshl%c.%24?us64\t%12-15,22R, %0-3,5R, #%16-21d"}, - {FPU_NEON_EXT_V1, 0xf2a00e10, 0xfea00e90, "vcvt%c.%24,8?usff32.%24,8?ffus32\t%12-15,22R, %0-3,5R, #%16-20e"}, - - /* Three registers of different lengths */ - {FPU_NEON_EXT_V1, 0xf2800e00, 0xfea00f50, "vmull%c.p%20S0\t%12-15,22Q, %16-19,7D, %0-3,5D"}, - {FPU_NEON_EXT_V1, 0xf2800400, 0xff800f50, "vaddhn%c.i%20-21T2\t%12-15,22D, %16-19,7Q, %0-3,5Q"}, - {FPU_NEON_EXT_V1, 0xf2800600, 0xff800f50, "vsubhn%c.i%20-21T2\t%12-15,22D, %16-19,7Q, %0-3,5Q"}, - {FPU_NEON_EXT_V1, 0xf2800900, 0xff800f50, "vqdmlal%c.s%20-21S6\t%12-15,22Q, %16-19,7D, %0-3,5D"}, - {FPU_NEON_EXT_V1, 0xf2800b00, 0xff800f50, "vqdmlsl%c.s%20-21S6\t%12-15,22Q, %16-19,7D, %0-3,5D"}, - {FPU_NEON_EXT_V1, 0xf2800d00, 0xff800f50, "vqdmull%c.s%20-21S6\t%12-15,22Q, %16-19,7D, %0-3,5D"}, - {FPU_NEON_EXT_V1, 0xf3800400, 0xff800f50, "vraddhn%c.i%20-21T2\t%12-15,22D, %16-19,7Q, %0-3,5Q"}, - {FPU_NEON_EXT_V1, 0xf3800600, 0xff800f50, "vrsubhn%c.i%20-21T2\t%12-15,22D, %16-19,7Q, %0-3,5Q"}, - {FPU_NEON_EXT_V1, 0xf2800000, 0xfe800f50, "vaddl%c.%24?us%20-21S2\t%12-15,22Q, %16-19,7D, %0-3,5D"}, - {FPU_NEON_EXT_V1, 0xf2800100, 0xfe800f50, "vaddw%c.%24?us%20-21S2\t%12-15,22Q, %16-19,7Q, %0-3,5D"}, - {FPU_NEON_EXT_V1, 0xf2800200, 0xfe800f50, "vsubl%c.%24?us%20-21S2\t%12-15,22Q, %16-19,7D, %0-3,5D"}, - {FPU_NEON_EXT_V1, 0xf2800300, 0xfe800f50, "vsubw%c.%24?us%20-21S2\t%12-15,22Q, %16-19,7Q, %0-3,5D"}, - {FPU_NEON_EXT_V1, 0xf2800500, 0xfe800f50, "vabal%c.%24?us%20-21S2\t%12-15,22Q, %16-19,7D, %0-3,5D"}, - {FPU_NEON_EXT_V1, 0xf2800700, 0xfe800f50, "vabdl%c.%24?us%20-21S2\t%12-15,22Q, %16-19,7D, %0-3,5D"}, - {FPU_NEON_EXT_V1, 0xf2800800, 0xfe800f50, "vmlal%c.%24?us%20-21S2\t%12-15,22Q, %16-19,7D, %0-3,5D"}, - {FPU_NEON_EXT_V1, 0xf2800a00, 0xfe800f50, "vmlsl%c.%24?us%20-21S2\t%12-15,22Q, %16-19,7D, %0-3,5D"}, - {FPU_NEON_EXT_V1, 0xf2800c00, 0xfe800f50, "vmull%c.%24?us%20-21S2\t%12-15,22Q, %16-19,7D, %0-3,5D"}, - - /* Two registers and a scalar */ - {FPU_NEON_EXT_V1, 0xf2800040, 0xff800f50, "vmla%c.i%20-21S6\t%12-15,22D, %16-19,7D, %D"}, - {FPU_NEON_EXT_V1, 0xf2800140, 0xff800f50, "vmla%c.f%20-21Sa\t%12-15,22D, %16-19,7D, %D"}, - {FPU_NEON_EXT_V1, 0xf2800340, 0xff800f50, "vqdmlal%c.s%20-21S6\t%12-15,22Q, %16-19,7D, %D"}, - {FPU_NEON_EXT_V1, 0xf2800440, 0xff800f50, "vmls%c.i%20-21S6\t%12-15,22D, %16-19,7D, %D"}, - {FPU_NEON_EXT_V1, 0xf2800540, 0xff800f50, "vmls%c.f%20-21S6\t%12-15,22D, %16-19,7D, %D"}, - {FPU_NEON_EXT_V1, 0xf2800740, 0xff800f50, "vqdmlsl%c.s%20-21S6\t%12-15,22Q, %16-19,7D, %D"}, - {FPU_NEON_EXT_V1, 0xf2800840, 0xff800f50, "vmul%c.i%20-21S6\t%12-15,22D, %16-19,7D, %D"}, - {FPU_NEON_EXT_V1, 0xf2800940, 0xff800f50, "vmul%c.f%20-21Sa\t%12-15,22D, %16-19,7D, %D"}, - {FPU_NEON_EXT_V1, 0xf2800b40, 0xff800f50, "vqdmull%c.s%20-21S6\t%12-15,22Q, %16-19,7D, %D"}, - {FPU_NEON_EXT_V1, 0xf2800c40, 0xff800f50, "vqdmulh%c.s%20-21S6\t%12-15,22D, %16-19,7D, %D"}, - {FPU_NEON_EXT_V1, 0xf2800d40, 0xff800f50, "vqrdmulh%c.s%20-21S6\t%12-15,22D, %16-19,7D, %D"}, - {FPU_NEON_EXT_V1, 0xf3800040, 0xff800f50, "vmla%c.i%20-21S6\t%12-15,22Q, %16-19,7Q, %D"}, - {FPU_NEON_EXT_V1, 0xf3800140, 0xff800f50, "vmla%c.f%20-21Sa\t%12-15,22Q, %16-19,7Q, %D"}, - {FPU_NEON_EXT_V1, 0xf3800440, 0xff800f50, "vmls%c.i%20-21S6\t%12-15,22Q, %16-19,7Q, %D"}, - {FPU_NEON_EXT_V1, 0xf3800540, 0xff800f50, "vmls%c.f%20-21Sa\t%12-15,22Q, %16-19,7Q, %D"}, - {FPU_NEON_EXT_V1, 0xf3800840, 0xff800f50, "vmul%c.i%20-21S6\t%12-15,22Q, %16-19,7Q, %D"}, - {FPU_NEON_EXT_V1, 0xf3800940, 0xff800f50, "vmul%c.f%20-21Sa\t%12-15,22Q, %16-19,7Q, %D"}, - {FPU_NEON_EXT_V1, 0xf3800c40, 0xff800f50, "vqdmulh%c.s%20-21S6\t%12-15,22Q, %16-19,7Q, %D"}, - {FPU_NEON_EXT_V1, 0xf3800d40, 0xff800f50, "vqrdmulh%c.s%20-21S6\t%12-15,22Q, %16-19,7Q, %D"}, - {FPU_NEON_EXT_V1, 0xf2800240, 0xfe800f50, "vmlal%c.%24?us%20-21S6\t%12-15,22Q, %16-19,7D, %D"}, - {FPU_NEON_EXT_V1, 0xf2800640, 0xfe800f50, "vmlsl%c.%24?us%20-21S6\t%12-15,22Q, %16-19,7D, %D"}, - {FPU_NEON_EXT_V1, 0xf2800a40, 0xfe800f50, "vmull%c.%24?us%20-21S6\t%12-15,22Q, %16-19,7D, %D"}, - - /* Element and structure load/store */ - {FPU_NEON_EXT_V1, 0xf4a00fc0, 0xffb00fc0, "vld4%c.32\t%C"}, - {FPU_NEON_EXT_V1, 0xf4a00c00, 0xffb00f00, "vld1%c.%6-7S2\t%C"}, - {FPU_NEON_EXT_V1, 0xf4a00d00, 0xffb00f00, "vld2%c.%6-7S2\t%C"}, - {FPU_NEON_EXT_V1, 0xf4a00e00, 0xffb00f00, "vld3%c.%6-7S2\t%C"}, - {FPU_NEON_EXT_V1, 0xf4a00f00, 0xffb00f00, "vld4%c.%6-7S2\t%C"}, - {FPU_NEON_EXT_V1, 0xf4000200, 0xff900f00, "v%21?ls%21?dt1%c.%6-7S3\t%A"}, - {FPU_NEON_EXT_V1, 0xf4000300, 0xff900f00, "v%21?ls%21?dt2%c.%6-7S2\t%A"}, - {FPU_NEON_EXT_V1, 0xf4000400, 0xff900f00, "v%21?ls%21?dt3%c.%6-7S2\t%A"}, - {FPU_NEON_EXT_V1, 0xf4000500, 0xff900f00, "v%21?ls%21?dt3%c.%6-7S2\t%A"}, - {FPU_NEON_EXT_V1, 0xf4000600, 0xff900f00, "v%21?ls%21?dt1%c.%6-7S3\t%A"}, - {FPU_NEON_EXT_V1, 0xf4000700, 0xff900f00, "v%21?ls%21?dt1%c.%6-7S3\t%A"}, - {FPU_NEON_EXT_V1, 0xf4000800, 0xff900f00, "v%21?ls%21?dt2%c.%6-7S2\t%A"}, - {FPU_NEON_EXT_V1, 0xf4000900, 0xff900f00, "v%21?ls%21?dt2%c.%6-7S2\t%A"}, - {FPU_NEON_EXT_V1, 0xf4000a00, 0xff900f00, "v%21?ls%21?dt1%c.%6-7S3\t%A"}, - {FPU_NEON_EXT_V1, 0xf4000000, 0xff900e00, "v%21?ls%21?dt4%c.%6-7S2\t%A"}, - {FPU_NEON_EXT_V1, 0xf4800000, 0xff900300, "v%21?ls%21?dt1%c.%10-11S2\t%B"}, - {FPU_NEON_EXT_V1, 0xf4800100, 0xff900300, "v%21?ls%21?dt2%c.%10-11S2\t%B"}, - {FPU_NEON_EXT_V1, 0xf4800200, 0xff900300, "v%21?ls%21?dt3%c.%10-11S2\t%B"}, - {FPU_NEON_EXT_V1, 0xf4800300, 0xff900300, "v%21?ls%21?dt4%c.%10-11S2\t%B"}, - - {0,0 ,0, 0} -}; - -/* Opcode tables: ARM, 16-bit Thumb, 32-bit Thumb. All three are partially - ordered: they must be searched linearly from the top to obtain a correct - match. */ - -/* print_insn_arm recognizes the following format control codes: - - %% % - - %a print address for ldr/str instruction - %s print address for ldr/str halfword/signextend instruction - %b print branch destination - %c print condition code (always bits 28-31) - %m print register mask for ldm/stm instruction - %o print operand2 (immediate or register + shift) - %p print 'p' iff bits 12-15 are 15 - %t print 't' iff bit 21 set and bit 24 clear - %B print arm BLX(1) destination - %C print the PSR sub type. - %U print barrier type. - %P print address for pli instruction. - - %<bitfield>r print as an ARM register - %<bitfield>d print the bitfield in decimal - %<bitfield>W print the bitfield plus one in decimal - %<bitfield>x print the bitfield in hex - %<bitfield>X print the bitfield as 1 hex digit without leading "0x" - - %<bitfield>'c print specified char iff bitfield is all ones - %<bitfield>`c print specified char iff bitfield is all zeroes - %<bitfield>?ab... select from array of values in big endian order - - %e print arm SMI operand (bits 0..7,8..19). - %E print the LSB and WIDTH fields of a BFI or BFC instruction. - %V print the 16-bit immediate field of a MOVT or MOVW instruction. */ - -static const struct opcode32 arm_opcodes[] = -{ - /* ARM instructions. */ - {ARM_EXT_V1, 0xe1a00000, 0xffffffff, "nop\t\t\t(mov r0,r0)"}, - {ARM_EXT_V4T | ARM_EXT_V5, 0x012FFF10, 0x0ffffff0, "bx%c\t%0-3r"}, - {ARM_EXT_V2, 0x00000090, 0x0fe000f0, "mul%20's%c\t%16-19r, %0-3r, %8-11r"}, - {ARM_EXT_V2, 0x00200090, 0x0fe000f0, "mla%20's%c\t%16-19r, %0-3r, %8-11r, %12-15r"}, - {ARM_EXT_V2S, 0x01000090, 0x0fb00ff0, "swp%22'b%c\t%12-15r, %0-3r, [%16-19r]"}, - {ARM_EXT_V3M, 0x00800090, 0x0fa000f0, "%22?sumull%20's%c\t%12-15r, %16-19r, %0-3r, %8-11r"}, - {ARM_EXT_V3M, 0x00a00090, 0x0fa000f0, "%22?sumlal%20's%c\t%12-15r, %16-19r, %0-3r, %8-11r"}, - - /* V7 instructions. */ - {ARM_EXT_V7, 0xf450f000, 0xfd70f000, "pli\t%P"}, - {ARM_EXT_V7, 0x0320f0f0, 0x0ffffff0, "dbg%c\t#%0-3d"}, - {ARM_EXT_V7, 0xf57ff050, 0xfffffff0, "dmb\t%U"}, - {ARM_EXT_V7, 0xf57ff040, 0xfffffff0, "dsb\t%U"}, - {ARM_EXT_V7, 0xf57ff060, 0xfffffff0, "isb\t%U"}, - - /* ARM V6T2 instructions. */ - {ARM_EXT_V6T2, 0x07c0001f, 0x0fe0007f, "bfc%c\t%12-15r, %E"}, - {ARM_EXT_V6T2, 0x07c00010, 0x0fe00070, "bfi%c\t%12-15r, %0-3r, %E"}, - {ARM_EXT_V6T2, 0x00600090, 0x0ff000f0, "mls%c\t%16-19r, %0-3r, %8-11r, %12-15r"}, - {ARM_EXT_V6T2, 0x006000b0, 0x0f7000f0, "strht%c\t%12-15r, %s"}, - {ARM_EXT_V6T2, 0x00300090, 0x0f300090, "ldr%6's%5?hbt%c\t%12-15r, %s"}, - {ARM_EXT_V6T2, 0x03000000, 0x0ff00000, "movw%c\t%12-15r, %V"}, - {ARM_EXT_V6T2, 0x03400000, 0x0ff00000, "movt%c\t%12-15r, %V"}, - {ARM_EXT_V6T2, 0x06ff0f30, 0x0fff0ff0, "rbit%c\t%12-15r, %0-3r"}, - {ARM_EXT_V6T2, 0x07a00050, 0x0fa00070, "%22?usbfx%c\t%12-15r, %0-3r, #%7-11d, #%16-20W"}, - - /* ARM V6Z instructions. */ - {ARM_EXT_V6Z, 0x01600070, 0x0ff000f0, "smc%c\t%e"}, - - /* ARM V6K instructions. */ - {ARM_EXT_V6K, 0xf57ff01f, 0xffffffff, "clrex"}, - {ARM_EXT_V6K, 0x01d00f9f, 0x0ff00fff, "ldrexb%c\t%12-15r, [%16-19r]"}, - {ARM_EXT_V6K, 0x01b00f9f, 0x0ff00fff, "ldrexd%c\t%12-15r, [%16-19r]"}, - {ARM_EXT_V6K, 0x01f00f9f, 0x0ff00fff, "ldrexh%c\t%12-15r, [%16-19r]"}, - {ARM_EXT_V6K, 0x01c00f90, 0x0ff00ff0, "strexb%c\t%12-15r, %0-3r, [%16-19r]"}, - {ARM_EXT_V6K, 0x01a00f90, 0x0ff00ff0, "strexd%c\t%12-15r, %0-3r, [%16-19r]"}, - {ARM_EXT_V6K, 0x01e00f90, 0x0ff00ff0, "strexh%c\t%12-15r, %0-3r, [%16-19r]"}, - - /* ARM V6K NOP hints. */ - {ARM_EXT_V6K, 0x0320f001, 0x0fffffff, "yield%c"}, - {ARM_EXT_V6K, 0x0320f002, 0x0fffffff, "wfe%c"}, - {ARM_EXT_V6K, 0x0320f003, 0x0fffffff, "wfi%c"}, - {ARM_EXT_V6K, 0x0320f004, 0x0fffffff, "sev%c"}, - {ARM_EXT_V6K, 0x0320f000, 0x0fffff00, "nop%c\t{%0-7d}"}, - - /* ARM V6 instructions. */ - {ARM_EXT_V6, 0xf1080000, 0xfffffe3f, "cpsie\t%8'a%7'i%6'f"}, - {ARM_EXT_V6, 0xf10a0000, 0xfffffe20, "cpsie\t%8'a%7'i%6'f,#%0-4d"}, - {ARM_EXT_V6, 0xf10C0000, 0xfffffe3f, "cpsid\t%8'a%7'i%6'f"}, - {ARM_EXT_V6, 0xf10e0000, 0xfffffe20, "cpsid\t%8'a%7'i%6'f,#%0-4d"}, - {ARM_EXT_V6, 0xf1000000, 0xfff1fe20, "cps\t#%0-4d"}, - {ARM_EXT_V6, 0x06800010, 0x0ff00ff0, "pkhbt%c\t%12-15r, %16-19r, %0-3r"}, - {ARM_EXT_V6, 0x06800010, 0x0ff00070, "pkhbt%c\t%12-15r, %16-19r, %0-3r, lsl #%7-11d"}, - {ARM_EXT_V6, 0x06800050, 0x0ff00ff0, "pkhtb%c\t%12-15r, %16-19r, %0-3r, asr #32"}, - {ARM_EXT_V6, 0x06800050, 0x0ff00070, "pkhtb%c\t%12-15r, %16-19r, %0-3r, asr #%7-11d"}, - {ARM_EXT_V6, 0x01900f9f, 0x0ff00fff, "ldrex%c\tr%12-15d, [%16-19r]"}, - {ARM_EXT_V6, 0x06200f10, 0x0ff00ff0, "qadd16%c\t%12-15r, %16-19r, %0-3r"}, - {ARM_EXT_V6, 0x06200f90, 0x0ff00ff0, "qadd8%c\t%12-15r, %16-19r, %0-3r"}, - {ARM_EXT_V6, 0x06200f30, 0x0ff00ff0, "qaddsubx%c\t%12-15r, %16-19r, %0-3r"}, - {ARM_EXT_V6, 0x06200f70, 0x0ff00ff0, "qsub16%c\t%12-15r, %16-19r, %0-3r"}, - {ARM_EXT_V6, 0x06200ff0, 0x0ff00ff0, "qsub8%c\t%12-15r, %16-19r, %0-3r"}, - {ARM_EXT_V6, 0x06200f50, 0x0ff00ff0, "qsubaddx%c\t%12-15r, %16-19r, %0-3r"}, - {ARM_EXT_V6, 0x06100f10, 0x0ff00ff0, "sadd16%c\t%12-15r, %16-19r, %0-3r"}, - {ARM_EXT_V6, 0x06100f90, 0x0ff00ff0, "sadd8%c\t%12-15r, %16-19r, %0-3r"}, - {ARM_EXT_V6, 0x06100f30, 0x0ff00ff0, "saddaddx%c\t%12-15r, %16-19r, %0-3r"}, - {ARM_EXT_V6, 0x06300f10, 0x0ff00ff0, "shadd16%c\t%12-15r, %16-19r, %0-3r"}, - {ARM_EXT_V6, 0x06300f90, 0x0ff00ff0, "shadd8%c\t%12-15r, %16-19r, %0-3r"}, - {ARM_EXT_V6, 0x06300f30, 0x0ff00ff0, "shaddsubx%c\t%12-15r, %16-19r, %0-3r"}, - {ARM_EXT_V6, 0x06300f70, 0x0ff00ff0, "shsub16%c\t%12-15r, %16-19r, %0-3r"}, - {ARM_EXT_V6, 0x06300ff0, 0x0ff00ff0, "shsub8%c\t%12-15r, %16-19r, %0-3r"}, - {ARM_EXT_V6, 0x06300f50, 0x0ff00ff0, "shsubaddx%c\t%12-15r, %16-19r, %0-3r"}, - {ARM_EXT_V6, 0x06100f70, 0x0ff00ff0, "ssub16%c\t%12-15r, %16-19r, %0-3r"}, - {ARM_EXT_V6, 0x06100ff0, 0x0ff00ff0, "ssub8%c\t%12-15r, %16-19r, %0-3r"}, - {ARM_EXT_V6, 0x06100f50, 0x0ff00ff0, "ssubaddx%c\t%12-15r, %16-19r, %0-3r"}, - {ARM_EXT_V6, 0x06500f10, 0x0ff00ff0, "uadd16%c\t%12-15r, %16-19r, %0-3r"}, - {ARM_EXT_V6, 0x06500f90, 0x0ff00ff0, "uadd8%c\t%12-15r, %16-19r, %0-3r"}, - {ARM_EXT_V6, 0x06500f30, 0x0ff00ff0, "uaddsubx%c\t%12-15r, %16-19r, %0-3r"}, - {ARM_EXT_V6, 0x06700f10, 0x0ff00ff0, "uhadd16%c\t%12-15r, %16-19r, %0-3r"}, - {ARM_EXT_V6, 0x06700f90, 0x0ff00ff0, "uhadd8%c\t%12-15r, %16-19r, %0-3r"}, - {ARM_EXT_V6, 0x06700f30, 0x0ff00ff0, "uhaddsubx%c\t%12-15r, %16-19r, %0-3r"}, - {ARM_EXT_V6, 0x06700f70, 0x0ff00ff0, "uhsub16%c\t%12-15r, %16-19r, %0-3r"}, - {ARM_EXT_V6, 0x06700ff0, 0x0ff00ff0, "uhsub8%c\t%12-15r, %16-19r, %0-3r"}, - {ARM_EXT_V6, 0x06700f50, 0x0ff00ff0, "uhsubaddx%c\t%12-15r, %16-19r, %0-3r"}, - {ARM_EXT_V6, 0x06600f10, 0x0ff00ff0, "uqadd16%c\t%12-15r, %16-19r, %0-3r"}, - {ARM_EXT_V6, 0x06600f90, 0x0ff00ff0, "uqadd8%c\t%12-15r, %16-19r, %0-3r"}, - {ARM_EXT_V6, 0x06600f30, 0x0ff00ff0, "uqaddsubx%c\t%12-15r, %16-19r, %0-3r"}, - {ARM_EXT_V6, 0x06600f70, 0x0ff00ff0, "uqsub16%c\t%12-15r, %16-19r, %0-3r"}, - {ARM_EXT_V6, 0x06600ff0, 0x0ff00ff0, "uqsub8%c\t%12-15r, %16-19r, %0-3r"}, - {ARM_EXT_V6, 0x06600f50, 0x0ff00ff0, "uqsubaddx%c\t%12-15r, %16-19r, %0-3r"}, - {ARM_EXT_V6, 0x06500f70, 0x0ff00ff0, "usub16%c\t%12-15r, %16-19r, %0-3r"}, - {ARM_EXT_V6, 0x06500ff0, 0x0ff00ff0, "usub8%c\t%12-15r, %16-19r, %0-3r"}, - {ARM_EXT_V6, 0x06500f50, 0x0ff00ff0, "usubaddx%c\t%12-15r, %16-19r, %0-3r"}, - {ARM_EXT_V6, 0x06bf0f30, 0x0fff0ff0, "rev%c\t%12-15r, %0-3r"}, - {ARM_EXT_V6, 0x06bf0fb0, 0x0fff0ff0, "rev16%c\t%12-15r, %0-3r"}, - {ARM_EXT_V6, 0x06ff0fb0, 0x0fff0ff0, "revsh%c\t%12-15r, %0-3r"}, - {ARM_EXT_V6, 0xf8100a00, 0xfe50ffff, "rfe%23?id%24?ba\t%16-19r%21'!"}, - {ARM_EXT_V6, 0x06bf0070, 0x0fff0ff0, "sxth%c\t%12-15r, %0-3r"}, - {ARM_EXT_V6, 0x06bf0470, 0x0fff0ff0, "sxth%c\t%12-15r, %0-3r, ror #8"}, - {ARM_EXT_V6, 0x06bf0870, 0x0fff0ff0, "sxth%c\t%12-15r, %0-3r, ror #16"}, - {ARM_EXT_V6, 0x06bf0c70, 0x0fff0ff0, "sxth%c\t%12-15r, %0-3r, ror #24"}, - {ARM_EXT_V6, 0x068f0070, 0x0fff0ff0, "sxtb16%c\t%12-15r, %0-3r"}, - {ARM_EXT_V6, 0x068f0470, 0x0fff0ff0, "sxtb16%c\t%12-15r, %0-3r, ror #8"}, - {ARM_EXT_V6, 0x068f0870, 0x0fff0ff0, "sxtb16%c\t%12-15r, %0-3r, ror #16"}, - {ARM_EXT_V6, 0x068f0c70, 0x0fff0ff0, "sxtb16%c\t%12-15r, %0-3r, ror #24"}, - {ARM_EXT_V6, 0x06af0070, 0x0fff0ff0, "sxtb%c\t%12-15r, %0-3r"}, - {ARM_EXT_V6, 0x06af0470, 0x0fff0ff0, "sxtb%c\t%12-15r, %0-3r, ror #8"}, - {ARM_EXT_V6, 0x06af0870, 0x0fff0ff0, "sxtb%c\t%12-15r, %0-3r, ror #16"}, - {ARM_EXT_V6, 0x06af0c70, 0x0fff0ff0, "sxtb%c\t%12-15r, %0-3r, ror #24"}, - {ARM_EXT_V6, 0x06ff0070, 0x0fff0ff0, "uxth%c\t%12-15r, %0-3r"}, - {ARM_EXT_V6, 0x06ff0470, 0x0fff0ff0, "uxth%c\t%12-15r, %0-3r, ror #8"}, - {ARM_EXT_V6, 0x06ff0870, 0x0fff0ff0, "uxth%c\t%12-15r, %0-3r, ror #16"}, - {ARM_EXT_V6, 0x06ff0c70, 0x0fff0ff0, "uxth%c\t%12-15r, %0-3r, ror #24"}, - {ARM_EXT_V6, 0x06cf0070, 0x0fff0ff0, "uxtb16%c\t%12-15r, %0-3r"}, - {ARM_EXT_V6, 0x06cf0470, 0x0fff0ff0, "uxtb16%c\t%12-15r, %0-3r, ror #8"}, - {ARM_EXT_V6, 0x06cf0870, 0x0fff0ff0, "uxtb16%c\t%12-15r, %0-3r, ror #16"}, - {ARM_EXT_V6, 0x06cf0c70, 0x0fff0ff0, "uxtb16%c\t%12-15r, %0-3r, ror #24"}, - {ARM_EXT_V6, 0x06ef0070, 0x0fff0ff0, "uxtb%c\t%12-15r, %0-3r"}, - {ARM_EXT_V6, 0x06ef0470, 0x0fff0ff0, "uxtb%c\t%12-15r, %0-3r, ror #8"}, - {ARM_EXT_V6, 0x06ef0870, 0x0fff0ff0, "uxtb%c\t%12-15r, %0-3r, ror #16"}, - {ARM_EXT_V6, 0x06ef0c70, 0x0fff0ff0, "uxtb%c\t%12-15r, %0-3r, ror #24"}, - {ARM_EXT_V6, 0x06b00070, 0x0ff00ff0, "sxtah%c\t%12-15r, %16-19r, %0-3r"}, - {ARM_EXT_V6, 0x06b00470, 0x0ff00ff0, "sxtah%c\t%12-15r, %16-19r, %0-3r, ror #8"}, - {ARM_EXT_V6, 0x06b00870, 0x0ff00ff0, "sxtah%c\t%12-15r, %16-19r, %0-3r, ror #16"}, - {ARM_EXT_V6, 0x06b00c70, 0x0ff00ff0, "sxtah%c\t%12-15r, %16-19r, %0-3r, ror #24"}, - {ARM_EXT_V6, 0x06800070, 0x0ff00ff0, "sxtab16%c\t%12-15r, %16-19r, %0-3r"}, - {ARM_EXT_V6, 0x06800470, 0x0ff00ff0, "sxtab16%c\t%12-15r, %16-19r, %0-3r, ror #8"}, - {ARM_EXT_V6, 0x06800870, 0x0ff00ff0, "sxtab16%c\t%12-15r, %16-19r, %0-3r, ror #16"}, - {ARM_EXT_V6, 0x06800c70, 0x0ff00ff0, "sxtab16%c\t%12-15r, %16-19r, %0-3r, ror #24"}, - {ARM_EXT_V6, 0x06a00070, 0x0ff00ff0, "sxtab%c\t%12-15r, %16-19r, %0-3r"}, - {ARM_EXT_V6, 0x06a00470, 0x0ff00ff0, "sxtab%c\t%12-15r, %16-19r, %0-3r, ror #8"}, - {ARM_EXT_V6, 0x06a00870, 0x0ff00ff0, "sxtab%c\t%12-15r, %16-19r, %0-3r, ror #16"}, - {ARM_EXT_V6, 0x06a00c70, 0x0ff00ff0, "sxtab%c\t%12-15r, %16-19r, %0-3r, ror #24"}, - {ARM_EXT_V6, 0x06f00070, 0x0ff00ff0, "uxtah%c\t%12-15r, %16-19r, %0-3r"}, - {ARM_EXT_V6, 0x06f00470, 0x0ff00ff0, "uxtah%c\t%12-15r, %16-19r, %0-3r, ror #8"}, - {ARM_EXT_V6, 0x06f00870, 0x0ff00ff0, "uxtah%c\t%12-15r, %16-19r, %0-3r, ror #16"}, - {ARM_EXT_V6, 0x06f00c70, 0x0ff00ff0, "uxtah%c\t%12-15r, %16-19r, %0-3r, ror #24"}, - {ARM_EXT_V6, 0x06c00070, 0x0ff00ff0, "uxtab16%c\t%12-15r, %16-19r, %0-3r"}, - {ARM_EXT_V6, 0x06c00470, 0x0ff00ff0, "uxtab16%c\t%12-15r, %16-19r, %0-3r, ror #8"}, - {ARM_EXT_V6, 0x06c00870, 0x0ff00ff0, "uxtab16%c\t%12-15r, %16-19r, %0-3r, ror #16"}, - {ARM_EXT_V6, 0x06c00c70, 0x0ff00ff0, "uxtab16%c\t%12-15r, %16-19r, %0-3r, ROR #24"}, - {ARM_EXT_V6, 0x06e00070, 0x0ff00ff0, "uxtab%c\t%12-15r, %16-19r, %0-3r"}, - {ARM_EXT_V6, 0x06e00470, 0x0ff00ff0, "uxtab%c\t%12-15r, %16-19r, %0-3r, ror #8"}, - {ARM_EXT_V6, 0x06e00870, 0x0ff00ff0, "uxtab%c\t%12-15r, %16-19r, %0-3r, ror #16"}, - {ARM_EXT_V6, 0x06e00c70, 0x0ff00ff0, "uxtab%c\t%12-15r, %16-19r, %0-3r, ror #24"}, - {ARM_EXT_V6, 0x06800fb0, 0x0ff00ff0, "sel%c\t%12-15r, %16-19r, %0-3r"}, - {ARM_EXT_V6, 0xf1010000, 0xfffffc00, "setend\t%9?ble"}, - {ARM_EXT_V6, 0x0700f010, 0x0ff0f0d0, "smuad%5'x%c\t%16-19r, %0-3r, %8-11r"}, - {ARM_EXT_V6, 0x0700f050, 0x0ff0f0d0, "smusd%5'x%c\t%16-19r, %0-3r, %8-11r"}, - {ARM_EXT_V6, 0x07000010, 0x0ff000d0, "smlad%5'x%c\t%16-19r, %0-3r, %8-11r, %12-15r"}, - {ARM_EXT_V6, 0x07400010, 0x0ff000d0, "smlald%5'x%c\t%12-15r, %16-19r, %0-3r, %8-11r"}, - {ARM_EXT_V6, 0x07000050, 0x0ff000d0, "smlsd%5'x%c\t%16-19r, %0-3r, %8-11r, %12-15r"}, - {ARM_EXT_V6, 0x07400050, 0x0ff000d0, "smlsld%5'x%c\t%12-15r, %16-19r, %0-3r, %8-11r"}, - {ARM_EXT_V6, 0x0750f010, 0x0ff0f0d0, "smmul%5'r%c\t%16-19r, %0-3r, %8-11r"}, - {ARM_EXT_V6, 0x07500010, 0x0ff000d0, "smmla%5'r%c\t%16-19r, %0-3r, %8-11r, %12-15r"}, - {ARM_EXT_V6, 0x075000d0, 0x0ff000d0, "smmls%5'r%c\t%16-19r, %0-3r, %8-11r, %12-15r"}, - {ARM_EXT_V6, 0xf84d0500, 0xfe5fffe0, "srs%23?id%24?ba\t%16-19r%21'!, #%0-4d"}, - {ARM_EXT_V6, 0x06a00010, 0x0fe00ff0, "ssat%c\t%12-15r, #%16-20W, %0-3r"}, - {ARM_EXT_V6, 0x06a00010, 0x0fe00070, "ssat%c\t%12-15r, #%16-20W, %0-3r, lsl #%7-11d"}, - {ARM_EXT_V6, 0x06a00050, 0x0fe00070, "ssat%c\t%12-15r, #%16-20W, %0-3r, asr #%7-11d"}, - {ARM_EXT_V6, 0x06a00f30, 0x0ff00ff0, "ssat16%c\t%12-15r, #%16-19W, %0-3r"}, - {ARM_EXT_V6, 0x01800f90, 0x0ff00ff0, "strex%c\t%12-15r, %0-3r, [%16-19r]"}, - {ARM_EXT_V6, 0x00400090, 0x0ff000f0, "umaal%c\t%12-15r, %16-19r, %0-3r, %8-11r"}, - {ARM_EXT_V6, 0x0780f010, 0x0ff0f0f0, "usad8%c\t%16-19r, %0-3r, %8-11r"}, - {ARM_EXT_V6, 0x07800010, 0x0ff000f0, "usada8%c\t%16-19r, %0-3r, %8-11r, %12-15r"}, - {ARM_EXT_V6, 0x06e00010, 0x0fe00ff0, "usat%c\t%12-15r, #%16-20d, %0-3r"}, - {ARM_EXT_V6, 0x06e00010, 0x0fe00070, "usat%c\t%12-15r, #%16-20d, %0-3r, lsl #%7-11d"}, - {ARM_EXT_V6, 0x06e00050, 0x0fe00070, "usat%c\t%12-15r, #%16-20d, %0-3r, asr #%7-11d"}, - {ARM_EXT_V6, 0x06e00f30, 0x0ff00ff0, "usat16%c\t%12-15r, #%16-19d, %0-3r"}, - - /* V5J instruction. */ - {ARM_EXT_V5J, 0x012fff20, 0x0ffffff0, "bxj%c\t%0-3r"}, - - /* V5 Instructions. */ - {ARM_EXT_V5, 0xe1200070, 0xfff000f0, "bkpt\t0x%16-19X%12-15X%8-11X%0-3X"}, - {ARM_EXT_V5, 0xfa000000, 0xfe000000, "blx\t%B"}, - {ARM_EXT_V5, 0x012fff30, 0x0ffffff0, "blx%c\t%0-3r"}, - {ARM_EXT_V5, 0x016f0f10, 0x0fff0ff0, "clz%c\t%12-15r, %0-3r"}, - - /* V5E "El Segundo" Instructions. */ - {ARM_EXT_V5E, 0x000000d0, 0x0e1000f0, "ldrd%c\t%12-15r, %s"}, - {ARM_EXT_V5E, 0x000000f0, 0x0e1000f0, "strd%c\t%12-15r, %s"}, - {ARM_EXT_V5E, 0xf450f000, 0xfc70f000, "pld\t%a"}, - {ARM_EXT_V5ExP, 0x01000080, 0x0ff000f0, "smlabb%c\t%16-19r, %0-3r, %8-11r, %12-15r"}, - {ARM_EXT_V5ExP, 0x010000a0, 0x0ff000f0, "smlatb%c\t%16-19r, %0-3r, %8-11r, %12-15r"}, - {ARM_EXT_V5ExP, 0x010000c0, 0x0ff000f0, "smlabt%c\t%16-19r, %0-3r, %8-11r, %12-15r"}, - {ARM_EXT_V5ExP, 0x010000e0, 0x0ff000f0, "smlatt%c\t%16-19r, %0-3r, %8-11r, %12-15r"}, - - {ARM_EXT_V5ExP, 0x01200080, 0x0ff000f0, "smlawb%c\t%16-19r, %0-3r, %8-11r, %12-15r"}, - {ARM_EXT_V5ExP, 0x012000c0, 0x0ff000f0, "smlawt%c\t%16-19r, %0-3r, %8-11r, %12-15r"}, - - {ARM_EXT_V5ExP, 0x01400080, 0x0ff000f0, "smlalbb%c\t%12-15r, %16-19r, %0-3r, %8-11r"}, - {ARM_EXT_V5ExP, 0x014000a0, 0x0ff000f0, "smlaltb%c\t%12-15r, %16-19r, %0-3r, %8-11r"}, - {ARM_EXT_V5ExP, 0x014000c0, 0x0ff000f0, "smlalbt%c\t%12-15r, %16-19r, %0-3r, %8-11r"}, - {ARM_EXT_V5ExP, 0x014000e0, 0x0ff000f0, "smlaltt%c\t%12-15r, %16-19r, %0-3r, %8-11r"}, - - {ARM_EXT_V5ExP, 0x01600080, 0x0ff0f0f0, "smulbb%c\t%16-19r, %0-3r, %8-11r"}, - {ARM_EXT_V5ExP, 0x016000a0, 0x0ff0f0f0, "smultb%c\t%16-19r, %0-3r, %8-11r"}, - {ARM_EXT_V5ExP, 0x016000c0, 0x0ff0f0f0, "smulbt%c\t%16-19r, %0-3r, %8-11r"}, - {ARM_EXT_V5ExP, 0x016000e0, 0x0ff0f0f0, "smultt%c\t%16-19r, %0-3r, %8-11r"}, - - {ARM_EXT_V5ExP, 0x012000a0, 0x0ff0f0f0, "smulwb%c\t%16-19r, %0-3r, %8-11r"}, - {ARM_EXT_V5ExP, 0x012000e0, 0x0ff0f0f0, "smulwt%c\t%16-19r, %0-3r, %8-11r"}, - - {ARM_EXT_V5ExP, 0x01000050, 0x0ff00ff0, "qadd%c\t%12-15r, %0-3r, %16-19r"}, - {ARM_EXT_V5ExP, 0x01400050, 0x0ff00ff0, "qdadd%c\t%12-15r, %0-3r, %16-19r"}, - {ARM_EXT_V5ExP, 0x01200050, 0x0ff00ff0, "qsub%c\t%12-15r, %0-3r, %16-19r"}, - {ARM_EXT_V5ExP, 0x01600050, 0x0ff00ff0, "qdsub%c\t%12-15r, %0-3r, %16-19r"}, - - /* ARM Instructions. */ - {ARM_EXT_V1, 0x00000090, 0x0e100090, "str%6's%5?hb%c\t%12-15r, %s"}, - {ARM_EXT_V1, 0x00100090, 0x0e100090, "ldr%6's%5?hb%c\t%12-15r, %s"}, - {ARM_EXT_V1, 0x00000000, 0x0de00000, "and%20's%c\t%12-15r, %16-19r, %o"}, - {ARM_EXT_V1, 0x00200000, 0x0de00000, "eor%20's%c\t%12-15r, %16-19r, %o"}, - {ARM_EXT_V1, 0x00400000, 0x0de00000, "sub%20's%c\t%12-15r, %16-19r, %o"}, - {ARM_EXT_V1, 0x00600000, 0x0de00000, "rsb%20's%c\t%12-15r, %16-19r, %o"}, - {ARM_EXT_V1, 0x00800000, 0x0de00000, "add%20's%c\t%12-15r, %16-19r, %o"}, - {ARM_EXT_V1, 0x00a00000, 0x0de00000, "adc%20's%c\t%12-15r, %16-19r, %o"}, - {ARM_EXT_V1, 0x00c00000, 0x0de00000, "sbc%20's%c\t%12-15r, %16-19r, %o"}, - {ARM_EXT_V1, 0x00e00000, 0x0de00000, "rsc%20's%c\t%12-15r, %16-19r, %o"}, - {ARM_EXT_V3, 0x0120f000, 0x0db0f000, "msr%c\t%22?SCPSR%C, %o"}, - {ARM_EXT_V3, 0x010f0000, 0x0fbf0fff, "mrs%c\t%12-15r, %22?SCPSR"}, - {ARM_EXT_V1, 0x01000000, 0x0de00000, "tst%p%c\t%16-19r, %o"}, - {ARM_EXT_V1, 0x01200000, 0x0de00000, "teq%p%c\t%16-19r, %o"}, - {ARM_EXT_V1, 0x01400000, 0x0de00000, "cmp%p%c\t%16-19r, %o"}, - {ARM_EXT_V1, 0x01600000, 0x0de00000, "cmn%p%c\t%16-19r, %o"}, - {ARM_EXT_V1, 0x01800000, 0x0de00000, "orr%20's%c\t%12-15r, %16-19r, %o"}, - {ARM_EXT_V1, 0x03a00000, 0x0fef0000, "mov%20's%c\t%12-15r, %o"}, - {ARM_EXT_V1, 0x01a00000, 0x0def0ff0, "mov%20's%c\t%12-15r, %0-3r"}, - {ARM_EXT_V1, 0x01a00000, 0x0def0060, "lsl%20's%c\t%12-15r, %q"}, - {ARM_EXT_V1, 0x01a00020, 0x0def0060, "lsr%20's%c\t%12-15r, %q"}, - {ARM_EXT_V1, 0x01a00040, 0x0def0060, "asr%20's%c\t%12-15r, %q"}, - {ARM_EXT_V1, 0x01a00060, 0x0def0ff0, "rrx%20's%c\t%12-15r, %0-3r"}, - {ARM_EXT_V1, 0x01a00060, 0x0def0060, "ror%20's%c\t%12-15r, %q"}, - {ARM_EXT_V1, 0x01c00000, 0x0de00000, "bic%20's%c\t%12-15r, %16-19r, %o"}, - {ARM_EXT_V1, 0x01e00000, 0x0de00000, "mvn%20's%c\t%12-15r, %o"}, - {ARM_EXT_V1, 0x052d0004, 0x0fff0fff, "push%c\t{%12-15r}\t\t; (str%c %12-15r, %a)"}, - {ARM_EXT_V1, 0x04000000, 0x0e100000, "str%22'b%t%c\t%12-15r, %a"}, - {ARM_EXT_V1, 0x06000000, 0x0e100ff0, "str%22'b%t%c\t%12-15r, %a"}, - {ARM_EXT_V1, 0x04000000, 0x0c100010, "str%22'b%t%c\t%12-15r, %a"}, - {ARM_EXT_V1, 0x06000010, 0x0e000010, "undefined"}, - {ARM_EXT_V1, 0x049d0004, 0x0fff0fff, "pop%c\t{%12-15r}\t\t; (ldr%c %12-15r, %a)"}, - {ARM_EXT_V1, 0x04100000, 0x0c100000, "ldr%22'b%t%c\t%12-15r, %a"}, - {ARM_EXT_V1, 0x092d0000, 0x0fff0000, "push%c\t%m"}, - {ARM_EXT_V1, 0x08800000, 0x0ff00000, "stm%c\t%16-19r%21'!, %m%22'^"}, - {ARM_EXT_V1, 0x08000000, 0x0e100000, "stm%23?id%24?ba%c\t%16-19r%21'!, %m%22'^"}, - {ARM_EXT_V1, 0x08bd0000, 0x0fff0000, "pop%c\t%m"}, - {ARM_EXT_V1, 0x08900000, 0x0f900000, "ldm%c\t%16-19r%21'!, %m%22'^"}, - {ARM_EXT_V1, 0x08100000, 0x0e100000, "ldm%23?id%24?ba%c\t%16-19r%21'!, %m%22'^"}, - {ARM_EXT_V1, 0x0a000000, 0x0e000000, "b%24'l%c\t%b"}, - {ARM_EXT_V1, 0x0f000000, 0x0f000000, "svc%c\t%0-23x"}, - - /* The rest. */ - {ARM_EXT_V1, 0x00000000, 0x00000000, "undefined instruction %0-31x"}, - {0, 0x00000000, 0x00000000, 0} -}; - -/* print_insn_thumb16 recognizes the following format control codes: - - %S print Thumb register (bits 3..5 as high number if bit 6 set) - %D print Thumb register (bits 0..2 as high number if bit 7 set) - %<bitfield>I print bitfield as a signed decimal - (top bit of range being the sign bit) - %N print Thumb register mask (with LR) - %O print Thumb register mask (with PC) - %M print Thumb register mask - %b print CZB's 6-bit unsigned branch destination - %s print Thumb right-shift immediate (6..10; 0 == 32). - %c print the condition code - %C print the condition code, or "s" if not conditional - %x print warning if conditional an not at end of IT block" - %X print "\t; unpredictable IT:code" if conditional - %I print IT instruction suffix and operands - %<bitfield>r print bitfield as an ARM register - %<bitfield>d print bitfield as a decimal - %<bitfield>H print (bitfield * 2) as a decimal - %<bitfield>W print (bitfield * 4) as a decimal - %<bitfield>a print (bitfield * 4) as a pc-rel offset + decoded symbol - %<bitfield>B print Thumb branch destination (signed displacement) - %<bitfield>c print bitfield as a condition code - %<bitnum>'c print specified char iff bit is one - %<bitnum>?ab print a if bit is one else print b. */ - -static const struct opcode16 thumb_opcodes[] = -{ - /* Thumb instructions. */ - - /* ARM V6K no-argument instructions. */ - {ARM_EXT_V6K, 0xbf00, 0xffff, "nop%c"}, - {ARM_EXT_V6K, 0xbf10, 0xffff, "yield%c"}, - {ARM_EXT_V6K, 0xbf20, 0xffff, "wfe%c"}, - {ARM_EXT_V6K, 0xbf30, 0xffff, "wfi%c"}, - {ARM_EXT_V6K, 0xbf40, 0xffff, "sev%c"}, - {ARM_EXT_V6K, 0xbf00, 0xff0f, "nop%c\t{%4-7d}"}, - - /* ARM V6T2 instructions. */ - {ARM_EXT_V6T2, 0xb900, 0xfd00, "cbnz\t%0-2r, %b%X"}, - {ARM_EXT_V6T2, 0xb100, 0xfd00, "cbz\t%0-2r, %b%X"}, - {ARM_EXT_V6T2, 0xbf00, 0xff00, "it%I%X"}, - - /* ARM V6. */ - {ARM_EXT_V6, 0xb660, 0xfff8, "cpsie\t%2'a%1'i%0'f%X"}, - {ARM_EXT_V6, 0xb670, 0xfff8, "cpsid\t%2'a%1'i%0'f%X"}, - {ARM_EXT_V6, 0x4600, 0xffc0, "mov%c\t%0-2r, %3-5r"}, - {ARM_EXT_V6, 0xba00, 0xffc0, "rev%c\t%0-2r, %3-5r"}, - {ARM_EXT_V6, 0xba40, 0xffc0, "rev16%c\t%0-2r, %3-5r"}, - {ARM_EXT_V6, 0xbac0, 0xffc0, "revsh%c\t%0-2r, %3-5r"}, - {ARM_EXT_V6, 0xb650, 0xfff7, "setend\t%3?ble%X"}, - {ARM_EXT_V6, 0xb200, 0xffc0, "sxth%c\t%0-2r, %3-5r"}, - {ARM_EXT_V6, 0xb240, 0xffc0, "sxtb%c\t%0-2r, %3-5r"}, - {ARM_EXT_V6, 0xb280, 0xffc0, "uxth%c\t%0-2r, %3-5r"}, - {ARM_EXT_V6, 0xb2c0, 0xffc0, "uxtb%c\t%0-2r, %3-5r"}, - - /* ARM V5 ISA extends Thumb. */ - {ARM_EXT_V5T, 0xbe00, 0xff00, "bkpt\t%0-7x"}, /* Is always unconditional. */ - /* This is BLX(2). BLX(1) is a 32-bit instruction. */ - {ARM_EXT_V5T, 0x4780, 0xff87, "blx%c\t%3-6r%x"}, /* note: 4 bit register number. */ - /* ARM V4T ISA (Thumb v1). */ - {ARM_EXT_V4T, 0x46C0, 0xFFFF, "nop%c\t\t\t(mov r8, r8)"}, - /* Format 4. */ - {ARM_EXT_V4T, 0x4000, 0xFFC0, "and%C\t%0-2r, %3-5r"}, - {ARM_EXT_V4T, 0x4040, 0xFFC0, "eor%C\t%0-2r, %3-5r"}, - {ARM_EXT_V4T, 0x4080, 0xFFC0, "lsl%C\t%0-2r, %3-5r"}, - {ARM_EXT_V4T, 0x40C0, 0xFFC0, "lsr%C\t%0-2r, %3-5r"}, - {ARM_EXT_V4T, 0x4100, 0xFFC0, "asr%C\t%0-2r, %3-5r"}, - {ARM_EXT_V4T, 0x4140, 0xFFC0, "adc%C\t%0-2r, %3-5r"}, - {ARM_EXT_V4T, 0x4180, 0xFFC0, "sbc%C\t%0-2r, %3-5r"}, - {ARM_EXT_V4T, 0x41C0, 0xFFC0, "ror%C\t%0-2r, %3-5r"}, - {ARM_EXT_V4T, 0x4200, 0xFFC0, "tst%c\t%0-2r, %3-5r"}, - {ARM_EXT_V4T, 0x4240, 0xFFC0, "neg%C\t%0-2r, %3-5r"}, - {ARM_EXT_V4T, 0x4280, 0xFFC0, "cmp%c\t%0-2r, %3-5r"}, - {ARM_EXT_V4T, 0x42C0, 0xFFC0, "cmn%c\t%0-2r, %3-5r"}, - {ARM_EXT_V4T, 0x4300, 0xFFC0, "orr%C\t%0-2r, %3-5r"}, - {ARM_EXT_V4T, 0x4340, 0xFFC0, "mul%C\t%0-2r, %3-5r"}, - {ARM_EXT_V4T, 0x4380, 0xFFC0, "bic%C\t%0-2r, %3-5r"}, - {ARM_EXT_V4T, 0x43C0, 0xFFC0, "mvn%C\t%0-2r, %3-5r"}, - /* format 13 */ - {ARM_EXT_V4T, 0xB000, 0xFF80, "add%c\tsp, #%0-6W"}, - {ARM_EXT_V4T, 0xB080, 0xFF80, "sub%c\tsp, #%0-6W"}, - /* format 5 */ - {ARM_EXT_V4T, 0x4700, 0xFF80, "bx%c\t%S%x"}, - {ARM_EXT_V4T, 0x4400, 0xFF00, "add%c\t%D, %S"}, - {ARM_EXT_V4T, 0x4500, 0xFF00, "cmp%c\t%D, %S"}, - {ARM_EXT_V4T, 0x4600, 0xFF00, "mov%c\t%D, %S"}, - /* format 14 */ - {ARM_EXT_V4T, 0xB400, 0xFE00, "push%c\t%N"}, - {ARM_EXT_V4T, 0xBC00, 0xFE00, "pop%c\t%O"}, - /* format 2 */ - {ARM_EXT_V4T, 0x1800, 0xFE00, "add%C\t%0-2r, %3-5r, %6-8r"}, - {ARM_EXT_V4T, 0x1A00, 0xFE00, "sub%C\t%0-2r, %3-5r, %6-8r"}, - {ARM_EXT_V4T, 0x1C00, 0xFE00, "add%C\t%0-2r, %3-5r, #%6-8d"}, - {ARM_EXT_V4T, 0x1E00, 0xFE00, "sub%C\t%0-2r, %3-5r, #%6-8d"}, - /* format 8 */ - {ARM_EXT_V4T, 0x5200, 0xFE00, "strh%c\t%0-2r, [%3-5r, %6-8r]"}, - {ARM_EXT_V4T, 0x5A00, 0xFE00, "ldrh%c\t%0-2r, [%3-5r, %6-8r]"}, - {ARM_EXT_V4T, 0x5600, 0xF600, "ldrs%11?hb%c\t%0-2r, [%3-5r, %6-8r]"}, - /* format 7 */ - {ARM_EXT_V4T, 0x5000, 0xFA00, "str%10'b%c\t%0-2r, [%3-5r, %6-8r]"}, - {ARM_EXT_V4T, 0x5800, 0xFA00, "ldr%10'b%c\t%0-2r, [%3-5r, %6-8r]"}, - /* format 1 */ - {ARM_EXT_V4T, 0x0000, 0xF800, "lsl%C\t%0-2r, %3-5r, #%6-10d"}, - {ARM_EXT_V4T, 0x0800, 0xF800, "lsr%C\t%0-2r, %3-5r, %s"}, - {ARM_EXT_V4T, 0x1000, 0xF800, "asr%C\t%0-2r, %3-5r, %s"}, - /* format 3 */ - {ARM_EXT_V4T, 0x2000, 0xF800, "mov%C\t%8-10r, #%0-7d"}, - {ARM_EXT_V4T, 0x2800, 0xF800, "cmp%c\t%8-10r, #%0-7d"}, - {ARM_EXT_V4T, 0x3000, 0xF800, "add%C\t%8-10r, #%0-7d"}, - {ARM_EXT_V4T, 0x3800, 0xF800, "sub%C\t%8-10r, #%0-7d"}, - /* format 6 */ - {ARM_EXT_V4T, 0x4800, 0xF800, "ldr%c\t%8-10r, [pc, #%0-7W]\t(%0-7a)"}, /* TODO: Disassemble PC relative "LDR rD,=<symbolic>" */ - /* format 9 */ - {ARM_EXT_V4T, 0x6000, 0xF800, "str%c\t%0-2r, [%3-5r, #%6-10W]"}, - {ARM_EXT_V4T, 0x6800, 0xF800, "ldr%c\t%0-2r, [%3-5r, #%6-10W]"}, - {ARM_EXT_V4T, 0x7000, 0xF800, "strb%c\t%0-2r, [%3-5r, #%6-10d]"}, - {ARM_EXT_V4T, 0x7800, 0xF800, "ldrb%c\t%0-2r, [%3-5r, #%6-10d]"}, - /* format 10 */ - {ARM_EXT_V4T, 0x8000, 0xF800, "strh%c\t%0-2r, [%3-5r, #%6-10H]"}, - {ARM_EXT_V4T, 0x8800, 0xF800, "ldrh%c\t%0-2r, [%3-5r, #%6-10H]"}, - /* format 11 */ - {ARM_EXT_V4T, 0x9000, 0xF800, "str%c\t%8-10r, [sp, #%0-7W]"}, - {ARM_EXT_V4T, 0x9800, 0xF800, "ldr%c\t%8-10r, [sp, #%0-7W]"}, - /* format 12 */ - {ARM_EXT_V4T, 0xA000, 0xF800, "add%c\t%8-10r, pc, #%0-7W\t(adr %8-10r, %0-7a)"}, - {ARM_EXT_V4T, 0xA800, 0xF800, "add%c\t%8-10r, sp, #%0-7W"}, - /* format 15 */ - {ARM_EXT_V4T, 0xC000, 0xF800, "stmia%c\t%8-10r!, %M"}, - {ARM_EXT_V4T, 0xC800, 0xF800, "ldmia%c\t%8-10r!, %M"}, - /* format 17 */ - {ARM_EXT_V4T, 0xDF00, 0xFF00, "svc%c\t%0-7d"}, - /* format 16 */ - {ARM_EXT_V4T, 0xDE00, 0xFE00, "undefined"}, - {ARM_EXT_V4T, 0xD000, 0xF000, "b%8-11c.n\t%0-7B%X"}, - /* format 18 */ - {ARM_EXT_V4T, 0xE000, 0xF800, "b%c.n\t%0-10B%x"}, - - /* The E800 .. FFFF range is unconditionally redirected to the - 32-bit table, because even in pre-V6T2 ISAs, BL and BLX(1) pairs - are processed via that table. Thus, we can never encounter a - bare "second half of BL/BLX(1)" instruction here. */ - {ARM_EXT_V1, 0x0000, 0x0000, "undefined"}, - {0, 0, 0, 0} -}; - -/* Thumb32 opcodes use the same table structure as the ARM opcodes. - We adopt the convention that hw1 is the high 16 bits of .value and - .mask, hw2 the low 16 bits. - - print_insn_thumb32 recognizes the following format control codes: - - %% % - - %I print a 12-bit immediate from hw1[10],hw2[14:12,7:0] - %M print a modified 12-bit immediate (same location) - %J print a 16-bit immediate from hw1[3:0,10],hw2[14:12,7:0] - %K print a 16-bit immediate from hw2[3:0],hw1[3:0],hw2[11:4] - %S print a possibly-shifted Rm - - %a print the address of a plain load/store - %w print the width and signedness of a core load/store - %m print register mask for ldm/stm - - %E print the lsb and width fields of a bfc/bfi instruction - %F print the lsb and width fields of a sbfx/ubfx instruction - %b print a conditional branch offset - %B print an unconditional branch offset - %s print the shift field of an SSAT instruction - %R print the rotation field of an SXT instruction - %U print barrier type. - %P print address for pli instruction. - %c print the condition code - %x print warning if conditional an not at end of IT block" - %X print "\t; unpredictable IT:code" if conditional - - %<bitfield>d print bitfield in decimal - %<bitfield>W print bitfield*4 in decimal - %<bitfield>r print bitfield as an ARM register - %<bitfield>c print bitfield as a condition code - - %<bitfield>'c print specified char iff bitfield is all ones - %<bitfield>`c print specified char iff bitfield is all zeroes - %<bitfield>?ab... select from array of values in big endian order - - With one exception at the bottom (done because BL and BLX(1) need - to come dead last), this table was machine-sorted first in - decreasing order of number of bits set in the mask, then in - increasing numeric order of mask, then in increasing numeric order - of opcode. This order is not the clearest for a human reader, but - is guaranteed never to catch a special-case bit pattern with a more - general mask, which is important, because this instruction encoding - makes heavy use of special-case bit patterns. */ -static const struct opcode32 thumb32_opcodes[] = -{ - /* V7 instructions. */ - {ARM_EXT_V7, 0xf910f000, 0xff70f000, "pli%c\t%a"}, - {ARM_EXT_V7, 0xf3af80f0, 0xfffffff0, "dbg%c\t#%0-3d"}, - {ARM_EXT_V7, 0xf3bf8f50, 0xfffffff0, "dmb%c\t%U"}, - {ARM_EXT_V7, 0xf3bf8f40, 0xfffffff0, "dsb%c\t%U"}, - {ARM_EXT_V7, 0xf3bf8f60, 0xfffffff0, "isb%c\t%U"}, - {ARM_EXT_DIV, 0xfb90f0f0, 0xfff0f0f0, "sdiv%c\t%8-11r, %16-19r, %0-3r"}, - {ARM_EXT_DIV, 0xfbb0f0f0, 0xfff0f0f0, "udiv%c\t%8-11r, %16-19r, %0-3r"}, - - /* Instructions defined in the basic V6T2 set. */ - {ARM_EXT_V6T2, 0xf3af8000, 0xffffffff, "nop%c.w"}, - {ARM_EXT_V6T2, 0xf3af8001, 0xffffffff, "yield%c.w"}, - {ARM_EXT_V6T2, 0xf3af8002, 0xffffffff, "wfe%c.w"}, - {ARM_EXT_V6T2, 0xf3af8003, 0xffffffff, "wfi%c.w"}, - {ARM_EXT_V6T2, 0xf3af9004, 0xffffffff, "sev%c.w"}, - {ARM_EXT_V6T2, 0xf3af8000, 0xffffff00, "nop%c.w\t{%0-7d}"}, - - {ARM_EXT_V6T2, 0xf3bf8f2f, 0xffffffff, "clrex%c"}, - {ARM_EXT_V6T2, 0xf3af8400, 0xffffff1f, "cpsie.w\t%7'a%6'i%5'f%X"}, - {ARM_EXT_V6T2, 0xf3af8600, 0xffffff1f, "cpsid.w\t%7'a%6'i%5'f%X"}, - {ARM_EXT_V6T2, 0xf3c08f00, 0xfff0ffff, "bxj%c\t%16-19r%x"}, - {ARM_EXT_V6T2, 0xe810c000, 0xffd0ffff, "rfedb%c\t%16-19r%21'!"}, - {ARM_EXT_V6T2, 0xe990c000, 0xffd0ffff, "rfeia%c\t%16-19r%21'!"}, - {ARM_EXT_V6T2, 0xf3ef8000, 0xffeff000, "mrs%c\t%8-11r, %D"}, - {ARM_EXT_V6T2, 0xf3af8100, 0xffffffe0, "cps\t#%0-4d%X"}, - {ARM_EXT_V6T2, 0xe8d0f000, 0xfff0fff0, "tbb%c\t[%16-19r, %0-3r]%x"}, - {ARM_EXT_V6T2, 0xe8d0f010, 0xfff0fff0, "tbh%c\t[%16-19r, %0-3r, lsl #1]%x"}, - {ARM_EXT_V6T2, 0xf3af8500, 0xffffff00, "cpsie\t%7'a%6'i%5'f, #%0-4d%X"}, - {ARM_EXT_V6T2, 0xf3af8700, 0xffffff00, "cpsid\t%7'a%6'i%5'f, #%0-4d%X"}, - {ARM_EXT_V6T2, 0xf3de8f00, 0xffffff00, "subs%c\tpc, lr, #%0-7d"}, - {ARM_EXT_V6T2, 0xf3808000, 0xffe0f000, "msr%c\t%C, %16-19r"}, - {ARM_EXT_V6T2, 0xe8500f00, 0xfff00fff, "ldrex%c\t%12-15r, [%16-19r]"}, - {ARM_EXT_V6T2, 0xe8d00f4f, 0xfff00fef, "ldrex%4?hb%c\t%12-15r, [%16-19r]"}, - {ARM_EXT_V6T2, 0xe800c000, 0xffd0ffe0, "srsdb%c\t%16-19r%21'!, #%0-4d"}, - {ARM_EXT_V6T2, 0xe980c000, 0xffd0ffe0, "srsia%c\t%16-19r%21'!, #%0-4d"}, - {ARM_EXT_V6T2, 0xfa0ff080, 0xfffff0c0, "sxth%c.w\t%8-11r, %0-3r%R"}, - {ARM_EXT_V6T2, 0xfa1ff080, 0xfffff0c0, "uxth%c.w\t%8-11r, %0-3r%R"}, - {ARM_EXT_V6T2, 0xfa2ff080, 0xfffff0c0, "sxtb16%c\t%8-11r, %0-3r%R"}, - {ARM_EXT_V6T2, 0xfa3ff080, 0xfffff0c0, "uxtb16%c\t%8-11r, %0-3r%R"}, - {ARM_EXT_V6T2, 0xfa4ff080, 0xfffff0c0, "sxtb%c.w\t%8-11r, %0-3r%R"}, - {ARM_EXT_V6T2, 0xfa5ff080, 0xfffff0c0, "uxtb%c.w\t%8-11r, %0-3r%R"}, - {ARM_EXT_V6T2, 0xe8400000, 0xfff000ff, "strex%c\t%8-11r, %12-15r, [%16-19r]"}, - {ARM_EXT_V6T2, 0xe8d0007f, 0xfff000ff, "ldrexd%c\t%12-15r, %8-11r, [%16-19r]"}, - {ARM_EXT_V6T2, 0xfa80f000, 0xfff0f0f0, "sadd8%c\t%8-11r, %16-19r, %0-3r"}, - {ARM_EXT_V6T2, 0xfa80f010, 0xfff0f0f0, "qadd8%c\t%8-11r, %16-19r, %0-3r"}, - {ARM_EXT_V6T2, 0xfa80f020, 0xfff0f0f0, "shadd8%c\t%8-11r, %16-19r, %0-3r"}, - {ARM_EXT_V6T2, 0xfa80f040, 0xfff0f0f0, "uadd8%c\t%8-11r, %16-19r, %0-3r"}, - {ARM_EXT_V6T2, 0xfa80f050, 0xfff0f0f0, "uqadd8%c\t%8-11r, %16-19r, %0-3r"}, - {ARM_EXT_V6T2, 0xfa80f060, 0xfff0f0f0, "uhadd8%c\t%8-11r, %16-19r, %0-3r"}, - {ARM_EXT_V6T2, 0xfa80f080, 0xfff0f0f0, "qadd%c\t%8-11r, %0-3r, %16-19r"}, - {ARM_EXT_V6T2, 0xfa80f090, 0xfff0f0f0, "qdadd%c\t%8-11r, %0-3r, %16-19r"}, - {ARM_EXT_V6T2, 0xfa80f0a0, 0xfff0f0f0, "qsub%c\t%8-11r, %0-3r, %16-19r"}, - {ARM_EXT_V6T2, 0xfa80f0b0, 0xfff0f0f0, "qdsub%c\t%8-11r, %0-3r, %16-19r"}, - {ARM_EXT_V6T2, 0xfa90f000, 0xfff0f0f0, "sadd16%c\t%8-11r, %16-19r, %0-3r"}, - {ARM_EXT_V6T2, 0xfa90f010, 0xfff0f0f0, "qadd16%c\t%8-11r, %16-19r, %0-3r"}, - {ARM_EXT_V6T2, 0xfa90f020, 0xfff0f0f0, "shadd16%c\t%8-11r, %16-19r, %0-3r"}, - {ARM_EXT_V6T2, 0xfa90f040, 0xfff0f0f0, "uadd16%c\t%8-11r, %16-19r, %0-3r"}, - {ARM_EXT_V6T2, 0xfa90f050, 0xfff0f0f0, "uqadd16%c\t%8-11r, %16-19r, %0-3r"}, - {ARM_EXT_V6T2, 0xfa90f060, 0xfff0f0f0, "uhadd16%c\t%8-11r, %16-19r, %0-3r"}, - {ARM_EXT_V6T2, 0xfa90f080, 0xfff0f0f0, "rev%c.w\t%8-11r, %16-19r"}, - {ARM_EXT_V6T2, 0xfa90f090, 0xfff0f0f0, "rev16%c.w\t%8-11r, %16-19r"}, - {ARM_EXT_V6T2, 0xfa90f0a0, 0xfff0f0f0, "rbit%c\t%8-11r, %16-19r"}, - {ARM_EXT_V6T2, 0xfa90f0b0, 0xfff0f0f0, "revsh%c.w\t%8-11r, %16-19r"}, - {ARM_EXT_V6T2, 0xfaa0f000, 0xfff0f0f0, "saddsubx%c\t%8-11r, %16-19r, %0-3r"}, - {ARM_EXT_V6T2, 0xfaa0f010, 0xfff0f0f0, "qaddsubx%c\t%8-11r, %16-19r, %0-3r"}, - {ARM_EXT_V6T2, 0xfaa0f020, 0xfff0f0f0, "shaddsubx%c\t%8-11r, %16-19r, %0-3r"}, - {ARM_EXT_V6T2, 0xfaa0f040, 0xfff0f0f0, "uaddsubx%c\t%8-11r, %16-19r, %0-3r"}, - {ARM_EXT_V6T2, 0xfaa0f050, 0xfff0f0f0, "uqaddsubx%c\t%8-11r, %16-19r, %0-3r"}, - {ARM_EXT_V6T2, 0xfaa0f060, 0xfff0f0f0, "uhaddsubx%c\t%8-11r, %16-19r, %0-3r"}, - {ARM_EXT_V6T2, 0xfaa0f080, 0xfff0f0f0, "sel%c\t%8-11r, %16-19r, %0-3r"}, - {ARM_EXT_V6T2, 0xfab0f080, 0xfff0f0f0, "clz%c\t%8-11r, %16-19r"}, - {ARM_EXT_V6T2, 0xfac0f000, 0xfff0f0f0, "ssub8%c\t%8-11r, %16-19r, %0-3r"}, - {ARM_EXT_V6T2, 0xfac0f010, 0xfff0f0f0, "qsub8%c\t%8-11r, %16-19r, %0-3r"}, - {ARM_EXT_V6T2, 0xfac0f020, 0xfff0f0f0, "shsub8%c\t%8-11r, %16-19r, %0-3r"}, - {ARM_EXT_V6T2, 0xfac0f040, 0xfff0f0f0, "usub8%c\t%8-11r, %16-19r, %0-3r"}, - {ARM_EXT_V6T2, 0xfac0f050, 0xfff0f0f0, "uqsub8%c\t%8-11r, %16-19r, %0-3r"}, - {ARM_EXT_V6T2, 0xfac0f060, 0xfff0f0f0, "uhsub8%c\t%8-11r, %16-19r, %0-3r"}, - {ARM_EXT_V6T2, 0xfad0f000, 0xfff0f0f0, "ssub16%c\t%8-11r, %16-19r, %0-3r"}, - {ARM_EXT_V6T2, 0xfad0f010, 0xfff0f0f0, "qsub16%c\t%8-11r, %16-19r, %0-3r"}, - {ARM_EXT_V6T2, 0xfad0f020, 0xfff0f0f0, "shsub16%c\t%8-11r, %16-19r, %0-3r"}, - {ARM_EXT_V6T2, 0xfad0f040, 0xfff0f0f0, "usub16%c\t%8-11r, %16-19r, %0-3r"}, - {ARM_EXT_V6T2, 0xfad0f050, 0xfff0f0f0, "uqsub16%c\t%8-11r, %16-19r, %0-3r"}, - {ARM_EXT_V6T2, 0xfad0f060, 0xfff0f0f0, "uhsub16%c\t%8-11r, %16-19r, %0-3r"}, - {ARM_EXT_V6T2, 0xfae0f000, 0xfff0f0f0, "ssubaddx%c\t%8-11r, %16-19r, %0-3r"}, - {ARM_EXT_V6T2, 0xfae0f010, 0xfff0f0f0, "qsubaddx%c\t%8-11r, %16-19r, %0-3r"}, - {ARM_EXT_V6T2, 0xfae0f020, 0xfff0f0f0, "shsubaddx%c\t%8-11r, %16-19r, %0-3r"}, - {ARM_EXT_V6T2, 0xfae0f040, 0xfff0f0f0, "usubaddx%c\t%8-11r, %16-19r, %0-3r"}, - {ARM_EXT_V6T2, 0xfae0f050, 0xfff0f0f0, "uqsubaddx%c\t%8-11r, %16-19r, %0-3r"}, - {ARM_EXT_V6T2, 0xfae0f060, 0xfff0f0f0, "uhsubaddx%c\t%8-11r, %16-19r, %0-3r"}, - {ARM_EXT_V6T2, 0xfb00f000, 0xfff0f0f0, "mul%c.w\t%8-11r, %16-19r, %0-3r"}, - {ARM_EXT_V6T2, 0xfb70f000, 0xfff0f0f0, "usad8%c\t%8-11r, %16-19r, %0-3r"}, - {ARM_EXT_V6T2, 0xfa00f000, 0xffe0f0f0, "lsl%20's%c.w\t%8-11r, %16-19r, %0-3r"}, - {ARM_EXT_V6T2, 0xfa20f000, 0xffe0f0f0, "lsr%20's%c.w\t%8-11r, %16-19r, %0-3r"}, - {ARM_EXT_V6T2, 0xfa40f000, 0xffe0f0f0, "asr%20's%c.w\t%8-11r, %16-19r, %0-3r"}, - {ARM_EXT_V6T2, 0xfa60f000, 0xffe0f0f0, "ror%20's%c.w\t%8-11r, %16-19r, %0-3r"}, - {ARM_EXT_V6T2, 0xe8c00f40, 0xfff00fe0, "strex%4?hb%c\t%0-3r, %12-15r, [%16-19r]"}, - {ARM_EXT_V6T2, 0xf3200000, 0xfff0f0e0, "ssat16%c\t%8-11r, #%0-4d, %16-19r"}, - {ARM_EXT_V6T2, 0xf3a00000, 0xfff0f0e0, "usat16%c\t%8-11r, #%0-4d, %16-19r"}, - {ARM_EXT_V6T2, 0xfb20f000, 0xfff0f0e0, "smuad%4'x%c\t%8-11r, %16-19r, %0-3r"}, - {ARM_EXT_V6T2, 0xfb30f000, 0xfff0f0e0, "smulw%4?tb%c\t%8-11r, %16-19r, %0-3r"}, - {ARM_EXT_V6T2, 0xfb40f000, 0xfff0f0e0, "smusd%4'x%c\t%8-11r, %16-19r, %0-3r"}, - {ARM_EXT_V6T2, 0xfb50f000, 0xfff0f0e0, "smmul%4'r%c\t%8-11r, %16-19r, %0-3r"}, - {ARM_EXT_V6T2, 0xfa00f080, 0xfff0f0c0, "sxtah%c\t%8-11r, %16-19r, %0-3r%R"}, - {ARM_EXT_V6T2, 0xfa10f080, 0xfff0f0c0, "uxtah%c\t%8-11r, %16-19r, %0-3r%R"}, - {ARM_EXT_V6T2, 0xfa20f080, 0xfff0f0c0, "sxtab16%c\t%8-11r, %16-19r, %0-3r%R"}, - {ARM_EXT_V6T2, 0xfa30f080, 0xfff0f0c0, "uxtab16%c\t%8-11r, %16-19r, %0-3r%R"}, - {ARM_EXT_V6T2, 0xfa40f080, 0xfff0f0c0, "sxtab%c\t%8-11r, %16-19r, %0-3r%R"}, - {ARM_EXT_V6T2, 0xfa50f080, 0xfff0f0c0, "uxtab%c\t%8-11r, %16-19r, %0-3r%R"}, - {ARM_EXT_V6T2, 0xfb10f000, 0xfff0f0c0, "smul%5?tb%4?tb%c\t%8-11r, %16-19r, %0-3r"}, - {ARM_EXT_V6T2, 0xf36f0000, 0xffff8020, "bfc%c\t%8-11r, %E"}, - {ARM_EXT_V6T2, 0xea100f00, 0xfff08f00, "tst%c.w\t%16-19r, %S"}, - {ARM_EXT_V6T2, 0xea900f00, 0xfff08f00, "teq%c\t%16-19r, %S"}, - {ARM_EXT_V6T2, 0xeb100f00, 0xfff08f00, "cmn%c.w\t%16-19r, %S"}, - {ARM_EXT_V6T2, 0xebb00f00, 0xfff08f00, "cmp%c.w\t%16-19r, %S"}, - {ARM_EXT_V6T2, 0xf0100f00, 0xfbf08f00, "tst%c.w\t%16-19r, %M"}, - {ARM_EXT_V6T2, 0xf0900f00, 0xfbf08f00, "teq%c\t%16-19r, %M"}, - {ARM_EXT_V6T2, 0xf1100f00, 0xfbf08f00, "cmn%c.w\t%16-19r, %M"}, - {ARM_EXT_V6T2, 0xf1b00f00, 0xfbf08f00, "cmp%c.w\t%16-19r, %M"}, - {ARM_EXT_V6T2, 0xea4f0000, 0xffef8000, "mov%20's%c.w\t%8-11r, %S"}, - {ARM_EXT_V6T2, 0xea6f0000, 0xffef8000, "mvn%20's%c.w\t%8-11r, %S"}, - {ARM_EXT_V6T2, 0xe8c00070, 0xfff000f0, "strexd%c\t%0-3r, %12-15r, %8-11r, [%16-19r]"}, - {ARM_EXT_V6T2, 0xfb000000, 0xfff000f0, "mla%c\t%8-11r, %16-19r, %0-3r, %12-15r"}, - {ARM_EXT_V6T2, 0xfb000010, 0xfff000f0, "mls%c\t%8-11r, %16-19r, %0-3r, %12-15r"}, - {ARM_EXT_V6T2, 0xfb700000, 0xfff000f0, "usada8%c\t%8-11r, %16-19r, %0-3r, %12-15r"}, - {ARM_EXT_V6T2, 0xfb800000, 0xfff000f0, "smull%c\t%12-15r, %8-11r, %16-19r, %0-3r"}, - {ARM_EXT_V6T2, 0xfba00000, 0xfff000f0, "umull%c\t%12-15r, %8-11r, %16-19r, %0-3r"}, - {ARM_EXT_V6T2, 0xfbc00000, 0xfff000f0, "smlal%c\t%12-15r, %8-11r, %16-19r, %0-3r"}, - {ARM_EXT_V6T2, 0xfbe00000, 0xfff000f0, "umlal%c\t%12-15r, %8-11r, %16-19r, %0-3r"}, - {ARM_EXT_V6T2, 0xfbe00060, 0xfff000f0, "umaal%c\t%12-15r, %8-11r, %16-19r, %0-3r"}, - {ARM_EXT_V6T2, 0xe8500f00, 0xfff00f00, "ldrex%c\t%12-15r, [%16-19r, #%0-7W]"}, - {ARM_EXT_V6T2, 0xf7f08000, 0xfff0f000, "smc%c\t%K"}, - {ARM_EXT_V6T2, 0xf04f0000, 0xfbef8000, "mov%20's%c.w\t%8-11r, %M"}, - {ARM_EXT_V6T2, 0xf06f0000, 0xfbef8000, "mvn%20's%c.w\t%8-11r, %M"}, - {ARM_EXT_V6T2, 0xf810f000, 0xff70f000, "pld%c\t%a"}, - {ARM_EXT_V6T2, 0xfb200000, 0xfff000e0, "smlad%4'x%c\t%8-11r, %16-19r, %0-3r, %12-15r"}, - {ARM_EXT_V6T2, 0xfb300000, 0xfff000e0, "smlaw%4?tb%c\t%8-11r, %16-19r, %0-3r, %12-15r"}, - {ARM_EXT_V6T2, 0xfb400000, 0xfff000e0, "smlsd%4'x%c\t%8-11r, %16-19r, %0-3r, %12-15r"}, - {ARM_EXT_V6T2, 0xfb500000, 0xfff000e0, "smmla%4'r%c\t%8-11r, %16-19r, %0-3r, %12-15r"}, - {ARM_EXT_V6T2, 0xfb600000, 0xfff000e0, "smmls%4'r%c\t%8-11r, %16-19r, %0-3r, %12-15r"}, - {ARM_EXT_V6T2, 0xfbc000c0, 0xfff000e0, "smlald%4'x%c\t%12-15r, %8-11r, %16-19r, %0-3r"}, - {ARM_EXT_V6T2, 0xfbd000c0, 0xfff000e0, "smlsld%4'x%c\t%12-15r, %8-11r, %16-19r, %0-3r"}, - {ARM_EXT_V6T2, 0xeac00000, 0xfff08030, "pkhbt%c\t%8-11r, %16-19r, %S"}, - {ARM_EXT_V6T2, 0xeac00020, 0xfff08030, "pkhtb%c\t%8-11r, %16-19r, %S"}, - {ARM_EXT_V6T2, 0xf3400000, 0xfff08020, "sbfx%c\t%8-11r, %16-19r, %F"}, - {ARM_EXT_V6T2, 0xf3c00000, 0xfff08020, "ubfx%c\t%8-11r, %16-19r, %F"}, - {ARM_EXT_V6T2, 0xf8000e00, 0xff900f00, "str%wt%c\t%12-15r, %a"}, - {ARM_EXT_V6T2, 0xfb100000, 0xfff000c0, "smla%5?tb%4?tb%c\t%8-11r, %16-19r, %0-3r, %12-15r"}, - {ARM_EXT_V6T2, 0xfbc00080, 0xfff000c0, "smlal%5?tb%4?tb%c\t%12-15r, %8-11r, %16-19r, %0-3r"}, - {ARM_EXT_V6T2, 0xf3600000, 0xfff08020, "bfi%c\t%8-11r, %16-19r, %E"}, - {ARM_EXT_V6T2, 0xf8100e00, 0xfe900f00, "ldr%wt%c\t%12-15r, %a"}, - {ARM_EXT_V6T2, 0xf3000000, 0xffd08020, "ssat%c\t%8-11r, #%0-4d, %16-19r%s"}, - {ARM_EXT_V6T2, 0xf3800000, 0xffd08020, "usat%c\t%8-11r, #%0-4d, %16-19r%s"}, - {ARM_EXT_V6T2, 0xf2000000, 0xfbf08000, "addw%c\t%8-11r, %16-19r, %I"}, - {ARM_EXT_V6T2, 0xf2400000, 0xfbf08000, "movw%c\t%8-11r, %J"}, - {ARM_EXT_V6T2, 0xf2a00000, 0xfbf08000, "subw%c\t%8-11r, %16-19r, %I"}, - {ARM_EXT_V6T2, 0xf2c00000, 0xfbf08000, "movt%c\t%8-11r, %J"}, - {ARM_EXT_V6T2, 0xea000000, 0xffe08000, "and%20's%c.w\t%8-11r, %16-19r, %S"}, - {ARM_EXT_V6T2, 0xea200000, 0xffe08000, "bic%20's%c.w\t%8-11r, %16-19r, %S"}, - {ARM_EXT_V6T2, 0xea400000, 0xffe08000, "orr%20's%c.w\t%8-11r, %16-19r, %S"}, - {ARM_EXT_V6T2, 0xea600000, 0xffe08000, "orn%20's%c\t%8-11r, %16-19r, %S"}, - {ARM_EXT_V6T2, 0xea800000, 0xffe08000, "eor%20's%c.w\t%8-11r, %16-19r, %S"}, - {ARM_EXT_V6T2, 0xeb000000, 0xffe08000, "add%20's%c.w\t%8-11r, %16-19r, %S"}, - {ARM_EXT_V6T2, 0xeb400000, 0xffe08000, "adc%20's%c.w\t%8-11r, %16-19r, %S"}, - {ARM_EXT_V6T2, 0xeb600000, 0xffe08000, "sbc%20's%c.w\t%8-11r, %16-19r, %S"}, - {ARM_EXT_V6T2, 0xeba00000, 0xffe08000, "sub%20's%c.w\t%8-11r, %16-19r, %S"}, - {ARM_EXT_V6T2, 0xebc00000, 0xffe08000, "rsb%20's%c\t%8-11r, %16-19r, %S"}, - {ARM_EXT_V6T2, 0xe8400000, 0xfff00000, "strex%c\t%8-11r, %12-15r, [%16-19r, #%0-7W]"}, - {ARM_EXT_V6T2, 0xf0000000, 0xfbe08000, "and%20's%c.w\t%8-11r, %16-19r, %M"}, - {ARM_EXT_V6T2, 0xf0200000, 0xfbe08000, "bic%20's%c.w\t%8-11r, %16-19r, %M"}, - {ARM_EXT_V6T2, 0xf0400000, 0xfbe08000, "orr%20's%c.w\t%8-11r, %16-19r, %M"}, - {ARM_EXT_V6T2, 0xf0600000, 0xfbe08000, "orn%20's%c\t%8-11r, %16-19r, %M"}, - {ARM_EXT_V6T2, 0xf0800000, 0xfbe08000, "eor%20's%c.w\t%8-11r, %16-19r, %M"}, - {ARM_EXT_V6T2, 0xf1000000, 0xfbe08000, "add%20's%c.w\t%8-11r, %16-19r, %M"}, - {ARM_EXT_V6T2, 0xf1400000, 0xfbe08000, "adc%20's%c.w\t%8-11r, %16-19r, %M"}, - {ARM_EXT_V6T2, 0xf1600000, 0xfbe08000, "sbc%20's%c.w\t%8-11r, %16-19r, %M"}, - {ARM_EXT_V6T2, 0xf1a00000, 0xfbe08000, "sub%20's%c.w\t%8-11r, %16-19r, %M"}, - {ARM_EXT_V6T2, 0xf1c00000, 0xfbe08000, "rsb%20's%c\t%8-11r, %16-19r, %M"}, - {ARM_EXT_V6T2, 0xe8800000, 0xffd00000, "stmia%c.w\t%16-19r%21'!, %m"}, - {ARM_EXT_V6T2, 0xe8900000, 0xffd00000, "ldmia%c.w\t%16-19r%21'!, %m"}, - {ARM_EXT_V6T2, 0xe9000000, 0xffd00000, "stmdb%c\t%16-19r%21'!, %m"}, - {ARM_EXT_V6T2, 0xe9100000, 0xffd00000, "ldmdb%c\t%16-19r%21'!, %m"}, - {ARM_EXT_V6T2, 0xe9c00000, 0xffd000ff, "strd%c\t%12-15r, %8-11r, [%16-19r]"}, - {ARM_EXT_V6T2, 0xe9d00000, 0xffd000ff, "ldrd%c\t%12-15r, %8-11r, [%16-19r]"}, - {ARM_EXT_V6T2, 0xe9400000, 0xff500000, "strd%c\t%12-15r, %8-11r, [%16-19r, #%23`-%0-7W]%21'!"}, - {ARM_EXT_V6T2, 0xe9500000, 0xff500000, "ldrd%c\t%12-15r, %8-11r, [%16-19r, #%23`-%0-7W]%21'!"}, - {ARM_EXT_V6T2, 0xe8600000, 0xff700000, "strd%c\t%12-15r, %8-11r, [%16-19r], #%23`-%0-7W"}, - {ARM_EXT_V6T2, 0xe8700000, 0xff700000, "ldrd%c\t%12-15r, %8-11r, [%16-19r], #%23`-%0-7W"}, - {ARM_EXT_V6T2, 0xf8000000, 0xff100000, "str%w%c.w\t%12-15r, %a"}, - {ARM_EXT_V6T2, 0xf8100000, 0xfe100000, "ldr%w%c.w\t%12-15r, %a"}, - - /* Filter out Bcc with cond=E or F, which are used for other instructions. */ - {ARM_EXT_V6T2, 0xf3c08000, 0xfbc0d000, "undefined (bcc, cond=0xF)"}, - {ARM_EXT_V6T2, 0xf3808000, 0xfbc0d000, "undefined (bcc, cond=0xE)"}, - {ARM_EXT_V6T2, 0xf0008000, 0xf800d000, "b%22-25c.w\t%b%X"}, - {ARM_EXT_V6T2, 0xf0009000, 0xf800d000, "b%c.w\t%B%x"}, - - /* These have been 32-bit since the invention of Thumb. */ - {ARM_EXT_V4T, 0xf000c000, 0xf800d000, "blx%c\t%B%x"}, - {ARM_EXT_V4T, 0xf000d000, 0xf800d000, "bl%c\t%B%x"}, - - /* Fallback. */ - {ARM_EXT_V1, 0x00000000, 0x00000000, "undefined"}, - {0, 0, 0, 0} -}; - -static const char *const arm_conditional[] = -{"eq", "ne", "cs", "cc", "mi", "pl", "vs", "vc", - "hi", "ls", "ge", "lt", "gt", "le", "al", "<und>", ""}; - -static const char *const arm_fp_const[] = -{"0.0", "1.0", "2.0", "3.0", "4.0", "5.0", "0.5", "10.0"}; - -static const char *const arm_shift[] = -{"lsl", "lsr", "asr", "ror"}; - -typedef struct -{ - const char *name; - const char *description; - const char *reg_names[16]; -} -arm_regname; - -static const arm_regname regnames[] = -{ - { "raw" , "Select raw register names", - { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15"}}, - { "gcc", "Select register names used by GCC", - { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "sl", "fp", "ip", "sp", "lr", "pc" }}, - { "std", "Select register names used in ARM's ISA documentation", - { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12", "sp", "lr", "pc" }}, - { "apcs", "Select register names used in the APCS", - { "a1", "a2", "a3", "a4", "v1", "v2", "v3", "v4", "v5", "v6", "sl", "fp", "ip", "sp", "lr", "pc" }}, - { "atpcs", "Select register names used in the ATPCS", - { "a1", "a2", "a3", "a4", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "IP", "SP", "LR", "PC" }}, - { "special-atpcs", "Select special register names used in the ATPCS", - { "a1", "a2", "a3", "a4", "v1", "v2", "v3", "WR", "v5", "SB", "SL", "FP", "IP", "SP", "LR", "PC" }}, -}; - -static const char *const iwmmxt_wwnames[] = -{"b", "h", "w", "d"}; - -static const char *const iwmmxt_wwssnames[] = -{"b", "bus", "bc", "bss", - "h", "hus", "hc", "hss", - "w", "wus", "wc", "wss", - "d", "dus", "dc", "dss" -}; - -static const char *const iwmmxt_regnames[] = -{ "wr0", "wr1", "wr2", "wr3", "wr4", "wr5", "wr6", "wr7", - "wr8", "wr9", "wr10", "wr11", "wr12", "wr13", "wr14", "wr15" -}; - -static const char *const iwmmxt_cregnames[] = -{ "wcid", "wcon", "wcssf", "wcasf", "reserved", "reserved", "reserved", "reserved", - "wcgr0", "wcgr1", "wcgr2", "wcgr3", "reserved", "reserved", "reserved", "reserved" -}; - -/* Default to GCC register name set. */ -static unsigned int regname_selected = 1; - -#define NUM_ARM_REGNAMES NUM_ELEM (regnames) -#define arm_regnames regnames[regname_selected].reg_names - -static bfd_boolean force_thumb = FALSE; - -/* Current IT instruction state. This contains the same state as the IT - bits in the CPSR. */ -static unsigned int ifthen_state; -/* IT state for the next instruction. */ -static unsigned int ifthen_next_state; -/* The address of the insn for which the IT state is valid. */ -static bfd_vma ifthen_address; -#define IFTHEN_COND ((ifthen_state >> 4) & 0xf) - -/* Cached mapping symbol state. */ -enum map_type { - MAP_ARM, - MAP_THUMB, - MAP_DATA -}; - -enum map_type last_type; -int last_mapping_sym = -1; -bfd_vma last_mapping_addr = 0; - -/* Decode a bitfield of the form matching regexp (N(-N)?,)*N(-N)?. - Returns pointer to following character of the format string and - fills in *VALUEP and *WIDTHP with the extracted value and number of - bits extracted. WIDTHP can be NULL. */ - -static const char * -arm_decode_bitfield (const char *ptr, unsigned long insn, - unsigned long *valuep, int *widthp) -{ - unsigned long value = 0; - int width = 0; - - do - { - int start, end; - int bits; - - for (start = 0; *ptr >= '0' && *ptr <= '9'; ptr++) - start = start * 10 + *ptr - '0'; - if (*ptr == '-') - for (end = 0, ptr++; *ptr >= '0' && *ptr <= '9'; ptr++) - end = end * 10 + *ptr - '0'; - else - end = start; - bits = end - start; - if (bits < 0) - abort (); - value |= ((insn >> start) & ((2ul << bits) - 1)) << width; - width += bits + 1; - } - while (*ptr++ == ','); - *valuep = value; - if (widthp) - *widthp = width; - return ptr - 1; -} - -static void -arm_decode_shift (long given, fprintf_ftype func, void *stream, - int print_shift) -{ - func (stream, "%s", arm_regnames[given & 0xf]); - - if ((given & 0xff0) != 0) - { - if ((given & 0x10) == 0) - { - int amount = (given & 0xf80) >> 7; - int shift = (given & 0x60) >> 5; - - if (amount == 0) - { - if (shift == 3) - { - func (stream, ", rrx"); - return; - } - - amount = 32; - } - - if (print_shift) - func (stream, ", %s #%d", arm_shift[shift], amount); - else - func (stream, ", #%d", amount); - } - else if (print_shift) - func (stream, ", %s %s", arm_shift[(given & 0x60) >> 5], - arm_regnames[(given & 0xf00) >> 8]); - else - func (stream, ", %s", arm_regnames[(given & 0xf00) >> 8]); - } -} - -/* Print one coprocessor instruction on INFO->STREAM. - Return TRUE if the instuction matched, FALSE if this is not a - recognised coprocessor instruction. */ - -static bfd_boolean -print_insn_coprocessor (bfd_vma pc, struct disassemble_info *info, long given, - bfd_boolean thumb) -{ - const struct opcode32 *insn; - void *stream = info->stream; - fprintf_ftype func = info->fprintf_func; - unsigned long mask; - unsigned long value; - int cond; - - for (insn = coprocessor_opcodes; insn->assembler; insn++) - { - if (insn->value == FIRST_IWMMXT_INSN - && info->mach != bfd_mach_arm_XScale - && info->mach != bfd_mach_arm_iWMMXt - && info->mach != bfd_mach_arm_iWMMXt2) - insn = insn + IWMMXT_INSN_COUNT; - - mask = insn->mask; - value = insn->value; - if (thumb) - { - /* The high 4 bits are 0xe for Arm conditional instructions, and - 0xe for arm unconditional instructions. The rest of the - encoding is the same. */ - mask |= 0xf0000000; - value |= 0xe0000000; - if (ifthen_state) - cond = IFTHEN_COND; - else - cond = 16; - } - else - { - /* Only match unconditional instuctions against unconditional - patterns. */ - if ((given & 0xf0000000) == 0xf0000000) - { - mask |= 0xf0000000; - cond = 16; - } - else - { - cond = (given >> 28) & 0xf; - if (cond == 0xe) - cond = 16; - } - } - if ((given & mask) == value) - { - const char *c; - - for (c = insn->assembler; *c; c++) - { - if (*c == '%') - { - switch (*++c) - { - case '%': - func (stream, "%%"); - break; - - case 'A': - func (stream, "[%s", arm_regnames [(given >> 16) & 0xf]); - - if ((given & (1 << 24)) != 0) - { - int offset = given & 0xff; - - if (offset) - func (stream, ", #%s%d]%s", - ((given & 0x00800000) == 0 ? "-" : ""), - offset * 4, - ((given & 0x00200000) != 0 ? "!" : "")); - else - func (stream, "]"); - } - else - { - int offset = given & 0xff; - - func (stream, "]"); - - if (given & (1 << 21)) - { - if (offset) - func (stream, ", #%s%d", - ((given & 0x00800000) == 0 ? "-" : ""), - offset * 4); - } - else - func (stream, ", {%d}", offset); - } - break; - - case 'B': - { - int regno = ((given >> 12) & 0xf) | ((given >> (22 - 4)) & 0x10); - int offset = (given >> 1) & 0x3f; - - if (offset == 1) - func (stream, "{d%d}", regno); - else if (regno + offset > 32) - func (stream, "{d%d-<overflow reg d%d>}", regno, regno + offset - 1); - else - func (stream, "{d%d-d%d}", regno, regno + offset - 1); - } - break; - - case 'C': - { - int rn = (given >> 16) & 0xf; - int offset = (given & 0xff) * 4; - int add = (given >> 23) & 1; - - func (stream, "[%s", arm_regnames[rn]); - - if (offset) - { - if (!add) - offset = -offset; - func (stream, ", #%d", offset); - } - func (stream, "]"); - if (rn == 15) - { - func (stream, "\t; "); - /* FIXME: Unsure if info->bytes_per_chunk is the - right thing to use here. */ - info->print_address_func (offset + pc - + info->bytes_per_chunk * 2, info); - } - } - break; - - case 'c': - func (stream, "%s", arm_conditional[cond]); - break; - - case 'I': - /* Print a Cirrus/DSP shift immediate. */ - /* Immediates are 7bit signed ints with bits 0..3 in - bits 0..3 of opcode and bits 4..6 in bits 5..7 - of opcode. */ - { - int imm; - - imm = (given & 0xf) | ((given & 0xe0) >> 1); - - /* Is ``imm'' a negative number? */ - if (imm & 0x40) - imm |= (-1 << 7); - - func (stream, "%d", imm); - } - - break; - - case 'F': - switch (given & 0x00408000) - { - case 0: - func (stream, "4"); - break; - case 0x8000: - func (stream, "1"); - break; - case 0x00400000: - func (stream, "2"); - break; - default: - func (stream, "3"); - } - break; - - case 'P': - switch (given & 0x00080080) - { - case 0: - func (stream, "s"); - break; - case 0x80: - func (stream, "d"); - break; - case 0x00080000: - func (stream, "e"); - break; - default: - func (stream, _("<illegal precision>")); - break; - } - break; - case 'Q': - switch (given & 0x00408000) - { - case 0: - func (stream, "s"); - break; - case 0x8000: - func (stream, "d"); - break; - case 0x00400000: - func (stream, "e"); - break; - default: - func (stream, "p"); - break; - } - break; - case 'R': - switch (given & 0x60) - { - case 0: - break; - case 0x20: - func (stream, "p"); - break; - case 0x40: - func (stream, "m"); - break; - default: - func (stream, "z"); - break; - } - break; - - case '0': case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': - { - int width; - unsigned long value; - - c = arm_decode_bitfield (c, given, &value, &width); - - switch (*c) - { - case 'r': - func (stream, "%s", arm_regnames[value]); - break; - case 'D': - func (stream, "d%ld", value); - break; - case 'Q': - if (value & 1) - func (stream, "<illegal reg q%ld.5>", value >> 1); - else - func (stream, "q%ld", value >> 1); - break; - case 'd': - func (stream, "%ld", value); - break; - case 'k': - { - int from = (given & (1 << 7)) ? 32 : 16; - func (stream, "%ld", from - value); - } - break; - - case 'f': - if (value > 7) - func (stream, "#%s", arm_fp_const[value & 7]); - else - func (stream, "f%ld", value); - break; - - case 'w': - if (width == 2) - func (stream, "%s", iwmmxt_wwnames[value]); - else - func (stream, "%s", iwmmxt_wwssnames[value]); - break; - - case 'g': - func (stream, "%s", iwmmxt_regnames[value]); - break; - case 'G': - func (stream, "%s", iwmmxt_cregnames[value]); - break; - - case 'x': - func (stream, "0x%lx", value); - break; - - case '`': - c++; - if (value == 0) - func (stream, "%c", *c); - break; - case ''': - c++; - if (value == ((1ul << width) - 1)) - func (stream, "%c", *c); - break; - case '?': - func (stream, "%c", c[(1 << width) - (int)value]); - c += 1 << width; - break; - default: - abort (); - } - break; - - case 'y': - case 'z': - { - int single = *c++ == 'y'; - int regno; - - switch (*c) - { - case '4': /* Sm pair */ - func (stream, "{"); - /* Fall through. */ - case '0': /* Sm, Dm */ - regno = given & 0x0000000f; - if (single) - { - regno <<= 1; - regno += (given >> 5) & 1; - } - else - regno += ((given >> 5) & 1) << 4; - break; - - case '1': /* Sd, Dd */ - regno = (given >> 12) & 0x0000000f; - if (single) - { - regno <<= 1; - regno += (given >> 22) & 1; - } - else - regno += ((given >> 22) & 1) << 4; - break; - - case '2': /* Sn, Dn */ - regno = (given >> 16) & 0x0000000f; - if (single) - { - regno <<= 1; - regno += (given >> 7) & 1; - } - else - regno += ((given >> 7) & 1) << 4; - break; - - case '3': /* List */ - func (stream, "{"); - regno = (given >> 12) & 0x0000000f; - if (single) - { - regno <<= 1; - regno += (given >> 22) & 1; - } - else - regno += ((given >> 22) & 1) << 4; - break; - - default: - abort (); - } - - func (stream, "%c%d", single ? 's' : 'd', regno); - - if (*c == '3') - { - int count = given & 0xff; - - if (single == 0) - count >>= 1; - - if (--count) - { - func (stream, "-%c%d", - single ? 's' : 'd', - regno + count); - } - - func (stream, "}"); - } - else if (*c == '4') - func (stream, ", %c%d}", single ? 's' : 'd', - regno + 1); - } - break; - - case 'L': - switch (given & 0x00400100) - { - case 0x00000000: func (stream, "b"); break; - case 0x00400000: func (stream, "h"); break; - case 0x00000100: func (stream, "w"); break; - case 0x00400100: func (stream, "d"); break; - default: - break; - } - break; - - case 'Z': - { - int value; - /* given (20, 23) | given (0, 3) */ - value = ((given >> 16) & 0xf0) | (given & 0xf); - func (stream, "%d", value); - } - break; - - case 'l': - /* This is like the 'A' operator, except that if - the width field "M" is zero, then the offset is - *not* multiplied by four. */ - { - int offset = given & 0xff; - int multiplier = (given & 0x00000100) ? 4 : 1; - - func (stream, "[%s", arm_regnames [(given >> 16) & 0xf]); - - if (offset) - { - if ((given & 0x01000000) != 0) - func (stream, ", #%s%d]%s", - ((given & 0x00800000) == 0 ? "-" : ""), - offset * multiplier, - ((given & 0x00200000) != 0 ? "!" : "")); - else - func (stream, "], #%s%d", - ((given & 0x00800000) == 0 ? "-" : ""), - offset * multiplier); - } - else - func (stream, "]"); - } - break; - - case 'r': - { - int imm4 = (given >> 4) & 0xf; - int puw_bits = ((given >> 22) & 6) | ((given >> 21) & 1); - int ubit = (given >> 23) & 1; - const char *rm = arm_regnames [given & 0xf]; - const char *rn = arm_regnames [(given >> 16) & 0xf]; - - switch (puw_bits) - { - case 1: - /* fall through */ - case 3: - func (stream, "[%s], %c%s", rn, ubit ? '+' : '-', rm); - if (imm4) - func (stream, ", lsl #%d", imm4); - break; - - case 4: - /* fall through */ - case 5: - /* fall through */ - case 6: - /* fall through */ - case 7: - func (stream, "[%s, %c%s", rn, ubit ? '+' : '-', rm); - if (imm4 > 0) - func (stream, ", lsl #%d", imm4); - func (stream, "]"); - if (puw_bits == 5 || puw_bits == 7) - func (stream, "!"); - break; - - default: - func (stream, "INVALID"); - } - } - break; - - case 'i': - { - long imm5; - imm5 = ((given & 0x100) >> 4) | (given & 0xf); - func (stream, "%ld", (imm5 == 0) ? 32 : imm5); - } - break; - - default: - abort (); - } - } - } - else - func (stream, "%c", *c); - } - return TRUE; - } - } - return FALSE; -} - -static void -print_arm_address (bfd_vma pc, struct disassemble_info *info, long given) -{ - void *stream = info->stream; - fprintf_ftype func = info->fprintf_func; - - if (((given & 0x000f0000) == 0x000f0000) - && ((given & 0x02000000) == 0)) - { - int offset = given & 0xfff; - - func (stream, "[pc"); - - if (given & 0x01000000) - { - if ((given & 0x00800000) == 0) - offset = - offset; - - /* Pre-indexed. */ - func (stream, ", #%d]", offset); - - offset += pc + 8; - - /* Cope with the possibility of write-back - being used. Probably a very dangerous thing - for the programmer to do, but who are we to - argue ? */ - if (given & 0x00200000) - func (stream, "!"); - } - else - { - /* Post indexed. */ - func (stream, "], #%d", offset); - - /* ie ignore the offset. */ - offset = pc + 8; - } - - func (stream, "\t; "); - info->print_address_func (offset, info); - } - else - { - func (stream, "[%s", - arm_regnames[(given >> 16) & 0xf]); - if ((given & 0x01000000) != 0) - { - if ((given & 0x02000000) == 0) - { - int offset = given & 0xfff; - if (offset) - func (stream, ", #%s%d", - (((given & 0x00800000) == 0) - ? "-" : ""), offset); - } - else - { - func (stream, ", %s", - (((given & 0x00800000) == 0) - ? "-" : "")); - arm_decode_shift (given, func, stream, 1); - } - - func (stream, "]%s", - ((given & 0x00200000) != 0) ? "!" : ""); - } - else - { - if ((given & 0x02000000) == 0) - { - int offset = given & 0xfff; - if (offset) - func (stream, "], #%s%d", - (((given & 0x00800000) == 0) - ? "-" : ""), offset); - else - func (stream, "]"); - } - else - { - func (stream, "], %s", - (((given & 0x00800000) == 0) - ? "-" : "")); - arm_decode_shift (given, func, stream, 1); - } - } - } -} - -/* Print one neon instruction on INFO->STREAM. - Return TRUE if the instuction matched, FALSE if this is not a - recognised neon instruction. */ - -static bfd_boolean -print_insn_neon (struct disassemble_info *info, long given, bfd_boolean thumb) -{ - const struct opcode32 *insn; - void *stream = info->stream; - fprintf_ftype func = info->fprintf_func; - - if (thumb) - { - if ((given & 0xef000000) == 0xef000000) - { - /* move bit 28 to bit 24 to translate Thumb2 to ARM encoding. */ - unsigned long bit28 = given & (1 << 28); - - given &= 0x00ffffff; - if (bit28) - given |= 0xf3000000; - else - given |= 0xf2000000; - } - else if ((given & 0xff000000) == 0xf9000000) - given ^= 0xf9000000 ^ 0xf4000000; - else - return FALSE; - } - - for (insn = neon_opcodes; insn->assembler; insn++) - { - if ((given & insn->mask) == insn->value) - { - const char *c; - - for (c = insn->assembler; *c; c++) - { - if (*c == '%') - { - switch (*++c) - { - case '%': - func (stream, "%%"); - break; - - case 'c': - if (thumb && ifthen_state) - func (stream, "%s", arm_conditional[IFTHEN_COND]); - break; - - case 'A': - { - static const unsigned char enc[16] = - { - 0x4, 0x14, /* st4 0,1 */ - 0x4, /* st1 2 */ - 0x4, /* st2 3 */ - 0x3, /* st3 4 */ - 0x13, /* st3 5 */ - 0x3, /* st1 6 */ - 0x1, /* st1 7 */ - 0x2, /* st2 8 */ - 0x12, /* st2 9 */ - 0x2, /* st1 10 */ - 0, 0, 0, 0, 0 - }; - int rd = ((given >> 12) & 0xf) | (((given >> 22) & 1) << 4); - int rn = ((given >> 16) & 0xf); - int rm = ((given >> 0) & 0xf); - int align = ((given >> 4) & 0x3); - int type = ((given >> 8) & 0xf); - int n = enc[type] & 0xf; - int stride = (enc[type] >> 4) + 1; - int ix; - - func (stream, "{"); - if (stride > 1) - for (ix = 0; ix != n; ix++) - func (stream, "%sd%d", ix ? "," : "", rd + ix * stride); - else if (n == 1) - func (stream, "d%d", rd); - else - func (stream, "d%d-d%d", rd, rd + n - 1); - func (stream, "}, [%s", arm_regnames[rn]); - if (align) - func (stream, ", :%d", 32 << align); - func (stream, "]"); - if (rm == 0xd) - func (stream, "!"); - else if (rm != 0xf) - func (stream, ", %s", arm_regnames[rm]); - } - break; - - case 'B': - { - int rd = ((given >> 12) & 0xf) | (((given >> 22) & 1) << 4); - int rn = ((given >> 16) & 0xf); - int rm = ((given >> 0) & 0xf); - int idx_align = ((given >> 4) & 0xf); - int align = 0; - int size = ((given >> 10) & 0x3); - int idx = idx_align >> (size + 1); - int length = ((given >> 8) & 3) + 1; - int stride = 1; - int i; - - if (length > 1 && size > 0) - stride = (idx_align & (1 << size)) ? 2 : 1; - - switch (length) - { - case 1: - { - int amask = (1 << size) - 1; - if ((idx_align & (1 << size)) != 0) - return FALSE; - if (size > 0) - { - if ((idx_align & amask) == amask) - align = 8 << size; - else if ((idx_align & amask) != 0) - return FALSE; - } - } - break; - - case 2: - if (size == 2 && (idx_align & 2) != 0) - return FALSE; - align = (idx_align & 1) ? 16 << size : 0; - break; - - case 3: - if ((size == 2 && (idx_align & 3) != 0) - || (idx_align & 1) != 0) - return FALSE; - break; - - case 4: - if (size == 2) - { - if ((idx_align & 3) == 3) - return FALSE; - align = (idx_align & 3) * 64; - } - else - align = (idx_align & 1) ? 32 << size : 0; - break; - - default: - abort (); - } - - func (stream, "{"); - for (i = 0; i < length; i++) - func (stream, "%sd%d[%d]", (i == 0) ? "" : ",", - rd + i * stride, idx); - func (stream, "}, [%s", arm_regnames[rn]); - if (align) - func (stream, ", :%d", align); - func (stream, "]"); - if (rm == 0xd) - func (stream, "!"); - else if (rm != 0xf) - func (stream, ", %s", arm_regnames[rm]); - } - break; - - case 'C': - { - int rd = ((given >> 12) & 0xf) | (((given >> 22) & 1) << 4); - int rn = ((given >> 16) & 0xf); - int rm = ((given >> 0) & 0xf); - int align = ((given >> 4) & 0x1); - int size = ((given >> 6) & 0x3); - int type = ((given >> 8) & 0x3); - int n = type + 1; - int stride = ((given >> 5) & 0x1); - int ix; - - if (stride && (n == 1)) - n++; - else - stride++; - - func (stream, "{"); - if (stride > 1) - for (ix = 0; ix != n; ix++) - func (stream, "%sd%d[]", ix ? "," : "", rd + ix * stride); - else if (n == 1) - func (stream, "d%d[]", rd); - else - func (stream, "d%d[]-d%d[]", rd, rd + n - 1); - func (stream, "}, [%s", arm_regnames[rn]); - if (align) - { - int align = (8 * (type + 1)) << size; - if (type == 3) - align = (size > 1) ? align >> 1 : align; - if (type == 2 || (type == 0 && !size)) - func (stream, ", :<bad align %d>", align); - else - func (stream, ", :%d", align); - } - func (stream, "]"); - if (rm == 0xd) - func (stream, "!"); - else if (rm != 0xf) - func (stream, ", %s", arm_regnames[rm]); - } - break; - - case 'D': - { - int raw_reg = (given & 0xf) | ((given >> 1) & 0x10); - int size = (given >> 20) & 3; - int reg = raw_reg & ((4 << size) - 1); - int ix = raw_reg >> size >> 2; - - func (stream, "d%d[%d]", reg, ix); - } - break; - - case 'E': - /* Neon encoded constant for mov, mvn, vorr, vbic */ - { - int bits = 0; - int cmode = (given >> 8) & 0xf; - int op = (given >> 5) & 0x1; - unsigned long value = 0, hival = 0; - unsigned shift; - int size = 0; - int isfloat = 0; - - bits |= ((given >> 24) & 1) << 7; - bits |= ((given >> 16) & 7) << 4; - bits |= ((given >> 0) & 15) << 0; - - if (cmode < 8) - { - shift = (cmode >> 1) & 3; - value = (unsigned long)bits << (8 * shift); - size = 32; - } - else if (cmode < 12) - { - shift = (cmode >> 1) & 1; - value = (unsigned long)bits << (8 * shift); - size = 16; - } - else if (cmode < 14) - { - shift = (cmode & 1) + 1; - value = (unsigned long)bits << (8 * shift); - value |= (1ul << (8 * shift)) - 1; - size = 32; - } - else if (cmode == 14) - { - if (op) - { - /* bit replication into bytes */ - int ix; - unsigned long mask; - - value = 0; - hival = 0; - for (ix = 7; ix >= 0; ix--) - { - mask = ((bits >> ix) & 1) ? 0xff : 0; - if (ix <= 3) - value = (value << 8) | mask; - else - hival = (hival << 8) | mask; - } - size = 64; - } - else - { - /* byte replication */ - value = (unsigned long)bits; - size = 8; - } - } - else if (!op) - { - /* floating point encoding */ - int tmp; - - value = (unsigned long)(bits & 0x7f) << 19; - value |= (unsigned long)(bits & 0x80) << 24; - tmp = bits & 0x40 ? 0x3c : 0x40; - value |= (unsigned long)tmp << 24; - size = 32; - isfloat = 1; - } - else - { - func (stream, "<illegal constant %.8x:%x:%x>", - bits, cmode, op); - size = 32; - break; - } - switch (size) - { - case 8: - func (stream, "#%ld\t; 0x%.2lx", value, value); - break; - - case 16: - func (stream, "#%ld\t; 0x%.4lx", value, value); - break; - - case 32: - if (isfloat) - { - unsigned char valbytes[4]; - double fvalue; - - /* Do this a byte at a time so we don't have to - worry about the host's endianness. */ - valbytes[0] = value & 0xff; - valbytes[1] = (value >> 8) & 0xff; - valbytes[2] = (value >> 16) & 0xff; - valbytes[3] = (value >> 24) & 0xff; - - floatformat_to_double - (&floatformat_ieee_single_little, valbytes, - &fvalue); - - func (stream, "#%.7g\t; 0x%.8lx", fvalue, - value); - } - else - func (stream, "#%ld\t; 0x%.8lx", - (long) ((value & 0x80000000) - ? value | ~0xffffffffl : value), value); - break; - - case 64: - func (stream, "#0x%.8lx%.8lx", hival, value); - break; - - default: - abort (); - } - } - break; - - case 'F': - { - int regno = ((given >> 16) & 0xf) | ((given >> (7 - 4)) & 0x10); - int num = (given >> 8) & 0x3; - - if (!num) - func (stream, "{d%d}", regno); - else if (num + regno >= 32) - func (stream, "{d%d-<overflow reg d%d}", regno, regno + num); - else - func (stream, "{d%d-d%d}", regno, regno + num); - } - break; - - - case '0': case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': - { - int width; - unsigned long value; - - c = arm_decode_bitfield (c, given, &value, &width); - - switch (*c) - { - case 'r': - func (stream, "%s", arm_regnames[value]); - break; - case 'd': - func (stream, "%ld", value); - break; - case 'e': - func (stream, "%ld", (1ul << width) - value); - break; - - case 'S': - case 'T': - case 'U': - /* various width encodings */ - { - int base = 8 << (*c - 'S'); /* 8,16 or 32 */ - int limit; - unsigned low, high; - - c++; - if (*c >= '0' && *c <= '9') - limit = *c - '0'; - else if (*c >= 'a' && *c <= 'f') - limit = *c - 'a' + 10; - else - abort (); - low = limit >> 2; - high = limit & 3; - - if (value < low || value > high) - func (stream, "<illegal width %d>", base << value); - else - func (stream, "%d", base << value); - } - break; - case 'R': - if (given & (1 << 6)) - goto Q; - /* FALLTHROUGH */ - case 'D': - func (stream, "d%ld", value); - break; - case 'Q': - Q: - if (value & 1) - func (stream, "<illegal reg q%ld.5>", value >> 1); - else - func (stream, "q%ld", value >> 1); - break; - - case '`': - c++; - if (value == 0) - func (stream, "%c", *c); - break; - case ''': - c++; - if (value == ((1ul << width) - 1)) - func (stream, "%c", *c); - break; - case '?': - func (stream, "%c", c[(1 << width) - (int)value]); - c += 1 << width; - break; - default: - abort (); - } - break; - - default: - abort (); - } - } - } - else - func (stream, "%c", *c); - } - return TRUE; - } - } - return FALSE; -} - -/* Print one ARM instruction from PC on INFO->STREAM. */ - -static void -print_insn_arm_internal (bfd_vma pc, struct disassemble_info *info, long given) -{ - const struct opcode32 *insn; - void *stream = info->stream; - fprintf_ftype func = info->fprintf_func; - - if (print_insn_coprocessor (pc, info, given, FALSE)) - return; - - if (print_insn_neon (info, given, FALSE)) - return; - - for (insn = arm_opcodes; insn->assembler; insn++) - { - if (insn->value == FIRST_IWMMXT_INSN - && info->mach != bfd_mach_arm_XScale - && info->mach != bfd_mach_arm_iWMMXt) - insn = insn + IWMMXT_INSN_COUNT; - - if ((given & insn->mask) == insn->value - /* Special case: an instruction with all bits set in the condition field - (0xFnnn_nnnn) is only matched if all those bits are set in insn->mask, - or by the catchall at the end of the table. */ - && ((given & 0xF0000000) != 0xF0000000 - || (insn->mask & 0xF0000000) == 0xF0000000 - || (insn->mask == 0 && insn->value == 0))) - { - const char *c; - - for (c = insn->assembler; *c; c++) - { - if (*c == '%') - { - switch (*++c) - { - case '%': - func (stream, "%%"); - break; - - case 'a': - print_arm_address (pc, info, given); - break; - - case 'P': - /* Set P address bit and use normal address - printing routine. */ - print_arm_address (pc, info, given | (1 << 24)); - break; - - case 's': - if ((given & 0x004f0000) == 0x004f0000) - { - /* PC relative with immediate offset. */ - int offset = ((given & 0xf00) >> 4) | (given & 0xf); - - if ((given & 0x00800000) == 0) - offset = -offset; - - func (stream, "[pc, #%d]\t; ", offset); - info->print_address_func (offset + pc + 8, info); - } - else - { - func (stream, "[%s", - arm_regnames[(given >> 16) & 0xf]); - if ((given & 0x01000000) != 0) - { - /* Pre-indexed. */ - if ((given & 0x00400000) == 0x00400000) - { - /* Immediate. */ - int offset = ((given & 0xf00) >> 4) | (given & 0xf); - if (offset) - func (stream, ", #%s%d", - (((given & 0x00800000) == 0) - ? "-" : ""), offset); - } - else - { - /* Register. */ - func (stream, ", %s%s", - (((given & 0x00800000) == 0) - ? "-" : ""), - arm_regnames[given & 0xf]); - } - - func (stream, "]%s", - ((given & 0x00200000) != 0) ? "!" : ""); - } - else - { - /* Post-indexed. */ - if ((given & 0x00400000) == 0x00400000) - { - /* Immediate. */ - int offset = ((given & 0xf00) >> 4) | (given & 0xf); - if (offset) - func (stream, "], #%s%d", - (((given & 0x00800000) == 0) - ? "-" : ""), offset); - else - func (stream, "]"); - } - else - { - /* Register. */ - func (stream, "], %s%s", - (((given & 0x00800000) == 0) - ? "-" : ""), - arm_regnames[given & 0xf]); - } - } - } - break; - - case 'b': - { - int disp = (((given & 0xffffff) ^ 0x800000) - 0x800000); - info->print_address_func (disp*4 + pc + 8, info); - } - break; - - case 'c': - if (((given >> 28) & 0xf) != 0xe) - func (stream, "%s", - arm_conditional [(given >> 28) & 0xf]); - break; - - case 'm': - { - int started = 0; - int reg; - - func (stream, "{"); - for (reg = 0; reg < 16; reg++) - if ((given & (1 << reg)) != 0) - { - if (started) - func (stream, ", "); - started = 1; - func (stream, "%s", arm_regnames[reg]); - } - func (stream, "}"); - } - break; - - case 'q': - arm_decode_shift (given, func, stream, 0); - break; - - case 'o': - if ((given & 0x02000000) != 0) - { - int rotate = (given & 0xf00) >> 7; - int immed = (given & 0xff); - immed = (((immed << (32 - rotate)) - | (immed >> rotate)) & 0xffffffff); - func (stream, "#%d\t; 0x%x", immed, immed); - } - else - arm_decode_shift (given, func, stream, 1); - break; - - case 'p': - if ((given & 0x0000f000) == 0x0000f000) - func (stream, "p"); - break; - - case 't': - if ((given & 0x01200000) == 0x00200000) - func (stream, "t"); - break; - - case 'A': - func (stream, "[%s", arm_regnames [(given >> 16) & 0xf]); - - if ((given & (1 << 24)) != 0) - { - int offset = given & 0xff; - - if (offset) - func (stream, ", #%s%d]%s", - ((given & 0x00800000) == 0 ? "-" : ""), - offset * 4, - ((given & 0x00200000) != 0 ? "!" : "")); - else - func (stream, "]"); - } - else - { - int offset = given & 0xff; - - func (stream, "]"); - - if (given & (1 << 21)) - { - if (offset) - func (stream, ", #%s%d", - ((given & 0x00800000) == 0 ? "-" : ""), - offset * 4); - } - else - func (stream, ", {%d}", offset); - } - break; - - case 'B': - /* Print ARM V5 BLX(1) address: pc+25 bits. */ - { - bfd_vma address; - bfd_vma offset = 0; - - if (given & 0x00800000) - /* Is signed, hi bits should be ones. */ - offset = (-1) ^ 0x00ffffff; - - /* Offset is (SignExtend(offset field)<<2). */ - offset += given & 0x00ffffff; - offset <<= 2; - address = offset + pc + 8; - - if (given & 0x01000000) - /* H bit allows addressing to 2-byte boundaries. */ - address += 2; - - info->print_address_func (address, info); - } - break; - - case 'C': - func (stream, "_"); - if (given & 0x80000) - func (stream, "f"); - if (given & 0x40000) - func (stream, "s"); - if (given & 0x20000) - func (stream, "x"); - if (given & 0x10000) - func (stream, "c"); - break; - - case 'U': - switch (given & 0xf) - { - case 0xf: func(stream, "sy"); break; - case 0x7: func(stream, "un"); break; - case 0xe: func(stream, "st"); break; - case 0x6: func(stream, "unst"); break; - default: - func(stream, "#%d", (int)given & 0xf); - break; - } - break; - - case '0': case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': - { - int width; - unsigned long value; - - c = arm_decode_bitfield (c, given, &value, &width); - - switch (*c) - { - case 'r': - func (stream, "%s", arm_regnames[value]); - break; - case 'd': - func (stream, "%ld", value); - break; - case 'b': - func (stream, "%ld", value * 8); - break; - case 'W': - func (stream, "%ld", value + 1); - break; - case 'x': - func (stream, "0x%08lx", value); - - /* Some SWI instructions have special - meanings. */ - if ((given & 0x0fffffff) == 0x0FF00000) - func (stream, "\t; IMB"); - else if ((given & 0x0fffffff) == 0x0FF00001) - func (stream, "\t; IMBRange"); - break; - case 'X': - func (stream, "%01lx", value & 0xf); - break; - case '`': - c++; - if (value == 0) - func (stream, "%c", *c); - break; - case ''': - c++; - if (value == ((1ul << width) - 1)) - func (stream, "%c", *c); - break; - case '?': - func (stream, "%c", c[(1 << width) - (int)value]); - c += 1 << width; - break; - default: - abort (); - } - break; - - case 'e': - { - int imm; - - imm = (given & 0xf) | ((given & 0xfff00) >> 4); - func (stream, "%d", imm); - } - break; - - case 'E': - /* LSB and WIDTH fields of BFI or BFC. The machine- - language instruction encodes LSB and MSB. */ - { - long msb = (given & 0x001f0000) >> 16; - long lsb = (given & 0x00000f80) >> 7; - - long width = msb - lsb + 1; - if (width > 0) - func (stream, "#%lu, #%lu", lsb, width); - else - func (stream, "(invalid: %lu:%lu)", lsb, msb); - } - break; - - case 'V': - /* 16-bit unsigned immediate from a MOVT or MOVW - instruction, encoded in bits 0:11 and 15:19. */ - { - long hi = (given & 0x000f0000) >> 4; - long lo = (given & 0x00000fff); - long imm16 = hi | lo; - func (stream, "#%lu\t; 0x%lx", imm16, imm16); - } - break; - - default: - abort (); - } - } - } - else - func (stream, "%c", *c); - } - return; - } - } - abort (); -} - -/* Print one 16-bit Thumb instruction from PC on INFO->STREAM. */ - -static void -print_insn_thumb16 (bfd_vma pc, struct disassemble_info *info, long given) -{ - const struct opcode16 *insn; - void *stream = info->stream; - fprintf_ftype func = info->fprintf_func; - - for (insn = thumb_opcodes; insn->assembler; insn++) - if ((given & insn->mask) == insn->value) - { - const char *c = insn->assembler; - for (; *c; c++) - { - int domaskpc = 0; - int domasklr = 0; - - if (*c != '%') - { - func (stream, "%c", *c); - continue; - } - - switch (*++c) - { - case '%': - func (stream, "%%"); - break; - - case 'c': - if (ifthen_state) - func (stream, "%s", arm_conditional[IFTHEN_COND]); - break; - - case 'C': - if (ifthen_state) - func (stream, "%s", arm_conditional[IFTHEN_COND]); - else - func (stream, "s"); - break; - - case 'I': - { - unsigned int tmp; - - ifthen_next_state = given & 0xff; - for (tmp = given << 1; tmp & 0xf; tmp <<= 1) - func (stream, ((given ^ tmp) & 0x10) ? "e" : "t"); - func (stream, "\t%s", arm_conditional[(given >> 4) & 0xf]); - } - break; - - case 'x': - if (ifthen_next_state) - func (stream, "\t; unpredictable branch in IT block\n"); - break; - - case 'X': - if (ifthen_state) - func (stream, "\t; unpredictable IT:%s", - arm_conditional[IFTHEN_COND]); - break; - - case 'S': - { - long reg; - - reg = (given >> 3) & 0x7; - if (given & (1 << 6)) - reg += 8; - - func (stream, "%s", arm_regnames[reg]); - } - break; - - case 'D': - { - long reg; - - reg = given & 0x7; - if (given & (1 << 7)) - reg += 8; - - func (stream, "%s", arm_regnames[reg]); - } - break; - - case 'N': - if (given & (1 << 8)) - domasklr = 1; - /* Fall through. */ - case 'O': - if (*c == 'O' && (given & (1 << 8))) - domaskpc = 1; - /* Fall through. */ - case 'M': - { - int started = 0; - int reg; - - func (stream, "{"); - - /* It would be nice if we could spot - ranges, and generate the rS-rE format: */ - for (reg = 0; (reg < 8); reg++) - if ((given & (1 << reg)) != 0) - { - if (started) - func (stream, ", "); - started = 1; - func (stream, "%s", arm_regnames[reg]); - } - - if (domasklr) - { - if (started) - func (stream, ", "); - started = 1; - func (stream, arm_regnames[14] /* "lr" */); - } - - if (domaskpc) - { - if (started) - func (stream, ", "); - func (stream, arm_regnames[15] /* "pc" */); - } - - func (stream, "}"); - } - break; - - case 'b': - /* Print ARM V6T2 CZB address: pc+4+6 bits. */ - { - bfd_vma address = (pc + 4 - + ((given & 0x00f8) >> 2) - + ((given & 0x0200) >> 3)); - info->print_address_func (address, info); - } - break; - - case 's': - /* Right shift immediate -- bits 6..10; 1-31 print - as themselves, 0 prints as 32. */ - { - long imm = (given & 0x07c0) >> 6; - if (imm == 0) - imm = 32; - func (stream, "#%ld", imm); - } - break; - - case '0': case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': - { - int bitstart = *c++ - '0'; - int bitend = 0; - - while (*c >= '0' && *c <= '9') - bitstart = (bitstart * 10) + *c++ - '0'; - - switch (*c) - { - case '-': - { - long reg; - - c++; - while (*c >= '0' && *c <= '9') - bitend = (bitend * 10) + *c++ - '0'; - if (!bitend) - abort (); - reg = given >> bitstart; - reg &= (2 << (bitend - bitstart)) - 1; - switch (*c) - { - case 'r': - func (stream, "%s", arm_regnames[reg]); - break; - - case 'd': - func (stream, "%ld", reg); - break; - - case 'H': - func (stream, "%ld", reg << 1); - break; - - case 'W': - func (stream, "%ld", reg << 2); - break; - - case 'a': - /* PC-relative address -- the bottom two - bits of the address are dropped - before the calculation. */ - info->print_address_func - (((pc + 4) & ~3) + (reg << 2), info); - break; - - case 'x': - func (stream, "0x%04lx", reg); - break; - - case 'B': - reg = ((reg ^ (1 << bitend)) - (1 << bitend)); - info->print_address_func (reg * 2 + pc + 4, info); - break; - - case 'c': - func (stream, "%s", arm_conditional [reg]); - break; - - default: - abort (); - } - } - break; - - case ''': - c++; - if ((given & (1 << bitstart)) != 0) - func (stream, "%c", *c); - break; - - case '?': - ++c; - if ((given & (1 << bitstart)) != 0) - func (stream, "%c", *c++); - else - func (stream, "%c", *++c); - break; - - default: - abort (); - } - } - break; - - default: - abort (); - } - } - return; - } - - /* No match. */ - abort (); -} - -/* Return the name of an V7M special register. */ -static const char * -psr_name (int regno) -{ - switch (regno) - { - case 0: return "APSR"; - case 1: return "IAPSR"; - case 2: return "EAPSR"; - case 3: return "PSR"; - case 5: return "IPSR"; - case 6: return "EPSR"; - case 7: return "IEPSR"; - case 8: return "MSP"; - case 9: return "PSP"; - case 16: return "PRIMASK"; - case 17: return "BASEPRI"; - case 18: return "BASEPRI_MASK"; - case 19: return "FAULTMASK"; - case 20: return "CONTROL"; - default: return "<unknown>"; - } -} - -/* Print one 32-bit Thumb instruction from PC on INFO->STREAM. */ - -static void -print_insn_thumb32 (bfd_vma pc, struct disassemble_info *info, long given) -{ - const struct opcode32 *insn; - void *stream = info->stream; - fprintf_ftype func = info->fprintf_func; - - if (print_insn_coprocessor (pc, info, given, TRUE)) - return; - - if (print_insn_neon (info, given, TRUE)) - return; - - for (insn = thumb32_opcodes; insn->assembler; insn++) - if ((given & insn->mask) == insn->value) - { - const char *c = insn->assembler; - for (; *c; c++) - { - if (*c != '%') - { - func (stream, "%c", *c); - continue; - } - - switch (*++c) - { - case '%': - func (stream, "%%"); - break; - - case 'c': - if (ifthen_state) - func (stream, "%s", arm_conditional[IFTHEN_COND]); - break; - - case 'x': - if (ifthen_next_state) - func (stream, "\t; unpredictable branch in IT block\n"); - break; - - case 'X': - if (ifthen_state) - func (stream, "\t; unpredictable IT:%s", - arm_conditional[IFTHEN_COND]); - break; - - case 'I': - { - unsigned int imm12 = 0; - imm12 |= (given & 0x000000ffu); - imm12 |= (given & 0x00007000u) >> 4; - imm12 |= (given & 0x04000000u) >> 15; - func (stream, "#%u\t; 0x%x", imm12, imm12); - } - break; - - case 'M': - { - unsigned int bits = 0, imm, imm8, mod; - bits |= (given & 0x000000ffu); - bits |= (given & 0x00007000u) >> 4; - bits |= (given & 0x04000000u) >> 15; - imm8 = (bits & 0x0ff); - mod = (bits & 0xf00) >> 8; - switch (mod) - { - case 0: imm = imm8; break; - case 1: imm = ((imm8<<16) | imm8); break; - case 2: imm = ((imm8<<24) | (imm8 << 8)); break; - case 3: imm = ((imm8<<24) | (imm8 << 16) | (imm8 << 8) | imm8); break; - default: - mod = (bits & 0xf80) >> 7; - imm8 = (bits & 0x07f) | 0x80; - imm = (((imm8 << (32 - mod)) | (imm8 >> mod)) & 0xffffffff); - } - func (stream, "#%u\t; 0x%x", imm, imm); - } - break; - - case 'J': - { - unsigned int imm = 0; - imm |= (given & 0x000000ffu); - imm |= (given & 0x00007000u) >> 4; - imm |= (given & 0x04000000u) >> 15; - imm |= (given & 0x000f0000u) >> 4; - func (stream, "#%u\t; 0x%x", imm, imm); - } - break; - - case 'K': - { - unsigned int imm = 0; - imm |= (given & 0x000f0000u) >> 16; - imm |= (given & 0x00000ff0u) >> 0; - imm |= (given & 0x0000000fu) << 12; - func (stream, "#%u\t; 0x%x", imm, imm); - } - break; - - case 'S': - { - unsigned int reg = (given & 0x0000000fu); - unsigned int stp = (given & 0x00000030u) >> 4; - unsigned int imm = 0; - imm |= (given & 0x000000c0u) >> 6; - imm |= (given & 0x00007000u) >> 10; - - func (stream, "%s", arm_regnames[reg]); - switch (stp) - { - case 0: - if (imm > 0) - func (stream, ", lsl #%u", imm); - break; - - case 1: - if (imm == 0) - imm = 32; - func (stream, ", lsr #%u", imm); - break; - - case 2: - if (imm == 0) - imm = 32; - func (stream, ", asr #%u", imm); - break; - - case 3: - if (imm == 0) - func (stream, ", rrx"); - else - func (stream, ", ror #%u", imm); - } - } - break; - - case 'a': - { - unsigned int Rn = (given & 0x000f0000) >> 16; - unsigned int U = (given & 0x00800000) >> 23; - unsigned int op = (given & 0x00000f00) >> 8; - unsigned int i12 = (given & 0x00000fff); - unsigned int i8 = (given & 0x000000ff); - bfd_boolean writeback = FALSE, postind = FALSE; - int offset = 0; - - func (stream, "[%s", arm_regnames[Rn]); - if (U) /* 12-bit positive immediate offset */ - offset = i12; - else if (Rn == 15) /* 12-bit negative immediate offset */ - offset = -(int)i12; - else if (op == 0x0) /* shifted register offset */ - { - unsigned int Rm = (i8 & 0x0f); - unsigned int sh = (i8 & 0x30) >> 4; - func (stream, ", %s", arm_regnames[Rm]); - if (sh) - func (stream, ", lsl #%u", sh); - func (stream, "]"); - break; - } - else switch (op) - { - case 0xE: /* 8-bit positive immediate offset */ - offset = i8; - break; - - case 0xC: /* 8-bit negative immediate offset */ - offset = -i8; - break; - - case 0xF: /* 8-bit + preindex with wb */ - offset = i8; - writeback = TRUE; - break; - - case 0xD: /* 8-bit - preindex with wb */ - offset = -i8; - writeback = TRUE; - break; - - case 0xB: /* 8-bit + postindex */ - offset = i8; - postind = TRUE; - break; - - case 0x9: /* 8-bit - postindex */ - offset = -i8; - postind = TRUE; - break; - - default: - func (stream, ", <undefined>]"); - goto skip; - } - - if (postind) - func (stream, "], #%d", offset); - else - { - if (offset) - func (stream, ", #%d", offset); - func (stream, writeback ? "]!" : "]"); - } - - if (Rn == 15) - { - func (stream, "\t; "); - info->print_address_func (((pc + 4) & ~3) + offset, info); - } - } - skip: - break; - - case 'A': - { - unsigned int P = (given & 0x01000000) >> 24; - unsigned int U = (given & 0x00800000) >> 23; - unsigned int W = (given & 0x00400000) >> 21; - unsigned int Rn = (given & 0x000f0000) >> 16; - unsigned int off = (given & 0x000000ff); - - func (stream, "[%s", arm_regnames[Rn]); - if (P) - { - if (off || !U) - func (stream, ", #%c%u", U ? '+' : '-', off * 4); - func (stream, "]"); - if (W) - func (stream, "!"); - } - else - { - func (stream, "], "); - if (W) - func (stream, "#%c%u", U ? '+' : '-', off * 4); - else - func (stream, "{%u}", off); - } - } - break; - - case 'w': - { - unsigned int Sbit = (given & 0x01000000) >> 24; - unsigned int type = (given & 0x00600000) >> 21; - switch (type) - { - case 0: func (stream, Sbit ? "sb" : "b"); break; - case 1: func (stream, Sbit ? "sh" : "h"); break; - case 2: - if (Sbit) - func (stream, "??"); - break; - case 3: - func (stream, "??"); - break; - } - } - break; - - case 'm': - { - int started = 0; - int reg; - - func (stream, "{"); - for (reg = 0; reg < 16; reg++) - if ((given & (1 << reg)) != 0) - { - if (started) - func (stream, ", "); - started = 1; - func (stream, "%s", arm_regnames[reg]); - } - func (stream, "}"); - } - break; - - case 'E': - { - unsigned int msb = (given & 0x0000001f); - unsigned int lsb = 0; - lsb |= (given & 0x000000c0u) >> 6; - lsb |= (given & 0x00007000u) >> 10; - func (stream, "#%u, #%u", lsb, msb - lsb + 1); - } - break; - - case 'F': - { - unsigned int width = (given & 0x0000001f) + 1; - unsigned int lsb = 0; - lsb |= (given & 0x000000c0u) >> 6; - lsb |= (given & 0x00007000u) >> 10; - func (stream, "#%u, #%u", lsb, width); - } - break; - - case 'b': - { - unsigned int S = (given & 0x04000000u) >> 26; - unsigned int J1 = (given & 0x00002000u) >> 13; - unsigned int J2 = (given & 0x00000800u) >> 11; - int offset = 0; - - offset |= !S << 20; - offset |= J2 << 19; - offset |= J1 << 18; - offset |= (given & 0x003f0000) >> 4; - offset |= (given & 0x000007ff) << 1; - offset -= (1 << 20); - - info->print_address_func (pc + 4 + offset, info); - } - break; - - case 'B': - { - unsigned int S = (given & 0x04000000u) >> 26; - unsigned int I1 = (given & 0x00002000u) >> 13; - unsigned int I2 = (given & 0x00000800u) >> 11; - int offset = 0; - - offset |= !S << 24; - offset |= !(I1 ^ S) << 23; - offset |= !(I2 ^ S) << 22; - offset |= (given & 0x03ff0000u) >> 4; - offset |= (given & 0x000007ffu) << 1; - offset -= (1 << 24); - offset += pc + 4; - - /* BLX target addresses are always word aligned. */ - if ((given & 0x00001000u) == 0) - offset &= ~2u; - - info->print_address_func (offset, info); - } - break; - - case 's': - { - unsigned int shift = 0; - shift |= (given & 0x000000c0u) >> 6; - shift |= (given & 0x00007000u) >> 10; - if (given & 0x00200000u) - func (stream, ", asr #%u", shift); - else if (shift) - func (stream, ", lsl #%u", shift); - /* else print nothing - lsl #0 */ - } - break; - - case 'R': - { - unsigned int rot = (given & 0x00000030) >> 4; - if (rot) - func (stream, ", ror #%u", rot * 8); - } - break; - - case 'U': - switch (given & 0xf) - { - case 0xf: func(stream, "sy"); break; - case 0x7: func(stream, "un"); break; - case 0xe: func(stream, "st"); break; - case 0x6: func(stream, "unst"); break; - default: - func(stream, "#%d", (int)given & 0xf); - break; - } - break; - - case 'C': - if ((given & 0xff) == 0) - { - func (stream, "%cPSR_", (given & 0x100000) ? 'S' : 'C'); - if (given & 0x800) - func (stream, "f"); - if (given & 0x400) - func (stream, "s"); - if (given & 0x200) - func (stream, "x"); - if (given & 0x100) - func (stream, "c"); - } - else - { - func (stream, psr_name (given & 0xff)); - } - break; - - case 'D': - if ((given & 0xff) == 0) - func (stream, "%cPSR", (given & 0x100000) ? 'S' : 'C'); - else - func (stream, psr_name (given & 0xff)); - break; - - case '0': case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': - { - int width; - unsigned long val; - - c = arm_decode_bitfield (c, given, &val, &width); - - switch (*c) - { - case 'd': func (stream, "%lu", val); break; - case 'W': func (stream, "%lu", val * 4); break; - case 'r': func (stream, "%s", arm_regnames[val]); break; - - case 'c': - func (stream, "%s", arm_conditional[val]); - break; - - case ''': - c++; - if (val == ((1ul << width) - 1)) - func (stream, "%c", *c); - break; - - case '`': - c++; - if (val == 0) - func (stream, "%c", *c); - break; - - case '?': - func (stream, "%c", c[(1 << width) - (int)val]); - c += 1 << width; - break; - - default: - abort (); - } - } - break; - - default: - abort (); - } - } - return; - } - - /* No match. */ - abort (); -} - -/* Print data bytes on INFO->STREAM. */ - -static void -print_insn_data (bfd_vma pc ATTRIBUTE_UNUSED, struct disassemble_info *info, - long given) -{ - switch (info->bytes_per_chunk) - { - case 1: - info->fprintf_func (info->stream, ".byte\t0x%02lx", given); - break; - case 2: - info->fprintf_func (info->stream, ".short\t0x%04lx", given); - break; - case 4: - info->fprintf_func (info->stream, ".word\t0x%08lx", given); - break; - default: - abort (); - } -} - -/* Search back through the insn stream to determine if this instruction is - conditionally executed. */ -static void -find_ifthen_state (bfd_vma pc, struct disassemble_info *info, - bfd_boolean little) -{ - unsigned char b[2]; - unsigned int insn; - int status; - /* COUNT is twice the number of instructions seen. It will be odd if we - just crossed an instruction boundary. */ - int count; - int it_count; - unsigned int seen_it; - bfd_vma addr; - - ifthen_address = pc; - ifthen_state = 0; - - addr = pc; - count = 1; - it_count = 0; - seen_it = 0; - /* Scan backwards looking for IT instructions, keeping track of where - instruction boundaries are. We don't know if something is actually an - IT instruction until we find a definite instruction boundary. */ - for (;;) - { - if (addr == 0 || info->symbol_at_address_func(addr, info)) - { - /* A symbol must be on an instruction boundary, and will not - be within an IT block. */ - if (seen_it && (count & 1)) - break; - - return; - } - addr -= 2; - status = info->read_memory_func (addr, (bfd_byte *)b, 2, info); - if (status) - return; - - if (little) - insn = (b[0]) | (b[1] << 8); - else - insn = (b[1]) | (b[0] << 8); - if (seen_it) - { - if ((insn & 0xf800) < 0xe800) - { - /* Addr + 2 is an instruction boundary. See if this matches - the expected boundary based on the position of the last - IT candidate. */ - if (count & 1) - break; - seen_it = 0; - } - } - if ((insn & 0xff00) == 0xbf00 && (insn & 0xf) != 0) - { - /* This could be an IT instruction. */ - seen_it = insn; - it_count = count >> 1; - } - if ((insn & 0xf800) >= 0xe800) - count++; - else - count = (count + 2) | 1; - /* IT blocks contain at most 4 instructions. */ - if (count >= 8 && !seen_it) - return; - } - /* We found an IT instruction. */ - ifthen_state = (seen_it & 0xe0) | ((seen_it << it_count) & 0x1f); - if ((ifthen_state & 0xf) == 0) - ifthen_state = 0; -} - -/* NOTE: There are no checks in these routines that - the relevant number of data bytes exist. */ - -int -print_insn_arm (bfd_vma pc, struct disassemble_info *info) -{ - unsigned char b[4]; - long given; - int status; - int is_thumb = FALSE; - int is_data = FALSE; - unsigned int size = 4; - void (*printer) (bfd_vma, struct disassemble_info *, long); -#if 0 - bfd_boolean found = FALSE; - - if (info->disassembler_options) - { - parse_disassembler_options (info->disassembler_options); - - /* To avoid repeated parsing of these options, we remove them here. */ - info->disassembler_options = NULL; - } - - /* First check the full symtab for a mapping symbol, even if there - are no usable non-mapping symbols for this address. */ - if (info->symtab != NULL - && bfd_asymbol_flavour (*info->symtab) == bfd_target_elf_flavour) - { - bfd_vma addr; - int n; - int last_sym = -1; - enum map_type type = MAP_ARM; - - if (pc <= last_mapping_addr) - last_mapping_sym = -1; - is_thumb = (last_type == MAP_THUMB); - found = FALSE; - /* Start scanning at the start of the function, or wherever - we finished last time. */ - n = info->symtab_pos + 1; - if (n < last_mapping_sym) - n = last_mapping_sym; - - /* Scan up to the location being disassembled. */ - for (; n < info->symtab_size; n++) - { - addr = bfd_asymbol_value (info->symtab[n]); - if (addr > pc) - break; - if ((info->section == NULL - || info->section == info->symtab[n]->section) - && get_sym_code_type (info, n, &type)) - { - last_sym = n; - found = TRUE; - } - } - - if (!found) - { - n = info->symtab_pos; - if (n < last_mapping_sym - 1) - n = last_mapping_sym - 1; - - /* No mapping symbol found at this address. Look backwards - for a preceeding one. */ - for (; n >= 0; n--) - { - if (get_sym_code_type (info, n, &type)) - { - last_sym = n; - found = TRUE; - break; - } - } - } - - last_mapping_sym = last_sym; - last_type = type; - is_thumb = (last_type == MAP_THUMB); - is_data = (last_type == MAP_DATA); - - /* Look a little bit ahead to see if we should print out - two or four bytes of data. If there's a symbol, - mapping or otherwise, after two bytes then don't - print more. */ - if (is_data) - { - size = 4 - (pc & 3); - for (n = last_sym + 1; n < info->symtab_size; n++) - { - addr = bfd_asymbol_value (info->symtab[n]); - if (addr > pc) - { - if (addr - pc < size) - size = addr - pc; - break; - } - } - /* If the next symbol is after three bytes, we need to - print only part of the data, so that we can use either - .byte or .short. */ - if (size == 3) - size = (pc & 1) ? 1 : 2; - } - } - - if (info->symbols != NULL) - { - if (bfd_asymbol_flavour (*info->symbols) == bfd_target_coff_flavour) - { - coff_symbol_type * cs; - - cs = coffsymbol (*info->symbols); - is_thumb = ( cs->native->u.syment.n_sclass == C_THUMBEXT - || cs->native->u.syment.n_sclass == C_THUMBSTAT - || cs->native->u.syment.n_sclass == C_THUMBLABEL - || cs->native->u.syment.n_sclass == C_THUMBEXTFUNC - || cs->native->u.syment.n_sclass == C_THUMBSTATFUNC); - } - else if (bfd_asymbol_flavour (*info->symbols) == bfd_target_elf_flavour - && !found) - { - /* If no mapping symbol has been found then fall back to the type - of the function symbol. */ - elf_symbol_type * es; - unsigned int type; - - es = *(elf_symbol_type **)(info->symbols); - type = ELF_ST_TYPE (es->internal_elf_sym.st_info); - - is_thumb = (type == STT_ARM_TFUNC) || (type == STT_ARM_16BIT); - } - } -#else - int little; - - little = (info->endian == BFD_ENDIAN_LITTLE); - is_thumb |= (pc & 1); - pc &= ~(bfd_vma)1; -#endif - - if (force_thumb) - is_thumb = TRUE; - - info->bytes_per_line = 4; - - if (is_data) - { - int i; - - /* size was already set above. */ - info->bytes_per_chunk = size; - printer = print_insn_data; - - status = info->read_memory_func (pc, (bfd_byte *)b, size, info); - given = 0; - if (little) - for (i = size - 1; i >= 0; i--) - given = b[i] | (given << 8); - else - for (i = 0; i < (int) size; i++) - given = b[i] | (given << 8); - } - else if (!is_thumb) - { - /* In ARM mode endianness is a straightforward issue: the instruction - is four bytes long and is either ordered 0123 or 3210. */ - printer = print_insn_arm_internal; - info->bytes_per_chunk = 4; - size = 4; - - status = info->read_memory_func (pc, (bfd_byte *)b, 4, info); - if (little) - given = (b[0]) | (b[1] << 8) | (b[2] << 16) | (b[3] << 24); - else - given = (b[3]) | (b[2] << 8) | (b[1] << 16) | (b[0] << 24); - } - else - { - /* In Thumb mode we have the additional wrinkle of two - instruction lengths. Fortunately, the bits that determine - the length of the current instruction are always to be found - in the first two bytes. */ - printer = print_insn_thumb16; - info->bytes_per_chunk = 2; - size = 2; - - status = info->read_memory_func (pc, (bfd_byte *)b, 2, info); - if (little) - given = (b[0]) | (b[1] << 8); - else - given = (b[1]) | (b[0] << 8); - - if (!status) - { - /* These bit patterns signal a four-byte Thumb - instruction. */ - if ((given & 0xF800) == 0xF800 - || (given & 0xF800) == 0xF000 - || (given & 0xF800) == 0xE800) - { - status = info->read_memory_func (pc + 2, (bfd_byte *)b, 2, info); - if (little) - given = (b[0]) | (b[1] << 8) | (given << 16); - else - given = (b[1]) | (b[0] << 8) | (given << 16); - - printer = print_insn_thumb32; - size = 4; - } - } - - if (ifthen_address != pc) - find_ifthen_state(pc, info, little); - - if (ifthen_state) - { - if ((ifthen_state & 0xf) == 0x8) - ifthen_next_state = 0; - else - ifthen_next_state = (ifthen_state & 0xe0) - | ((ifthen_state & 0xf) << 1); - } - } - - if (status) - { - info->memory_error_func (status, pc, info); - return -1; - } - if (info->flags & INSN_HAS_RELOC) - /* If the instruction has a reloc associated with it, then - the offset field in the instruction will actually be the - addend for the reloc. (We are using REL type relocs). - In such cases, we can ignore the pc when computing - addresses, since the addend is not currently pc-relative. */ - pc = 0; - - printer (pc, info, given); - - if (is_thumb) - { - ifthen_state = ifthen_next_state; - ifthen_address += size; - } - return size; -} diff --git a/qemu-0.11.0/arm-semi.c b/qemu-0.11.0/arm-semi.c deleted file mode 100644 index 5239ffc..0000000 --- a/qemu-0.11.0/arm-semi.c +++ /dev/null @@ -1,468 +0,0 @@ -/* - * Arm "Angel" semihosting syscalls - * - * Copyright (c) 2005, 2007 CodeSourcery. - * Written by Paul Brook. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see http://www.gnu.org/licenses/. - */ - -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <unistd.h> -#include <stdlib.h> -#include <stdio.h> -#include <time.h> - -#include "cpu.h" -#ifdef CONFIG_USER_ONLY -#include "qemu.h" - -#define ARM_ANGEL_HEAP_SIZE (128 * 1024 * 1024) -#else -#include "qemu-common.h" -#include "sysemu.h" -#include "gdbstub.h" -#endif - -#define SYS_OPEN 0x01 -#define SYS_CLOSE 0x02 -#define SYS_WRITEC 0x03 -#define SYS_WRITE0 0x04 -#define SYS_WRITE 0x05 -#define SYS_READ 0x06 -#define SYS_READC 0x07 -#define SYS_ISTTY 0x09 -#define SYS_SEEK 0x0a -#define SYS_FLEN 0x0c -#define SYS_TMPNAM 0x0d -#define SYS_REMOVE 0x0e -#define SYS_RENAME 0x0f -#define SYS_CLOCK 0x10 -#define SYS_TIME 0x11 -#define SYS_SYSTEM 0x12 -#define SYS_ERRNO 0x13 -#define SYS_GET_CMDLINE 0x15 -#define SYS_HEAPINFO 0x16 -#define SYS_EXIT 0x18 - -#ifndef O_BINARY -#define O_BINARY 0 -#endif - -#define GDB_O_RDONLY 0x000 -#define GDB_O_WRONLY 0x001 -#define GDB_O_RDWR 0x002 -#define GDB_O_APPEND 0x008 -#define GDB_O_CREAT 0x200 -#define GDB_O_TRUNC 0x400 -#define GDB_O_BINARY 0 - -static int gdb_open_modeflags[12] = { - GDB_O_RDONLY, - GDB_O_RDONLY | GDB_O_BINARY, - GDB_O_RDWR, - GDB_O_RDWR | GDB_O_BINARY, - GDB_O_WRONLY | GDB_O_CREAT | GDB_O_TRUNC, - GDB_O_WRONLY | GDB_O_CREAT | GDB_O_TRUNC | GDB_O_BINARY, - GDB_O_RDWR | GDB_O_CREAT | GDB_O_TRUNC, - GDB_O_RDWR | GDB_O_CREAT | GDB_O_TRUNC | GDB_O_BINARY, - GDB_O_WRONLY | GDB_O_CREAT | GDB_O_APPEND, - GDB_O_WRONLY | GDB_O_CREAT | GDB_O_APPEND | GDB_O_BINARY, - GDB_O_RDWR | GDB_O_CREAT | GDB_O_APPEND, - GDB_O_RDWR | GDB_O_CREAT | GDB_O_APPEND | GDB_O_BINARY -}; - -static int open_modeflags[12] = { - O_RDONLY, - O_RDONLY | O_BINARY, - O_RDWR, - O_RDWR | O_BINARY, - O_WRONLY | O_CREAT | O_TRUNC, - O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, - O_RDWR | O_CREAT | O_TRUNC, - O_RDWR | O_CREAT | O_TRUNC | O_BINARY, - O_WRONLY | O_CREAT | O_APPEND, - O_WRONLY | O_CREAT | O_APPEND | O_BINARY, - O_RDWR | O_CREAT | O_APPEND, - O_RDWR | O_CREAT | O_APPEND | O_BINARY -}; - -#ifdef CONFIG_USER_ONLY -static inline uint32_t set_swi_errno(TaskState *ts, uint32_t code) -{ - if (code == (uint32_t)-1) - ts->swi_errno = errno; - return code; -} -#else -static inline uint32_t set_swi_errno(CPUState *env, uint32_t code) -{ - return code; -} - -#include "softmmu-semi.h" -#endif - -static target_ulong arm_semi_syscall_len; - -#if !defined(CONFIG_USER_ONLY) -static target_ulong syscall_err; -#endif - -static void arm_semi_cb(CPUState *env, target_ulong ret, target_ulong err) -{ -#ifdef CONFIG_USER_ONLY - TaskState *ts = env->opaque; -#endif - - if (ret == (target_ulong)-1) { -#ifdef CONFIG_USER_ONLY - ts->swi_errno = err; -#else - syscall_err = err; -#endif - env->regs[0] = ret; - } else { - /* Fixup syscalls that use nonstardard return conventions. */ - switch (env->regs[0]) { - case SYS_WRITE: - case SYS_READ: - env->regs[0] = arm_semi_syscall_len - ret; - break; - case SYS_SEEK: - env->regs[0] = 0; - break; - default: - env->regs[0] = ret; - break; - } - } -} - -static void arm_semi_flen_cb(CPUState *env, target_ulong ret, target_ulong err) -{ - /* The size is always stored in big-endian order, extract - the value. We assume the size always fit in 32 bits. */ - uint32_t size; - cpu_memory_rw_debug(env, env->regs[13]-64+32, (uint8_t *)&size, 4, 0); - env->regs[0] = be32_to_cpu(size); -#ifdef CONFIG_USER_ONLY - ((TaskState *)env->opaque)->swi_errno = err; -#else - syscall_err = err; -#endif -} - -#define ARG(n) \ -({ \ - target_ulong __arg; \ - /* FIXME - handle get_user() failure */ \ - get_user_ual(__arg, args + (n) * 4); \ - __arg; \ -}) -#define SET_ARG(n, val) put_user_ual(val, args + (n) * 4) -uint32_t do_arm_semihosting(CPUState *env) -{ - target_ulong args; - char * s; - int nr; - uint32_t ret; - uint32_t len; -#ifdef CONFIG_USER_ONLY - TaskState *ts = env->opaque; -#else - CPUState *ts = env; -#endif - - nr = env->regs[0]; - args = env->regs[1]; - switch (nr) { - case SYS_OPEN: - if (!(s = lock_user_string(ARG(0)))) - /* FIXME - should this error code be -TARGET_EFAULT ? */ - return (uint32_t)-1; - if (ARG(1) >= 12) - return (uint32_t)-1; - if (strcmp(s, ":tt") == 0) { - if (ARG(1) < 4) - return STDIN_FILENO; - else - return STDOUT_FILENO; - } - if (use_gdb_syscalls()) { - gdb_do_syscall(arm_semi_cb, "open,%s,%x,1a4", ARG(0), - (int)ARG(2)+1, gdb_open_modeflags[ARG(1)]); - return env->regs[0]; - } else { - ret = set_swi_errno(ts, open(s, open_modeflags[ARG(1)], 0644)); - } - unlock_user(s, ARG(0), 0); - return ret; - case SYS_CLOSE: - if (use_gdb_syscalls()) { - gdb_do_syscall(arm_semi_cb, "close,%x", ARG(0)); - return env->regs[0]; - } else { - return set_swi_errno(ts, close(ARG(0))); - } - case SYS_WRITEC: - { - char c; - - if (get_user_u8(c, args)) - /* FIXME - should this error code be -TARGET_EFAULT ? */ - return (uint32_t)-1; - /* Write to debug console. stderr is near enough. */ - if (use_gdb_syscalls()) { - gdb_do_syscall(arm_semi_cb, "write,2,%x,1", args); - return env->regs[0]; - } else { - return write(STDERR_FILENO, &c, 1); - } - } - case SYS_WRITE0: - if (!(s = lock_user_string(args))) - /* FIXME - should this error code be -TARGET_EFAULT ? */ - return (uint32_t)-1; - len = strlen(s); - if (use_gdb_syscalls()) { - gdb_do_syscall(arm_semi_cb, "write,2,%x,%x\n", args, len); - ret = env->regs[0]; - } else { - ret = write(STDERR_FILENO, s, len); - } - unlock_user(s, args, 0); - return ret; - case SYS_WRITE: - len = ARG(2); - if (use_gdb_syscalls()) { - arm_semi_syscall_len = len; - gdb_do_syscall(arm_semi_cb, "write,%x,%x,%x", ARG(0), ARG(1), len); - return env->regs[0]; - } else { - if (!(s = lock_user(VERIFY_READ, ARG(1), len, 1))) - /* FIXME - should this error code be -TARGET_EFAULT ? */ - return (uint32_t)-1; - ret = set_swi_errno(ts, write(ARG(0), s, len)); - unlock_user(s, ARG(1), 0); - if (ret == (uint32_t)-1) - return -1; - return len - ret; - } - case SYS_READ: - len = ARG(2); - if (use_gdb_syscalls()) { - arm_semi_syscall_len = len; - gdb_do_syscall(arm_semi_cb, "read,%x,%x,%x", ARG(0), ARG(1), len); - return env->regs[0]; - } else { - if (!(s = lock_user(VERIFY_WRITE, ARG(1), len, 0))) - /* FIXME - should this error code be -TARGET_EFAULT ? */ - return (uint32_t)-1; - do - ret = set_swi_errno(ts, read(ARG(0), s, len)); - while (ret == -1 && errno == EINTR); - unlock_user(s, ARG(1), len); - if (ret == (uint32_t)-1) - return -1; - return len - ret; - } - case SYS_READC: - /* XXX: Read from debug cosole. Not implemented. */ - return 0; - case SYS_ISTTY: - if (use_gdb_syscalls()) { - gdb_do_syscall(arm_semi_cb, "isatty,%x", ARG(0)); - return env->regs[0]; - } else { - return isatty(ARG(0)); - } - case SYS_SEEK: - if (use_gdb_syscalls()) { - gdb_do_syscall(arm_semi_cb, "lseek,%x,%x,0", ARG(0), ARG(1)); - return env->regs[0]; - } else { - ret = set_swi_errno(ts, lseek(ARG(0), ARG(1), SEEK_SET)); - if (ret == (uint32_t)-1) - return -1; - return 0; - } - case SYS_FLEN: - if (use_gdb_syscalls()) { - gdb_do_syscall(arm_semi_flen_cb, "fstat,%x,%x", - ARG(0), env->regs[13]-64); - return env->regs[0]; - } else { - struct stat buf; - ret = set_swi_errno(ts, fstat(ARG(0), &buf)); - if (ret == (uint32_t)-1) - return -1; - return buf.st_size; - } - case SYS_TMPNAM: - /* XXX: Not implemented. */ - return -1; - case SYS_REMOVE: - if (use_gdb_syscalls()) { - gdb_do_syscall(arm_semi_cb, "unlink,%s", ARG(0), (int)ARG(1)+1); - ret = env->regs[0]; - } else { - if (!(s = lock_user_string(ARG(0)))) - /* FIXME - should this error code be -TARGET_EFAULT ? */ - return (uint32_t)-1; - ret = set_swi_errno(ts, remove(s)); - unlock_user(s, ARG(0), 0); - } - return ret; - case SYS_RENAME: - if (use_gdb_syscalls()) { - gdb_do_syscall(arm_semi_cb, "rename,%s,%s", - ARG(0), (int)ARG(1)+1, ARG(2), (int)ARG(3)+1); - return env->regs[0]; - } else { - char *s2; - s = lock_user_string(ARG(0)); - s2 = lock_user_string(ARG(2)); - if (!s || !s2) - /* FIXME - should this error code be -TARGET_EFAULT ? */ - ret = (uint32_t)-1; - else - ret = set_swi_errno(ts, rename(s, s2)); - if (s2) - unlock_user(s2, ARG(2), 0); - if (s) - unlock_user(s, ARG(0), 0); - return ret; - } - case SYS_CLOCK: - return clock() / (CLOCKS_PER_SEC / 100); - case SYS_TIME: - return set_swi_errno(ts, time(NULL)); - case SYS_SYSTEM: - if (use_gdb_syscalls()) { - gdb_do_syscall(arm_semi_cb, "system,%s", ARG(0), (int)ARG(1)+1); - return env->regs[0]; - } else { - if (!(s = lock_user_string(ARG(0)))) - /* FIXME - should this error code be -TARGET_EFAULT ? */ - return (uint32_t)-1; - ret = set_swi_errno(ts, system(s)); - unlock_user(s, ARG(0), 0); - return ret; - } - case SYS_ERRNO: -#ifdef CONFIG_USER_ONLY - return ts->swi_errno; -#else - return syscall_err; -#endif - case SYS_GET_CMDLINE: -#ifdef CONFIG_USER_ONLY - /* Build a commandline from the original argv. */ - { - char **arg = ts->info->host_argv; - int len = ARG(1); - /* lock the buffer on the ARM side */ - char *cmdline_buffer = (char*)lock_user(VERIFY_WRITE, ARG(0), len, 0); - - if (!cmdline_buffer) - /* FIXME - should this error code be -TARGET_EFAULT ? */ - return (uint32_t)-1; - - s = cmdline_buffer; - while (*arg && len > 2) { - int n = strlen(*arg); - - if (s != cmdline_buffer) { - *(s++) = ' '; - len--; - } - if (n >= len) - n = len - 1; - memcpy(s, *arg, n); - s += n; - len -= n; - arg++; - } - /* Null terminate the string. */ - *s = 0; - len = s - cmdline_buffer; - - /* Unlock the buffer on the ARM side. */ - unlock_user(cmdline_buffer, ARG(0), len); - - /* Adjust the commandline length argument. */ - SET_ARG(1, len); - - /* Return success if commandline fit into buffer. */ - return *arg ? -1 : 0; - } -#else - return -1; -#endif - case SYS_HEAPINFO: - { - uint32_t *ptr; - uint32_t limit; - -#ifdef CONFIG_USER_ONLY - /* Some C libraries assume the heap immediately follows .bss, so - allocate it using sbrk. */ - if (!ts->heap_limit) { - long ret; - - ts->heap_base = do_brk(0); - limit = ts->heap_base + ARM_ANGEL_HEAP_SIZE; - /* Try a big heap, and reduce the size if that fails. */ - for (;;) { - ret = do_brk(limit); - if (ret != -1) - break; - limit = (ts->heap_base >> 1) + (limit >> 1); - } - ts->heap_limit = limit; - } - - if (!(ptr = lock_user(VERIFY_WRITE, ARG(0), 16, 0))) - /* FIXME - should this error code be -TARGET_EFAULT ? */ - return (uint32_t)-1; - ptr[0] = tswap32(ts->heap_base); - ptr[1] = tswap32(ts->heap_limit); - ptr[2] = tswap32(ts->stack_base); - ptr[3] = tswap32(0); /* Stack limit. */ - unlock_user(ptr, ARG(0), 16); -#else - limit = ram_size; - if (!(ptr = lock_user(VERIFY_WRITE, ARG(0), 16, 0))) - /* FIXME - should this error code be -TARGET_EFAULT ? */ - return (uint32_t)-1; - /* TODO: Make this use the limit of the loaded application. */ - ptr[0] = tswap32(limit / 2); - ptr[1] = tswap32(limit); - ptr[2] = tswap32(limit); /* Stack base */ - ptr[3] = tswap32(0); /* Stack limit. */ - unlock_user(ptr, ARG(0), 16); -#endif - return 0; - } - case SYS_EXIT: - exit(0); - default: - fprintf(stderr, "qemu: Unsupported SemiHosting SWI 0x%02x\n", nr); - cpu_dump_state(env, stderr, fprintf, 0); - abort(); - } -} diff --git a/qemu-0.11.0/arm.ld b/qemu-0.11.0/arm.ld deleted file mode 100644 index 93285d6..0000000 --- a/qemu-0.11.0/arm.ld +++ /dev/null @@ -1,154 +0,0 @@ -OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", - "elf32-littlearm") -OUTPUT_ARCH(arm) -ENTRY(_start) -SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/alpha-unknown-linux-gnu/lib); -SECTIONS -{ - /* Read-only sections, merged into text segment: */ - . = 0x60000000 + SIZEOF_HEADERS; - .interp : { *(.interp) } - .hash : { *(.hash) } - .dynsym : { *(.dynsym) } - .dynstr : { *(.dynstr) } - .gnu.version : { *(.gnu.version) } - .gnu.version_d : { *(.gnu.version_d) } - .gnu.version_r : { *(.gnu.version_r) } - .rel.text : - { *(.rel.text) *(.rel.gnu.linkonce.t*) } - .rela.text : - { *(.rela.text) *(.rela.gnu.linkonce.t*) } - .rel.data : - { *(.rel.data) *(.rel.gnu.linkonce.d*) } - .rela.data : - { *(.rela.data) *(.rela.gnu.linkonce.d*) } - .rel.rodata : - { *(.rel.rodata) *(.rel.gnu.linkonce.r*) } - .rela.rodata : - { *(.rela.rodata) *(.rela.gnu.linkonce.r*) } - .rel.got : { *(.rel.got) } - .rela.got : { *(.rela.got) } - .rel.ctors : { *(.rel.ctors) } - .rela.ctors : { *(.rela.ctors) } - .rel.dtors : { *(.rel.dtors) } - .rela.dtors : { *(.rela.dtors) } - .rel.init : { *(.rel.init) } - .rela.init : { *(.rela.init) } - .rel.fini : { *(.rel.fini) } - .rela.fini : { *(.rela.fini) } - .rel.bss : { *(.rel.bss) } - .rela.bss : { *(.rela.bss) } - .rel.plt : { *(.rel.plt) } - .rela.plt : { *(.rela.plt) } - .init : { *(.init) } =0x47ff041f - .text : - { - *(.text) - /* .gnu.warning sections are handled specially by elf32.em. */ - *(.gnu.warning) - *(.gnu.linkonce.t*) - } =0x47ff041f - _etext = .; - PROVIDE (etext = .); - .fini : { *(.fini) } =0x47ff041f - .rodata : { *(.rodata) *(.gnu.linkonce.r*) } - .rodata1 : { *(.rodata1) } - .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } - __exidx_start = .; - .ARM.exidx : { *(.ARM.exidx* .gnu.linkonce.armexidx.*) } - __exidx_end = .; - .reginfo : { *(.reginfo) } - /* Adjust the address for the data segment. We want to adjust up to - the same address within the page on the next page up. */ - . = ALIGN(0x100000) + (. & (0x100000 - 1)); - .data : - { - *(.gen_code) - *(.data) - *(.gnu.linkonce.d*) - CONSTRUCTORS - } - .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } - .data1 : { *(.data1) } - .preinit_array : - { - PROVIDE_HIDDEN (__preinit_array_start = .); - KEEP (*(.preinit_array)) - PROVIDE_HIDDEN (__preinit_array_end = .); - } - .init_array : - { - PROVIDE_HIDDEN (__init_array_start = .); - KEEP (*(SORT(.init_array.*))) - KEEP (*(.init_array)) - PROVIDE_HIDDEN (__init_array_end = .); - } - .fini_array : - { - PROVIDE_HIDDEN (__fini_array_start = .); - KEEP (*(.fini_array)) - KEEP (*(SORT(.fini_array.*))) - PROVIDE_HIDDEN (__fini_array_end = .); - } - .ctors : - { - *(.ctors) - } - .dtors : - { - *(.dtors) - } - .plt : { *(.plt) } - .got : { *(.got.plt) *(.got) } - .dynamic : { *(.dynamic) } - /* We want the small data sections together, so single-instruction offsets - can access them all, and initialized data all before uninitialized, so - we can shorten the on-disk segment size. */ - .sdata : { *(.sdata) } - _edata = .; - PROVIDE (edata = .); - __bss_start = .; - .sbss : { *(.sbss) *(.scommon) } - .bss : - { - *(.dynbss) - *(.bss) - *(COMMON) - } - _end = . ; - PROVIDE (end = .); - /* Stabs debugging sections. */ - .stab 0 : { *(.stab) } - .stabstr 0 : { *(.stabstr) } - .stab.excl 0 : { *(.stab.excl) } - .stab.exclstr 0 : { *(.stab.exclstr) } - .stab.index 0 : { *(.stab.index) } - .stab.indexstr 0 : { *(.stab.indexstr) } - .comment 0 : { *(.comment) } - /* DWARF debug sections. - Symbols in the DWARF debugging sections are relative to the beginning - of the section so we begin them at 0. */ - /* DWARF 1 */ - .debug 0 : { *(.debug) } - .line 0 : { *(.line) } - /* GNU DWARF 1 extensions */ - .debug_srcinfo 0 : { *(.debug_srcinfo) } - .debug_sfnames 0 : { *(.debug_sfnames) } - /* DWARF 1.1 and DWARF 2 */ - .debug_aranges 0 : { *(.debug_aranges) } - .debug_pubnames 0 : { *(.debug_pubnames) } - /* DWARF 2 */ - .debug_info 0 : { *(.debug_info) } - .debug_abbrev 0 : { *(.debug_abbrev) } - .debug_line 0 : { *(.debug_line) } - .debug_frame 0 : { *(.debug_frame) } - .debug_str 0 : { *(.debug_str) } - .debug_loc 0 : { *(.debug_loc) } - .debug_macinfo 0 : { *(.debug_macinfo) } - /* SGI/MIPS DWARF 2 extensions */ - .debug_weaknames 0 : { *(.debug_weaknames) } - .debug_funcnames 0 : { *(.debug_funcnames) } - .debug_typenames 0 : { *(.debug_typenames) } - .debug_varnames 0 : { *(.debug_varnames) } - /* These must appear regardless of . */ -} diff --git a/qemu-0.11.0/audio/alsaaudio.c b/qemu-0.11.0/audio/alsaaudio.c deleted file mode 100644 index d0b7cd0..0000000 --- a/qemu-0.11.0/audio/alsaaudio.c +++ /dev/null @@ -1,952 +0,0 @@ -/* - * QEMU ALSA audio driver - * - * Copyright (c) 2005 Vassili Karpov (malc) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -#include <alsa/asoundlib.h> -#include "qemu-common.h" -#include "audio.h" - -#if QEMU_GNUC_PREREQ(4, 3) -#pragma GCC diagnostic ignored "-Waddress" -#endif - -#define AUDIO_CAP "alsa" -#include "audio_int.h" - -typedef struct ALSAVoiceOut { - HWVoiceOut hw; - void *pcm_buf; - snd_pcm_t *handle; -} ALSAVoiceOut; - -typedef struct ALSAVoiceIn { - HWVoiceIn hw; - snd_pcm_t *handle; - void *pcm_buf; -} ALSAVoiceIn; - -static struct { - int size_in_usec_in; - int size_in_usec_out; - const char *pcm_name_in; - const char *pcm_name_out; - unsigned int buffer_size_in; - unsigned int period_size_in; - unsigned int buffer_size_out; - unsigned int period_size_out; - unsigned int threshold; - - int buffer_size_in_overridden; - int period_size_in_overridden; - - int buffer_size_out_overridden; - int period_size_out_overridden; - int verbose; -} conf = { - .buffer_size_out = 1024, - .pcm_name_out = "default", - .pcm_name_in = "default", -}; - -struct alsa_params_req { - int freq; - snd_pcm_format_t fmt; - int nchannels; - int size_in_usec; - int override_mask; - unsigned int buffer_size; - unsigned int period_size; -}; - -struct alsa_params_obt { - int freq; - audfmt_e fmt; - int endianness; - int nchannels; - snd_pcm_uframes_t samples; -}; - -static void GCC_FMT_ATTR (2, 3) alsa_logerr (int err, const char *fmt, ...) -{ - va_list ap; - - va_start (ap, fmt); - AUD_vlog (AUDIO_CAP, fmt, ap); - va_end (ap); - - AUD_log (AUDIO_CAP, "Reason: %s\n", snd_strerror (err)); -} - -static void GCC_FMT_ATTR (3, 4) alsa_logerr2 ( - int err, - const char *typ, - const char *fmt, - ... - ) -{ - va_list ap; - - AUD_log (AUDIO_CAP, "Could not initialize %s\n", typ); - - va_start (ap, fmt); - AUD_vlog (AUDIO_CAP, fmt, ap); - va_end (ap); - - AUD_log (AUDIO_CAP, "Reason: %s\n", snd_strerror (err)); -} - -static void alsa_anal_close (snd_pcm_t **handlep) -{ - int err = snd_pcm_close (*handlep); - if (err) { - alsa_logerr (err, "Failed to close PCM handle %p\n", *handlep); - } - *handlep = NULL; -} - -static int alsa_write (SWVoiceOut *sw, void *buf, int len) -{ - return audio_pcm_sw_write (sw, buf, len); -} - -static snd_pcm_format_t aud_to_alsafmt (audfmt_e fmt) -{ - switch (fmt) { - case AUD_FMT_S8: - return SND_PCM_FORMAT_S8; - - case AUD_FMT_U8: - return SND_PCM_FORMAT_U8; - - case AUD_FMT_S16: - return SND_PCM_FORMAT_S16_LE; - - case AUD_FMT_U16: - return SND_PCM_FORMAT_U16_LE; - - case AUD_FMT_S32: - return SND_PCM_FORMAT_S32_LE; - - case AUD_FMT_U32: - return SND_PCM_FORMAT_U32_LE; - - default: - dolog ("Internal logic error: Bad audio format %d\n", fmt); -#ifdef DEBUG_AUDIO - abort (); -#endif - return SND_PCM_FORMAT_U8; - } -} - -static int alsa_to_audfmt (snd_pcm_format_t alsafmt, audfmt_e *fmt, - int *endianness) -{ - switch (alsafmt) { - case SND_PCM_FORMAT_S8: - *endianness = 0; - *fmt = AUD_FMT_S8; - break; - - case SND_PCM_FORMAT_U8: - *endianness = 0; - *fmt = AUD_FMT_U8; - break; - - case SND_PCM_FORMAT_S16_LE: - *endianness = 0; - *fmt = AUD_FMT_S16; - break; - - case SND_PCM_FORMAT_U16_LE: - *endianness = 0; - *fmt = AUD_FMT_U16; - break; - - case SND_PCM_FORMAT_S16_BE: - *endianness = 1; - *fmt = AUD_FMT_S16; - break; - - case SND_PCM_FORMAT_U16_BE: - *endianness = 1; - *fmt = AUD_FMT_U16; - break; - - case SND_PCM_FORMAT_S32_LE: - *endianness = 0; - *fmt = AUD_FMT_S32; - break; - - case SND_PCM_FORMAT_U32_LE: - *endianness = 0; - *fmt = AUD_FMT_U32; - break; - - case SND_PCM_FORMAT_S32_BE: - *endianness = 1; - *fmt = AUD_FMT_S32; - break; - - case SND_PCM_FORMAT_U32_BE: - *endianness = 1; - *fmt = AUD_FMT_U32; - break; - - default: - dolog ("Unrecognized audio format %d\n", alsafmt); - return -1; - } - - return 0; -} - -static void alsa_dump_info (struct alsa_params_req *req, - struct alsa_params_obt *obt) -{ - dolog ("parameter | requested value | obtained value\n"); - dolog ("format | %10d | %10d\n", req->fmt, obt->fmt); - dolog ("channels | %10d | %10d\n", - req->nchannels, obt->nchannels); - dolog ("frequency | %10d | %10d\n", req->freq, obt->freq); - dolog ("============================================\n"); - dolog ("requested: buffer size %d period size %d\n", - req->buffer_size, req->period_size); - dolog ("obtained: samples %ld\n", obt->samples); -} - -static void alsa_set_threshold (snd_pcm_t *handle, snd_pcm_uframes_t threshold) -{ - int err; - snd_pcm_sw_params_t *sw_params; - - snd_pcm_sw_params_alloca (&sw_params); - - err = snd_pcm_sw_params_current (handle, sw_params); - if (err < 0) { - dolog ("Could not fully initialize DAC\n"); - alsa_logerr (err, "Failed to get current software parameters\n"); - return; - } - - err = snd_pcm_sw_params_set_start_threshold (handle, sw_params, threshold); - if (err < 0) { - dolog ("Could not fully initialize DAC\n"); - alsa_logerr (err, "Failed to set software threshold to %ld\n", - threshold); - return; - } - - err = snd_pcm_sw_params (handle, sw_params); - if (err < 0) { - dolog ("Could not fully initialize DAC\n"); - alsa_logerr (err, "Failed to set software parameters\n"); - return; - } -} - -static int alsa_open (int in, struct alsa_params_req *req, - struct alsa_params_obt *obt, snd_pcm_t **handlep) -{ - snd_pcm_t *handle; - snd_pcm_hw_params_t *hw_params; - int err; - int size_in_usec; - unsigned int freq, nchannels; - const char *pcm_name = in ? conf.pcm_name_in : conf.pcm_name_out; - snd_pcm_uframes_t obt_buffer_size; - const char *typ = in ? "ADC" : "DAC"; - snd_pcm_format_t obtfmt; - - freq = req->freq; - nchannels = req->nchannels; - size_in_usec = req->size_in_usec; - - snd_pcm_hw_params_alloca (&hw_params); - - err = snd_pcm_open ( - &handle, - pcm_name, - in ? SND_PCM_STREAM_CAPTURE : SND_PCM_STREAM_PLAYBACK, - SND_PCM_NONBLOCK - ); - if (err < 0) { - alsa_logerr2 (err, typ, "Failed to open `%s':\n", pcm_name); - return -1; - } - - err = snd_pcm_hw_params_any (handle, hw_params); - if (err < 0) { - alsa_logerr2 (err, typ, "Failed to initialize hardware parameters\n"); - goto err; - } - - err = snd_pcm_hw_params_set_access ( - handle, - hw_params, - SND_PCM_ACCESS_RW_INTERLEAVED - ); - if (err < 0) { - alsa_logerr2 (err, typ, "Failed to set access type\n"); - goto err; - } - - err = snd_pcm_hw_params_set_format (handle, hw_params, req->fmt); - if (err < 0 && conf.verbose) { - alsa_logerr2 (err, typ, "Failed to set format %d\n", req->fmt); - } - - err = snd_pcm_hw_params_set_rate_near (handle, hw_params, &freq, 0); - if (err < 0) { - alsa_logerr2 (err, typ, "Failed to set frequency %d\n", req->freq); - goto err; - } - - err = snd_pcm_hw_params_set_channels_near ( - handle, - hw_params, - &nchannels - ); - if (err < 0) { - alsa_logerr2 (err, typ, "Failed to set number of channels %d\n", - req->nchannels); - goto err; - } - - if (nchannels != 1 && nchannels != 2) { - alsa_logerr2 (err, typ, - "Can not handle obtained number of channels %d\n", - nchannels); - goto err; - } - - if (req->buffer_size) { - unsigned long obt; - - if (size_in_usec) { - int dir = 0; - unsigned int btime = req->buffer_size; - - err = snd_pcm_hw_params_set_buffer_time_near ( - handle, - hw_params, - &btime, - &dir - ); - obt = btime; - } - else { - snd_pcm_uframes_t bsize = req->buffer_size; - - err = snd_pcm_hw_params_set_buffer_size_near ( - handle, - hw_params, - &bsize - ); - obt = bsize; - } - if (err < 0) { - alsa_logerr2 (err, typ, "Failed to set buffer %s to %d\n", - size_in_usec ? "time" : "size", req->buffer_size); - goto err; - } - - if ((req->override_mask & 2) && (obt - req->buffer_size)) - dolog ("Requested buffer %s %u was rejected, using %lu\n", - size_in_usec ? "time" : "size", req->buffer_size, obt); - } - - if (req->period_size) { - unsigned long obt; - - if (size_in_usec) { - int dir = 0; - unsigned int ptime = req->period_size; - - err = snd_pcm_hw_params_set_period_time_near ( - handle, - hw_params, - &ptime, - &dir - ); - obt = ptime; - } - else { - int dir = 0; - snd_pcm_uframes_t psize = req->period_size; - - err = snd_pcm_hw_params_set_period_size_near ( - handle, - hw_params, - &psize, - &dir - ); - obt = psize; - } - - if (err < 0) { - alsa_logerr2 (err, typ, "Failed to set period %s to %d\n", - size_in_usec ? "time" : "size", req->period_size); - goto err; - } - - if ((req->override_mask & 1) && (obt - req->period_size)) - dolog ("Requested period %s %u was rejected, using %lu\n", - size_in_usec ? "time" : "size", req->period_size, obt); - } - - err = snd_pcm_hw_params (handle, hw_params); - if (err < 0) { - alsa_logerr2 (err, typ, "Failed to apply audio parameters\n"); - goto err; - } - - err = snd_pcm_hw_params_get_buffer_size (hw_params, &obt_buffer_size); - if (err < 0) { - alsa_logerr2 (err, typ, "Failed to get buffer size\n"); - goto err; - } - - err = snd_pcm_hw_params_get_format (hw_params, &obtfmt); - if (err < 0) { - alsa_logerr2 (err, typ, "Failed to get format\n"); - goto err; - } - - if (alsa_to_audfmt (obtfmt, &obt->fmt, &obt->endianness)) { - dolog ("Invalid format was returned %d\n", obtfmt); - goto err; - } - - err = snd_pcm_prepare (handle); - if (err < 0) { - alsa_logerr2 (err, typ, "Could not prepare handle %p\n", handle); - goto err; - } - - if (!in && conf.threshold) { - snd_pcm_uframes_t threshold; - int bytes_per_sec; - - bytes_per_sec = freq << (nchannels == 2); - - switch (obt->fmt) { - case AUD_FMT_S8: - case AUD_FMT_U8: - break; - - case AUD_FMT_S16: - case AUD_FMT_U16: - bytes_per_sec <<= 1; - break; - - case AUD_FMT_S32: - case AUD_FMT_U32: - bytes_per_sec <<= 2; - break; - } - - threshold = (conf.threshold * bytes_per_sec) / 1000; - alsa_set_threshold (handle, threshold); - } - - obt->nchannels = nchannels; - obt->freq = freq; - obt->samples = obt_buffer_size; - - *handlep = handle; - - if (conf.verbose && - (obt->fmt != req->fmt || - obt->nchannels != req->nchannels || - obt->freq != req->freq)) { - dolog ("Audio paramters for %s\n", typ); - alsa_dump_info (req, obt); - } - -#ifdef DEBUG - alsa_dump_info (req, obt); -#endif - return 0; - - err: - alsa_anal_close (&handle); - return -1; -} - -static int alsa_recover (snd_pcm_t *handle) -{ - int err = snd_pcm_prepare (handle); - if (err < 0) { - alsa_logerr (err, "Failed to prepare handle %p\n", handle); - return -1; - } - return 0; -} - -static snd_pcm_sframes_t alsa_get_avail (snd_pcm_t *handle) -{ - snd_pcm_sframes_t avail; - - avail = snd_pcm_avail_update (handle); - if (avail < 0) { - if (avail == -EPIPE) { - if (!alsa_recover (handle)) { - avail = snd_pcm_avail_update (handle); - } - } - - if (avail < 0) { - alsa_logerr (avail, - "Could not obtain number of available frames\n"); - return -1; - } - } - - return avail; -} - -static int alsa_run_out (HWVoiceOut *hw) -{ - ALSAVoiceOut *alsa = (ALSAVoiceOut *) hw; - int rpos, live, decr; - int samples; - uint8_t *dst; - struct st_sample *src; - snd_pcm_sframes_t avail; - - live = audio_pcm_hw_get_live_out (hw); - if (!live) { - return 0; - } - - avail = alsa_get_avail (alsa->handle); - if (avail < 0) { - dolog ("Could not get number of available playback frames\n"); - return 0; - } - - decr = audio_MIN (live, avail); - samples = decr; - rpos = hw->rpos; - while (samples) { - int left_till_end_samples = hw->samples - rpos; - int len = audio_MIN (samples, left_till_end_samples); - snd_pcm_sframes_t written; - - src = hw->mix_buf + rpos; - dst = advance (alsa->pcm_buf, rpos << hw->info.shift); - - hw->clip (dst, src, len); - - while (len) { - written = snd_pcm_writei (alsa->handle, dst, len); - - if (written <= 0) { - switch (written) { - case 0: - if (conf.verbose) { - dolog ("Failed to write %d frames (wrote zero)\n", len); - } - goto exit; - - case -EPIPE: - if (alsa_recover (alsa->handle)) { - alsa_logerr (written, "Failed to write %d frames\n", - len); - goto exit; - } - if (conf.verbose) { - dolog ("Recovering from playback xrun\n"); - } - continue; - - case -EAGAIN: - goto exit; - - default: - alsa_logerr (written, "Failed to write %d frames to %p\n", - len, dst); - goto exit; - } - } - - rpos = (rpos + written) % hw->samples; - samples -= written; - len -= written; - dst = advance (dst, written << hw->info.shift); - src += written; - } - } - - exit: - hw->rpos = rpos; - return decr; -} - -static void alsa_fini_out (HWVoiceOut *hw) -{ - ALSAVoiceOut *alsa = (ALSAVoiceOut *) hw; - - ldebug ("alsa_fini\n"); - alsa_anal_close (&alsa->handle); - - if (alsa->pcm_buf) { - qemu_free (alsa->pcm_buf); - alsa->pcm_buf = NULL; - } -} - -static int alsa_init_out (HWVoiceOut *hw, struct audsettings *as) -{ - ALSAVoiceOut *alsa = (ALSAVoiceOut *) hw; - struct alsa_params_req req; - struct alsa_params_obt obt; - snd_pcm_t *handle; - struct audsettings obt_as; - - req.fmt = aud_to_alsafmt (as->fmt); - req.freq = as->freq; - req.nchannels = as->nchannels; - req.period_size = conf.period_size_out; - req.buffer_size = conf.buffer_size_out; - req.size_in_usec = conf.size_in_usec_out; - req.override_mask = - (conf.period_size_out_overridden ? 1 : 0) | - (conf.buffer_size_out_overridden ? 2 : 0); - - if (alsa_open (0, &req, &obt, &handle)) { - return -1; - } - - obt_as.freq = obt.freq; - obt_as.nchannels = obt.nchannels; - obt_as.fmt = obt.fmt; - obt_as.endianness = obt.endianness; - - audio_pcm_init_info (&hw->info, &obt_as); - hw->samples = obt.samples; - - alsa->pcm_buf = audio_calloc (AUDIO_FUNC, obt.samples, 1 << hw->info.shift); - if (!alsa->pcm_buf) { - dolog ("Could not allocate DAC buffer (%d samples, each %d bytes)\n", - hw->samples, 1 << hw->info.shift); - alsa_anal_close (&handle); - return -1; - } - - alsa->handle = handle; - return 0; -} - -static int alsa_voice_ctl (snd_pcm_t *handle, const char *typ, int pause) -{ - int err; - - if (pause) { - err = snd_pcm_drop (handle); - if (err < 0) { - alsa_logerr (err, "Could not stop %s\n", typ); - return -1; - } - } - else { - err = snd_pcm_prepare (handle); - if (err < 0) { - alsa_logerr (err, "Could not prepare handle for %s\n", typ); - return -1; - } - } - - return 0; -} - -static int alsa_ctl_out (HWVoiceOut *hw, int cmd, ...) -{ - ALSAVoiceOut *alsa = (ALSAVoiceOut *) hw; - - switch (cmd) { - case VOICE_ENABLE: - ldebug ("enabling voice\n"); - return alsa_voice_ctl (alsa->handle, "playback", 0); - - case VOICE_DISABLE: - ldebug ("disabling voice\n"); - return alsa_voice_ctl (alsa->handle, "playback", 1); - } - - return -1; -} - -static int alsa_init_in (HWVoiceIn *hw, struct audsettings *as) -{ - ALSAVoiceIn *alsa = (ALSAVoiceIn *) hw; - struct alsa_params_req req; - struct alsa_params_obt obt; - snd_pcm_t *handle; - struct audsettings obt_as; - - req.fmt = aud_to_alsafmt (as->fmt); - req.freq = as->freq; - req.nchannels = as->nchannels; - req.period_size = conf.period_size_in; - req.buffer_size = conf.buffer_size_in; - req.size_in_usec = conf.size_in_usec_in; - req.override_mask = - (conf.period_size_in_overridden ? 1 : 0) | - (conf.buffer_size_in_overridden ? 2 : 0); - - if (alsa_open (1, &req, &obt, &handle)) { - return -1; - } - - obt_as.freq = obt.freq; - obt_as.nchannels = obt.nchannels; - obt_as.fmt = obt.fmt; - obt_as.endianness = obt.endianness; - - audio_pcm_init_info (&hw->info, &obt_as); - hw->samples = obt.samples; - - alsa->pcm_buf = audio_calloc (AUDIO_FUNC, hw->samples, 1 << hw->info.shift); - if (!alsa->pcm_buf) { - dolog ("Could not allocate ADC buffer (%d samples, each %d bytes)\n", - hw->samples, 1 << hw->info.shift); - alsa_anal_close (&handle); - return -1; - } - - alsa->handle = handle; - return 0; -} - -static void alsa_fini_in (HWVoiceIn *hw) -{ - ALSAVoiceIn *alsa = (ALSAVoiceIn *) hw; - - alsa_anal_close (&alsa->handle); - - if (alsa->pcm_buf) { - qemu_free (alsa->pcm_buf); - alsa->pcm_buf = NULL; - } -} - -static int alsa_run_in (HWVoiceIn *hw) -{ - ALSAVoiceIn *alsa = (ALSAVoiceIn *) hw; - int hwshift = hw->info.shift; - int i; - int live = audio_pcm_hw_get_live_in (hw); - int dead = hw->samples - live; - int decr; - struct { - int add; - int len; - } bufs[2] = { - { hw->wpos, 0 }, - { 0, 0 } - }; - snd_pcm_sframes_t avail; - snd_pcm_uframes_t read_samples = 0; - - if (!dead) { - return 0; - } - - avail = alsa_get_avail (alsa->handle); - if (avail < 0) { - dolog ("Could not get number of captured frames\n"); - return 0; - } - - if (!avail && (snd_pcm_state (alsa->handle) == SND_PCM_STATE_PREPARED)) { - avail = hw->samples; - } - - decr = audio_MIN (dead, avail); - if (!decr) { - return 0; - } - - if (hw->wpos + decr > hw->samples) { - bufs[0].len = (hw->samples - hw->wpos); - bufs[1].len = (decr - (hw->samples - hw->wpos)); - } - else { - bufs[0].len = decr; - } - - for (i = 0; i < 2; ++i) { - void *src; - struct st_sample *dst; - snd_pcm_sframes_t nread; - snd_pcm_uframes_t len; - - len = bufs[i].len; - - src = advance (alsa->pcm_buf, bufs[i].add << hwshift); - dst = hw->conv_buf + bufs[i].add; - - while (len) { - nread = snd_pcm_readi (alsa->handle, src, len); - - if (nread <= 0) { - switch (nread) { - case 0: - if (conf.verbose) { - dolog ("Failed to read %ld frames (read zero)\n", len); - } - goto exit; - - case -EPIPE: - if (alsa_recover (alsa->handle)) { - alsa_logerr (nread, "Failed to read %ld frames\n", len); - goto exit; - } - if (conf.verbose) { - dolog ("Recovering from capture xrun\n"); - } - continue; - - case -EAGAIN: - goto exit; - - default: - alsa_logerr ( - nread, - "Failed to read %ld frames from %p\n", - len, - src - ); - goto exit; - } - } - - hw->conv (dst, src, nread, &nominal_volume); - - src = advance (src, nread << hwshift); - dst += nread; - - read_samples += nread; - len -= nread; - } - } - - exit: - hw->wpos = (hw->wpos + read_samples) % hw->samples; - return read_samples; -} - -static int alsa_read (SWVoiceIn *sw, void *buf, int size) -{ - return audio_pcm_sw_read (sw, buf, size); -} - -static int alsa_ctl_in (HWVoiceIn *hw, int cmd, ...) -{ - ALSAVoiceIn *alsa = (ALSAVoiceIn *) hw; - - switch (cmd) { - case VOICE_ENABLE: - ldebug ("enabling voice\n"); - return alsa_voice_ctl (alsa->handle, "capture", 0); - - case VOICE_DISABLE: - ldebug ("disabling voice\n"); - return alsa_voice_ctl (alsa->handle, "capture", 1); - } - - return -1; -} - -static void *alsa_audio_init (void) -{ - return &conf; -} - -static void alsa_audio_fini (void *opaque) -{ - (void) opaque; -} - -static struct audio_option alsa_options[] = { - {"DAC_SIZE_IN_USEC", AUD_OPT_BOOL, &conf.size_in_usec_out, - "DAC period/buffer size in microseconds (otherwise in frames)", NULL, 0}, - {"DAC_PERIOD_SIZE", AUD_OPT_INT, &conf.period_size_out, - "DAC period size (0 to go with system default)", - &conf.period_size_out_overridden, 0}, - {"DAC_BUFFER_SIZE", AUD_OPT_INT, &conf.buffer_size_out, - "DAC buffer size (0 to go with system default)", - &conf.buffer_size_out_overridden, 0}, - - {"ADC_SIZE_IN_USEC", AUD_OPT_BOOL, &conf.size_in_usec_in, - "ADC period/buffer size in microseconds (otherwise in frames)", NULL, 0}, - {"ADC_PERIOD_SIZE", AUD_OPT_INT, &conf.period_size_in, - "ADC period size (0 to go with system default)", - &conf.period_size_in_overridden, 0}, - {"ADC_BUFFER_SIZE", AUD_OPT_INT, &conf.buffer_size_in, - "ADC buffer size (0 to go with system default)", - &conf.buffer_size_in_overridden, 0}, - - {"THRESHOLD", AUD_OPT_INT, &conf.threshold, - "(undocumented)", NULL, 0}, - - {"DAC_DEV", AUD_OPT_STR, &conf.pcm_name_out, - "DAC device name (for instance dmix)", NULL, 0}, - - {"ADC_DEV", AUD_OPT_STR, &conf.pcm_name_in, - "ADC device name", NULL, 0}, - - {"VERBOSE", AUD_OPT_BOOL, &conf.verbose, - "Behave in a more verbose way", NULL, 0}, - - {NULL, 0, NULL, NULL, NULL, 0} -}; - -static struct audio_pcm_ops alsa_pcm_ops = { - alsa_init_out, - alsa_fini_out, - alsa_run_out, - alsa_write, - alsa_ctl_out, - - alsa_init_in, - alsa_fini_in, - alsa_run_in, - alsa_read, - alsa_ctl_in -}; - -struct audio_driver alsa_audio_driver = { - INIT_FIELD (name = ) "alsa", - INIT_FIELD (descr = ) "ALSA http://www.alsa-project.org", - INIT_FIELD (options = ) alsa_options, - INIT_FIELD (init = ) alsa_audio_init, - INIT_FIELD (fini = ) alsa_audio_fini, - INIT_FIELD (pcm_ops = ) &alsa_pcm_ops, - INIT_FIELD (can_be_default = ) 1, - INIT_FIELD (max_voices_out = ) INT_MAX, - INIT_FIELD (max_voices_in = ) INT_MAX, - INIT_FIELD (voice_size_out = ) sizeof (ALSAVoiceOut), - INIT_FIELD (voice_size_in = ) sizeof (ALSAVoiceIn) -}; diff --git a/qemu-0.11.0/audio/audio.c b/qemu-0.11.0/audio/audio.c deleted file mode 100644 index 72a18ec..0000000 --- a/qemu-0.11.0/audio/audio.c +++ /dev/null @@ -1,1954 +0,0 @@ -/* - * QEMU Audio subsystem - * - * Copyright (c) 2003-2005 Vassili Karpov (malc) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -#include "hw/hw.h" -#include "audio.h" -#include "monitor.h" -#include "qemu-timer.h" -#include "sysemu.h" - -#define AUDIO_CAP "audio" -#include "audio_int.h" - -/* #define DEBUG_PLIVE */ -/* #define DEBUG_LIVE */ -/* #define DEBUG_OUT */ -/* #define DEBUG_CAPTURE */ - -#define SW_NAME(sw) (sw)->name ? (sw)->name : "unknown" - -static struct audio_driver *drvtab[] = { - AUDIO_DRIVERS - &no_audio_driver, - &wav_audio_driver -}; - -struct fixed_settings { - int enabled; - int nb_voices; - int greedy; - struct audsettings settings; -}; - -static struct { - struct fixed_settings fixed_out; - struct fixed_settings fixed_in; - union { - int hertz; - int64_t ticks; - } period; - int plive; - int log_to_monitor; -} conf = { - { /* DAC fixed settings */ - 1, /* enabled */ - 1, /* nb_voices */ - 1, /* greedy */ - { - 44100, /* freq */ - 2, /* nchannels */ - AUD_FMT_S16, /* fmt */ - AUDIO_HOST_ENDIANNESS - } - }, - - { /* ADC fixed settings */ - 1, /* enabled */ - 1, /* nb_voices */ - 1, /* greedy */ - { - 44100, /* freq */ - 2, /* nchannels */ - AUD_FMT_S16, /* fmt */ - AUDIO_HOST_ENDIANNESS - } - }, - - { 250 }, /* period */ - 0, /* plive */ - 0 /* log_to_monitor */ -}; - -static AudioState glob_audio_state; - -struct mixeng_volume nominal_volume = { - 0, -#ifdef FLOAT_MIXENG - 1.0, - 1.0 -#else - 1ULL << 32, - 1ULL << 32 -#endif -}; - -/* http://www.df.lth.se/~john_e/gems/gem002d.html */ -/* http://www.multi-platforms.com/Tips/PopCount.htm */ -uint32_t popcount (uint32_t u) -{ - u = ((u&0x55555555) + ((u>>1)&0x55555555)); - u = ((u&0x33333333) + ((u>>2)&0x33333333)); - u = ((u&0x0f0f0f0f) + ((u>>4)&0x0f0f0f0f)); - u = ((u&0x00ff00ff) + ((u>>8)&0x00ff00ff)); - u = ( u&0x0000ffff) + (u>>16); - return u; -} - -inline uint32_t lsbindex (uint32_t u) -{ - return popcount ((u&-u)-1); -} - -#ifdef AUDIO_IS_FLAWLESS_AND_NO_CHECKS_ARE_REQURIED -#error No its not -#else -int audio_bug (const char *funcname, int cond) -{ - if (cond) { - static int shown; - - AUD_log (NULL, "A bug was just triggered in %s\n", funcname); - if (!shown) { - shown = 1; - AUD_log (NULL, "Save all your work and restart without audio\n"); - AUD_log (NULL, "Please send bug report to malc@pulsesoft.com\n"); - AUD_log (NULL, "I am sorry\n"); - } - AUD_log (NULL, "Context:\n"); - -#if defined AUDIO_BREAKPOINT_ON_BUG -# if defined HOST_I386 -# if defined __GNUC__ - __asm__ ("int3"); -# elif defined _MSC_VER - _asm _emit 0xcc; -# else - abort (); -# endif -# else - abort (); -# endif -#endif - } - - return cond; -} -#endif - -static inline int audio_bits_to_index (int bits) -{ - switch (bits) { - case 8: - return 0; - - case 16: - return 1; - - case 32: - return 2; - - default: - audio_bug ("bits_to_index", 1); - AUD_log (NULL, "invalid bits %d\n", bits); - return 0; - } -} - -void *audio_calloc (const char *funcname, int nmemb, size_t size) -{ - int cond; - size_t len; - - len = nmemb * size; - cond = !nmemb || !size; - cond |= nmemb < 0; - cond |= len < size; - - if (audio_bug ("audio_calloc", cond)) { - AUD_log (NULL, "%s passed invalid arguments to audio_calloc\n", - funcname); - AUD_log (NULL, "nmemb=%d size=%zu (len=%zu)\n", nmemb, size, len); - return NULL; - } - - return qemu_mallocz (len); -} - -static char *audio_alloc_prefix (const char *s) -{ - const char qemu_prefix[] = "QEMU_"; - size_t len, i; - char *r, *u; - - if (!s) { - return NULL; - } - - len = strlen (s); - r = qemu_malloc (len + sizeof (qemu_prefix)); - - u = r + sizeof (qemu_prefix) - 1; - - pstrcpy (r, len + sizeof (qemu_prefix), qemu_prefix); - pstrcat (r, len + sizeof (qemu_prefix), s); - - for (i = 0; i < len; ++i) { - u[i] = qemu_toupper(u[i]); - } - - return r; -} - -static const char *audio_audfmt_to_string (audfmt_e fmt) -{ - switch (fmt) { - case AUD_FMT_U8: - return "U8"; - - case AUD_FMT_U16: - return "U16"; - - case AUD_FMT_S8: - return "S8"; - - case AUD_FMT_S16: - return "S16"; - - case AUD_FMT_U32: - return "U32"; - - case AUD_FMT_S32: - return "S32"; - } - - dolog ("Bogus audfmt %d returning S16\n", fmt); - return "S16"; -} - -static audfmt_e audio_string_to_audfmt (const char *s, audfmt_e defval, - int *defaultp) -{ - if (!strcasecmp (s, "u8")) { - *defaultp = 0; - return AUD_FMT_U8; - } - else if (!strcasecmp (s, "u16")) { - *defaultp = 0; - return AUD_FMT_U16; - } - else if (!strcasecmp (s, "u32")) { - *defaultp = 0; - return AUD_FMT_U32; - } - else if (!strcasecmp (s, "s8")) { - *defaultp = 0; - return AUD_FMT_S8; - } - else if (!strcasecmp (s, "s16")) { - *defaultp = 0; - return AUD_FMT_S16; - } - else if (!strcasecmp (s, "s32")) { - *defaultp = 0; - return AUD_FMT_S32; - } - else { - dolog ("Bogus audio format `%s' using %s\n", - s, audio_audfmt_to_string (defval)); - *defaultp = 1; - return defval; - } -} - -static audfmt_e audio_get_conf_fmt (const char *envname, - audfmt_e defval, - int *defaultp) -{ - const char *var = getenv (envname); - if (!var) { - *defaultp = 1; - return defval; - } - return audio_string_to_audfmt (var, defval, defaultp); -} - -static int audio_get_conf_int (const char *key, int defval, int *defaultp) -{ - int val; - char *strval; - - strval = getenv (key); - if (strval) { - *defaultp = 0; - val = atoi (strval); - return val; - } - else { - *defaultp = 1; - return defval; - } -} - -static const char *audio_get_conf_str (const char *key, - const char *defval, - int *defaultp) -{ - const char *val = getenv (key); - if (!val) { - *defaultp = 1; - return defval; - } - else { - *defaultp = 0; - return val; - } -} - -void AUD_vlog (const char *cap, const char *fmt, va_list ap) -{ - if (conf.log_to_monitor) { - if (cap) { - monitor_printf(cur_mon, "%s: ", cap); - } - - monitor_vprintf(cur_mon, fmt, ap); - } - else { - if (cap) { - fprintf (stderr, "%s: ", cap); - } - - vfprintf (stderr, fmt, ap); - } -} - -void AUD_log (const char *cap, const char *fmt, ...) -{ - va_list ap; - - va_start (ap, fmt); - AUD_vlog (cap, fmt, ap); - va_end (ap); -} - -static void audio_print_options (const char *prefix, - struct audio_option *opt) -{ - char *uprefix; - - if (!prefix) { - dolog ("No prefix specified\n"); - return; - } - - if (!opt) { - dolog ("No options\n"); - return; - } - - uprefix = audio_alloc_prefix (prefix); - - for (; opt->name; opt++) { - const char *state = "default"; - printf (" %s_%s: ", uprefix, opt->name); - - if (opt->overriddenp && *opt->overriddenp) { - state = "current"; - } - - switch (opt->tag) { - case AUD_OPT_BOOL: - { - int *intp = opt->valp; - printf ("boolean, %s = %d\n", state, *intp ? 1 : 0); - } - break; - - case AUD_OPT_INT: - { - int *intp = opt->valp; - printf ("integer, %s = %d\n", state, *intp); - } - break; - - case AUD_OPT_FMT: - { - audfmt_e *fmtp = opt->valp; - printf ( - "format, %s = %s, (one of: U8 S8 U16 S16 U32 S32)\n", - state, - audio_audfmt_to_string (*fmtp) - ); - } - break; - - case AUD_OPT_STR: - { - const char **strp = opt->valp; - printf ("string, %s = %s\n", - state, - *strp ? *strp : "(not set)"); - } - break; - - default: - printf ("???\n"); - dolog ("Bad value tag for option %s_%s %d\n", - uprefix, opt->name, opt->tag); - break; - } - printf (" %s\n", opt->descr); - } - - qemu_free (uprefix); -} - -static void audio_process_options (const char *prefix, - struct audio_option *opt) -{ - char *optname; - const char qemu_prefix[] = "QEMU_"; - size_t preflen, optlen; - - if (audio_bug (AUDIO_FUNC, !prefix)) { - dolog ("prefix = NULL\n"); - return; - } - - if (audio_bug (AUDIO_FUNC, !opt)) { - dolog ("opt = NULL\n"); - return; - } - - preflen = strlen (prefix); - - for (; opt->name; opt++) { - size_t len, i; - int def; - - if (!opt->valp) { - dolog ("Option value pointer for `%s' is not set\n", - opt->name); - continue; - } - - len = strlen (opt->name); - /* len of opt->name + len of prefix + size of qemu_prefix - * (includes trailing zero) + zero + underscore (on behalf of - * sizeof) */ - optlen = len + preflen + sizeof (qemu_prefix) + 1; - optname = qemu_malloc (optlen); - - pstrcpy (optname, optlen, qemu_prefix); - - /* copy while upper-casing, including trailing zero */ - for (i = 0; i <= preflen; ++i) { - optname[i + sizeof (qemu_prefix) - 1] = qemu_toupper(prefix[i]); - } - pstrcat (optname, optlen, "_"); - pstrcat (optname, optlen, opt->name); - - def = 1; - switch (opt->tag) { - case AUD_OPT_BOOL: - case AUD_OPT_INT: - { - int *intp = opt->valp; - *intp = audio_get_conf_int (optname, *intp, &def); - } - break; - - case AUD_OPT_FMT: - { - audfmt_e *fmtp = opt->valp; - *fmtp = audio_get_conf_fmt (optname, *fmtp, &def); - } - break; - - case AUD_OPT_STR: - { - const char **strp = opt->valp; - *strp = audio_get_conf_str (optname, *strp, &def); - } - break; - - default: - dolog ("Bad value tag for option `%s' - %d\n", - optname, opt->tag); - break; - } - - if (!opt->overriddenp) { - opt->overriddenp = &opt->overridden; - } - *opt->overriddenp = !def; - qemu_free (optname); - } -} - -static void audio_print_settings (struct audsettings *as) -{ - dolog ("frequency=%d nchannels=%d fmt=", as->freq, as->nchannels); - - switch (as->fmt) { - case AUD_FMT_S8: - AUD_log (NULL, "S8"); - break; - case AUD_FMT_U8: - AUD_log (NULL, "U8"); - break; - case AUD_FMT_S16: - AUD_log (NULL, "S16"); - break; - case AUD_FMT_U16: - AUD_log (NULL, "U16"); - break; - case AUD_FMT_S32: - AUD_log (NULL, "S32"); - break; - case AUD_FMT_U32: - AUD_log (NULL, "U32"); - break; - default: - AUD_log (NULL, "invalid(%d)", as->fmt); - break; - } - - AUD_log (NULL, " endianness="); - switch (as->endianness) { - case 0: - AUD_log (NULL, "little"); - break; - case 1: - AUD_log (NULL, "big"); - break; - default: - AUD_log (NULL, "invalid"); - break; - } - AUD_log (NULL, "\n"); -} - -static int audio_validate_settings (struct audsettings *as) -{ - int invalid; - - invalid = as->nchannels != 1 && as->nchannels != 2; - invalid |= as->endianness != 0 && as->endianness != 1; - - switch (as->fmt) { - case AUD_FMT_S8: - case AUD_FMT_U8: - case AUD_FMT_S16: - case AUD_FMT_U16: - case AUD_FMT_S32: - case AUD_FMT_U32: - break; - default: - invalid = 1; - break; - } - - invalid |= as->freq <= 0; - return invalid ? -1 : 0; -} - -static int audio_pcm_info_eq (struct audio_pcm_info *info, struct audsettings *as) -{ - int bits = 8, sign = 0; - - switch (as->fmt) { - case AUD_FMT_S8: - sign = 1; - case AUD_FMT_U8: - break; - - case AUD_FMT_S16: - sign = 1; - case AUD_FMT_U16: - bits = 16; - break; - - case AUD_FMT_S32: - sign = 1; - case AUD_FMT_U32: - bits = 32; - break; - } - return info->freq == as->freq - && info->nchannels == as->nchannels - && info->sign == sign - && info->bits == bits - && info->swap_endianness == (as->endianness != AUDIO_HOST_ENDIANNESS); -} - -void audio_pcm_init_info (struct audio_pcm_info *info, struct audsettings *as) -{ - int bits = 8, sign = 0, shift = 0; - - switch (as->fmt) { - case AUD_FMT_S8: - sign = 1; - case AUD_FMT_U8: - break; - - case AUD_FMT_S16: - sign = 1; - case AUD_FMT_U16: - bits = 16; - shift = 1; - break; - - case AUD_FMT_S32: - sign = 1; - case AUD_FMT_U32: - bits = 32; - shift = 2; - break; - } - - info->freq = as->freq; - info->bits = bits; - info->sign = sign; - info->nchannels = as->nchannels; - info->shift = (as->nchannels == 2) + shift; - info->align = (1 << info->shift) - 1; - info->bytes_per_second = info->freq << info->shift; - info->swap_endianness = (as->endianness != AUDIO_HOST_ENDIANNESS); -} - -void audio_pcm_info_clear_buf (struct audio_pcm_info *info, void *buf, int len) -{ - if (!len) { - return; - } - - if (info->sign) { - memset (buf, 0x00, len << info->shift); - } - else { - switch (info->bits) { - case 8: - memset (buf, 0x80, len << info->shift); - break; - - case 16: - { - int i; - uint16_t *p = buf; - int shift = info->nchannels - 1; - short s = INT16_MAX; - - if (info->swap_endianness) { - s = bswap16 (s); - } - - for (i = 0; i < len << shift; i++) { - p[i] = s; - } - } - break; - - case 32: - { - int i; - uint32_t *p = buf; - int shift = info->nchannels - 1; - int32_t s = INT32_MAX; - - if (info->swap_endianness) { - s = bswap32 (s); - } - - for (i = 0; i < len << shift; i++) { - p[i] = s; - } - } - break; - - default: - AUD_log (NULL, "audio_pcm_info_clear_buf: invalid bits %d\n", - info->bits); - break; - } - } -} - -/* - * Capture - */ -static void noop_conv (struct st_sample *dst, const void *src, - int samples, struct mixeng_volume *vol) -{ - (void) src; - (void) dst; - (void) samples; - (void) vol; -} - -static CaptureVoiceOut *audio_pcm_capture_find_specific ( - struct audsettings *as - ) -{ - CaptureVoiceOut *cap; - AudioState *s = &glob_audio_state; - - for (cap = s->cap_head.lh_first; cap; cap = cap->entries.le_next) { - if (audio_pcm_info_eq (&cap->hw.info, as)) { - return cap; - } - } - return NULL; -} - -static void audio_notify_capture (CaptureVoiceOut *cap, audcnotification_e cmd) -{ - struct capture_callback *cb; - -#ifdef DEBUG_CAPTURE - dolog ("notification %d sent\n", cmd); -#endif - for (cb = cap->cb_head.lh_first; cb; cb = cb->entries.le_next) { - cb->ops.notify (cb->opaque, cmd); - } -} - -static void audio_capture_maybe_changed (CaptureVoiceOut *cap, int enabled) -{ - if (cap->hw.enabled != enabled) { - audcnotification_e cmd; - cap->hw.enabled = enabled; - cmd = enabled ? AUD_CNOTIFY_ENABLE : AUD_CNOTIFY_DISABLE; - audio_notify_capture (cap, cmd); - } -} - -static void audio_recalc_and_notify_capture (CaptureVoiceOut *cap) -{ - HWVoiceOut *hw = &cap->hw; - SWVoiceOut *sw; - int enabled = 0; - - for (sw = hw->sw_head.lh_first; sw; sw = sw->entries.le_next) { - if (sw->active) { - enabled = 1; - break; - } - } - audio_capture_maybe_changed (cap, enabled); -} - -static void audio_detach_capture (HWVoiceOut *hw) -{ - SWVoiceCap *sc = hw->cap_head.lh_first; - - while (sc) { - SWVoiceCap *sc1 = sc->entries.le_next; - SWVoiceOut *sw = &sc->sw; - CaptureVoiceOut *cap = sc->cap; - int was_active = sw->active; - - if (sw->rate) { - st_rate_stop (sw->rate); - sw->rate = NULL; - } - - LIST_REMOVE (sw, entries); - LIST_REMOVE (sc, entries); - qemu_free (sc); - if (was_active) { - /* We have removed soft voice from the capture: - this might have changed the overall status of the capture - since this might have been the only active voice */ - audio_recalc_and_notify_capture (cap); - } - sc = sc1; - } -} - -static int audio_attach_capture (HWVoiceOut *hw) -{ - AudioState *s = &glob_audio_state; - CaptureVoiceOut *cap; - - audio_detach_capture (hw); - for (cap = s->cap_head.lh_first; cap; cap = cap->entries.le_next) { - SWVoiceCap *sc; - SWVoiceOut *sw; - HWVoiceOut *hw_cap = &cap->hw; - - sc = audio_calloc (AUDIO_FUNC, 1, sizeof (*sc)); - if (!sc) { - dolog ("Could not allocate soft capture voice (%zu bytes)\n", - sizeof (*sc)); - return -1; - } - - sc->cap = cap; - sw = &sc->sw; - sw->hw = hw_cap; - sw->info = hw->info; - sw->empty = 1; - sw->active = hw->enabled; - sw->conv = noop_conv; - sw->ratio = ((int64_t) hw_cap->info.freq << 32) / sw->info.freq; - sw->rate = st_rate_start (sw->info.freq, hw_cap->info.freq); - if (!sw->rate) { - dolog ("Could not start rate conversion for `%s'\n", SW_NAME (sw)); - qemu_free (sw); - return -1; - } - LIST_INSERT_HEAD (&hw_cap->sw_head, sw, entries); - LIST_INSERT_HEAD (&hw->cap_head, sc, entries); -#ifdef DEBUG_CAPTURE - asprintf (&sw->name, "for %p %d,%d,%d", - hw, sw->info.freq, sw->info.bits, sw->info.nchannels); - dolog ("Added %s active = %d\n", sw->name, sw->active); -#endif - if (sw->active) { - audio_capture_maybe_changed (cap, 1); - } - } - return 0; -} - -/* - * Hard voice (capture) - */ -static int audio_pcm_hw_find_min_in (HWVoiceIn *hw) -{ - SWVoiceIn *sw; - int m = hw->total_samples_captured; - - for (sw = hw->sw_head.lh_first; sw; sw = sw->entries.le_next) { - if (sw->active) { - m = audio_MIN (m, sw->total_hw_samples_acquired); - } - } - return m; -} - -int audio_pcm_hw_get_live_in (HWVoiceIn *hw) -{ - int live = hw->total_samples_captured - audio_pcm_hw_find_min_in (hw); - if (audio_bug (AUDIO_FUNC, live < 0 || live > hw->samples)) { - dolog ("live=%d hw->samples=%d\n", live, hw->samples); - return 0; - } - return live; -} - -/* - * Soft voice (capture) - */ -static int audio_pcm_sw_get_rpos_in (SWVoiceIn *sw) -{ - HWVoiceIn *hw = sw->hw; - int live = hw->total_samples_captured - sw->total_hw_samples_acquired; - int rpos; - - if (audio_bug (AUDIO_FUNC, live < 0 || live > hw->samples)) { - dolog ("live=%d hw->samples=%d\n", live, hw->samples); - return 0; - } - - rpos = hw->wpos - live; - if (rpos >= 0) { - return rpos; - } - else { - return hw->samples + rpos; - } -} - -int audio_pcm_sw_read (SWVoiceIn *sw, void *buf, int size) -{ - HWVoiceIn *hw = sw->hw; - int samples, live, ret = 0, swlim, isamp, osamp, rpos, total = 0; - struct st_sample *src, *dst = sw->buf; - - rpos = audio_pcm_sw_get_rpos_in (sw) % hw->samples; - - live = hw->total_samples_captured - sw->total_hw_samples_acquired; - if (audio_bug (AUDIO_FUNC, live < 0 || live > hw->samples)) { - dolog ("live_in=%d hw->samples=%d\n", live, hw->samples); - return 0; - } - - samples = size >> sw->info.shift; - if (!live) { - return 0; - } - - swlim = (live * sw->ratio) >> 32; - swlim = audio_MIN (swlim, samples); - - while (swlim) { - src = hw->conv_buf + rpos; - isamp = hw->wpos - rpos; - /* XXX: <= ? */ - if (isamp <= 0) { - isamp = hw->samples - rpos; - } - - if (!isamp) { - break; - } - osamp = swlim; - - if (audio_bug (AUDIO_FUNC, osamp < 0)) { - dolog ("osamp=%d\n", osamp); - return 0; - } - - st_rate_flow (sw->rate, src, dst, &isamp, &osamp); - swlim -= osamp; - rpos = (rpos + isamp) % hw->samples; - dst += osamp; - ret += osamp; - total += isamp; - } - - sw->clip (buf, sw->buf, ret); - sw->total_hw_samples_acquired += total; - return ret << sw->info.shift; -} - -/* - * Hard voice (playback) - */ -static int audio_pcm_hw_find_min_out (HWVoiceOut *hw, int *nb_livep) -{ - SWVoiceOut *sw; - int m = INT_MAX; - int nb_live = 0; - - for (sw = hw->sw_head.lh_first; sw; sw = sw->entries.le_next) { - if (sw->active || !sw->empty) { - m = audio_MIN (m, sw->total_hw_samples_mixed); - nb_live += 1; - } - } - - *nb_livep = nb_live; - return m; -} - -int audio_pcm_hw_get_live_out2 (HWVoiceOut *hw, int *nb_live) -{ - int smin; - - smin = audio_pcm_hw_find_min_out (hw, nb_live); - - if (!*nb_live) { - return 0; - } - else { - int live = smin; - - if (audio_bug (AUDIO_FUNC, live < 0 || live > hw->samples)) { - dolog ("live=%d hw->samples=%d\n", live, hw->samples); - return 0; - } - return live; - } -} - -int audio_pcm_hw_get_live_out (HWVoiceOut *hw) -{ - int nb_live; - int live; - - live = audio_pcm_hw_get_live_out2 (hw, &nb_live); - if (audio_bug (AUDIO_FUNC, live < 0 || live > hw->samples)) { - dolog ("live=%d hw->samples=%d\n", live, hw->samples); - return 0; - } - return live; -} - -/* - * Soft voice (playback) - */ -int audio_pcm_sw_write (SWVoiceOut *sw, void *buf, int size) -{ - int hwsamples, samples, isamp, osamp, wpos, live, dead, left, swlim, blck; - int ret = 0, pos = 0, total = 0; - - if (!sw) { - return size; - } - - hwsamples = sw->hw->samples; - - live = sw->total_hw_samples_mixed; - if (audio_bug (AUDIO_FUNC, live < 0 || live > hwsamples)){ - dolog ("live=%d hw->samples=%d\n", live, hwsamples); - return 0; - } - - if (live == hwsamples) { -#ifdef DEBUG_OUT - dolog ("%s is full %d\n", sw->name, live); -#endif - return 0; - } - - wpos = (sw->hw->rpos + live) % hwsamples; - samples = size >> sw->info.shift; - - dead = hwsamples - live; - swlim = ((int64_t) dead << 32) / sw->ratio; - swlim = audio_MIN (swlim, samples); - if (swlim) { - sw->conv (sw->buf, buf, swlim, &sw->vol); - } - - while (swlim) { - dead = hwsamples - live; - left = hwsamples - wpos; - blck = audio_MIN (dead, left); - if (!blck) { - break; - } - isamp = swlim; - osamp = blck; - st_rate_flow_mix ( - sw->rate, - sw->buf + pos, - sw->hw->mix_buf + wpos, - &isamp, - &osamp - ); - ret += isamp; - swlim -= isamp; - pos += isamp; - live += osamp; - wpos = (wpos + osamp) % hwsamples; - total += osamp; - } - - sw->total_hw_samples_mixed += total; - sw->empty = sw->total_hw_samples_mixed == 0; - -#ifdef DEBUG_OUT - dolog ( - "%s: write size %d ret %d total sw %d\n", - SW_NAME (sw), - size >> sw->info.shift, - ret, - sw->total_hw_samples_mixed - ); -#endif - - return ret << sw->info.shift; -} - -#ifdef DEBUG_AUDIO -static void audio_pcm_print_info (const char *cap, struct audio_pcm_info *info) -{ - dolog ("%s: bits %d, sign %d, freq %d, nchan %d\n", - cap, info->bits, info->sign, info->freq, info->nchannels); -} -#endif - -#define DAC -#include "audio_template.h" -#undef DAC -#include "audio_template.h" - -int AUD_write (SWVoiceOut *sw, void *buf, int size) -{ - int bytes; - - if (!sw) { - /* XXX: Consider options */ - return size; - } - - if (!sw->hw->enabled) { - dolog ("Writing to disabled voice %s\n", SW_NAME (sw)); - return 0; - } - - bytes = sw->hw->pcm_ops->write (sw, buf, size); - return bytes; -} - -int AUD_read (SWVoiceIn *sw, void *buf, int size) -{ - int bytes; - - if (!sw) { - /* XXX: Consider options */ - return size; - } - - if (!sw->hw->enabled) { - dolog ("Reading from disabled voice %s\n", SW_NAME (sw)); - return 0; - } - - bytes = sw->hw->pcm_ops->read (sw, buf, size); - return bytes; -} - -int AUD_get_buffer_size_out (SWVoiceOut *sw) -{ - return sw->hw->samples << sw->hw->info.shift; -} - -void AUD_set_active_out (SWVoiceOut *sw, int on) -{ - HWVoiceOut *hw; - - if (!sw) { - return; - } - - hw = sw->hw; - if (sw->active != on) { - AudioState *s = &glob_audio_state; - SWVoiceOut *temp_sw; - SWVoiceCap *sc; - - if (on) { - hw->pending_disable = 0; - if (!hw->enabled) { - hw->enabled = 1; - if (s->vm_running) { - hw->pcm_ops->ctl_out (hw, VOICE_ENABLE); - } - } - } - else { - if (hw->enabled) { - int nb_active = 0; - - for (temp_sw = hw->sw_head.lh_first; temp_sw; - temp_sw = temp_sw->entries.le_next) { - nb_active += temp_sw->active != 0; - } - - hw->pending_disable = nb_active == 1; - } - } - - for (sc = hw->cap_head.lh_first; sc; sc = sc->entries.le_next) { - sc->sw.active = hw->enabled; - if (hw->enabled) { - audio_capture_maybe_changed (sc->cap, 1); - } - } - sw->active = on; - } -} - -void AUD_set_active_in (SWVoiceIn *sw, int on) -{ - HWVoiceIn *hw; - - if (!sw) { - return; - } - - hw = sw->hw; - if (sw->active != on) { - AudioState *s = &glob_audio_state; - SWVoiceIn *temp_sw; - - if (on) { - if (!hw->enabled) { - hw->enabled = 1; - if (s->vm_running) { - hw->pcm_ops->ctl_in (hw, VOICE_ENABLE); - } - } - sw->total_hw_samples_acquired = hw->total_samples_captured; - } - else { - if (hw->enabled) { - int nb_active = 0; - - for (temp_sw = hw->sw_head.lh_first; temp_sw; - temp_sw = temp_sw->entries.le_next) { - nb_active += temp_sw->active != 0; - } - - if (nb_active == 1) { - hw->enabled = 0; - hw->pcm_ops->ctl_in (hw, VOICE_DISABLE); - } - } - } - sw->active = on; - } -} - -static int audio_get_avail (SWVoiceIn *sw) -{ - int live; - - if (!sw) { - return 0; - } - - live = sw->hw->total_samples_captured - sw->total_hw_samples_acquired; - if (audio_bug (AUDIO_FUNC, live < 0 || live > sw->hw->samples)) { - dolog ("live=%d sw->hw->samples=%d\n", live, sw->hw->samples); - return 0; - } - - ldebug ( - "%s: get_avail live %d ret %" PRId64 "\n", - SW_NAME (sw), - live, (((int64_t) live << 32) / sw->ratio) << sw->info.shift - ); - - return (((int64_t) live << 32) / sw->ratio) << sw->info.shift; -} - -static int audio_get_free (SWVoiceOut *sw) -{ - int live, dead; - - if (!sw) { - return 0; - } - - live = sw->total_hw_samples_mixed; - - if (audio_bug (AUDIO_FUNC, live < 0 || live > sw->hw->samples)) { - dolog ("live=%d sw->hw->samples=%d\n", live, sw->hw->samples); - return 0; - } - - dead = sw->hw->samples - live; - -#ifdef DEBUG_OUT - dolog ("%s: get_free live %d dead %d ret %" PRId64 "\n", - SW_NAME (sw), - live, dead, (((int64_t) dead << 32) / sw->ratio) << sw->info.shift); -#endif - - return (((int64_t) dead << 32) / sw->ratio) << sw->info.shift; -} - -static void audio_capture_mix_and_clear (HWVoiceOut *hw, int rpos, int samples) -{ - int n; - - if (hw->enabled) { - SWVoiceCap *sc; - - for (sc = hw->cap_head.lh_first; sc; sc = sc->entries.le_next) { - SWVoiceOut *sw = &sc->sw; - int rpos2 = rpos; - - n = samples; - while (n) { - int till_end_of_hw = hw->samples - rpos2; - int to_write = audio_MIN (till_end_of_hw, n); - int bytes = to_write << hw->info.shift; - int written; - - sw->buf = hw->mix_buf + rpos2; - written = audio_pcm_sw_write (sw, NULL, bytes); - if (written - bytes) { - dolog ("Could not mix %d bytes into a capture " - "buffer, mixed %d\n", - bytes, written); - break; - } - n -= to_write; - rpos2 = (rpos2 + to_write) % hw->samples; - } - } - } - - n = audio_MIN (samples, hw->samples - rpos); - mixeng_clear (hw->mix_buf + rpos, n); - mixeng_clear (hw->mix_buf, samples - n); -} - -static void audio_run_out (AudioState *s) -{ - HWVoiceOut *hw = NULL; - SWVoiceOut *sw; - - while ((hw = audio_pcm_hw_find_any_enabled_out (hw))) { - int played; - int live, free, nb_live, cleanup_required, prev_rpos; - - live = audio_pcm_hw_get_live_out2 (hw, &nb_live); - if (!nb_live) { - live = 0; - } - - if (audio_bug (AUDIO_FUNC, live < 0 || live > hw->samples)) { - dolog ("live=%d hw->samples=%d\n", live, hw->samples); - continue; - } - - if (hw->pending_disable && !nb_live) { - SWVoiceCap *sc; -#ifdef DEBUG_OUT - dolog ("Disabling voice\n"); -#endif - hw->enabled = 0; - hw->pending_disable = 0; - hw->pcm_ops->ctl_out (hw, VOICE_DISABLE); - for (sc = hw->cap_head.lh_first; sc; sc = sc->entries.le_next) { - sc->sw.active = 0; - audio_recalc_and_notify_capture (sc->cap); - } - continue; - } - - if (!live) { - for (sw = hw->sw_head.lh_first; sw; sw = sw->entries.le_next) { - if (sw->active) { - free = audio_get_free (sw); - if (free > 0) { - sw->callback.fn (sw->callback.opaque, free); - } - } - } - continue; - } - - prev_rpos = hw->rpos; - played = hw->pcm_ops->run_out (hw); - if (audio_bug (AUDIO_FUNC, hw->rpos >= hw->samples)) { - dolog ("hw->rpos=%d hw->samples=%d played=%d\n", - hw->rpos, hw->samples, played); - hw->rpos = 0; - } - -#ifdef DEBUG_OUT - dolog ("played=%d\n", played); -#endif - - if (played) { - hw->ts_helper += played; - audio_capture_mix_and_clear (hw, prev_rpos, played); - } - - cleanup_required = 0; - for (sw = hw->sw_head.lh_first; sw; sw = sw->entries.le_next) { - if (!sw->active && sw->empty) { - continue; - } - - if (audio_bug (AUDIO_FUNC, played > sw->total_hw_samples_mixed)) { - dolog ("played=%d sw->total_hw_samples_mixed=%d\n", - played, sw->total_hw_samples_mixed); - played = sw->total_hw_samples_mixed; - } - - sw->total_hw_samples_mixed -= played; - - if (!sw->total_hw_samples_mixed) { - sw->empty = 1; - cleanup_required |= !sw->active && !sw->callback.fn; - } - - if (sw->active) { - free = audio_get_free (sw); - if (free > 0) { - sw->callback.fn (sw->callback.opaque, free); - } - } - } - - if (cleanup_required) { - SWVoiceOut *sw1; - - sw = hw->sw_head.lh_first; - while (sw) { - sw1 = sw->entries.le_next; - if (!sw->active && !sw->callback.fn) { -#ifdef DEBUG_PLIVE - dolog ("Finishing with old voice\n"); -#endif - audio_close_out (sw); - } - sw = sw1; - } - } - } -} - -static void audio_run_in (AudioState *s) -{ - HWVoiceIn *hw = NULL; - - while ((hw = audio_pcm_hw_find_any_enabled_in (hw))) { - SWVoiceIn *sw; - int captured, min; - - captured = hw->pcm_ops->run_in (hw); - - min = audio_pcm_hw_find_min_in (hw); - hw->total_samples_captured += captured - min; - hw->ts_helper += captured; - - for (sw = hw->sw_head.lh_first; sw; sw = sw->entries.le_next) { - sw->total_hw_samples_acquired -= min; - - if (sw->active) { - int avail; - - avail = audio_get_avail (sw); - if (avail > 0) { - sw->callback.fn (sw->callback.opaque, avail); - } - } - } - } -} - -static void audio_run_capture (AudioState *s) -{ - CaptureVoiceOut *cap; - - for (cap = s->cap_head.lh_first; cap; cap = cap->entries.le_next) { - int live, rpos, captured; - HWVoiceOut *hw = &cap->hw; - SWVoiceOut *sw; - - captured = live = audio_pcm_hw_get_live_out (hw); - rpos = hw->rpos; - while (live) { - int left = hw->samples - rpos; - int to_capture = audio_MIN (live, left); - struct st_sample *src; - struct capture_callback *cb; - - src = hw->mix_buf + rpos; - hw->clip (cap->buf, src, to_capture); - mixeng_clear (src, to_capture); - - for (cb = cap->cb_head.lh_first; cb; cb = cb->entries.le_next) { - cb->ops.capture (cb->opaque, cap->buf, - to_capture << hw->info.shift); - } - rpos = (rpos + to_capture) % hw->samples; - live -= to_capture; - } - hw->rpos = rpos; - - for (sw = hw->sw_head.lh_first; sw; sw = sw->entries.le_next) { - if (!sw->active && sw->empty) { - continue; - } - - if (audio_bug (AUDIO_FUNC, captured > sw->total_hw_samples_mixed)) { - dolog ("captured=%d sw->total_hw_samples_mixed=%d\n", - captured, sw->total_hw_samples_mixed); - captured = sw->total_hw_samples_mixed; - } - - sw->total_hw_samples_mixed -= captured; - sw->empty = sw->total_hw_samples_mixed == 0; - } - } -} - -static void audio_timer (void *opaque) -{ - AudioState *s = opaque; - - audio_run_out (s); - audio_run_in (s); - audio_run_capture (s); - - qemu_mod_timer (s->ts, qemu_get_clock (vm_clock) + conf.period.ticks); -} - -static struct audio_option audio_options[] = { - /* DAC */ - {"DAC_FIXED_SETTINGS", AUD_OPT_BOOL, &conf.fixed_out.enabled, - "Use fixed settings for host DAC", NULL, 0}, - - {"DAC_FIXED_FREQ", AUD_OPT_INT, &conf.fixed_out.settings.freq, - "Frequency for fixed host DAC", NULL, 0}, - - {"DAC_FIXED_FMT", AUD_OPT_FMT, &conf.fixed_out.settings.fmt, - "Format for fixed host DAC", NULL, 0}, - - {"DAC_FIXED_CHANNELS", AUD_OPT_INT, &conf.fixed_out.settings.nchannels, - "Number of channels for fixed DAC (1 - mono, 2 - stereo)", NULL, 0}, - - {"DAC_VOICES", AUD_OPT_INT, &conf.fixed_out.nb_voices, - "Number of voices for DAC", NULL, 0}, - - /* ADC */ - {"ADC_FIXED_SETTINGS", AUD_OPT_BOOL, &conf.fixed_in.enabled, - "Use fixed settings for host ADC", NULL, 0}, - - {"ADC_FIXED_FREQ", AUD_OPT_INT, &conf.fixed_in.settings.freq, - "Frequency for fixed host ADC", NULL, 0}, - - {"ADC_FIXED_FMT", AUD_OPT_FMT, &conf.fixed_in.settings.fmt, - "Format for fixed host ADC", NULL, 0}, - - {"ADC_FIXED_CHANNELS", AUD_OPT_INT, &conf.fixed_in.settings.nchannels, - "Number of channels for fixed ADC (1 - mono, 2 - stereo)", NULL, 0}, - - {"ADC_VOICES", AUD_OPT_INT, &conf.fixed_in.nb_voices, - "Number of voices for ADC", NULL, 0}, - - /* Misc */ - {"TIMER_PERIOD", AUD_OPT_INT, &conf.period.hertz, - "Timer period in HZ (0 - use lowest possible)", NULL, 0}, - - {"PLIVE", AUD_OPT_BOOL, &conf.plive, - "(undocumented)", NULL, 0}, - - {"LOG_TO_MONITOR", AUD_OPT_BOOL, &conf.log_to_monitor, - "print logging messages to monitor instead of stderr", NULL, 0}, - - {NULL, 0, NULL, NULL, NULL, 0} -}; - -static void audio_pp_nb_voices (const char *typ, int nb) -{ - switch (nb) { - case 0: - printf ("Does not support %s\n", typ); - break; - case 1: - printf ("One %s voice\n", typ); - break; - case INT_MAX: - printf ("Theoretically supports many %s voices\n", typ); - break; - default: - printf ("Theoretically supports upto %d %s voices\n", nb, typ); - break; - } - -} - -void AUD_help (void) -{ - size_t i; - - audio_process_options ("AUDIO", audio_options); - for (i = 0; i < ARRAY_SIZE (drvtab); i++) { - struct audio_driver *d = drvtab[i]; - if (d->options) { - audio_process_options (d->name, d->options); - } - } - - printf ("Audio options:\n"); - audio_print_options ("AUDIO", audio_options); - printf ("\n"); - - printf ("Available drivers:\n"); - - for (i = 0; i < ARRAY_SIZE (drvtab); i++) { - struct audio_driver *d = drvtab[i]; - - printf ("Name: %s\n", d->name); - printf ("Description: %s\n", d->descr); - - audio_pp_nb_voices ("playback", d->max_voices_out); - audio_pp_nb_voices ("capture", d->max_voices_in); - - if (d->options) { - printf ("Options:\n"); - audio_print_options (d->name, d->options); - } - else { - printf ("No options\n"); - } - printf ("\n"); - } - - printf ( - "Options are settable through environment variables.\n" - "Example:\n" -#ifdef _WIN32 - " set QEMU_AUDIO_DRV=wav\n" - " set QEMU_WAV_PATH=c:\tune.wav\n" -#else - " export QEMU_AUDIO_DRV=wav\n" - " export QEMU_WAV_PATH=$HOME/tune.wav\n" - "(for csh replace export with setenv in the above)\n" -#endif - " qemu ...\n\n" - ); -} - -static int audio_driver_init (AudioState *s, struct audio_driver *drv) -{ - if (drv->options) { - audio_process_options (drv->name, drv->options); - } - s->drv_opaque = drv->init (); - - if (s->drv_opaque) { - audio_init_nb_voices_out (drv); - audio_init_nb_voices_in (drv); - s->drv = drv; - return 0; - } - else { - dolog ("Could not init `%s' audio driver\n", drv->name); - return -1; - } -} - -static void audio_vm_change_state_handler (void *opaque, int running, - int reason) -{ - AudioState *s = opaque; - HWVoiceOut *hwo = NULL; - HWVoiceIn *hwi = NULL; - int op = running ? VOICE_ENABLE : VOICE_DISABLE; - - s->vm_running = running; - while ((hwo = audio_pcm_hw_find_any_enabled_out (hwo))) { - hwo->pcm_ops->ctl_out (hwo, op); - } - - while ((hwi = audio_pcm_hw_find_any_enabled_in (hwi))) { - hwi->pcm_ops->ctl_in (hwi, op); - } -} - -static void audio_atexit (void) -{ - AudioState *s = &glob_audio_state; - HWVoiceOut *hwo = NULL; - HWVoiceIn *hwi = NULL; - - while ((hwo = audio_pcm_hw_find_any_enabled_out (hwo))) { - SWVoiceCap *sc; - - hwo->pcm_ops->ctl_out (hwo, VOICE_DISABLE); - hwo->pcm_ops->fini_out (hwo); - - for (sc = hwo->cap_head.lh_first; sc; sc = sc->entries.le_next) { - CaptureVoiceOut *cap = sc->cap; - struct capture_callback *cb; - - for (cb = cap->cb_head.lh_first; cb; cb = cb->entries.le_next) { - cb->ops.destroy (cb->opaque); - } - } - } - - while ((hwi = audio_pcm_hw_find_any_enabled_in (hwi))) { - hwi->pcm_ops->ctl_in (hwi, VOICE_DISABLE); - hwi->pcm_ops->fini_in (hwi); - } - - if (s->drv) { - s->drv->fini (s->drv_opaque); - } -} - -static void audio_save (QEMUFile *f, void *opaque) -{ - (void) f; - (void) opaque; -} - -static int audio_load (QEMUFile *f, void *opaque, int version_id) -{ - (void) f; - (void) opaque; - - if (version_id != 1) { - return -EINVAL; - } - - return 0; -} - -static void audio_init (void) -{ - size_t i; - int done = 0; - const char *drvname; - AudioState *s = &glob_audio_state; - - if (s->drv) { - return; - } - - LIST_INIT (&s->hw_head_out); - LIST_INIT (&s->hw_head_in); - LIST_INIT (&s->cap_head); - atexit (audio_atexit); - - s->ts = qemu_new_timer (vm_clock, audio_timer, s); - if (!s->ts) { - hw_error("Could not create audio timer\n"); - } - - audio_process_options ("AUDIO", audio_options); - - s->nb_hw_voices_out = conf.fixed_out.nb_voices; - s->nb_hw_voices_in = conf.fixed_in.nb_voices; - - if (s->nb_hw_voices_out <= 0) { - dolog ("Bogus number of playback voices %d, setting to 1\n", - s->nb_hw_voices_out); - s->nb_hw_voices_out = 1; - } - - if (s->nb_hw_voices_in <= 0) { - dolog ("Bogus number of capture voices %d, setting to 0\n", - s->nb_hw_voices_in); - s->nb_hw_voices_in = 0; - } - - { - int def; - drvname = audio_get_conf_str ("QEMU_AUDIO_DRV", NULL, &def); - } - - if (drvname) { - int found = 0; - - for (i = 0; i < ARRAY_SIZE (drvtab); i++) { - if (!strcmp (drvname, drvtab[i]->name)) { - done = !audio_driver_init (s, drvtab[i]); - found = 1; - break; - } - } - - if (!found) { - dolog ("Unknown audio driver `%s'\n", drvname); - dolog ("Run with -audio-help to list available drivers\n"); - } - } - - if (!done) { - for (i = 0; !done && i < ARRAY_SIZE (drvtab); i++) { - if (drvtab[i]->can_be_default) { - done = !audio_driver_init (s, drvtab[i]); - } - } - } - - if (!done) { - done = !audio_driver_init (s, &no_audio_driver); - if (!done) { - hw_error("Could not initialize audio subsystem\n"); - } - else { - dolog ("warning: Using timer based audio emulation\n"); - } - } - - VMChangeStateEntry *e; - - if (conf.period.hertz <= 0) { - if (conf.period.hertz < 0) { - dolog ("warning: Timer period is negative - %d " - "treating as zero\n", - conf.period.hertz); - } - conf.period.ticks = 1; - } else { - conf.period.ticks = ticks_per_sec / conf.period.hertz; - } - - e = qemu_add_vm_change_state_handler (audio_vm_change_state_handler, s); - if (!e) { - dolog ("warning: Could not register change state handler\n" - "(Audio can continue looping even after stopping the VM)\n"); - } - - LIST_INIT (&s->card_head); - register_savevm ("audio", 0, 1, audio_save, audio_load, s); - qemu_mod_timer (s->ts, qemu_get_clock (vm_clock) + conf.period.ticks); -} - -void AUD_register_card (const char *name, QEMUSoundCard *card) -{ - audio_init (); - card->name = qemu_strdup (name); - memset (&card->entries, 0, sizeof (card->entries)); - LIST_INSERT_HEAD (&glob_audio_state.card_head, card, entries); -} - -void AUD_remove_card (QEMUSoundCard *card) -{ - LIST_REMOVE (card, entries); - qemu_free (card->name); -} - - -CaptureVoiceOut *AUD_add_capture ( - struct audsettings *as, - struct audio_capture_ops *ops, - void *cb_opaque - ) -{ - AudioState *s = &glob_audio_state; - CaptureVoiceOut *cap; - struct capture_callback *cb; - - if (audio_validate_settings (as)) { - dolog ("Invalid settings were passed when trying to add capture\n"); - audio_print_settings (as); - goto err0; - } - - cb = audio_calloc (AUDIO_FUNC, 1, sizeof (*cb)); - if (!cb) { - dolog ("Could not allocate capture callback information, size %zu\n", - sizeof (*cb)); - goto err0; - } - cb->ops = *ops; - cb->opaque = cb_opaque; - - cap = audio_pcm_capture_find_specific (as); - if (cap) { - LIST_INSERT_HEAD (&cap->cb_head, cb, entries); - return cap; - } - else { - HWVoiceOut *hw; - CaptureVoiceOut *cap; - - cap = audio_calloc (AUDIO_FUNC, 1, sizeof (*cap)); - if (!cap) { - dolog ("Could not allocate capture voice, size %zu\n", - sizeof (*cap)); - goto err1; - } - - hw = &cap->hw; - LIST_INIT (&hw->sw_head); - LIST_INIT (&cap->cb_head); - - /* XXX find a more elegant way */ - hw->samples = 4096 * 4; - hw->mix_buf = audio_calloc (AUDIO_FUNC, hw->samples, - sizeof (struct st_sample)); - if (!hw->mix_buf) { - dolog ("Could not allocate capture mix buffer (%d samples)\n", - hw->samples); - goto err2; - } - - audio_pcm_init_info (&hw->info, as); - - cap->buf = audio_calloc (AUDIO_FUNC, hw->samples, 1 << hw->info.shift); - if (!cap->buf) { - dolog ("Could not allocate capture buffer " - "(%d samples, each %d bytes)\n", - hw->samples, 1 << hw->info.shift); - goto err3; - } - - hw->clip = mixeng_clip - [hw->info.nchannels == 2] - [hw->info.sign] - [hw->info.swap_endianness] - [audio_bits_to_index (hw->info.bits)]; - - LIST_INSERT_HEAD (&s->cap_head, cap, entries); - LIST_INSERT_HEAD (&cap->cb_head, cb, entries); - - hw = NULL; - while ((hw = audio_pcm_hw_find_any_out (hw))) { - audio_attach_capture (hw); - } - return cap; - - err3: - qemu_free (cap->hw.mix_buf); - err2: - qemu_free (cap); - err1: - qemu_free (cb); - err0: - return NULL; - } -} - -void AUD_del_capture (CaptureVoiceOut *cap, void *cb_opaque) -{ - struct capture_callback *cb; - - for (cb = cap->cb_head.lh_first; cb; cb = cb->entries.le_next) { - if (cb->opaque == cb_opaque) { - cb->ops.destroy (cb_opaque); - LIST_REMOVE (cb, entries); - qemu_free (cb); - - if (!cap->cb_head.lh_first) { - SWVoiceOut *sw = cap->hw.sw_head.lh_first, *sw1; - - while (sw) { - SWVoiceCap *sc = (SWVoiceCap *) sw; -#ifdef DEBUG_CAPTURE - dolog ("freeing %s\n", sw->name); -#endif - - sw1 = sw->entries.le_next; - if (sw->rate) { - st_rate_stop (sw->rate); - sw->rate = NULL; - } - LIST_REMOVE (sw, entries); - LIST_REMOVE (sc, entries); - qemu_free (sc); - sw = sw1; - } - LIST_REMOVE (cap, entries); - qemu_free (cap); - } - return; - } - } -} - -void AUD_set_volume_out (SWVoiceOut *sw, int mute, uint8_t lvol, uint8_t rvol) -{ - if (sw) { - sw->vol.mute = mute; - sw->vol.l = nominal_volume.l * lvol / 255; - sw->vol.r = nominal_volume.r * rvol / 255; - } -} - -void AUD_set_volume_in (SWVoiceIn *sw, int mute, uint8_t lvol, uint8_t rvol) -{ - if (sw) { - sw->vol.mute = mute; - sw->vol.l = nominal_volume.l * lvol / 255; - sw->vol.r = nominal_volume.r * rvol / 255; - } -} diff --git a/qemu-0.11.0/audio/audio.h b/qemu-0.11.0/audio/audio.h deleted file mode 100644 index 3fb2c8b..0000000 --- a/qemu-0.11.0/audio/audio.h +++ /dev/null @@ -1,173 +0,0 @@ -/* - * QEMU Audio subsystem header - * - * Copyright (c) 2003-2005 Vassili Karpov (malc) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -#ifndef QEMU_AUDIO_H -#define QEMU_AUDIO_H - -#include "config-host.h" -#include "sys-queue.h" - -typedef void (*audio_callback_fn_t) (void *opaque, int avail); - -typedef enum { - AUD_FMT_U8, - AUD_FMT_S8, - AUD_FMT_U16, - AUD_FMT_S16, - AUD_FMT_U32, - AUD_FMT_S32 -} audfmt_e; - -#ifdef WORDS_BIGENDIAN -#define AUDIO_HOST_ENDIANNESS 1 -#else -#define AUDIO_HOST_ENDIANNESS 0 -#endif - -struct audsettings { - int freq; - int nchannels; - audfmt_e fmt; - int endianness; -}; - -typedef enum { - AUD_CNOTIFY_ENABLE, - AUD_CNOTIFY_DISABLE -} audcnotification_e; - -struct audio_capture_ops { - void (*notify) (void *opaque, audcnotification_e cmd); - void (*capture) (void *opaque, void *buf, int size); - void (*destroy) (void *opaque); -}; - -struct capture_ops { - void (*info) (void *opaque); - void (*destroy) (void *opaque); -}; - -typedef struct CaptureState { - void *opaque; - struct capture_ops ops; - LIST_ENTRY (CaptureState) entries; -} CaptureState; - -typedef struct SWVoiceOut SWVoiceOut; -typedef struct CaptureVoiceOut CaptureVoiceOut; -typedef struct SWVoiceIn SWVoiceIn; - -typedef struct QEMUSoundCard { - char *name; - LIST_ENTRY (QEMUSoundCard) entries; -} QEMUSoundCard; - -typedef struct QEMUAudioTimeStamp { - uint64_t old_ts; -} QEMUAudioTimeStamp; - -void AUD_vlog (const char *cap, const char *fmt, va_list ap); -void AUD_log (const char *cap, const char *fmt, ...) -#ifdef __GNUC__ - __attribute__ ((__format__ (__printf__, 2, 3))) -#endif - ; - -void AUD_help (void); -void AUD_register_card (const char *name, QEMUSoundCard *card); -void AUD_remove_card (QEMUSoundCard *card); -CaptureVoiceOut *AUD_add_capture ( - struct audsettings *as, - struct audio_capture_ops *ops, - void *opaque - ); -void AUD_del_capture (CaptureVoiceOut *cap, void *cb_opaque); - -SWVoiceOut *AUD_open_out ( - QEMUSoundCard *card, - SWVoiceOut *sw, - const char *name, - void *callback_opaque, - audio_callback_fn_t callback_fn, - struct audsettings *settings - ); - -void AUD_close_out (QEMUSoundCard *card, SWVoiceOut *sw); -int AUD_write (SWVoiceOut *sw, void *pcm_buf, int size); -int AUD_get_buffer_size_out (SWVoiceOut *sw); -void AUD_set_active_out (SWVoiceOut *sw, int on); -int AUD_is_active_out (SWVoiceOut *sw); - -void AUD_init_time_stamp_out (SWVoiceOut *sw, QEMUAudioTimeStamp *ts); -uint64_t AUD_get_elapsed_usec_out (SWVoiceOut *sw, QEMUAudioTimeStamp *ts); - -void AUD_set_volume_out (SWVoiceOut *sw, int mute, uint8_t lvol, uint8_t rvol); -void AUD_set_volume_in (SWVoiceIn *sw, int mute, uint8_t lvol, uint8_t rvol); - -SWVoiceIn *AUD_open_in ( - QEMUSoundCard *card, - SWVoiceIn *sw, - const char *name, - void *callback_opaque, - audio_callback_fn_t callback_fn, - struct audsettings *settings - ); - -void AUD_close_in (QEMUSoundCard *card, SWVoiceIn *sw); -int AUD_read (SWVoiceIn *sw, void *pcm_buf, int size); -void AUD_set_active_in (SWVoiceIn *sw, int on); -int AUD_is_active_in (SWVoiceIn *sw); - -void AUD_init_time_stamp_in (SWVoiceIn *sw, QEMUAudioTimeStamp *ts); -uint64_t AUD_get_elapsed_usec_in (SWVoiceIn *sw, QEMUAudioTimeStamp *ts); - -static inline void *advance (void *p, int incr) -{ - uint8_t *d = p; - return (d + incr); -} - -uint32_t popcount (uint32_t u); -uint32_t lsbindex (uint32_t u); - -#ifdef __GNUC__ -#define audio_MIN(a, b) ( __extension__ ({ \ - __typeof (a) ta = a; \ - __typeof (b) tb = b; \ - ((ta)>(tb)?(tb):(ta)); \ -})) - -#define audio_MAX(a, b) ( __extension__ ({ \ - __typeof (a) ta = a; \ - __typeof (b) tb = b; \ - ((ta)<(tb)?(tb):(ta)); \ -})) -#else -#define audio_MIN(a, b) ((a)>(b)?(b):(a)) -#define audio_MAX(a, b) ((a)<(b)?(b):(a)) -#endif - -int wav_start_capture (CaptureState *s, const char *path, int freq, - int bits, int nchannels); - -#endif /* audio.h */ diff --git a/qemu-0.11.0/audio/audio_int.h b/qemu-0.11.0/audio/audio_int.h deleted file mode 100644 index 0abed38..0000000 --- a/qemu-0.11.0/audio/audio_int.h +++ /dev/null @@ -1,285 +0,0 @@ -/* - * QEMU Audio subsystem header - * - * Copyright (c) 2003-2005 Vassili Karpov (malc) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -#ifndef QEMU_AUDIO_INT_H -#define QEMU_AUDIO_INT_H - -#ifdef CONFIG_COREAUDIO -#define FLOAT_MIXENG -/* #define RECIPROCAL */ -#endif -#include "mixeng.h" - -struct audio_pcm_ops; - -typedef enum { - AUD_OPT_INT, - AUD_OPT_FMT, - AUD_OPT_STR, - AUD_OPT_BOOL -} audio_option_tag_e; - -struct audio_option { - const char *name; - audio_option_tag_e tag; - void *valp; - const char *descr; - int *overriddenp; - int overridden; -}; - -struct audio_callback { - void *opaque; - audio_callback_fn_t fn; -}; - -struct audio_pcm_info { - int bits; - int sign; - int freq; - int nchannels; - int align; - int shift; - int bytes_per_second; - int swap_endianness; -}; - -typedef struct SWVoiceCap SWVoiceCap; - -typedef struct HWVoiceOut { - int enabled; - int pending_disable; - struct audio_pcm_info info; - - f_sample *clip; - - int rpos; - uint64_t ts_helper; - - struct st_sample *mix_buf; - - int samples; - LIST_HEAD (sw_out_listhead, SWVoiceOut) sw_head; - LIST_HEAD (sw_cap_listhead, SWVoiceCap) cap_head; - struct audio_pcm_ops *pcm_ops; - LIST_ENTRY (HWVoiceOut) entries; -} HWVoiceOut; - -typedef struct HWVoiceIn { - int enabled; - struct audio_pcm_info info; - - t_sample *conv; - - int wpos; - int total_samples_captured; - uint64_t ts_helper; - - struct st_sample *conv_buf; - - int samples; - LIST_HEAD (sw_in_listhead, SWVoiceIn) sw_head; - struct audio_pcm_ops *pcm_ops; - LIST_ENTRY (HWVoiceIn) entries; -} HWVoiceIn; - -struct SWVoiceOut { - QEMUSoundCard *card; - struct audio_pcm_info info; - t_sample *conv; - int64_t ratio; - struct st_sample *buf; - void *rate; - int total_hw_samples_mixed; - int active; - int empty; - HWVoiceOut *hw; - char *name; - struct mixeng_volume vol; - struct audio_callback callback; - LIST_ENTRY (SWVoiceOut) entries; -}; - -struct SWVoiceIn { - QEMUSoundCard *card; - int active; - struct audio_pcm_info info; - int64_t ratio; - void *rate; - int total_hw_samples_acquired; - struct st_sample *buf; - f_sample *clip; - HWVoiceIn *hw; - char *name; - struct mixeng_volume vol; - struct audio_callback callback; - LIST_ENTRY (SWVoiceIn) entries; -}; - -struct audio_driver { - const char *name; - const char *descr; - struct audio_option *options; - void *(*init) (void); - void (*fini) (void *); - struct audio_pcm_ops *pcm_ops; - int can_be_default; - int max_voices_out; - int max_voices_in; - int voice_size_out; - int voice_size_in; -}; - -struct audio_pcm_ops { - int (*init_out)(HWVoiceOut *hw, struct audsettings *as); - void (*fini_out)(HWVoiceOut *hw); - int (*run_out) (HWVoiceOut *hw); - int (*write) (SWVoiceOut *sw, void *buf, int size); - int (*ctl_out) (HWVoiceOut *hw, int cmd, ...); - - int (*init_in) (HWVoiceIn *hw, struct audsettings *as); - void (*fini_in) (HWVoiceIn *hw); - int (*run_in) (HWVoiceIn *hw); - int (*read) (SWVoiceIn *sw, void *buf, int size); - int (*ctl_in) (HWVoiceIn *hw, int cmd, ...); -}; - -struct capture_callback { - struct audio_capture_ops ops; - void *opaque; - LIST_ENTRY (capture_callback) entries; -}; - -struct CaptureVoiceOut { - HWVoiceOut hw; - void *buf; - LIST_HEAD (cb_listhead, capture_callback) cb_head; - LIST_ENTRY (CaptureVoiceOut) entries; -}; - -struct SWVoiceCap { - SWVoiceOut sw; - CaptureVoiceOut *cap; - LIST_ENTRY (SWVoiceCap) entries; -}; - -struct AudioState { - struct audio_driver *drv; - void *drv_opaque; - - QEMUTimer *ts; - LIST_HEAD (card_listhead, QEMUSoundCard) card_head; - LIST_HEAD (hw_in_listhead, HWVoiceIn) hw_head_in; - LIST_HEAD (hw_out_listhead, HWVoiceOut) hw_head_out; - LIST_HEAD (cap_listhead, CaptureVoiceOut) cap_head; - int nb_hw_voices_out; - int nb_hw_voices_in; - int vm_running; -}; - -extern struct audio_driver no_audio_driver; -extern struct audio_driver oss_audio_driver; -extern struct audio_driver sdl_audio_driver; -extern struct audio_driver wav_audio_driver; -extern struct audio_driver fmod_audio_driver; -extern struct audio_driver alsa_audio_driver; -extern struct audio_driver coreaudio_audio_driver; -extern struct audio_driver dsound_audio_driver; -extern struct audio_driver esd_audio_driver; -extern struct audio_driver pa_audio_driver; -extern struct mixeng_volume nominal_volume; - -void audio_pcm_init_info (struct audio_pcm_info *info, struct audsettings *as); -void audio_pcm_info_clear_buf (struct audio_pcm_info *info, void *buf, int len); - -int audio_pcm_sw_write (SWVoiceOut *sw, void *buf, int len); -int audio_pcm_hw_get_live_in (HWVoiceIn *hw); - -int audio_pcm_sw_read (SWVoiceIn *sw, void *buf, int len); -int audio_pcm_hw_get_live_out (HWVoiceOut *hw); -int audio_pcm_hw_get_live_out2 (HWVoiceOut *hw, int *nb_live); - -int audio_bug (const char *funcname, int cond); -void *audio_calloc (const char *funcname, int nmemb, size_t size); - -#define VOICE_ENABLE 1 -#define VOICE_DISABLE 2 - -static inline int audio_ring_dist (int dst, int src, int len) -{ - return (dst >= src) ? (dst - src) : (len - src + dst); -} - -#if defined __GNUC__ -#define GCC_ATTR __attribute__ ((__unused__, __format__ (__printf__, 1, 2))) -#define INIT_FIELD(f) . f -#define GCC_FMT_ATTR(n, m) __attribute__ ((__format__ (__printf__, n, m))) -#else -#define GCC_ATTR /**/ -#define INIT_FIELD(f) /**/ -#define GCC_FMT_ATTR(n, m) -#endif - -static void GCC_ATTR dolog (const char *fmt, ...) -{ - va_list ap; - - va_start (ap, fmt); - AUD_vlog (AUDIO_CAP, fmt, ap); - va_end (ap); -} - -#ifdef DEBUG -static void GCC_ATTR ldebug (const char *fmt, ...) -{ - va_list ap; - - va_start (ap, fmt); - AUD_vlog (AUDIO_CAP, fmt, ap); - va_end (ap); -} -#else -#if defined NDEBUG && defined __GNUC__ -#define ldebug(...) -#elif defined NDEBUG && defined _MSC_VER -#define ldebug __noop -#else -static void GCC_ATTR ldebug (const char *fmt, ...) -{ - (void) fmt; -} -#endif -#endif - -#undef GCC_ATTR - -#define AUDIO_STRINGIFY_(n) #n -#define AUDIO_STRINGIFY(n) AUDIO_STRINGIFY_(n) - -#if defined _MSC_VER || defined __GNUC__ -#define AUDIO_FUNC __FUNCTION__ -#else -#define AUDIO_FUNC __FILE__ ":" AUDIO_STRINGIFY (__LINE__) -#endif - -#endif /* audio_int.h */ diff --git a/qemu-0.11.0/audio/audio_pt_int.c b/qemu-0.11.0/audio/audio_pt_int.c deleted file mode 100644 index e889a98..0000000 --- a/qemu-0.11.0/audio/audio_pt_int.c +++ /dev/null @@ -1,149 +0,0 @@ -#include "qemu-common.h" -#include "audio.h" - -#define AUDIO_CAP "audio-pt" - -#include "audio_int.h" -#include "audio_pt_int.h" - -static void logerr (struct audio_pt *pt, int err, const char *fmt, ...) -{ - va_list ap; - - va_start (ap, fmt); - AUD_vlog (pt->drv, fmt, ap); - va_end (ap); - - AUD_log (NULL, "\n"); - AUD_log (pt->drv, "Reason: %s\n", strerror (err)); -} - -int audio_pt_init (struct audio_pt *p, void *(*func) (void *), - void *opaque, const char *drv, const char *cap) -{ - int err, err2; - const char *efunc; - - p->drv = drv; - - err = pthread_mutex_init (&p->mutex, NULL); - if (err) { - efunc = "pthread_mutex_init"; - goto err0; - } - - err = pthread_cond_init (&p->cond, NULL); - if (err) { - efunc = "pthread_cond_init"; - goto err1; - } - - err = pthread_create (&p->thread, NULL, func, opaque); - if (err) { - efunc = "pthread_create"; - goto err2; - } - - return 0; - - err2: - err2 = pthread_cond_destroy (&p->cond); - if (err2) { - logerr (p, err2, "%s(%s): pthread_cond_destroy failed", cap, AUDIO_FUNC); - } - - err1: - err2 = pthread_mutex_destroy (&p->mutex); - if (err2) { - logerr (p, err2, "%s(%s): pthread_mutex_destroy failed", cap, AUDIO_FUNC); - } - - err0: - logerr (p, err, "%s(%s): %s failed", cap, AUDIO_FUNC, efunc); - return -1; -} - -int audio_pt_fini (struct audio_pt *p, const char *cap) -{ - int err, ret = 0; - - err = pthread_cond_destroy (&p->cond); - if (err) { - logerr (p, err, "%s(%s): pthread_cond_destroy failed", cap, AUDIO_FUNC); - ret = -1; - } - - err = pthread_mutex_destroy (&p->mutex); - if (err) { - logerr (p, err, "%s(%s): pthread_mutex_destroy failed", cap, AUDIO_FUNC); - ret = -1; - } - return ret; -} - -int audio_pt_lock (struct audio_pt *p, const char *cap) -{ - int err; - - err = pthread_mutex_lock (&p->mutex); - if (err) { - logerr (p, err, "%s(%s): pthread_mutex_lock failed", cap, AUDIO_FUNC); - return -1; - } - return 0; -} - -int audio_pt_unlock (struct audio_pt *p, const char *cap) -{ - int err; - - err = pthread_mutex_unlock (&p->mutex); - if (err) { - logerr (p, err, "%s(%s): pthread_mutex_unlock failed", cap, AUDIO_FUNC); - return -1; - } - return 0; -} - -int audio_pt_wait (struct audio_pt *p, const char *cap) -{ - int err; - - err = pthread_cond_wait (&p->cond, &p->mutex); - if (err) { - logerr (p, err, "%s(%s): pthread_cond_wait failed", cap, AUDIO_FUNC); - return -1; - } - return 0; -} - -int audio_pt_unlock_and_signal (struct audio_pt *p, const char *cap) -{ - int err; - - err = pthread_mutex_unlock (&p->mutex); - if (err) { - logerr (p, err, "%s(%s): pthread_mutex_unlock failed", cap, AUDIO_FUNC); - return -1; - } - err = pthread_cond_signal (&p->cond); - if (err) { - logerr (p, err, "%s(%s): pthread_cond_signal failed", cap, AUDIO_FUNC); - return -1; - } - return 0; -} - -int audio_pt_join (struct audio_pt *p, void **arg, const char *cap) -{ - int err; - void *ret; - - err = pthread_join (p->thread, &ret); - if (err) { - logerr (p, err, "%s(%s): pthread_join failed", cap, AUDIO_FUNC); - return -1; - } - *arg = ret; - return 0; -} diff --git a/qemu-0.11.0/audio/audio_pt_int.h b/qemu-0.11.0/audio/audio_pt_int.h deleted file mode 100644 index 0dfff76..0000000 --- a/qemu-0.11.0/audio/audio_pt_int.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef QEMU_AUDIO_PT_INT_H -#define QEMU_AUDIO_PT_INT_H - -#include <pthread.h> - -struct audio_pt { - const char *drv; - pthread_t thread; - pthread_cond_t cond; - pthread_mutex_t mutex; -}; - -int audio_pt_init (struct audio_pt *, void *(*) (void *), void *, - const char *, const char *); -int audio_pt_fini (struct audio_pt *, const char *); -int audio_pt_lock (struct audio_pt *, const char *); -int audio_pt_unlock (struct audio_pt *, const char *); -int audio_pt_wait (struct audio_pt *, const char *); -int audio_pt_unlock_and_signal (struct audio_pt *, const char *); -int audio_pt_join (struct audio_pt *, void **, const char *); - -#endif /* audio_pt_int.h */ diff --git a/qemu-0.11.0/audio/audio_template.h b/qemu-0.11.0/audio/audio_template.h deleted file mode 100644 index 0ffca65..0000000 --- a/qemu-0.11.0/audio/audio_template.h +++ /dev/null @@ -1,566 +0,0 @@ -/* - * QEMU Audio subsystem header - * - * Copyright (c) 2005 Vassili Karpov (malc) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#ifdef DAC -#define NAME "playback" -#define HWBUF hw->mix_buf -#define TYPE out -#define HW HWVoiceOut -#define SW SWVoiceOut -#else -#define NAME "capture" -#define TYPE in -#define HW HWVoiceIn -#define SW SWVoiceIn -#define HWBUF hw->conv_buf -#endif - -static void glue (audio_init_nb_voices_, TYPE) (struct audio_driver *drv) -{ - AudioState *s = &glob_audio_state; - int max_voices = glue (drv->max_voices_, TYPE); - int voice_size = glue (drv->voice_size_, TYPE); - - if (glue (s->nb_hw_voices_, TYPE) > max_voices) { - if (!max_voices) { -#ifdef DAC - dolog ("Driver `%s' does not support " NAME "\n", drv->name); -#endif - } - else { - dolog ("Driver `%s' does not support %d " NAME " voices, max %d\n", - drv->name, - glue (s->nb_hw_voices_, TYPE), - max_voices); - } - glue (s->nb_hw_voices_, TYPE) = max_voices; - } - - if (audio_bug (AUDIO_FUNC, !voice_size && max_voices)) { - dolog ("drv=`%s' voice_size=0 max_voices=%d\n", - drv->name, max_voices); - glue (s->nb_hw_voices_, TYPE) = 0; - } - - if (audio_bug (AUDIO_FUNC, voice_size && !max_voices)) { - dolog ("drv=`%s' voice_size=%d max_voices=0\n", - drv->name, voice_size); - } -} - -static void glue (audio_pcm_hw_free_resources_, TYPE) (HW *hw) -{ - if (HWBUF) { - qemu_free (HWBUF); - } - - HWBUF = NULL; -} - -static int glue (audio_pcm_hw_alloc_resources_, TYPE) (HW *hw) -{ - HWBUF = audio_calloc (AUDIO_FUNC, hw->samples, sizeof (struct st_sample)); - if (!HWBUF) { - dolog ("Could not allocate " NAME " buffer (%d samples)\n", - hw->samples); - return -1; - } - - return 0; -} - -static void glue (audio_pcm_sw_free_resources_, TYPE) (SW *sw) -{ - if (sw->buf) { - qemu_free (sw->buf); - } - - if (sw->rate) { - st_rate_stop (sw->rate); - } - - sw->buf = NULL; - sw->rate = NULL; -} - -static int glue (audio_pcm_sw_alloc_resources_, TYPE) (SW *sw) -{ - int samples; - -#ifdef DAC - samples = sw->hw->samples; -#else - samples = ((int64_t) sw->hw->samples << 32) / sw->ratio; -#endif - - sw->buf = audio_calloc (AUDIO_FUNC, samples, sizeof (struct st_sample)); - if (!sw->buf) { - dolog ("Could not allocate buffer for `%s' (%d samples)\n", - SW_NAME (sw), samples); - return -1; - } - -#ifdef DAC - sw->rate = st_rate_start (sw->info.freq, sw->hw->info.freq); -#else - sw->rate = st_rate_start (sw->hw->info.freq, sw->info.freq); -#endif - if (!sw->rate) { - qemu_free (sw->buf); - sw->buf = NULL; - return -1; - } - return 0; -} - -static int glue (audio_pcm_sw_init_, TYPE) ( - SW *sw, - HW *hw, - const char *name, - struct audsettings *as - ) -{ - int err; - - audio_pcm_init_info (&sw->info, as); - sw->hw = hw; - sw->active = 0; -#ifdef DAC - sw->ratio = ((int64_t) sw->hw->info.freq << 32) / sw->info.freq; - sw->total_hw_samples_mixed = 0; - sw->empty = 1; -#else - sw->ratio = ((int64_t) sw->info.freq << 32) / sw->hw->info.freq; -#endif - -#ifdef DAC - sw->conv = mixeng_conv -#else - sw->clip = mixeng_clip -#endif - [sw->info.nchannels == 2] - [sw->info.sign] - [sw->info.swap_endianness] - [audio_bits_to_index (sw->info.bits)]; - - sw->name = qemu_strdup (name); - err = glue (audio_pcm_sw_alloc_resources_, TYPE) (sw); - if (err) { - qemu_free (sw->name); - sw->name = NULL; - } - return err; -} - -static void glue (audio_pcm_sw_fini_, TYPE) (SW *sw) -{ - glue (audio_pcm_sw_free_resources_, TYPE) (sw); - if (sw->name) { - qemu_free (sw->name); - sw->name = NULL; - } -} - -static void glue (audio_pcm_hw_add_sw_, TYPE) (HW *hw, SW *sw) -{ - LIST_INSERT_HEAD (&hw->sw_head, sw, entries); -} - -static void glue (audio_pcm_hw_del_sw_, TYPE) (SW *sw) -{ - LIST_REMOVE (sw, entries); -} - -static void glue (audio_pcm_hw_gc_, TYPE) (HW **hwp) -{ - AudioState *s = &glob_audio_state; - HW *hw = *hwp; - - if (!hw->sw_head.lh_first) { -#ifdef DAC - audio_detach_capture (hw); -#endif - LIST_REMOVE (hw, entries); - glue (s->nb_hw_voices_, TYPE) += 1; - glue (audio_pcm_hw_free_resources_ ,TYPE) (hw); - glue (hw->pcm_ops->fini_, TYPE) (hw); - qemu_free (hw); - *hwp = NULL; - } -} - -static HW *glue (audio_pcm_hw_find_any_, TYPE) (HW *hw) -{ - AudioState *s = &glob_audio_state; - return hw ? hw->entries.le_next : glue (s->hw_head_, TYPE).lh_first; -} - -static HW *glue (audio_pcm_hw_find_any_enabled_, TYPE) (HW *hw) -{ - while ((hw = glue (audio_pcm_hw_find_any_, TYPE) (hw))) { - if (hw->enabled) { - return hw; - } - } - return NULL; -} - -static HW *glue (audio_pcm_hw_find_specific_, TYPE) ( - HW *hw, - struct audsettings *as - ) -{ - while ((hw = glue (audio_pcm_hw_find_any_, TYPE) (hw))) { - if (audio_pcm_info_eq (&hw->info, as)) { - return hw; - } - } - return NULL; -} - -static HW *glue (audio_pcm_hw_add_new_, TYPE) (struct audsettings *as) -{ - HW *hw; - AudioState *s = &glob_audio_state; - struct audio_driver *drv = s->drv; - - if (!glue (s->nb_hw_voices_, TYPE)) { - return NULL; - } - - if (audio_bug (AUDIO_FUNC, !drv)) { - dolog ("No host audio driver\n"); - return NULL; - } - - if (audio_bug (AUDIO_FUNC, !drv->pcm_ops)) { - dolog ("Host audio driver without pcm_ops\n"); - return NULL; - } - - hw = audio_calloc (AUDIO_FUNC, 1, glue (drv->voice_size_, TYPE)); - if (!hw) { - dolog ("Can not allocate voice `%s' size %d\n", - drv->name, glue (drv->voice_size_, TYPE)); - return NULL; - } - - hw->pcm_ops = drv->pcm_ops; - LIST_INIT (&hw->sw_head); -#ifdef DAC - LIST_INIT (&hw->cap_head); -#endif - if (glue (hw->pcm_ops->init_, TYPE) (hw, as)) { - goto err0; - } - - if (audio_bug (AUDIO_FUNC, hw->samples <= 0)) { - dolog ("hw->samples=%d\n", hw->samples); - goto err1; - } - -#ifdef DAC - hw->clip = mixeng_clip -#else - hw->conv = mixeng_conv -#endif - [hw->info.nchannels == 2] - [hw->info.sign] - [hw->info.swap_endianness] - [audio_bits_to_index (hw->info.bits)]; - - if (glue (audio_pcm_hw_alloc_resources_, TYPE) (hw)) { - goto err1; - } - - LIST_INSERT_HEAD (&s->glue (hw_head_, TYPE), hw, entries); - glue (s->nb_hw_voices_, TYPE) -= 1; -#ifdef DAC - audio_attach_capture (hw); -#endif - return hw; - - err1: - glue (hw->pcm_ops->fini_, TYPE) (hw); - err0: - qemu_free (hw); - return NULL; -} - -static HW *glue (audio_pcm_hw_add_, TYPE) (struct audsettings *as) -{ - HW *hw; - - if (glue (conf.fixed_, TYPE).enabled && glue (conf.fixed_, TYPE).greedy) { - hw = glue (audio_pcm_hw_add_new_, TYPE) (as); - if (hw) { - return hw; - } - } - - hw = glue (audio_pcm_hw_find_specific_, TYPE) (NULL, as); - if (hw) { - return hw; - } - - hw = glue (audio_pcm_hw_add_new_, TYPE) (as); - if (hw) { - return hw; - } - - return glue (audio_pcm_hw_find_any_, TYPE) (NULL); -} - -static SW *glue (audio_pcm_create_voice_pair_, TYPE) ( - const char *sw_name, - struct audsettings *as - ) -{ - SW *sw; - HW *hw; - struct audsettings hw_as; - - if (glue (conf.fixed_, TYPE).enabled) { - hw_as = glue (conf.fixed_, TYPE).settings; - } - else { - hw_as = *as; - } - - sw = audio_calloc (AUDIO_FUNC, 1, sizeof (*sw)); - if (!sw) { - dolog ("Could not allocate soft voice `%s' (%zu bytes)\n", - sw_name ? sw_name : "unknown", sizeof (*sw)); - goto err1; - } - - hw = glue (audio_pcm_hw_add_, TYPE) (&hw_as); - if (!hw) { - goto err2; - } - - glue (audio_pcm_hw_add_sw_, TYPE) (hw, sw); - - if (glue (audio_pcm_sw_init_, TYPE) (sw, hw, sw_name, as)) { - goto err3; - } - - return sw; - -err3: - glue (audio_pcm_hw_del_sw_, TYPE) (sw); - glue (audio_pcm_hw_gc_, TYPE) (&hw); -err2: - qemu_free (sw); -err1: - return NULL; -} - -static void glue (audio_close_, TYPE) (SW *sw) -{ - glue (audio_pcm_sw_fini_, TYPE) (sw); - glue (audio_pcm_hw_del_sw_, TYPE) (sw); - glue (audio_pcm_hw_gc_, TYPE) (&sw->hw); - qemu_free (sw); -} - -void glue (AUD_close_, TYPE) (QEMUSoundCard *card, SW *sw) -{ - if (sw) { - if (audio_bug (AUDIO_FUNC, !card)) { - dolog ("card=%p\n", card); - return; - } - - glue (audio_close_, TYPE) (sw); - } -} - -SW *glue (AUD_open_, TYPE) ( - QEMUSoundCard *card, - SW *sw, - const char *name, - void *callback_opaque , - audio_callback_fn_t callback_fn, - struct audsettings *as - ) -{ - AudioState *s = &glob_audio_state; -#ifdef DAC - int live = 0; - SW *old_sw = NULL; -#endif - - ldebug ("open %s, freq %d, nchannels %d, fmt %d\n", - name, as->freq, as->nchannels, as->fmt); - - if (audio_bug (AUDIO_FUNC, !card || !name || !callback_fn || !as)) { - dolog ("card=%p name=%p callback_fn=%p as=%p\n", - card, name, callback_fn, as); - goto fail; - } - - if (audio_bug (AUDIO_FUNC, audio_validate_settings (as))) { - audio_print_settings (as); - goto fail; - } - - if (audio_bug (AUDIO_FUNC, !s->drv)) { - dolog ("Can not open `%s' (no host audio driver)\n", name); - goto fail; - } - - if (sw && audio_pcm_info_eq (&sw->info, as)) { - return sw; - } - -#ifdef DAC - if (conf.plive && sw && (!sw->active && !sw->empty)) { - live = sw->total_hw_samples_mixed; - -#ifdef DEBUG_PLIVE - dolog ("Replacing voice %s with %d live samples\n", SW_NAME (sw), live); - dolog ("Old %s freq %d, bits %d, channels %d\n", - SW_NAME (sw), sw->info.freq, sw->info.bits, sw->info.nchannels); - dolog ("New %s freq %d, bits %d, channels %d\n", - name, - freq, - (fmt == AUD_FMT_S16 || fmt == AUD_FMT_U16) ? 16 : 8, - nchannels); -#endif - - if (live) { - old_sw = sw; - old_sw->callback.fn = NULL; - sw = NULL; - } - } -#endif - - if (!glue (conf.fixed_, TYPE).enabled && sw) { - glue (AUD_close_, TYPE) (card, sw); - sw = NULL; - } - - if (sw) { - HW *hw = sw->hw; - - if (!hw) { - dolog ("Internal logic error voice `%s' has no hardware store\n", - SW_NAME (sw)); - goto fail; - } - - glue (audio_pcm_sw_fini_, TYPE) (sw); - if (glue (audio_pcm_sw_init_, TYPE) (sw, hw, name, as)) { - goto fail; - } - } - else { - sw = glue (audio_pcm_create_voice_pair_, TYPE) (name, as); - if (!sw) { - dolog ("Failed to create voice `%s'\n", name); - return NULL; - } - } - - if (sw) { - sw->card = card; - sw->vol = nominal_volume; - sw->callback.fn = callback_fn; - sw->callback.opaque = callback_opaque; - -#ifdef DAC - if (live) { - int mixed = - (live << old_sw->info.shift) - * old_sw->info.bytes_per_second - / sw->info.bytes_per_second; - -#ifdef DEBUG_PLIVE - dolog ("Silence will be mixed %d\n", mixed); -#endif - sw->total_hw_samples_mixed += mixed; - } -#endif - -#ifdef DEBUG_AUDIO - dolog ("%s\n", name); - audio_pcm_print_info ("hw", &sw->hw->info); - audio_pcm_print_info ("sw", &sw->info); -#endif - } - - return sw; - - fail: - glue (AUD_close_, TYPE) (card, sw); - return NULL; -} - -int glue (AUD_is_active_, TYPE) (SW *sw) -{ - return sw ? sw->active : 0; -} - -void glue (AUD_init_time_stamp_, TYPE) (SW *sw, QEMUAudioTimeStamp *ts) -{ - if (!sw) { - return; - } - - ts->old_ts = sw->hw->ts_helper; -} - -uint64_t glue (AUD_get_elapsed_usec_, TYPE) (SW *sw, QEMUAudioTimeStamp *ts) -{ - uint64_t delta, cur_ts, old_ts; - - if (!sw) { - return 0; - } - - cur_ts = sw->hw->ts_helper; - old_ts = ts->old_ts; - /* dolog ("cur %lld old %lld\n", cur_ts, old_ts); */ - - if (cur_ts >= old_ts) { - delta = cur_ts - old_ts; - } - else { - delta = UINT64_MAX - old_ts + cur_ts; - } - - if (!delta) { - return 0; - } - - return (delta * sw->hw->info.freq) / 1000000; -} - -#undef TYPE -#undef HW -#undef SW -#undef HWBUF -#undef NAME diff --git a/qemu-0.11.0/audio/coreaudio.c b/qemu-0.11.0/audio/coreaudio.c deleted file mode 100644 index 9671429..0000000 --- a/qemu-0.11.0/audio/coreaudio.c +++ /dev/null @@ -1,550 +0,0 @@ -/* - * QEMU OS X CoreAudio audio driver - * - * Copyright (c) 2005 Mike Kronenberg - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include <CoreAudio/CoreAudio.h> -#include <string.h> /* strerror */ -#include <pthread.h> /* pthread_X */ - -#include "qemu-common.h" -#include "audio.h" - -#define AUDIO_CAP "coreaudio" -#include "audio_int.h" - -struct { - int buffer_frames; - int nbuffers; - int isAtexit; -} conf = { - .buffer_frames = 512, - .nbuffers = 4, - .isAtexit = 0 -}; - -typedef struct coreaudioVoiceOut { - HWVoiceOut hw; - pthread_mutex_t mutex; - int isAtexit; - AudioDeviceID outputDeviceID; - UInt32 audioDevicePropertyBufferFrameSize; - AudioStreamBasicDescription outputStreamBasicDescription; - int live; - int decr; - int rpos; -} coreaudioVoiceOut; - -static void coreaudio_logstatus (OSStatus status) -{ - char *str = "BUG"; - - switch(status) { - case kAudioHardwareNoError: - str = "kAudioHardwareNoError"; - break; - - case kAudioHardwareNotRunningError: - str = "kAudioHardwareNotRunningError"; - break; - - case kAudioHardwareUnspecifiedError: - str = "kAudioHardwareUnspecifiedError"; - break; - - case kAudioHardwareUnknownPropertyError: - str = "kAudioHardwareUnknownPropertyError"; - break; - - case kAudioHardwareBadPropertySizeError: - str = "kAudioHardwareBadPropertySizeError"; - break; - - case kAudioHardwareIllegalOperationError: - str = "kAudioHardwareIllegalOperationError"; - break; - - case kAudioHardwareBadDeviceError: - str = "kAudioHardwareBadDeviceError"; - break; - - case kAudioHardwareBadStreamError: - str = "kAudioHardwareBadStreamError"; - break; - - case kAudioHardwareUnsupportedOperationError: - str = "kAudioHardwareUnsupportedOperationError"; - break; - - case kAudioDeviceUnsupportedFormatError: - str = "kAudioDeviceUnsupportedFormatError"; - break; - - case kAudioDevicePermissionsError: - str = "kAudioDevicePermissionsError"; - break; - - default: - AUD_log (AUDIO_CAP, "Reason: status code %ld\n", status); - return; - } - - AUD_log (AUDIO_CAP, "Reason: %s\n", str); -} - -static void GCC_FMT_ATTR (2, 3) coreaudio_logerr ( - OSStatus status, - const char *fmt, - ... - ) -{ - va_list ap; - - va_start (ap, fmt); - AUD_log (AUDIO_CAP, fmt, ap); - va_end (ap); - - coreaudio_logstatus (status); -} - -static void GCC_FMT_ATTR (3, 4) coreaudio_logerr2 ( - OSStatus status, - const char *typ, - const char *fmt, - ... - ) -{ - va_list ap; - - AUD_log (AUDIO_CAP, "Could not initialize %s\n", typ); - - va_start (ap, fmt); - AUD_vlog (AUDIO_CAP, fmt, ap); - va_end (ap); - - coreaudio_logstatus (status); -} - -static inline UInt32 isPlaying (AudioDeviceID outputDeviceID) -{ - OSStatus status; - UInt32 result = 0; - UInt32 propertySize = sizeof(outputDeviceID); - status = AudioDeviceGetProperty( - outputDeviceID, 0, 0, - kAudioDevicePropertyDeviceIsRunning, &propertySize, &result); - if (status != kAudioHardwareNoError) { - coreaudio_logerr(status, - "Could not determine whether Device is playing\n"); - } - return result; -} - -static void coreaudio_atexit (void) -{ - conf.isAtexit = 1; -} - -static int coreaudio_lock (coreaudioVoiceOut *core, const char *fn_name) -{ - int err; - - err = pthread_mutex_lock (&core->mutex); - if (err) { - dolog ("Could not lock voice for %s\nReason: %s\n", - fn_name, strerror (err)); - return -1; - } - return 0; -} - -static int coreaudio_unlock (coreaudioVoiceOut *core, const char *fn_name) -{ - int err; - - err = pthread_mutex_unlock (&core->mutex); - if (err) { - dolog ("Could not unlock voice for %s\nReason: %s\n", - fn_name, strerror (err)); - return -1; - } - return 0; -} - -static int coreaudio_run_out (HWVoiceOut *hw) -{ - int live, decr; - coreaudioVoiceOut *core = (coreaudioVoiceOut *) hw; - - if (coreaudio_lock (core, "coreaudio_run_out")) { - return 0; - } - - live = audio_pcm_hw_get_live_out (hw); - - if (core->decr > live) { - ldebug ("core->decr %d live %d core->live %d\n", - core->decr, - live, - core->live); - } - - decr = audio_MIN (core->decr, live); - core->decr -= decr; - - core->live = live - decr; - hw->rpos = core->rpos; - - coreaudio_unlock (core, "coreaudio_run_out"); - return decr; -} - -/* callback to feed audiooutput buffer */ -static OSStatus audioDeviceIOProc( - AudioDeviceID inDevice, - const AudioTimeStamp* inNow, - const AudioBufferList* inInputData, - const AudioTimeStamp* inInputTime, - AudioBufferList* outOutputData, - const AudioTimeStamp* inOutputTime, - void* hwptr) -{ - UInt32 frame, frameCount; - float *out = outOutputData->mBuffers[0].mData; - HWVoiceOut *hw = hwptr; - coreaudioVoiceOut *core = (coreaudioVoiceOut *) hwptr; - int rpos, live; - struct st_sample *src; -#ifndef FLOAT_MIXENG -#ifdef RECIPROCAL - const float scale = 1.f / UINT_MAX; -#else - const float scale = UINT_MAX; -#endif -#endif - - if (coreaudio_lock (core, "audioDeviceIOProc")) { - inInputTime = 0; - return 0; - } - - frameCount = core->audioDevicePropertyBufferFrameSize; - live = core->live; - - /* if there are not enough samples, set signal and return */ - if (live < frameCount) { - inInputTime = 0; - coreaudio_unlock (core, "audioDeviceIOProc(empty)"); - return 0; - } - - rpos = core->rpos; - src = hw->mix_buf + rpos; - - /* fill buffer */ - for (frame = 0; frame < frameCount; frame++) { -#ifdef FLOAT_MIXENG - *out++ = src[frame].l; /* left channel */ - *out++ = src[frame].r; /* right channel */ -#else -#ifdef RECIPROCAL - *out++ = src[frame].l * scale; /* left channel */ - *out++ = src[frame].r * scale; /* right channel */ -#else - *out++ = src[frame].l / scale; /* left channel */ - *out++ = src[frame].r / scale; /* right channel */ -#endif -#endif - } - - rpos = (rpos + frameCount) % hw->samples; - core->decr += frameCount; - core->rpos = rpos; - - coreaudio_unlock (core, "audioDeviceIOProc"); - return 0; -} - -static int coreaudio_write (SWVoiceOut *sw, void *buf, int len) -{ - return audio_pcm_sw_write (sw, buf, len); -} - -static int coreaudio_init_out (HWVoiceOut *hw, struct audsettings *as) -{ - OSStatus status; - coreaudioVoiceOut *core = (coreaudioVoiceOut *) hw; - UInt32 propertySize; - int err; - const char *typ = "playback"; - AudioValueRange frameRange; - - /* create mutex */ - err = pthread_mutex_init(&core->mutex, NULL); - if (err) { - dolog("Could not create mutex\nReason: %s\n", strerror (err)); - return -1; - } - - audio_pcm_init_info (&hw->info, as); - - /* open default output device */ - propertySize = sizeof(core->outputDeviceID); - status = AudioHardwareGetProperty( - kAudioHardwarePropertyDefaultOutputDevice, - &propertySize, - &core->outputDeviceID); - if (status != kAudioHardwareNoError) { - coreaudio_logerr2 (status, typ, - "Could not get default output Device\n"); - return -1; - } - if (core->outputDeviceID == kAudioDeviceUnknown) { - dolog ("Could not initialize %s - Unknown Audiodevice\n", typ); - return -1; - } - - /* get minimum and maximum buffer frame sizes */ - propertySize = sizeof(frameRange); - status = AudioDeviceGetProperty( - core->outputDeviceID, - 0, - 0, - kAudioDevicePropertyBufferFrameSizeRange, - &propertySize, - &frameRange); - if (status != kAudioHardwareNoError) { - coreaudio_logerr2 (status, typ, - "Could not get device buffer frame range\n"); - return -1; - } - - if (frameRange.mMinimum > conf.buffer_frames) { - core->audioDevicePropertyBufferFrameSize = (UInt32) frameRange.mMinimum; - dolog ("warning: Upsizing Buffer Frames to %f\n", frameRange.mMinimum); - } - else if (frameRange.mMaximum < conf.buffer_frames) { - core->audioDevicePropertyBufferFrameSize = (UInt32) frameRange.mMaximum; - dolog ("warning: Downsizing Buffer Frames to %f\n", frameRange.mMaximum); - } - else { - core->audioDevicePropertyBufferFrameSize = conf.buffer_frames; - } - - /* set Buffer Frame Size */ - propertySize = sizeof(core->audioDevicePropertyBufferFrameSize); - status = AudioDeviceSetProperty( - core->outputDeviceID, - NULL, - 0, - false, - kAudioDevicePropertyBufferFrameSize, - propertySize, - &core->audioDevicePropertyBufferFrameSize); - if (status != kAudioHardwareNoError) { - coreaudio_logerr2 (status, typ, - "Could not set device buffer frame size %ld\n", - core->audioDevicePropertyBufferFrameSize); - return -1; - } - - /* get Buffer Frame Size */ - propertySize = sizeof(core->audioDevicePropertyBufferFrameSize); - status = AudioDeviceGetProperty( - core->outputDeviceID, - 0, - false, - kAudioDevicePropertyBufferFrameSize, - &propertySize, - &core->audioDevicePropertyBufferFrameSize); - if (status != kAudioHardwareNoError) { - coreaudio_logerr2 (status, typ, - "Could not get device buffer frame size\n"); - return -1; - } - hw->samples = conf.nbuffers * core->audioDevicePropertyBufferFrameSize; - - /* get StreamFormat */ - propertySize = sizeof(core->outputStreamBasicDescription); - status = AudioDeviceGetProperty( - core->outputDeviceID, - 0, - false, - kAudioDevicePropertyStreamFormat, - &propertySize, - &core->outputStreamBasicDescription); - if (status != kAudioHardwareNoError) { - coreaudio_logerr2 (status, typ, - "Could not get Device Stream properties\n"); - core->outputDeviceID = kAudioDeviceUnknown; - return -1; - } - - /* set Samplerate */ - core->outputStreamBasicDescription.mSampleRate = (Float64) as->freq; - propertySize = sizeof(core->outputStreamBasicDescription); - status = AudioDeviceSetProperty( - core->outputDeviceID, - 0, - 0, - 0, - kAudioDevicePropertyStreamFormat, - propertySize, - &core->outputStreamBasicDescription); - if (status != kAudioHardwareNoError) { - coreaudio_logerr2 (status, typ, "Could not set samplerate %d\n", - as->freq); - core->outputDeviceID = kAudioDeviceUnknown; - return -1; - } - - /* set Callback */ - status = AudioDeviceAddIOProc(core->outputDeviceID, audioDeviceIOProc, hw); - if (status != kAudioHardwareNoError) { - coreaudio_logerr2 (status, typ, "Could not set IOProc\n"); - core->outputDeviceID = kAudioDeviceUnknown; - return -1; - } - - /* start Playback */ - if (!isPlaying(core->outputDeviceID)) { - status = AudioDeviceStart(core->outputDeviceID, audioDeviceIOProc); - if (status != kAudioHardwareNoError) { - coreaudio_logerr2 (status, typ, "Could not start playback\n"); - AudioDeviceRemoveIOProc(core->outputDeviceID, audioDeviceIOProc); - core->outputDeviceID = kAudioDeviceUnknown; - return -1; - } - } - - return 0; -} - -static void coreaudio_fini_out (HWVoiceOut *hw) -{ - OSStatus status; - int err; - coreaudioVoiceOut *core = (coreaudioVoiceOut *) hw; - - if (!conf.isAtexit) { - /* stop playback */ - if (isPlaying(core->outputDeviceID)) { - status = AudioDeviceStop(core->outputDeviceID, audioDeviceIOProc); - if (status != kAudioHardwareNoError) { - coreaudio_logerr (status, "Could not stop playback\n"); - } - } - - /* remove callback */ - status = AudioDeviceRemoveIOProc(core->outputDeviceID, - audioDeviceIOProc); - if (status != kAudioHardwareNoError) { - coreaudio_logerr (status, "Could not remove IOProc\n"); - } - } - core->outputDeviceID = kAudioDeviceUnknown; - - /* destroy mutex */ - err = pthread_mutex_destroy(&core->mutex); - if (err) { - dolog("Could not destroy mutex\nReason: %s\n", strerror (err)); - } -} - -static int coreaudio_ctl_out (HWVoiceOut *hw, int cmd, ...) -{ - OSStatus status; - coreaudioVoiceOut *core = (coreaudioVoiceOut *) hw; - - switch (cmd) { - case VOICE_ENABLE: - /* start playback */ - if (!isPlaying(core->outputDeviceID)) { - status = AudioDeviceStart(core->outputDeviceID, audioDeviceIOProc); - if (status != kAudioHardwareNoError) { - coreaudio_logerr (status, "Could not resume playback\n"); - } - } - break; - - case VOICE_DISABLE: - /* stop playback */ - if (!conf.isAtexit) { - if (isPlaying(core->outputDeviceID)) { - status = AudioDeviceStop(core->outputDeviceID, audioDeviceIOProc); - if (status != kAudioHardwareNoError) { - coreaudio_logerr (status, "Could not pause playback\n"); - } - } - } - break; - } - return 0; -} - -static void *coreaudio_audio_init (void) -{ - atexit(coreaudio_atexit); - return &coreaudio_audio_init; -} - -static void coreaudio_audio_fini (void *opaque) -{ - (void) opaque; -} - -static struct audio_option coreaudio_options[] = { - {"BUFFER_SIZE", AUD_OPT_INT, &conf.buffer_frames, - "Size of the buffer in frames", NULL, 0}, - {"BUFFER_COUNT", AUD_OPT_INT, &conf.nbuffers, - "Number of buffers", NULL, 0}, - {NULL, 0, NULL, NULL, NULL, 0} -}; - -static struct audio_pcm_ops coreaudio_pcm_ops = { - coreaudio_init_out, - coreaudio_fini_out, - coreaudio_run_out, - coreaudio_write, - coreaudio_ctl_out, - - NULL, - NULL, - NULL, - NULL, - NULL -}; - -struct audio_driver coreaudio_audio_driver = { - INIT_FIELD (name = ) "coreaudio", - INIT_FIELD (descr = ) - "CoreAudio http://developer.apple.com/audio/coreaudio.html", - INIT_FIELD (options = ) coreaudio_options, - INIT_FIELD (init = ) coreaudio_audio_init, - INIT_FIELD (fini = ) coreaudio_audio_fini, - INIT_FIELD (pcm_ops = ) &coreaudio_pcm_ops, - INIT_FIELD (can_be_default = ) 1, - INIT_FIELD (max_voices_out = ) 1, - INIT_FIELD (max_voices_in = ) 0, - INIT_FIELD (voice_size_out = ) sizeof (coreaudioVoiceOut), - INIT_FIELD (voice_size_in = ) 0 -}; diff --git a/qemu-0.11.0/audio/dsound_template.h b/qemu-0.11.0/audio/dsound_template.h deleted file mode 100644 index 8b37d16..0000000 --- a/qemu-0.11.0/audio/dsound_template.h +++ /dev/null @@ -1,293 +0,0 @@ -/* - * QEMU DirectSound audio driver header - * - * Copyright (c) 2005 Vassili Karpov (malc) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -#ifdef DSBTYPE_IN -#define NAME "capture buffer" -#define NAME2 "DirectSoundCapture" -#define TYPE in -#define IFACE IDirectSoundCaptureBuffer -#define BUFPTR LPDIRECTSOUNDCAPTUREBUFFER -#define FIELD dsound_capture_buffer -#define FIELD2 dsound_capture -#else -#define NAME "playback buffer" -#define NAME2 "DirectSound" -#define TYPE out -#define IFACE IDirectSoundBuffer -#define BUFPTR LPDIRECTSOUNDBUFFER -#define FIELD dsound_buffer -#define FIELD2 dsound -#endif - -static int glue (dsound_unlock_, TYPE) ( - BUFPTR buf, - LPVOID p1, - LPVOID p2, - DWORD blen1, - DWORD blen2 - ) -{ - HRESULT hr; - - hr = glue (IFACE, _Unlock) (buf, p1, blen1, p2, blen2); - if (FAILED (hr)) { - dsound_logerr (hr, "Could not unlock " NAME "\n"); - return -1; - } - - return 0; -} - -static int glue (dsound_lock_, TYPE) ( - BUFPTR buf, - struct audio_pcm_info *info, - DWORD pos, - DWORD len, - LPVOID *p1p, - LPVOID *p2p, - DWORD *blen1p, - DWORD *blen2p, - int entire - ) -{ - HRESULT hr; - int i; - LPVOID p1 = NULL, p2 = NULL; - DWORD blen1 = 0, blen2 = 0; - DWORD flag; - -#ifdef DSBTYPE_IN - flag = entire ? DSCBLOCK_ENTIREBUFFER : 0; -#else - flag = entire ? DSBLOCK_ENTIREBUFFER : 0; -#endif - for (i = 0; i < conf.lock_retries; ++i) { - hr = glue (IFACE, _Lock) ( - buf, - pos, - len, - &p1, - &blen1, - &p2, - &blen2, - flag - ); - - if (FAILED (hr)) { -#ifndef DSBTYPE_IN - if (hr == DSERR_BUFFERLOST) { - if (glue (dsound_restore_, TYPE) (buf)) { - dsound_logerr (hr, "Could not lock " NAME "\n"); - goto fail; - } - continue; - } -#endif - dsound_logerr (hr, "Could not lock " NAME "\n"); - goto fail; - } - - break; - } - - if (i == conf.lock_retries) { - dolog ("%d attempts to lock " NAME " failed\n", i); - goto fail; - } - - if ((p1 && (blen1 & info->align)) || (p2 && (blen2 & info->align))) { - dolog ("DirectSound returned misaligned buffer %ld %ld\n", - blen1, blen2); - glue (dsound_unlock_, TYPE) (buf, p1, p2, blen1, blen2); - goto fail; - } - - if (!p1 && blen1) { - dolog ("warning: !p1 && blen1=%ld\n", blen1); - blen1 = 0; - } - - if (!p2 && blen2) { - dolog ("warning: !p2 && blen2=%ld\n", blen2); - blen2 = 0; - } - - *p1p = p1; - *p2p = p2; - *blen1p = blen1; - *blen2p = blen2; - return 0; - - fail: - *p1p = NULL - 1; - *p2p = NULL - 1; - *blen1p = -1; - *blen2p = -1; - return -1; -} - -#ifdef DSBTYPE_IN -static void dsound_fini_in (HWVoiceIn *hw) -#else -static void dsound_fini_out (HWVoiceOut *hw) -#endif -{ - HRESULT hr; -#ifdef DSBTYPE_IN - DSoundVoiceIn *ds = (DSoundVoiceIn *) hw; -#else - DSoundVoiceOut *ds = (DSoundVoiceOut *) hw; -#endif - - if (ds->FIELD) { - hr = glue (IFACE, _Stop) (ds->FIELD); - if (FAILED (hr)) { - dsound_logerr (hr, "Could not stop " NAME "\n"); - } - - hr = glue (IFACE, _Release) (ds->FIELD); - if (FAILED (hr)) { - dsound_logerr (hr, "Could not release " NAME "\n"); - } - ds->FIELD = NULL; - } -} - -#ifdef DSBTYPE_IN -static int dsound_init_in (HWVoiceIn *hw, struct audsettings *as) -#else -static int dsound_init_out (HWVoiceOut *hw, struct audsettings *as) -#endif -{ - int err; - HRESULT hr; - dsound *s = &glob_dsound; - WAVEFORMATEX wfx; - struct audsettings obt_as; -#ifdef DSBTYPE_IN - const char *typ = "ADC"; - DSoundVoiceIn *ds = (DSoundVoiceIn *) hw; - DSCBUFFERDESC bd; - DSCBCAPS bc; -#else - const char *typ = "DAC"; - DSoundVoiceOut *ds = (DSoundVoiceOut *) hw; - DSBUFFERDESC bd; - DSBCAPS bc; -#endif - - if (!s->FIELD2) { - dolog ("Attempt to initialize voice without " NAME2 " object\n"); - return -1; - } - - err = waveformat_from_audio_settings (&wfx, as); - if (err) { - return -1; - } - - memset (&bd, 0, sizeof (bd)); - bd.dwSize = sizeof (bd); - bd.lpwfxFormat = &wfx; -#ifdef DSBTYPE_IN - bd.dwBufferBytes = conf.bufsize_in; - hr = IDirectSoundCapture_CreateCaptureBuffer ( - s->dsound_capture, - &bd, - &ds->dsound_capture_buffer, - NULL - ); -#else - bd.dwFlags = DSBCAPS_STICKYFOCUS | DSBCAPS_GETCURRENTPOSITION2; - bd.dwBufferBytes = conf.bufsize_out; - hr = IDirectSound_CreateSoundBuffer ( - s->dsound, - &bd, - &ds->dsound_buffer, - NULL - ); -#endif - - if (FAILED (hr)) { - dsound_logerr2 (hr, typ, "Could not create " NAME "\n"); - return -1; - } - - hr = glue (IFACE, _GetFormat) (ds->FIELD, &wfx, sizeof (wfx), NULL); - if (FAILED (hr)) { - dsound_logerr2 (hr, typ, "Could not get " NAME " format\n"); - goto fail0; - } - -#ifdef DEBUG_DSOUND - dolog (NAME "\n"); - print_wave_format (&wfx); -#endif - - memset (&bc, 0, sizeof (bc)); - bc.dwSize = sizeof (bc); - - hr = glue (IFACE, _GetCaps) (ds->FIELD, &bc); - if (FAILED (hr)) { - dsound_logerr2 (hr, typ, "Could not get " NAME " format\n"); - goto fail0; - } - - err = waveformat_to_audio_settings (&wfx, &obt_as); - if (err) { - goto fail0; - } - - ds->first_time = 1; - obt_as.endianness = 0; - audio_pcm_init_info (&hw->info, &obt_as); - - if (bc.dwBufferBytes & hw->info.align) { - dolog ( - "GetCaps returned misaligned buffer size %ld, alignment %d\n", - bc.dwBufferBytes, hw->info.align + 1 - ); - } - hw->samples = bc.dwBufferBytes >> hw->info.shift; - -#ifdef DEBUG_DSOUND - dolog ("caps %ld, desc %ld\n", - bc.dwBufferBytes, bd.dwBufferBytes); - - dolog ("bufsize %d, freq %d, chan %d, fmt %d\n", - hw->bufsize, settings.freq, settings.nchannels, settings.fmt); -#endif - return 0; - - fail0: - glue (dsound_fini_, TYPE) (hw); - return -1; -} - -#undef NAME -#undef NAME2 -#undef TYPE -#undef IFACE -#undef BUFPTR -#undef FIELD -#undef FIELD2 diff --git a/qemu-0.11.0/audio/dsoundaudio.c b/qemu-0.11.0/audio/dsoundaudio.c deleted file mode 100644 index a78c856..0000000 --- a/qemu-0.11.0/audio/dsoundaudio.c +++ /dev/null @@ -1,1088 +0,0 @@ -/* - * QEMU DirectSound audio driver - * - * Copyright (c) 2005 Vassili Karpov (malc) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -/* - * SEAL 1.07 by Carlos 'pel' Hasan was used as documentation - */ - -#include "qemu-common.h" -#include "audio.h" - -#define AUDIO_CAP "dsound" -#include "audio_int.h" - -#include <windows.h> -#include <mmsystem.h> -#include <objbase.h> -#include <dsound.h> - -/* #define DEBUG_DSOUND */ - -static struct { - int lock_retries; - int restore_retries; - int getstatus_retries; - int set_primary; - int bufsize_in; - int bufsize_out; - struct audsettings settings; - int latency_millis; -} conf = { - 1, - 1, - 1, - 0, - 16384, - 16384, - { - 44100, - 2, - AUD_FMT_S16 - }, - 10 -}; - -typedef struct { - LPDIRECTSOUND dsound; - LPDIRECTSOUNDCAPTURE dsound_capture; - LPDIRECTSOUNDBUFFER dsound_primary_buffer; - struct audsettings settings; -} dsound; - -static dsound glob_dsound; - -typedef struct { - HWVoiceOut hw; - LPDIRECTSOUNDBUFFER dsound_buffer; - DWORD old_pos; - int first_time; -#ifdef DEBUG_DSOUND - DWORD old_ppos; - DWORD played; - DWORD mixed; -#endif -} DSoundVoiceOut; - -typedef struct { - HWVoiceIn hw; - int first_time; - LPDIRECTSOUNDCAPTUREBUFFER dsound_capture_buffer; -} DSoundVoiceIn; - -static void dsound_log_hresult (HRESULT hr) -{ - const char *str = "BUG"; - - switch (hr) { - case DS_OK: - str = "The method succeeded"; - break; -#ifdef DS_NO_VIRTUALIZATION - case DS_NO_VIRTUALIZATION: - str = "The buffer was created, but another 3D algorithm was substituted"; - break; -#endif -#ifdef DS_INCOMPLETE - case DS_INCOMPLETE: - str = "The method succeeded, but not all the optional effects were obtained"; - break; -#endif -#ifdef DSERR_ACCESSDENIED - case DSERR_ACCESSDENIED: - str = "The request failed because access was denied"; - break; -#endif -#ifdef DSERR_ALLOCATED - case DSERR_ALLOCATED: - str = "The request failed because resources, such as a priority level, were already in use by another caller"; - break; -#endif -#ifdef DSERR_ALREADYINITIALIZED - case DSERR_ALREADYINITIALIZED: - str = "The object is already initialized"; - break; -#endif -#ifdef DSERR_BADFORMAT - case DSERR_BADFORMAT: - str = "The specified wave format is not supported"; - break; -#endif -#ifdef DSERR_BADSENDBUFFERGUID - case DSERR_BADSENDBUFFERGUID: - str = "The GUID specified in an audiopath file does not match a valid mix-in buffer"; - break; -#endif -#ifdef DSERR_BUFFERLOST - case DSERR_BUFFERLOST: - str = "The buffer memory has been lost and must be restored"; - break; -#endif -#ifdef DSERR_BUFFERTOOSMALL - case DSERR_BUFFERTOOSMALL: - str = "The buffer size is not great enough to enable effects processing"; - break; -#endif -#ifdef DSERR_CONTROLUNAVAIL - case DSERR_CONTROLUNAVAIL: - 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"; - break; -#endif -#ifdef DSERR_DS8_REQUIRED - case DSERR_DS8_REQUIRED: - str = "A DirectSound object of class CLSID_DirectSound8 or later is required for the requested functionality. For more information, see IDirectSound8 Interface"; - break; -#endif -#ifdef DSERR_FXUNAVAILABLE - case DSERR_FXUNAVAILABLE: - 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"; - break; -#endif -#ifdef DSERR_GENERIC - case DSERR_GENERIC : - str = "An undetermined error occurred inside the DirectSound subsystem"; - break; -#endif -#ifdef DSERR_INVALIDCALL - case DSERR_INVALIDCALL: - str = "This function is not valid for the current state of this object"; - break; -#endif -#ifdef DSERR_INVALIDPARAM - case DSERR_INVALIDPARAM: - str = "An invalid parameter was passed to the returning function"; - break; -#endif -#ifdef DSERR_NOAGGREGATION - case DSERR_NOAGGREGATION: - str = "The object does not support aggregation"; - break; -#endif -#ifdef DSERR_NODRIVER - case DSERR_NODRIVER: - str = "No sound driver is available for use, or the given GUID is not a valid DirectSound device ID"; - break; -#endif -#ifdef DSERR_NOINTERFACE - case DSERR_NOINTERFACE: - str = "The requested COM interface is not available"; - break; -#endif -#ifdef DSERR_OBJECTNOTFOUND - case DSERR_OBJECTNOTFOUND: - str = "The requested object was not found"; - break; -#endif -#ifdef DSERR_OTHERAPPHASPRIO - case DSERR_OTHERAPPHASPRIO: - str = "Another application has a higher priority level, preventing this call from succeeding"; - break; -#endif -#ifdef DSERR_OUTOFMEMORY - case DSERR_OUTOFMEMORY: - str = "The DirectSound subsystem could not allocate sufficient memory to complete the caller's request"; - break; -#endif -#ifdef DSERR_PRIOLEVELNEEDED - case DSERR_PRIOLEVELNEEDED: - str = "A cooperative level of DSSCL_PRIORITY or higher is required"; - break; -#endif -#ifdef DSERR_SENDLOOP - case DSERR_SENDLOOP: - str = "A circular loop of send effects was detected"; - break; -#endif -#ifdef DSERR_UNINITIALIZED - case DSERR_UNINITIALIZED: - str = "The Initialize method has not been called or has not been called successfully before other methods were called"; - break; -#endif -#ifdef DSERR_UNSUPPORTED - case DSERR_UNSUPPORTED: - str = "The function called is not supported at this time"; - break; -#endif - default: - AUD_log (AUDIO_CAP, "Reason: Unknown (HRESULT %#lx)\n", hr); - return; - } - - AUD_log (AUDIO_CAP, "Reason: %s\n", str); -} - -static void GCC_FMT_ATTR (2, 3) dsound_logerr ( - HRESULT hr, - const char *fmt, - ... - ) -{ - va_list ap; - - va_start (ap, fmt); - AUD_vlog (AUDIO_CAP, fmt, ap); - va_end (ap); - - dsound_log_hresult (hr); -} - -static void GCC_FMT_ATTR (3, 4) dsound_logerr2 ( - HRESULT hr, - const char *typ, - const char *fmt, - ... - ) -{ - va_list ap; - - AUD_log (AUDIO_CAP, "Could not initialize %s\n", typ); - va_start (ap, fmt); - AUD_vlog (AUDIO_CAP, fmt, ap); - va_end (ap); - - dsound_log_hresult (hr); -} - -static DWORD millis_to_bytes (struct audio_pcm_info *info, DWORD millis) -{ - return (millis * info->bytes_per_second) / 1000; -} - -#ifdef DEBUG_DSOUND -static void print_wave_format (WAVEFORMATEX *wfx) -{ - dolog ("tag = %d\n", wfx->wFormatTag); - dolog ("nChannels = %d\n", wfx->nChannels); - dolog ("nSamplesPerSec = %ld\n", wfx->nSamplesPerSec); - dolog ("nAvgBytesPerSec = %ld\n", wfx->nAvgBytesPerSec); - dolog ("nBlockAlign = %d\n", wfx->nBlockAlign); - dolog ("wBitsPerSample = %d\n", wfx->wBitsPerSample); - dolog ("cbSize = %d\n", wfx->cbSize); -} -#endif - -static int dsound_restore_out (LPDIRECTSOUNDBUFFER dsb) -{ - HRESULT hr; - int i; - - for (i = 0; i < conf.restore_retries; ++i) { - hr = IDirectSoundBuffer_Restore (dsb); - - switch (hr) { - case DS_OK: - return 0; - - case DSERR_BUFFERLOST: - continue; - - default: - dsound_logerr (hr, "Could not restore playback buffer\n"); - return -1; - } - } - - dolog ("%d attempts to restore playback buffer failed\n", i); - return -1; -} - -static int waveformat_from_audio_settings (WAVEFORMATEX *wfx, - struct audsettings *as) -{ - memset (wfx, 0, sizeof (*wfx)); - - wfx->wFormatTag = WAVE_FORMAT_PCM; - wfx->nChannels = as->nchannels; - wfx->nSamplesPerSec = as->freq; - wfx->nAvgBytesPerSec = as->freq << (as->nchannels == 2); - wfx->nBlockAlign = 1 << (as->nchannels == 2); - wfx->cbSize = 0; - - switch (as->fmt) { - case AUD_FMT_S8: - case AUD_FMT_U8: - wfx->wBitsPerSample = 8; - break; - - case AUD_FMT_S16: - case AUD_FMT_U16: - wfx->wBitsPerSample = 16; - wfx->nAvgBytesPerSec <<= 1; - wfx->nBlockAlign <<= 1; - break; - - case AUD_FMT_S32: - case AUD_FMT_U32: - wfx->wBitsPerSample = 32; - wfx->nAvgBytesPerSec <<= 2; - wfx->nBlockAlign <<= 2; - break; - - default: - dolog ("Internal logic error: Bad audio format %d\n", as->freq); - return -1; - } - - return 0; -} - -static int waveformat_to_audio_settings (WAVEFORMATEX *wfx, - struct audsettings *as) -{ - if (wfx->wFormatTag != WAVE_FORMAT_PCM) { - dolog ("Invalid wave format, tag is not PCM, but %d\n", - wfx->wFormatTag); - return -1; - } - - if (!wfx->nSamplesPerSec) { - dolog ("Invalid wave format, frequency is zero\n"); - return -1; - } - as->freq = wfx->nSamplesPerSec; - - switch (wfx->nChannels) { - case 1: - as->nchannels = 1; - break; - - case 2: - as->nchannels = 2; - break; - - default: - dolog ( - "Invalid wave format, number of channels is not 1 or 2, but %d\n", - wfx->nChannels - ); - return -1; - } - - switch (wfx->wBitsPerSample) { - case 8: - as->fmt = AUD_FMT_U8; - break; - - case 16: - as->fmt = AUD_FMT_S16; - break; - - case 32: - as->fmt = AUD_FMT_S32; - break; - - default: - dolog ("Invalid wave format, bits per sample is not " - "8, 16 or 32, but %d\n", - wfx->wBitsPerSample); - return -1; - } - - return 0; -} - -#include "dsound_template.h" -#define DSBTYPE_IN -#include "dsound_template.h" -#undef DSBTYPE_IN - -static int dsound_get_status_out (LPDIRECTSOUNDBUFFER dsb, DWORD *statusp) -{ - HRESULT hr; - int i; - - for (i = 0; i < conf.getstatus_retries; ++i) { - hr = IDirectSoundBuffer_GetStatus (dsb, statusp); - if (FAILED (hr)) { - dsound_logerr (hr, "Could not get playback buffer status\n"); - return -1; - } - - if (*statusp & DSERR_BUFFERLOST) { - if (dsound_restore_out (dsb)) { - return -1; - } - continue; - } - break; - } - - return 0; -} - -static int dsound_get_status_in (LPDIRECTSOUNDCAPTUREBUFFER dscb, - DWORD *statusp) -{ - HRESULT hr; - - hr = IDirectSoundCaptureBuffer_GetStatus (dscb, statusp); - if (FAILED (hr)) { - dsound_logerr (hr, "Could not get capture buffer status\n"); - return -1; - } - - return 0; -} - -static void dsound_write_sample (HWVoiceOut *hw, uint8_t *dst, int dst_len) -{ - int src_len1 = dst_len; - int src_len2 = 0; - int pos = hw->rpos + dst_len; - struct st_sample *src1 = hw->mix_buf + hw->rpos; - struct st_sample *src2 = NULL; - - if (pos > hw->samples) { - src_len1 = hw->samples - hw->rpos; - src2 = hw->mix_buf; - src_len2 = dst_len - src_len1; - pos = src_len2; - } - - if (src_len1) { - hw->clip (dst, src1, src_len1); - } - - if (src_len2) { - dst = advance (dst, src_len1 << hw->info.shift); - hw->clip (dst, src2, src_len2); - } - - hw->rpos = pos % hw->samples; -} - -static void dsound_clear_sample (HWVoiceOut *hw, LPDIRECTSOUNDBUFFER dsb) -{ - int err; - LPVOID p1, p2; - DWORD blen1, blen2, len1, len2; - - err = dsound_lock_out ( - dsb, - &hw->info, - 0, - hw->samples << hw->info.shift, - &p1, &p2, - &blen1, &blen2, - 1 - ); - if (err) { - return; - } - - len1 = blen1 >> hw->info.shift; - len2 = blen2 >> hw->info.shift; - -#ifdef DEBUG_DSOUND - dolog ("clear %p,%ld,%ld %p,%ld,%ld\n", - p1, blen1, len1, - p2, blen2, len2); -#endif - - if (p1 && len1) { - audio_pcm_info_clear_buf (&hw->info, p1, len1); - } - - if (p2 && len2) { - audio_pcm_info_clear_buf (&hw->info, p2, len2); - } - - dsound_unlock_out (dsb, p1, p2, blen1, blen2); -} - -static void dsound_close (dsound *s) -{ - HRESULT hr; - - if (s->dsound_primary_buffer) { - hr = IDirectSoundBuffer_Release (s->dsound_primary_buffer); - if (FAILED (hr)) { - dsound_logerr (hr, "Could not release primary buffer\n"); - } - s->dsound_primary_buffer = NULL; - } -} - -static int dsound_open (dsound *s) -{ - int err; - HRESULT hr; - WAVEFORMATEX wfx; - DSBUFFERDESC dsbd; - HWND hwnd; - - hwnd = GetForegroundWindow (); - hr = IDirectSound_SetCooperativeLevel ( - s->dsound, - hwnd, - DSSCL_PRIORITY - ); - - if (FAILED (hr)) { - dsound_logerr (hr, "Could not set cooperative level for window %p\n", - hwnd); - return -1; - } - - if (!conf.set_primary) { - return 0; - } - - err = waveformat_from_audio_settings (&wfx, &conf.settings); - if (err) { - return -1; - } - - memset (&dsbd, 0, sizeof (dsbd)); - dsbd.dwSize = sizeof (dsbd); - dsbd.dwFlags = DSBCAPS_PRIMARYBUFFER; - dsbd.dwBufferBytes = 0; - dsbd.lpwfxFormat = NULL; - - hr = IDirectSound_CreateSoundBuffer ( - s->dsound, - &dsbd, - &s->dsound_primary_buffer, - NULL - ); - if (FAILED (hr)) { - dsound_logerr (hr, "Could not create primary playback buffer\n"); - return -1; - } - - hr = IDirectSoundBuffer_SetFormat (s->dsound_primary_buffer, &wfx); - if (FAILED (hr)) { - dsound_logerr (hr, "Could not set primary playback buffer format\n"); - } - - hr = IDirectSoundBuffer_GetFormat ( - s->dsound_primary_buffer, - &wfx, - sizeof (wfx), - NULL - ); - if (FAILED (hr)) { - dsound_logerr (hr, "Could not get primary playback buffer format\n"); - goto fail0; - } - -#ifdef DEBUG_DSOUND - dolog ("Primary\n"); - print_wave_format (&wfx); -#endif - - err = waveformat_to_audio_settings (&wfx, &s->settings); - if (err) { - goto fail0; - } - - return 0; - - fail0: - dsound_close (s); - return -1; -} - -static int dsound_ctl_out (HWVoiceOut *hw, int cmd, ...) -{ - HRESULT hr; - DWORD status; - DSoundVoiceOut *ds = (DSoundVoiceOut *) hw; - LPDIRECTSOUNDBUFFER dsb = ds->dsound_buffer; - - if (!dsb) { - dolog ("Attempt to control voice without a buffer\n"); - return 0; - } - - switch (cmd) { - case VOICE_ENABLE: - if (dsound_get_status_out (dsb, &status)) { - return -1; - } - - if (status & DSBSTATUS_PLAYING) { - dolog ("warning: Voice is already playing\n"); - return 0; - } - - dsound_clear_sample (hw, dsb); - - hr = IDirectSoundBuffer_Play (dsb, 0, 0, DSBPLAY_LOOPING); - if (FAILED (hr)) { - dsound_logerr (hr, "Could not start playing buffer\n"); - return -1; - } - break; - - case VOICE_DISABLE: - if (dsound_get_status_out (dsb, &status)) { - return -1; - } - - if (status & DSBSTATUS_PLAYING) { - hr = IDirectSoundBuffer_Stop (dsb); - if (FAILED (hr)) { - dsound_logerr (hr, "Could not stop playing buffer\n"); - return -1; - } - } - else { - dolog ("warning: Voice is not playing\n"); - } - break; - } - return 0; -} - -static int dsound_write (SWVoiceOut *sw, void *buf, int len) -{ - return audio_pcm_sw_write (sw, buf, len); -} - -static int dsound_run_out (HWVoiceOut *hw) -{ - int err; - HRESULT hr; - DSoundVoiceOut *ds = (DSoundVoiceOut *) hw; - LPDIRECTSOUNDBUFFER dsb = ds->dsound_buffer; - int live, len, hwshift; - DWORD blen1, blen2; - DWORD len1, len2; - DWORD decr; - DWORD wpos, ppos, old_pos; - LPVOID p1, p2; - int bufsize; - - if (!dsb) { - dolog ("Attempt to run empty with playback buffer\n"); - return 0; - } - - hwshift = hw->info.shift; - bufsize = hw->samples << hwshift; - - live = audio_pcm_hw_get_live_out (hw); - - hr = IDirectSoundBuffer_GetCurrentPosition ( - dsb, - &ppos, - ds->first_time ? &wpos : NULL - ); - if (FAILED (hr)) { - dsound_logerr (hr, "Could not get playback buffer position\n"); - return 0; - } - - len = live << hwshift; - - if (ds->first_time) { - if (conf.latency_millis) { - DWORD cur_blat; - - cur_blat = audio_ring_dist (wpos, ppos, bufsize); - ds->first_time = 0; - old_pos = wpos; - old_pos += - millis_to_bytes (&hw->info, conf.latency_millis) - cur_blat; - old_pos %= bufsize; - old_pos &= ~hw->info.align; - } - else { - old_pos = wpos; - } -#ifdef DEBUG_DSOUND - ds->played = 0; - ds->mixed = 0; -#endif - } - else { - if (ds->old_pos == ppos) { -#ifdef DEBUG_DSOUND - dolog ("old_pos == ppos\n"); -#endif - return 0; - } - -#ifdef DEBUG_DSOUND - ds->played += audio_ring_dist (ds->old_pos, ppos, hw->bufsize); -#endif - old_pos = ds->old_pos; - } - - if ((old_pos < ppos) && ((old_pos + len) > ppos)) { - len = ppos - old_pos; - } - else { - if ((old_pos > ppos) && ((old_pos + len) > (ppos + bufsize))) { - len = bufsize - old_pos + ppos; - } - } - - if (audio_bug (AUDIO_FUNC, len < 0 || len > bufsize)) { - dolog ("len=%d bufsize=%d old_pos=%ld ppos=%ld\n", - len, bufsize, old_pos, ppos); - return 0; - } - - len &= ~hw->info.align; - if (!len) { - return 0; - } - -#ifdef DEBUG_DSOUND - ds->old_ppos = ppos; -#endif - err = dsound_lock_out ( - dsb, - &hw->info, - old_pos, - len, - &p1, &p2, - &blen1, &blen2, - 0 - ); - if (err) { - return 0; - } - - len1 = blen1 >> hwshift; - len2 = blen2 >> hwshift; - decr = len1 + len2; - - if (p1 && len1) { - dsound_write_sample (hw, p1, len1); - } - - if (p2 && len2) { - dsound_write_sample (hw, p2, len2); - } - - dsound_unlock_out (dsb, p1, p2, blen1, blen2); - ds->old_pos = (old_pos + (decr << hwshift)) % bufsize; - -#ifdef DEBUG_DSOUND - ds->mixed += decr << hwshift; - - dolog ("played %lu mixed %lu diff %ld sec %f\n", - ds->played, - ds->mixed, - ds->mixed - ds->played, - abs (ds->mixed - ds->played) / (double) hw->info.bytes_per_second); -#endif - return decr; -} - -static int dsound_ctl_in (HWVoiceIn *hw, int cmd, ...) -{ - HRESULT hr; - DWORD status; - DSoundVoiceIn *ds = (DSoundVoiceIn *) hw; - LPDIRECTSOUNDCAPTUREBUFFER dscb = ds->dsound_capture_buffer; - - if (!dscb) { - dolog ("Attempt to control capture voice without a buffer\n"); - return -1; - } - - switch (cmd) { - case VOICE_ENABLE: - if (dsound_get_status_in (dscb, &status)) { - return -1; - } - - if (status & DSCBSTATUS_CAPTURING) { - dolog ("warning: Voice is already capturing\n"); - return 0; - } - - /* clear ?? */ - - hr = IDirectSoundCaptureBuffer_Start (dscb, DSCBSTART_LOOPING); - if (FAILED (hr)) { - dsound_logerr (hr, "Could not start capturing\n"); - return -1; - } - break; - - case VOICE_DISABLE: - if (dsound_get_status_in (dscb, &status)) { - return -1; - } - - if (status & DSCBSTATUS_CAPTURING) { - hr = IDirectSoundCaptureBuffer_Stop (dscb); - if (FAILED (hr)) { - dsound_logerr (hr, "Could not stop capturing\n"); - return -1; - } - } - else { - dolog ("warning: Voice is not capturing\n"); - } - break; - } - return 0; -} - -static int dsound_read (SWVoiceIn *sw, void *buf, int len) -{ - return audio_pcm_sw_read (sw, buf, len); -} - -static int dsound_run_in (HWVoiceIn *hw) -{ - int err; - HRESULT hr; - DSoundVoiceIn *ds = (DSoundVoiceIn *) hw; - LPDIRECTSOUNDCAPTUREBUFFER dscb = ds->dsound_capture_buffer; - int live, len, dead; - DWORD blen1, blen2; - DWORD len1, len2; - DWORD decr; - DWORD cpos, rpos; - LPVOID p1, p2; - int hwshift; - - if (!dscb) { - dolog ("Attempt to run without capture buffer\n"); - return 0; - } - - hwshift = hw->info.shift; - - live = audio_pcm_hw_get_live_in (hw); - dead = hw->samples - live; - if (!dead) { - return 0; - } - - hr = IDirectSoundCaptureBuffer_GetCurrentPosition ( - dscb, - &cpos, - ds->first_time ? &rpos : NULL - ); - if (FAILED (hr)) { - dsound_logerr (hr, "Could not get capture buffer position\n"); - return 0; - } - - if (ds->first_time) { - ds->first_time = 0; - if (rpos & hw->info.align) { - ldebug ("warning: Misaligned capture read position %ld(%d)\n", - rpos, hw->info.align); - } - hw->wpos = rpos >> hwshift; - } - - if (cpos & hw->info.align) { - ldebug ("warning: Misaligned capture position %ld(%d)\n", - cpos, hw->info.align); - } - cpos >>= hwshift; - - len = audio_ring_dist (cpos, hw->wpos, hw->samples); - if (!len) { - return 0; - } - len = audio_MIN (len, dead); - - err = dsound_lock_in ( - dscb, - &hw->info, - hw->wpos << hwshift, - len << hwshift, - &p1, - &p2, - &blen1, - &blen2, - 0 - ); - if (err) { - return 0; - } - - len1 = blen1 >> hwshift; - len2 = blen2 >> hwshift; - decr = len1 + len2; - - if (p1 && len1) { - hw->conv (hw->conv_buf + hw->wpos, p1, len1, &nominal_volume); - } - - if (p2 && len2) { - hw->conv (hw->conv_buf, p2, len2, &nominal_volume); - } - - dsound_unlock_in (dscb, p1, p2, blen1, blen2); - hw->wpos = (hw->wpos + decr) % hw->samples; - return decr; -} - -static void dsound_audio_fini (void *opaque) -{ - HRESULT hr; - dsound *s = opaque; - - if (!s->dsound) { - return; - } - - hr = IDirectSound_Release (s->dsound); - if (FAILED (hr)) { - dsound_logerr (hr, "Could not release DirectSound\n"); - } - s->dsound = NULL; - - if (!s->dsound_capture) { - return; - } - - hr = IDirectSoundCapture_Release (s->dsound_capture); - if (FAILED (hr)) { - dsound_logerr (hr, "Could not release DirectSoundCapture\n"); - } - s->dsound_capture = NULL; -} - -static void *dsound_audio_init (void) -{ - int err; - HRESULT hr; - dsound *s = &glob_dsound; - - hr = CoInitialize (NULL); - if (FAILED (hr)) { - dsound_logerr (hr, "Could not initialize COM\n"); - return NULL; - } - - hr = CoCreateInstance ( - &CLSID_DirectSound, - NULL, - CLSCTX_ALL, - &IID_IDirectSound, - (void **) &s->dsound - ); - if (FAILED (hr)) { - dsound_logerr (hr, "Could not create DirectSound instance\n"); - return NULL; - } - - hr = IDirectSound_Initialize (s->dsound, NULL); - if (FAILED (hr)) { - dsound_logerr (hr, "Could not initialize DirectSound\n"); - - hr = IDirectSound_Release (s->dsound); - if (FAILED (hr)) { - dsound_logerr (hr, "Could not release DirectSound\n"); - } - s->dsound = NULL; - return NULL; - } - - hr = CoCreateInstance ( - &CLSID_DirectSoundCapture, - NULL, - CLSCTX_ALL, - &IID_IDirectSoundCapture, - (void **) &s->dsound_capture - ); - if (FAILED (hr)) { - dsound_logerr (hr, "Could not create DirectSoundCapture instance\n"); - } - else { - hr = IDirectSoundCapture_Initialize (s->dsound_capture, NULL); - if (FAILED (hr)) { - dsound_logerr (hr, "Could not initialize DirectSoundCapture\n"); - - hr = IDirectSoundCapture_Release (s->dsound_capture); - if (FAILED (hr)) { - dsound_logerr (hr, "Could not release DirectSoundCapture\n"); - } - s->dsound_capture = NULL; - } - } - - err = dsound_open (s); - if (err) { - dsound_audio_fini (s); - return NULL; - } - - return s; -} - -static struct audio_option dsound_options[] = { - {"LOCK_RETRIES", AUD_OPT_INT, &conf.lock_retries, - "Number of times to attempt locking the buffer", NULL, 0}, - {"RESTOURE_RETRIES", AUD_OPT_INT, &conf.restore_retries, - "Number of times to attempt restoring the buffer", NULL, 0}, - {"GETSTATUS_RETRIES", AUD_OPT_INT, &conf.getstatus_retries, - "Number of times to attempt getting status of the buffer", NULL, 0}, - {"SET_PRIMARY", AUD_OPT_BOOL, &conf.set_primary, - "Set the parameters of primary buffer", NULL, 0}, - {"LATENCY_MILLIS", AUD_OPT_INT, &conf.latency_millis, - "(undocumented)", NULL, 0}, - {"PRIMARY_FREQ", AUD_OPT_INT, &conf.settings.freq, - "Primary buffer frequency", NULL, 0}, - {"PRIMARY_CHANNELS", AUD_OPT_INT, &conf.settings.nchannels, - "Primary buffer number of channels (1 - mono, 2 - stereo)", NULL, 0}, - {"PRIMARY_FMT", AUD_OPT_FMT, &conf.settings.fmt, - "Primary buffer format", NULL, 0}, - {"BUFSIZE_OUT", AUD_OPT_INT, &conf.bufsize_out, - "(undocumented)", NULL, 0}, - {"BUFSIZE_IN", AUD_OPT_INT, &conf.bufsize_in, - "(undocumented)", NULL, 0}, - {NULL, 0, NULL, NULL, NULL, 0} -}; - -static struct audio_pcm_ops dsound_pcm_ops = { - dsound_init_out, - dsound_fini_out, - dsound_run_out, - dsound_write, - dsound_ctl_out, - - dsound_init_in, - dsound_fini_in, - dsound_run_in, - dsound_read, - dsound_ctl_in -}; - -struct audio_driver dsound_audio_driver = { - INIT_FIELD (name = ) "dsound", - INIT_FIELD (descr = ) - "DirectSound http://wikipedia.org/wiki/DirectSound", - INIT_FIELD (options = ) dsound_options, - INIT_FIELD (init = ) dsound_audio_init, - INIT_FIELD (fini = ) dsound_audio_fini, - INIT_FIELD (pcm_ops = ) &dsound_pcm_ops, - INIT_FIELD (can_be_default = ) 1, - INIT_FIELD (max_voices_out = ) INT_MAX, - INIT_FIELD (max_voices_in = ) 1, - INIT_FIELD (voice_size_out = ) sizeof (DSoundVoiceOut), - INIT_FIELD (voice_size_in = ) sizeof (DSoundVoiceIn) -}; diff --git a/qemu-0.11.0/audio/esdaudio.c b/qemu-0.11.0/audio/esdaudio.c deleted file mode 100644 index 0102c5a..0000000 --- a/qemu-0.11.0/audio/esdaudio.c +++ /dev/null @@ -1,596 +0,0 @@ -/* - * QEMU ESD audio driver - * - * Copyright (c) 2006 Frederick Reeve (brushed up by malc) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -#include <esd.h> -#include "qemu-common.h" -#include "audio.h" -#include <signal.h> - -#define AUDIO_CAP "esd" -#include "audio_int.h" -#include "audio_pt_int.h" - -typedef struct { - HWVoiceOut hw; - int done; - int live; - int decr; - int rpos; - void *pcm_buf; - int fd; - struct audio_pt pt; -} ESDVoiceOut; - -typedef struct { - HWVoiceIn hw; - int done; - int dead; - int incr; - int wpos; - void *pcm_buf; - int fd; - struct audio_pt pt; -} ESDVoiceIn; - -static struct { - int samples; - int divisor; - char *dac_host; - char *adc_host; -} conf = { - 1024, - 2, - NULL, - NULL -}; - -static void GCC_FMT_ATTR (2, 3) qesd_logerr (int err, const char *fmt, ...) -{ - va_list ap; - - va_start (ap, fmt); - AUD_vlog (AUDIO_CAP, fmt, ap); - va_end (ap); - - AUD_log (AUDIO_CAP, "Reason: %s\n", strerror (err)); -} - -/* playback */ -static void *qesd_thread_out (void *arg) -{ - ESDVoiceOut *esd = arg; - HWVoiceOut *hw = &esd->hw; - int threshold; - - threshold = conf.divisor ? hw->samples / conf.divisor : 0; - - if (audio_pt_lock (&esd->pt, AUDIO_FUNC)) { - return NULL; - } - - for (;;) { - int decr, to_mix, rpos; - - for (;;) { - if (esd->done) { - goto exit; - } - - if (esd->live > threshold) { - break; - } - - if (audio_pt_wait (&esd->pt, AUDIO_FUNC)) { - goto exit; - } - } - - decr = to_mix = esd->live; - rpos = hw->rpos; - - if (audio_pt_unlock (&esd->pt, AUDIO_FUNC)) { - return NULL; - } - - while (to_mix) { - ssize_t written; - int chunk = audio_MIN (to_mix, hw->samples - rpos); - struct st_sample *src = hw->mix_buf + rpos; - - hw->clip (esd->pcm_buf, src, chunk); - - again: - written = write (esd->fd, esd->pcm_buf, chunk << hw->info.shift); - if (written == -1) { - if (errno == EINTR || errno == EAGAIN) { - goto again; - } - qesd_logerr (errno, "write failed\n"); - return NULL; - } - - if (written != chunk << hw->info.shift) { - int wsamples = written >> hw->info.shift; - int wbytes = wsamples << hw->info.shift; - if (wbytes != written) { - dolog ("warning: Misaligned write %d (requested %d), " - "alignment %d\n", - wbytes, written, hw->info.align + 1); - } - to_mix -= wsamples; - rpos = (rpos + wsamples) % hw->samples; - break; - } - - rpos = (rpos + chunk) % hw->samples; - to_mix -= chunk; - } - - if (audio_pt_lock (&esd->pt, AUDIO_FUNC)) { - return NULL; - } - - esd->rpos = rpos; - esd->live -= decr; - esd->decr += decr; - } - - exit: - audio_pt_unlock (&esd->pt, AUDIO_FUNC); - return NULL; -} - -static int qesd_run_out (HWVoiceOut *hw) -{ - int live, decr; - ESDVoiceOut *esd = (ESDVoiceOut *) hw; - - if (audio_pt_lock (&esd->pt, AUDIO_FUNC)) { - return 0; - } - - live = audio_pcm_hw_get_live_out (hw); - decr = audio_MIN (live, esd->decr); - esd->decr -= decr; - esd->live = live - decr; - hw->rpos = esd->rpos; - if (esd->live > 0) { - audio_pt_unlock_and_signal (&esd->pt, AUDIO_FUNC); - } - else { - audio_pt_unlock (&esd->pt, AUDIO_FUNC); - } - return decr; -} - -static int qesd_write (SWVoiceOut *sw, void *buf, int len) -{ - return audio_pcm_sw_write (sw, buf, len); -} - -static int qesd_init_out (HWVoiceOut *hw, struct audsettings *as) -{ - ESDVoiceOut *esd = (ESDVoiceOut *) hw; - struct audsettings obt_as = *as; - int esdfmt = ESD_STREAM | ESD_PLAY; - int err; - sigset_t set, old_set; - - sigfillset (&set); - - esdfmt |= (as->nchannels == 2) ? ESD_STEREO : ESD_MONO; - switch (as->fmt) { - case AUD_FMT_S8: - case AUD_FMT_U8: - esdfmt |= ESD_BITS8; - obt_as.fmt = AUD_FMT_U8; - break; - - case AUD_FMT_S32: - case AUD_FMT_U32: - dolog ("Will use 16 instead of 32 bit samples\n"); - - case AUD_FMT_S16: - case AUD_FMT_U16: - deffmt: - esdfmt |= ESD_BITS16; - obt_as.fmt = AUD_FMT_S16; - break; - - default: - dolog ("Internal logic error: Bad audio format %d\n", as->fmt); - goto deffmt; - - } - obt_as.endianness = AUDIO_HOST_ENDIANNESS; - - audio_pcm_init_info (&hw->info, &obt_as); - - hw->samples = conf.samples; - esd->pcm_buf = audio_calloc (AUDIO_FUNC, hw->samples, 1 << hw->info.shift); - if (!esd->pcm_buf) { - dolog ("Could not allocate buffer (%d bytes)\n", - hw->samples << hw->info.shift); - return -1; - } - - esd->fd = -1; - err = pthread_sigmask (SIG_BLOCK, &set, &old_set); - if (err) { - qesd_logerr (err, "pthread_sigmask failed\n"); - goto fail1; - } - - esd->fd = esd_play_stream (esdfmt, as->freq, conf.dac_host, NULL); - if (esd->fd < 0) { - qesd_logerr (errno, "esd_play_stream failed\n"); - goto fail2; - } - - if (audio_pt_init (&esd->pt, qesd_thread_out, esd, AUDIO_CAP, AUDIO_FUNC)) { - goto fail3; - } - - err = pthread_sigmask (SIG_SETMASK, &old_set, NULL); - if (err) { - qesd_logerr (err, "pthread_sigmask(restore) failed\n"); - } - - return 0; - - fail3: - if (close (esd->fd)) { - qesd_logerr (errno, "%s: close on esd socket(%d) failed\n", - AUDIO_FUNC, esd->fd); - } - esd->fd = -1; - - fail2: - err = pthread_sigmask (SIG_SETMASK, &old_set, NULL); - if (err) { - qesd_logerr (err, "pthread_sigmask(restore) failed\n"); - } - - fail1: - qemu_free (esd->pcm_buf); - esd->pcm_buf = NULL; - return -1; -} - -static void qesd_fini_out (HWVoiceOut *hw) -{ - void *ret; - ESDVoiceOut *esd = (ESDVoiceOut *) hw; - - audio_pt_lock (&esd->pt, AUDIO_FUNC); - esd->done = 1; - audio_pt_unlock_and_signal (&esd->pt, AUDIO_FUNC); - audio_pt_join (&esd->pt, &ret, AUDIO_FUNC); - - if (esd->fd >= 0) { - if (close (esd->fd)) { - qesd_logerr (errno, "failed to close esd socket\n"); - } - esd->fd = -1; - } - - audio_pt_fini (&esd->pt, AUDIO_FUNC); - - qemu_free (esd->pcm_buf); - esd->pcm_buf = NULL; -} - -static int qesd_ctl_out (HWVoiceOut *hw, int cmd, ...) -{ - (void) hw; - (void) cmd; - return 0; -} - -/* capture */ -static void *qesd_thread_in (void *arg) -{ - ESDVoiceIn *esd = arg; - HWVoiceIn *hw = &esd->hw; - int threshold; - - threshold = conf.divisor ? hw->samples / conf.divisor : 0; - - if (audio_pt_lock (&esd->pt, AUDIO_FUNC)) { - return NULL; - } - - for (;;) { - int incr, to_grab, wpos; - - for (;;) { - if (esd->done) { - goto exit; - } - - if (esd->dead > threshold) { - break; - } - - if (audio_pt_wait (&esd->pt, AUDIO_FUNC)) { - goto exit; - } - } - - incr = to_grab = esd->dead; - wpos = hw->wpos; - - if (audio_pt_unlock (&esd->pt, AUDIO_FUNC)) { - return NULL; - } - - while (to_grab) { - ssize_t nread; - int chunk = audio_MIN (to_grab, hw->samples - wpos); - void *buf = advance (esd->pcm_buf, wpos); - - again: - nread = read (esd->fd, buf, chunk << hw->info.shift); - if (nread == -1) { - if (errno == EINTR || errno == EAGAIN) { - goto again; - } - qesd_logerr (errno, "read failed\n"); - return NULL; - } - - if (nread != chunk << hw->info.shift) { - int rsamples = nread >> hw->info.shift; - int rbytes = rsamples << hw->info.shift; - if (rbytes != nread) { - dolog ("warning: Misaligned write %d (requested %d), " - "alignment %d\n", - rbytes, nread, hw->info.align + 1); - } - to_grab -= rsamples; - wpos = (wpos + rsamples) % hw->samples; - break; - } - - hw->conv (hw->conv_buf + wpos, buf, nread >> hw->info.shift, - &nominal_volume); - wpos = (wpos + chunk) % hw->samples; - to_grab -= chunk; - } - - if (audio_pt_lock (&esd->pt, AUDIO_FUNC)) { - return NULL; - } - - esd->wpos = wpos; - esd->dead -= incr; - esd->incr += incr; - } - - exit: - audio_pt_unlock (&esd->pt, AUDIO_FUNC); - return NULL; -} - -static int qesd_run_in (HWVoiceIn *hw) -{ - int live, incr, dead; - ESDVoiceIn *esd = (ESDVoiceIn *) hw; - - if (audio_pt_lock (&esd->pt, AUDIO_FUNC)) { - return 0; - } - - live = audio_pcm_hw_get_live_in (hw); - dead = hw->samples - live; - incr = audio_MIN (dead, esd->incr); - esd->incr -= incr; - esd->dead = dead - incr; - hw->wpos = esd->wpos; - if (esd->dead > 0) { - audio_pt_unlock_and_signal (&esd->pt, AUDIO_FUNC); - } - else { - audio_pt_unlock (&esd->pt, AUDIO_FUNC); - } - return incr; -} - -static int qesd_read (SWVoiceIn *sw, void *buf, int len) -{ - return audio_pcm_sw_read (sw, buf, len); -} - -static int qesd_init_in (HWVoiceIn *hw, struct audsettings *as) -{ - ESDVoiceIn *esd = (ESDVoiceIn *) hw; - struct audsettings obt_as = *as; - int esdfmt = ESD_STREAM | ESD_RECORD; - int err; - sigset_t set, old_set; - - sigfillset (&set); - - esdfmt |= (as->nchannels == 2) ? ESD_STEREO : ESD_MONO; - switch (as->fmt) { - case AUD_FMT_S8: - case AUD_FMT_U8: - esdfmt |= ESD_BITS8; - obt_as.fmt = AUD_FMT_U8; - break; - - case AUD_FMT_S16: - case AUD_FMT_U16: - esdfmt |= ESD_BITS16; - obt_as.fmt = AUD_FMT_S16; - break; - - case AUD_FMT_S32: - case AUD_FMT_U32: - dolog ("Will use 16 instead of 32 bit samples\n"); - esdfmt |= ESD_BITS16; - obt_as.fmt = AUD_FMT_S16; - break; - } - obt_as.endianness = AUDIO_HOST_ENDIANNESS; - - audio_pcm_init_info (&hw->info, &obt_as); - - hw->samples = conf.samples; - esd->pcm_buf = audio_calloc (AUDIO_FUNC, hw->samples, 1 << hw->info.shift); - if (!esd->pcm_buf) { - dolog ("Could not allocate buffer (%d bytes)\n", - hw->samples << hw->info.shift); - return -1; - } - - esd->fd = -1; - - err = pthread_sigmask (SIG_BLOCK, &set, &old_set); - if (err) { - qesd_logerr (err, "pthread_sigmask failed\n"); - goto fail1; - } - - esd->fd = esd_record_stream (esdfmt, as->freq, conf.adc_host, NULL); - if (esd->fd < 0) { - qesd_logerr (errno, "esd_record_stream failed\n"); - goto fail2; - } - - if (audio_pt_init (&esd->pt, qesd_thread_in, esd, AUDIO_CAP, AUDIO_FUNC)) { - goto fail3; - } - - err = pthread_sigmask (SIG_SETMASK, &old_set, NULL); - if (err) { - qesd_logerr (err, "pthread_sigmask(restore) failed\n"); - } - - return 0; - - fail3: - if (close (esd->fd)) { - qesd_logerr (errno, "%s: close on esd socket(%d) failed\n", - AUDIO_FUNC, esd->fd); - } - esd->fd = -1; - - fail2: - err = pthread_sigmask (SIG_SETMASK, &old_set, NULL); - if (err) { - qesd_logerr (err, "pthread_sigmask(restore) failed\n"); - } - - fail1: - qemu_free (esd->pcm_buf); - esd->pcm_buf = NULL; - return -1; -} - -static void qesd_fini_in (HWVoiceIn *hw) -{ - void *ret; - ESDVoiceIn *esd = (ESDVoiceIn *) hw; - - audio_pt_lock (&esd->pt, AUDIO_FUNC); - esd->done = 1; - audio_pt_unlock_and_signal (&esd->pt, AUDIO_FUNC); - audio_pt_join (&esd->pt, &ret, AUDIO_FUNC); - - if (esd->fd >= 0) { - if (close (esd->fd)) { - qesd_logerr (errno, "failed to close esd socket\n"); - } - esd->fd = -1; - } - - audio_pt_fini (&esd->pt, AUDIO_FUNC); - - qemu_free (esd->pcm_buf); - esd->pcm_buf = NULL; -} - -static int qesd_ctl_in (HWVoiceIn *hw, int cmd, ...) -{ - (void) hw; - (void) cmd; - return 0; -} - -/* common */ -static void *qesd_audio_init (void) -{ - return &conf; -} - -static void qesd_audio_fini (void *opaque) -{ - (void) opaque; - ldebug ("esd_fini"); -} - -struct audio_option qesd_options[] = { - {"SAMPLES", AUD_OPT_INT, &conf.samples, - "buffer size in samples", NULL, 0}, - - {"DIVISOR", AUD_OPT_INT, &conf.divisor, - "threshold divisor", NULL, 0}, - - {"DAC_HOST", AUD_OPT_STR, &conf.dac_host, - "playback host", NULL, 0}, - - {"ADC_HOST", AUD_OPT_STR, &conf.adc_host, - "capture host", NULL, 0}, - - {NULL, 0, NULL, NULL, NULL, 0} -}; - -static struct audio_pcm_ops qesd_pcm_ops = { - qesd_init_out, - qesd_fini_out, - qesd_run_out, - qesd_write, - qesd_ctl_out, - - qesd_init_in, - qesd_fini_in, - qesd_run_in, - qesd_read, - qesd_ctl_in, -}; - -struct audio_driver esd_audio_driver = { - INIT_FIELD (name = ) "esd", - INIT_FIELD (descr = ) - "http://en.wikipedia.org/wiki/Esound", - INIT_FIELD (options = ) qesd_options, - INIT_FIELD (init = ) qesd_audio_init, - INIT_FIELD (fini = ) qesd_audio_fini, - INIT_FIELD (pcm_ops = ) &qesd_pcm_ops, - INIT_FIELD (can_be_default = ) 0, - INIT_FIELD (max_voices_out = ) INT_MAX, - INIT_FIELD (max_voices_in = ) INT_MAX, - INIT_FIELD (voice_size_out = ) sizeof (ESDVoiceOut), - INIT_FIELD (voice_size_in = ) sizeof (ESDVoiceIn) -}; diff --git a/qemu-0.11.0/audio/fmodaudio.c b/qemu-0.11.0/audio/fmodaudio.c deleted file mode 100644 index 0becd3b..0000000 --- a/qemu-0.11.0/audio/fmodaudio.c +++ /dev/null @@ -1,686 +0,0 @@ -/* - * QEMU FMOD audio driver - * - * Copyright (c) 2004-2005 Vassili Karpov (malc) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -#include <fmod.h> -#include <fmod_errors.h> -#include "qemu-common.h" -#include "audio.h" - -#define AUDIO_CAP "fmod" -#include "audio_int.h" - -typedef struct FMODVoiceOut { - HWVoiceOut hw; - unsigned int old_pos; - FSOUND_SAMPLE *fmod_sample; - int channel; -} FMODVoiceOut; - -typedef struct FMODVoiceIn { - HWVoiceIn hw; - FSOUND_SAMPLE *fmod_sample; -} FMODVoiceIn; - -static struct { - const char *drvname; - int nb_samples; - int freq; - int nb_channels; - int bufsize; - int threshold; - int broken_adc; -} conf = { - NULL, - 2048 * 2, - 44100, - 2, - 0, - 0, - 0 -}; - -static void GCC_FMT_ATTR (1, 2) fmod_logerr (const char *fmt, ...) -{ - va_list ap; - - va_start (ap, fmt); - AUD_vlog (AUDIO_CAP, fmt, ap); - va_end (ap); - - AUD_log (AUDIO_CAP, "Reason: %s\n", - FMOD_ErrorString (FSOUND_GetError ())); -} - -static void GCC_FMT_ATTR (2, 3) fmod_logerr2 ( - const char *typ, - const char *fmt, - ... - ) -{ - va_list ap; - - AUD_log (AUDIO_CAP, "Could not initialize %s\n", typ); - - va_start (ap, fmt); - AUD_vlog (AUDIO_CAP, fmt, ap); - va_end (ap); - - AUD_log (AUDIO_CAP, "Reason: %s\n", - FMOD_ErrorString (FSOUND_GetError ())); -} - -static int fmod_write (SWVoiceOut *sw, void *buf, int len) -{ - return audio_pcm_sw_write (sw, buf, len); -} - -static void fmod_clear_sample (FMODVoiceOut *fmd) -{ - HWVoiceOut *hw = &fmd->hw; - int status; - void *p1 = 0, *p2 = 0; - unsigned int len1 = 0, len2 = 0; - - status = FSOUND_Sample_Lock ( - fmd->fmod_sample, - 0, - hw->samples << hw->info.shift, - &p1, - &p2, - &len1, - &len2 - ); - - if (!status) { - fmod_logerr ("Failed to lock sample\n"); - return; - } - - if ((len1 & hw->info.align) || (len2 & hw->info.align)) { - dolog ("Lock returned misaligned length %d, %d, alignment %d\n", - len1, len2, hw->info.align + 1); - goto fail; - } - - if ((len1 + len2) - (hw->samples << hw->info.shift)) { - dolog ("Lock returned incomplete length %d, %d\n", - len1 + len2, hw->samples << hw->info.shift); - goto fail; - } - - audio_pcm_info_clear_buf (&hw->info, p1, hw->samples); - - fail: - status = FSOUND_Sample_Unlock (fmd->fmod_sample, p1, p2, len1, len2); - if (!status) { - fmod_logerr ("Failed to unlock sample\n"); - } -} - -static void fmod_write_sample (HWVoiceOut *hw, uint8_t *dst, int dst_len) -{ - int src_len1 = dst_len; - int src_len2 = 0; - int pos = hw->rpos + dst_len; - struct st_sample *src1 = hw->mix_buf + hw->rpos; - struct st_sample *src2 = NULL; - - if (pos > hw->samples) { - src_len1 = hw->samples - hw->rpos; - src2 = hw->mix_buf; - src_len2 = dst_len - src_len1; - pos = src_len2; - } - - if (src_len1) { - hw->clip (dst, src1, src_len1); - } - - if (src_len2) { - dst = advance (dst, src_len1 << hw->info.shift); - hw->clip (dst, src2, src_len2); - } - - hw->rpos = pos % hw->samples; -} - -static int fmod_unlock_sample (FSOUND_SAMPLE *sample, void *p1, void *p2, - unsigned int blen1, unsigned int blen2) -{ - int status = FSOUND_Sample_Unlock (sample, p1, p2, blen1, blen2); - if (!status) { - fmod_logerr ("Failed to unlock sample\n"); - return -1; - } - return 0; -} - -static int fmod_lock_sample ( - FSOUND_SAMPLE *sample, - struct audio_pcm_info *info, - int pos, - int len, - void **p1, - void **p2, - unsigned int *blen1, - unsigned int *blen2 - ) -{ - int status; - - status = FSOUND_Sample_Lock ( - sample, - pos << info->shift, - len << info->shift, - p1, - p2, - blen1, - blen2 - ); - - if (!status) { - fmod_logerr ("Failed to lock sample\n"); - return -1; - } - - if ((*blen1 & info->align) || (*blen2 & info->align)) { - dolog ("Lock returned misaligned length %d, %d, alignment %d\n", - *blen1, *blen2, info->align + 1); - - fmod_unlock_sample (sample, *p1, *p2, *blen1, *blen2); - - *p1 = NULL - 1; - *p2 = NULL - 1; - *blen1 = ~0U; - *blen2 = ~0U; - return -1; - } - - if (!*p1 && *blen1) { - dolog ("warning: !p1 && blen1=%d\n", *blen1); - *blen1 = 0; - } - - if (!p2 && *blen2) { - dolog ("warning: !p2 && blen2=%d\n", *blen2); - *blen2 = 0; - } - - return 0; -} - -static int fmod_run_out (HWVoiceOut *hw) -{ - FMODVoiceOut *fmd = (FMODVoiceOut *) hw; - int live, decr; - void *p1 = 0, *p2 = 0; - unsigned int blen1 = 0, blen2 = 0; - unsigned int len1 = 0, len2 = 0; - int nb_live; - - live = audio_pcm_hw_get_live_out2 (hw, &nb_live); - if (!live) { - return 0; - } - - if (!hw->pending_disable - && nb_live - && (conf.threshold && live <= conf.threshold)) { - ldebug ("live=%d nb_live=%d\n", live, nb_live); - return 0; - } - - decr = live; - - if (fmd->channel >= 0) { - int len = decr; - int old_pos = fmd->old_pos; - int ppos = FSOUND_GetCurrentPosition (fmd->channel); - - if (ppos == old_pos || !ppos) { - return 0; - } - - if ((old_pos < ppos) && ((old_pos + len) > ppos)) { - len = ppos - old_pos; - } - else { - if ((old_pos > ppos) && ((old_pos + len) > (ppos + hw->samples))) { - len = hw->samples - old_pos + ppos; - } - } - decr = len; - - if (audio_bug (AUDIO_FUNC, decr < 0)) { - dolog ("decr=%d live=%d ppos=%d old_pos=%d len=%d\n", - decr, live, ppos, old_pos, len); - return 0; - } - } - - - if (!decr) { - return 0; - } - - if (fmod_lock_sample (fmd->fmod_sample, &fmd->hw.info, - fmd->old_pos, decr, - &p1, &p2, - &blen1, &blen2)) { - return 0; - } - - len1 = blen1 >> hw->info.shift; - len2 = blen2 >> hw->info.shift; - ldebug ("%p %p %d %d %d %d\n", p1, p2, len1, len2, blen1, blen2); - decr = len1 + len2; - - if (p1 && len1) { - fmod_write_sample (hw, p1, len1); - } - - if (p2 && len2) { - fmod_write_sample (hw, p2, len2); - } - - fmod_unlock_sample (fmd->fmod_sample, p1, p2, blen1, blen2); - - fmd->old_pos = (fmd->old_pos + decr) % hw->samples; - return decr; -} - -static int aud_to_fmodfmt (audfmt_e fmt, int stereo) -{ - int mode = FSOUND_LOOP_NORMAL; - - switch (fmt) { - case AUD_FMT_S8: - mode |= FSOUND_SIGNED | FSOUND_8BITS; - break; - - case AUD_FMT_U8: - mode |= FSOUND_UNSIGNED | FSOUND_8BITS; - break; - - case AUD_FMT_S16: - mode |= FSOUND_SIGNED | FSOUND_16BITS; - break; - - case AUD_FMT_U16: - mode |= FSOUND_UNSIGNED | FSOUND_16BITS; - break; - - default: - dolog ("Internal logic error: Bad audio format %d\n", fmt); -#ifdef DEBUG_FMOD - abort (); -#endif - mode |= FSOUND_8BITS; - } - mode |= stereo ? FSOUND_STEREO : FSOUND_MONO; - return mode; -} - -static void fmod_fini_out (HWVoiceOut *hw) -{ - FMODVoiceOut *fmd = (FMODVoiceOut *) hw; - - if (fmd->fmod_sample) { - FSOUND_Sample_Free (fmd->fmod_sample); - fmd->fmod_sample = 0; - - if (fmd->channel >= 0) { - FSOUND_StopSound (fmd->channel); - } - } -} - -static int fmod_init_out (HWVoiceOut *hw, struct audsettings *as) -{ - int bits16, mode, channel; - FMODVoiceOut *fmd = (FMODVoiceOut *) hw; - struct audsettings obt_as = *as; - - mode = aud_to_fmodfmt (as->fmt, as->nchannels == 2 ? 1 : 0); - fmd->fmod_sample = FSOUND_Sample_Alloc ( - FSOUND_FREE, /* index */ - conf.nb_samples, /* length */ - mode, /* mode */ - as->freq, /* freq */ - 255, /* volume */ - 128, /* pan */ - 255 /* priority */ - ); - - if (!fmd->fmod_sample) { - fmod_logerr2 ("DAC", "Failed to allocate FMOD sample\n"); - return -1; - } - - channel = FSOUND_PlaySoundEx (FSOUND_FREE, fmd->fmod_sample, 0, 1); - if (channel < 0) { - fmod_logerr2 ("DAC", "Failed to start playing sound\n"); - FSOUND_Sample_Free (fmd->fmod_sample); - return -1; - } - fmd->channel = channel; - - /* FMOD always operates on little endian frames? */ - obt_as.endianness = 0; - audio_pcm_init_info (&hw->info, &obt_as); - bits16 = (mode & FSOUND_16BITS) != 0; - hw->samples = conf.nb_samples; - return 0; -} - -static int fmod_ctl_out (HWVoiceOut *hw, int cmd, ...) -{ - int status; - FMODVoiceOut *fmd = (FMODVoiceOut *) hw; - - switch (cmd) { - case VOICE_ENABLE: - fmod_clear_sample (fmd); - status = FSOUND_SetPaused (fmd->channel, 0); - if (!status) { - fmod_logerr ("Failed to resume channel %d\n", fmd->channel); - } - break; - - case VOICE_DISABLE: - status = FSOUND_SetPaused (fmd->channel, 1); - if (!status) { - fmod_logerr ("Failed to pause channel %d\n", fmd->channel); - } - break; - } - return 0; -} - -static int fmod_init_in (HWVoiceIn *hw, struct audsettings *as) -{ - int bits16, mode; - FMODVoiceIn *fmd = (FMODVoiceIn *) hw; - struct audsettings obt_as = *as; - - if (conf.broken_adc) { - return -1; - } - - mode = aud_to_fmodfmt (as->fmt, as->nchannels == 2 ? 1 : 0); - fmd->fmod_sample = FSOUND_Sample_Alloc ( - FSOUND_FREE, /* index */ - conf.nb_samples, /* length */ - mode, /* mode */ - as->freq, /* freq */ - 255, /* volume */ - 128, /* pan */ - 255 /* priority */ - ); - - if (!fmd->fmod_sample) { - fmod_logerr2 ("ADC", "Failed to allocate FMOD sample\n"); - return -1; - } - - /* FMOD always operates on little endian frames? */ - obt_as.endianness = 0; - audio_pcm_init_info (&hw->info, &obt_as); - bits16 = (mode & FSOUND_16BITS) != 0; - hw->samples = conf.nb_samples; - return 0; -} - -static void fmod_fini_in (HWVoiceIn *hw) -{ - FMODVoiceIn *fmd = (FMODVoiceIn *) hw; - - if (fmd->fmod_sample) { - FSOUND_Record_Stop (); - FSOUND_Sample_Free (fmd->fmod_sample); - fmd->fmod_sample = 0; - } -} - -static int fmod_run_in (HWVoiceIn *hw) -{ - FMODVoiceIn *fmd = (FMODVoiceIn *) hw; - int hwshift = hw->info.shift; - int live, dead, new_pos, len; - unsigned int blen1 = 0, blen2 = 0; - unsigned int len1, len2; - unsigned int decr; - void *p1, *p2; - - live = audio_pcm_hw_get_live_in (hw); - dead = hw->samples - live; - if (!dead) { - return 0; - } - - new_pos = FSOUND_Record_GetPosition (); - if (new_pos < 0) { - fmod_logerr ("Could not get recording position\n"); - return 0; - } - - len = audio_ring_dist (new_pos, hw->wpos, hw->samples); - if (!len) { - return 0; - } - len = audio_MIN (len, dead); - - if (fmod_lock_sample (fmd->fmod_sample, &fmd->hw.info, - hw->wpos, len, - &p1, &p2, - &blen1, &blen2)) { - return 0; - } - - len1 = blen1 >> hwshift; - len2 = blen2 >> hwshift; - decr = len1 + len2; - - if (p1 && blen1) { - hw->conv (hw->conv_buf + hw->wpos, p1, len1, &nominal_volume); - } - if (p2 && len2) { - hw->conv (hw->conv_buf, p2, len2, &nominal_volume); - } - - fmod_unlock_sample (fmd->fmod_sample, p1, p2, blen1, blen2); - hw->wpos = (hw->wpos + decr) % hw->samples; - return decr; -} - -static struct { - const char *name; - int type; -} drvtab[] = { - {"none", FSOUND_OUTPUT_NOSOUND}, -#ifdef _WIN32 - {"winmm", FSOUND_OUTPUT_WINMM}, - {"dsound", FSOUND_OUTPUT_DSOUND}, - {"a3d", FSOUND_OUTPUT_A3D}, - {"asio", FSOUND_OUTPUT_ASIO}, -#endif -#ifdef __linux__ - {"oss", FSOUND_OUTPUT_OSS}, - {"alsa", FSOUND_OUTPUT_ALSA}, - {"esd", FSOUND_OUTPUT_ESD}, -#endif -#ifdef __APPLE__ - {"mac", FSOUND_OUTPUT_MAC}, -#endif -#if 0 - {"xbox", FSOUND_OUTPUT_XBOX}, - {"ps2", FSOUND_OUTPUT_PS2}, - {"gcube", FSOUND_OUTPUT_GC}, -#endif - {"none-realtime", FSOUND_OUTPUT_NOSOUND_NONREALTIME} -}; - -static void *fmod_audio_init (void) -{ - size_t i; - double ver; - int status; - int output_type = -1; - const char *drv = conf.drvname; - - ver = FSOUND_GetVersion (); - if (ver < FMOD_VERSION) { - dolog ("Wrong FMOD version %f, need at least %f\n", ver, FMOD_VERSION); - return NULL; - } - -#ifdef __linux__ - if (ver < 3.75) { - dolog ("FMOD before 3.75 has bug preventing ADC from working\n" - "ADC will be disabled.\n"); - conf.broken_adc = 1; - } -#endif - - if (drv) { - int found = 0; - for (i = 0; i < ARRAY_SIZE (drvtab); i++) { - if (!strcmp (drv, drvtab[i].name)) { - output_type = drvtab[i].type; - found = 1; - break; - } - } - if (!found) { - dolog ("Unknown FMOD driver `%s'\n", drv); - dolog ("Valid drivers:\n"); - for (i = 0; i < ARRAY_SIZE (drvtab); i++) { - dolog (" %s\n", drvtab[i].name); - } - } - } - - if (output_type != -1) { - status = FSOUND_SetOutput (output_type); - if (!status) { - fmod_logerr ("FSOUND_SetOutput(%d) failed\n", output_type); - return NULL; - } - } - - if (conf.bufsize) { - status = FSOUND_SetBufferSize (conf.bufsize); - if (!status) { - fmod_logerr ("FSOUND_SetBufferSize (%d) failed\n", conf.bufsize); - } - } - - status = FSOUND_Init (conf.freq, conf.nb_channels, 0); - if (!status) { - fmod_logerr ("FSOUND_Init failed\n"); - return NULL; - } - - return &conf; -} - -static int fmod_read (SWVoiceIn *sw, void *buf, int size) -{ - return audio_pcm_sw_read (sw, buf, size); -} - -static int fmod_ctl_in (HWVoiceIn *hw, int cmd, ...) -{ - int status; - FMODVoiceIn *fmd = (FMODVoiceIn *) hw; - - switch (cmd) { - case VOICE_ENABLE: - status = FSOUND_Record_StartSample (fmd->fmod_sample, 1); - if (!status) { - fmod_logerr ("Failed to start recording\n"); - } - break; - - case VOICE_DISABLE: - status = FSOUND_Record_Stop (); - if (!status) { - fmod_logerr ("Failed to stop recording\n"); - } - break; - } - return 0; -} - -static void fmod_audio_fini (void *opaque) -{ - (void) opaque; - FSOUND_Close (); -} - -static struct audio_option fmod_options[] = { - {"DRV", AUD_OPT_STR, &conf.drvname, - "FMOD driver", NULL, 0}, - {"FREQ", AUD_OPT_INT, &conf.freq, - "Default frequency", NULL, 0}, - {"SAMPLES", AUD_OPT_INT, &conf.nb_samples, - "Buffer size in samples", NULL, 0}, - {"CHANNELS", AUD_OPT_INT, &conf.nb_channels, - "Number of default channels (1 - mono, 2 - stereo)", NULL, 0}, - {"BUFSIZE", AUD_OPT_INT, &conf.bufsize, - "(undocumented)", NULL, 0}, -#if 0 - {"THRESHOLD", AUD_OPT_INT, &conf.threshold, - "(undocumented)"}, -#endif - - {NULL, 0, NULL, NULL, NULL, 0} -}; - -static struct audio_pcm_ops fmod_pcm_ops = { - fmod_init_out, - fmod_fini_out, - fmod_run_out, - fmod_write, - fmod_ctl_out, - - fmod_init_in, - fmod_fini_in, - fmod_run_in, - fmod_read, - fmod_ctl_in -}; - -struct audio_driver fmod_audio_driver = { - INIT_FIELD (name = ) "fmod", - INIT_FIELD (descr = ) "FMOD 3.xx http://www.fmod.org", - INIT_FIELD (options = ) fmod_options, - INIT_FIELD (init = ) fmod_audio_init, - INIT_FIELD (fini = ) fmod_audio_fini, - INIT_FIELD (pcm_ops = ) &fmod_pcm_ops, - INIT_FIELD (can_be_default = ) 1, - INIT_FIELD (max_voices_out = ) INT_MAX, - INIT_FIELD (max_voices_in = ) INT_MAX, - INIT_FIELD (voice_size_out = ) sizeof (FMODVoiceOut), - INIT_FIELD (voice_size_in = ) sizeof (FMODVoiceIn) -}; diff --git a/qemu-0.11.0/audio/mixeng.c b/qemu-0.11.0/audio/mixeng.c deleted file mode 100644 index 8ce942e..0000000 --- a/qemu-0.11.0/audio/mixeng.c +++ /dev/null @@ -1,335 +0,0 @@ -/* - * QEMU Mixing engine - * - * Copyright (c) 2004-2005 Vassili Karpov (malc) - * Copyright (c) 1998 Fabrice Bellard - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -#include "qemu-common.h" -#include "audio.h" - -#define AUDIO_CAP "mixeng" -#include "audio_int.h" - -/* 8 bit */ -#define ENDIAN_CONVERSION natural -#define ENDIAN_CONVERT(v) (v) - -/* Signed 8 bit */ -#define IN_T int8_t -#define IN_MIN SCHAR_MIN -#define IN_MAX SCHAR_MAX -#define SIGNED -#define SHIFT 8 -#include "mixeng_template.h" -#undef SIGNED -#undef IN_MAX -#undef IN_MIN -#undef IN_T -#undef SHIFT - -/* Unsigned 8 bit */ -#define IN_T uint8_t -#define IN_MIN 0 -#define IN_MAX UCHAR_MAX -#define SHIFT 8 -#include "mixeng_template.h" -#undef IN_MAX -#undef IN_MIN -#undef IN_T -#undef SHIFT - -#undef ENDIAN_CONVERT -#undef ENDIAN_CONVERSION - -/* Signed 16 bit */ -#define IN_T int16_t -#define IN_MIN SHRT_MIN -#define IN_MAX SHRT_MAX -#define SIGNED -#define SHIFT 16 -#define ENDIAN_CONVERSION natural -#define ENDIAN_CONVERT(v) (v) -#include "mixeng_template.h" -#undef ENDIAN_CONVERT -#undef ENDIAN_CONVERSION -#define ENDIAN_CONVERSION swap -#define ENDIAN_CONVERT(v) bswap16 (v) -#include "mixeng_template.h" -#undef ENDIAN_CONVERT -#undef ENDIAN_CONVERSION -#undef SIGNED -#undef IN_MAX -#undef IN_MIN -#undef IN_T -#undef SHIFT - -/* Unsigned 16 bit */ -#define IN_T uint16_t -#define IN_MIN 0 -#define IN_MAX USHRT_MAX -#define SHIFT 16 -#define ENDIAN_CONVERSION natural -#define ENDIAN_CONVERT(v) (v) -#include "mixeng_template.h" -#undef ENDIAN_CONVERT -#undef ENDIAN_CONVERSION -#define ENDIAN_CONVERSION swap -#define ENDIAN_CONVERT(v) bswap16 (v) -#include "mixeng_template.h" -#undef ENDIAN_CONVERT -#undef ENDIAN_CONVERSION -#undef IN_MAX -#undef IN_MIN -#undef IN_T -#undef SHIFT - -/* Signed 32 bit */ -#define IN_T int32_t -#define IN_MIN INT32_MIN -#define IN_MAX INT32_MAX -#define SIGNED -#define SHIFT 32 -#define ENDIAN_CONVERSION natural -#define ENDIAN_CONVERT(v) (v) -#include "mixeng_template.h" -#undef ENDIAN_CONVERT -#undef ENDIAN_CONVERSION -#define ENDIAN_CONVERSION swap -#define ENDIAN_CONVERT(v) bswap32 (v) -#include "mixeng_template.h" -#undef ENDIAN_CONVERT -#undef ENDIAN_CONVERSION -#undef SIGNED -#undef IN_MAX -#undef IN_MIN -#undef IN_T -#undef SHIFT - -/* Unsigned 16 bit */ -#define IN_T uint32_t -#define IN_MIN 0 -#define IN_MAX UINT32_MAX -#define SHIFT 32 -#define ENDIAN_CONVERSION natural -#define ENDIAN_CONVERT(v) (v) -#include "mixeng_template.h" -#undef ENDIAN_CONVERT -#undef ENDIAN_CONVERSION -#define ENDIAN_CONVERSION swap -#define ENDIAN_CONVERT(v) bswap32 (v) -#include "mixeng_template.h" -#undef ENDIAN_CONVERT -#undef ENDIAN_CONVERSION -#undef IN_MAX -#undef IN_MIN -#undef IN_T -#undef SHIFT - -t_sample *mixeng_conv[2][2][2][3] = { - { - { - { - conv_natural_uint8_t_to_mono, - conv_natural_uint16_t_to_mono, - conv_natural_uint32_t_to_mono - }, - { - conv_natural_uint8_t_to_mono, - conv_swap_uint16_t_to_mono, - conv_swap_uint32_t_to_mono, - } - }, - { - { - conv_natural_int8_t_to_mono, - conv_natural_int16_t_to_mono, - conv_natural_int32_t_to_mono - }, - { - conv_natural_int8_t_to_mono, - conv_swap_int16_t_to_mono, - conv_swap_int32_t_to_mono - } - } - }, - { - { - { - conv_natural_uint8_t_to_stereo, - conv_natural_uint16_t_to_stereo, - conv_natural_uint32_t_to_stereo - }, - { - conv_natural_uint8_t_to_stereo, - conv_swap_uint16_t_to_stereo, - conv_swap_uint32_t_to_stereo - } - }, - { - { - conv_natural_int8_t_to_stereo, - conv_natural_int16_t_to_stereo, - conv_natural_int32_t_to_stereo - }, - { - conv_natural_int8_t_to_stereo, - conv_swap_int16_t_to_stereo, - conv_swap_int32_t_to_stereo, - } - } - } -}; - -f_sample *mixeng_clip[2][2][2][3] = { - { - { - { - clip_natural_uint8_t_from_mono, - clip_natural_uint16_t_from_mono, - clip_natural_uint32_t_from_mono - }, - { - clip_natural_uint8_t_from_mono, - clip_swap_uint16_t_from_mono, - clip_swap_uint32_t_from_mono - } - }, - { - { - clip_natural_int8_t_from_mono, - clip_natural_int16_t_from_mono, - clip_natural_int32_t_from_mono - }, - { - clip_natural_int8_t_from_mono, - clip_swap_int16_t_from_mono, - clip_swap_int32_t_from_mono - } - } - }, - { - { - { - clip_natural_uint8_t_from_stereo, - clip_natural_uint16_t_from_stereo, - clip_natural_uint32_t_from_stereo - }, - { - clip_natural_uint8_t_from_stereo, - clip_swap_uint16_t_from_stereo, - clip_swap_uint32_t_from_stereo - } - }, - { - { - clip_natural_int8_t_from_stereo, - clip_natural_int16_t_from_stereo, - clip_natural_int32_t_from_stereo - }, - { - clip_natural_int8_t_from_stereo, - clip_swap_int16_t_from_stereo, - clip_swap_int32_t_from_stereo - } - } - } -}; - -/* - * August 21, 1998 - * Copyright 1998 Fabrice Bellard. - * - * [Rewrote completly the code of Lance Norskog And Sundry - * Contributors with a more efficient algorithm.] - * - * This source code is freely redistributable and may be used for - * any purpose. This copyright notice must be maintained. - * Lance Norskog And Sundry Contributors are not responsible for - * the consequences of using this software. - */ - -/* - * Sound Tools rate change effect file. - */ -/* - * Linear Interpolation. - * - * The use of fractional increment allows us to use no buffer. It - * avoid the problems at the end of the buffer we had with the old - * method which stored a possibly big buffer of size - * lcm(in_rate,out_rate). - * - * Limited to 16 bit samples and sampling frequency <= 65535 Hz. If - * the input & output frequencies are equal, a delay of one sample is - * introduced. Limited to processing 32-bit count worth of samples. - * - * 1 << FRAC_BITS evaluating to zero in several places. Changed with - * an (unsigned long) cast to make it safe. MarkMLl 2/1/99 - */ - -/* Private data */ -struct rate { - uint64_t opos; - uint64_t opos_inc; - uint32_t ipos; /* position in the input stream (integer) */ - struct st_sample ilast; /* last sample in the input stream */ -}; - -/* - * Prepare processing. - */ -void *st_rate_start (int inrate, int outrate) -{ - struct rate *rate = audio_calloc (AUDIO_FUNC, 1, sizeof (*rate)); - - if (!rate) { - dolog ("Could not allocate resampler (%zu bytes)\n", sizeof (*rate)); - return NULL; - } - - rate->opos = 0; - - /* increment */ - rate->opos_inc = ((uint64_t) inrate << 32) / outrate; - - rate->ipos = 0; - rate->ilast.l = 0; - rate->ilast.r = 0; - return rate; -} - -#define NAME st_rate_flow_mix -#define OP(a, b) a += b -#include "rate_template.h" - -#define NAME st_rate_flow -#define OP(a, b) a = b -#include "rate_template.h" - -void st_rate_stop (void *opaque) -{ - qemu_free (opaque); -} - -void mixeng_clear (struct st_sample *buf, int len) -{ - memset (buf, 0, len * sizeof (struct st_sample)); -} diff --git a/qemu-0.11.0/audio/mixeng.h b/qemu-0.11.0/audio/mixeng.h deleted file mode 100644 index cac0569..0000000 --- a/qemu-0.11.0/audio/mixeng.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * QEMU Mixing engine header - * - * Copyright (c) 2004-2005 Vassili Karpov (malc) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -#ifndef QEMU_MIXENG_H -#define QEMU_MIXENG_H - -#ifdef FLOAT_MIXENG -typedef float mixeng_real; -struct mixeng_volume { int mute; mixeng_real r; mixeng_real l; }; -struct mixeng_sample { mixeng_real l; mixeng_real r; }; -#else -struct mixeng_volume { int mute; int64_t r; int64_t l; }; -struct st_sample { int64_t l; int64_t r; }; -#endif - -typedef void (t_sample) (struct st_sample *dst, const void *src, - int samples, struct mixeng_volume *vol); -typedef void (f_sample) (void *dst, const struct st_sample *src, int samples); - -extern t_sample *mixeng_conv[2][2][2][3]; -extern f_sample *mixeng_clip[2][2][2][3]; - -void *st_rate_start (int inrate, int outrate); -void st_rate_flow (void *opaque, struct st_sample *ibuf, struct st_sample *obuf, - int *isamp, int *osamp); -void st_rate_flow_mix (void *opaque, struct st_sample *ibuf, struct st_sample *obuf, - int *isamp, int *osamp); -void st_rate_stop (void *opaque); -void mixeng_clear (struct st_sample *buf, int len); - -#endif /* mixeng.h */ diff --git a/qemu-0.11.0/audio/mixeng_template.h b/qemu-0.11.0/audio/mixeng_template.h deleted file mode 100644 index 5617705..0000000 --- a/qemu-0.11.0/audio/mixeng_template.h +++ /dev/null @@ -1,177 +0,0 @@ -/* - * QEMU Mixing engine - * - * Copyright (c) 2004-2005 Vassili Karpov (malc) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -/* - * Tusen tack till Mike Nordell - * dec++'ified by Dscho - */ - -#ifndef SIGNED -#define HALF (IN_MAX >> 1) -#endif - -#ifdef CONFIG_MIXEMU -#ifdef FLOAT_MIXENG -#define VOL(a, b) ((a) * (b)) -#else -#define VOL(a, b) ((a) * (b)) >> 32 -#endif -#else -#define VOL(a, b) a -#endif - -#define ET glue (ENDIAN_CONVERSION, glue (_, IN_T)) - -#ifdef FLOAT_MIXENG -static mixeng_real inline glue (conv_, ET) (IN_T v) -{ - IN_T nv = ENDIAN_CONVERT (v); - -#ifdef RECIPROCAL -#ifdef SIGNED - return nv * (1.f / (mixeng_real) (IN_MAX - IN_MIN)); -#else - return (nv - HALF) * (1.f / (mixeng_real) IN_MAX); -#endif -#else /* !RECIPROCAL */ -#ifdef SIGNED - return nv / (mixeng_real) (IN_MAX - IN_MIN); -#else - return (nv - HALF) / (mixeng_real) IN_MAX; -#endif -#endif -} - -static IN_T inline glue (clip_, ET) (mixeng_real v) -{ - if (v >= 0.5) { - return IN_MAX; - } - else if (v < -0.5) { - return IN_MIN; - } - -#ifdef SIGNED - return ENDIAN_CONVERT ((IN_T) (v * (IN_MAX - IN_MIN))); -#else - return ENDIAN_CONVERT ((IN_T) ((v * IN_MAX) + HALF)); -#endif -} - -#else /* !FLOAT_MIXENG */ - -static inline int64_t glue (conv_, ET) (IN_T v) -{ - IN_T nv = ENDIAN_CONVERT (v); -#ifdef SIGNED - return ((int64_t) nv) << (32 - SHIFT); -#else - return ((int64_t) nv - HALF) << (32 - SHIFT); -#endif -} - -static inline IN_T glue (clip_, ET) (int64_t v) -{ - if (v >= 0x7f000000) { - return IN_MAX; - } - else if (v < -2147483648LL) { - return IN_MIN; - } - -#ifdef SIGNED - return ENDIAN_CONVERT ((IN_T) (v >> (32 - SHIFT))); -#else - return ENDIAN_CONVERT ((IN_T) ((v >> (32 - SHIFT)) + HALF)); -#endif -} -#endif - -static void glue (glue (conv_, ET), _to_stereo) - (struct st_sample *dst, const void *src, int samples, struct mixeng_volume *vol) -{ - struct st_sample *out = dst; - IN_T *in = (IN_T *) src; -#ifdef CONFIG_MIXEMU - if (vol->mute) { - mixeng_clear (dst, samples); - return; - } -#else - (void) vol; -#endif - while (samples--) { - out->l = VOL (glue (conv_, ET) (*in++), vol->l); - out->r = VOL (glue (conv_, ET) (*in++), vol->r); - out += 1; - } -} - -static void glue (glue (conv_, ET), _to_mono) - (struct st_sample *dst, const void *src, int samples, struct mixeng_volume *vol) -{ - struct st_sample *out = dst; - IN_T *in = (IN_T *) src; -#ifdef CONFIG_MIXEMU - if (vol->mute) { - mixeng_clear (dst, samples); - return; - } -#else - (void) vol; -#endif - while (samples--) { - out->l = VOL (glue (conv_, ET) (in[0]), vol->l); - out->r = out->l; - out += 1; - in += 1; - } -} - -static void glue (glue (clip_, ET), _from_stereo) - (void *dst, const struct st_sample *src, int samples) -{ - const struct st_sample *in = src; - IN_T *out = (IN_T *) dst; - while (samples--) { - *out++ = glue (clip_, ET) (in->l); - *out++ = glue (clip_, ET) (in->r); - in += 1; - } -} - -static void glue (glue (clip_, ET), _from_mono) - (void *dst, const struct st_sample *src, int samples) -{ - const struct st_sample *in = src; - IN_T *out = (IN_T *) dst; - while (samples--) { - *out++ = glue (clip_, ET) (in->l + in->r); - in += 1; - } -} - -#undef ET -#undef HALF -#undef VOL diff --git a/qemu-0.11.0/audio/noaudio.c b/qemu-0.11.0/audio/noaudio.c deleted file mode 100644 index 9432413..0000000 --- a/qemu-0.11.0/audio/noaudio.c +++ /dev/null @@ -1,174 +0,0 @@ -/* - * QEMU Timer based audio emulation - * - * Copyright (c) 2004-2005 Vassili Karpov (malc) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -#include "qemu-common.h" -#include "audio.h" -#include "qemu-timer.h" - -#define AUDIO_CAP "noaudio" -#include "audio_int.h" - -typedef struct NoVoiceOut { - HWVoiceOut hw; - int64_t old_ticks; -} NoVoiceOut; - -typedef struct NoVoiceIn { - HWVoiceIn hw; - int64_t old_ticks; -} NoVoiceIn; - -static int no_run_out (HWVoiceOut *hw) -{ - NoVoiceOut *no = (NoVoiceOut *) hw; - int live, decr, samples; - int64_t now; - int64_t ticks; - int64_t bytes; - - live = audio_pcm_hw_get_live_out (&no->hw); - if (!live) { - return 0; - } - - now = qemu_get_clock (vm_clock); - ticks = now - no->old_ticks; - bytes = (ticks * hw->info.bytes_per_second) / ticks_per_sec; - bytes = audio_MIN (bytes, INT_MAX); - samples = bytes >> hw->info.shift; - - no->old_ticks = now; - decr = audio_MIN (live, samples); - hw->rpos = (hw->rpos + decr) % hw->samples; - return decr; -} - -static int no_write (SWVoiceOut *sw, void *buf, int len) -{ - return audio_pcm_sw_write (sw, buf, len); -} - -static int no_init_out (HWVoiceOut *hw, struct audsettings *as) -{ - audio_pcm_init_info (&hw->info, as); - hw->samples = 1024; - return 0; -} - -static void no_fini_out (HWVoiceOut *hw) -{ - (void) hw; -} - -static int no_ctl_out (HWVoiceOut *hw, int cmd, ...) -{ - (void) hw; - (void) cmd; - return 0; -} - -static int no_init_in (HWVoiceIn *hw, struct audsettings *as) -{ - audio_pcm_init_info (&hw->info, as); - hw->samples = 1024; - return 0; -} - -static void no_fini_in (HWVoiceIn *hw) -{ - (void) hw; -} - -static int no_run_in (HWVoiceIn *hw) -{ - NoVoiceIn *no = (NoVoiceIn *) hw; - int live = audio_pcm_hw_get_live_in (hw); - int dead = hw->samples - live; - int samples = 0; - - if (dead) { - int64_t now = qemu_get_clock (vm_clock); - int64_t ticks = now - no->old_ticks; - int64_t bytes = (ticks * hw->info.bytes_per_second) / ticks_per_sec; - - no->old_ticks = now; - bytes = audio_MIN (bytes, INT_MAX); - samples = bytes >> hw->info.shift; - samples = audio_MIN (samples, dead); - } - return samples; -} - -static int no_read (SWVoiceIn *sw, void *buf, int size) -{ - int samples = size >> sw->info.shift; - int total = sw->hw->total_samples_captured - sw->total_hw_samples_acquired; - int to_clear = audio_MIN (samples, total); - audio_pcm_info_clear_buf (&sw->info, buf, to_clear); - return to_clear; -} - -static int no_ctl_in (HWVoiceIn *hw, int cmd, ...) -{ - (void) hw; - (void) cmd; - return 0; -} - -static void *no_audio_init (void) -{ - return &no_audio_init; -} - -static void no_audio_fini (void *opaque) -{ - (void) opaque; -} - -static struct audio_pcm_ops no_pcm_ops = { - no_init_out, - no_fini_out, - no_run_out, - no_write, - no_ctl_out, - - no_init_in, - no_fini_in, - no_run_in, - no_read, - no_ctl_in -}; - -struct audio_driver no_audio_driver = { - INIT_FIELD (name = ) "none", - INIT_FIELD (descr = ) "Timer based audio emulation", - INIT_FIELD (options = ) NULL, - INIT_FIELD (init = ) no_audio_init, - INIT_FIELD (fini = ) no_audio_fini, - INIT_FIELD (pcm_ops = ) &no_pcm_ops, - INIT_FIELD (can_be_default = ) 1, - INIT_FIELD (max_voices_out = ) INT_MAX, - INIT_FIELD (max_voices_in = ) INT_MAX, - INIT_FIELD (voice_size_out = ) sizeof (NoVoiceOut), - INIT_FIELD (voice_size_in = ) sizeof (NoVoiceIn) -}; diff --git a/qemu-0.11.0/audio/ossaudio.c b/qemu-0.11.0/audio/ossaudio.c deleted file mode 100644 index bb727d3..0000000 --- a/qemu-0.11.0/audio/ossaudio.c +++ /dev/null @@ -1,780 +0,0 @@ -/* - * QEMU OSS audio driver - * - * Copyright (c) 2003-2005 Vassili Karpov (malc) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -#include <stdlib.h> -#include <sys/mman.h> -#include <sys/types.h> -#include <sys/ioctl.h> -#ifdef __OpenBSD__ -#include <soundcard.h> -#else -#include <sys/soundcard.h> -#endif -#include "qemu-common.h" -#include "audio.h" - -#define AUDIO_CAP "oss" -#include "audio_int.h" - -typedef struct OSSVoiceOut { - HWVoiceOut hw; - void *pcm_buf; - int fd; - int nfrags; - int fragsize; - int mmapped; - int old_optr; -} OSSVoiceOut; - -typedef struct OSSVoiceIn { - HWVoiceIn hw; - void *pcm_buf; - int fd; - int nfrags; - int fragsize; - int old_optr; -} OSSVoiceIn; - -static struct { - int try_mmap; - int nfrags; - int fragsize; - const char *devpath_out; - const char *devpath_in; - int debug; -} conf = { - .try_mmap = 0, - .nfrags = 4, - .fragsize = 4096, - .devpath_out = "/dev/dsp", - .devpath_in = "/dev/dsp", - .debug = 0 -}; - -struct oss_params { - int freq; - audfmt_e fmt; - int nchannels; - int nfrags; - int fragsize; -}; - -static void GCC_FMT_ATTR (2, 3) oss_logerr (int err, const char *fmt, ...) -{ - va_list ap; - - va_start (ap, fmt); - AUD_vlog (AUDIO_CAP, fmt, ap); - va_end (ap); - - AUD_log (AUDIO_CAP, "Reason: %s\n", strerror (err)); -} - -static void GCC_FMT_ATTR (3, 4) oss_logerr2 ( - int err, - const char *typ, - const char *fmt, - ... - ) -{ - va_list ap; - - AUD_log (AUDIO_CAP, "Could not initialize %s\n", typ); - - va_start (ap, fmt); - AUD_vlog (AUDIO_CAP, fmt, ap); - va_end (ap); - - AUD_log (AUDIO_CAP, "Reason: %s\n", strerror (err)); -} - -static void oss_anal_close (int *fdp) -{ - int err = close (*fdp); - if (err) { - oss_logerr (errno, "Failed to close file(fd=%d)\n", *fdp); - } - *fdp = -1; -} - -static int oss_write (SWVoiceOut *sw, void *buf, int len) -{ - return audio_pcm_sw_write (sw, buf, len); -} - -static int aud_to_ossfmt (audfmt_e fmt) -{ - switch (fmt) { - case AUD_FMT_S8: - return AFMT_S8; - - case AUD_FMT_U8: - return AFMT_U8; - - case AUD_FMT_S16: - return AFMT_S16_LE; - - case AUD_FMT_U16: - return AFMT_U16_LE; - - default: - dolog ("Internal logic error: Bad audio format %d\n", fmt); -#ifdef DEBUG_AUDIO - abort (); -#endif - return AFMT_U8; - } -} - -static int oss_to_audfmt (int ossfmt, audfmt_e *fmt, int *endianness) -{ - switch (ossfmt) { - case AFMT_S8: - *endianness = 0; - *fmt = AUD_FMT_S8; - break; - - case AFMT_U8: - *endianness = 0; - *fmt = AUD_FMT_U8; - break; - - case AFMT_S16_LE: - *endianness = 0; - *fmt = AUD_FMT_S16; - break; - - case AFMT_U16_LE: - *endianness = 0; - *fmt = AUD_FMT_U16; - break; - - case AFMT_S16_BE: - *endianness = 1; - *fmt = AUD_FMT_S16; - break; - - case AFMT_U16_BE: - *endianness = 1; - *fmt = AUD_FMT_U16; - break; - - default: - dolog ("Unrecognized audio format %d\n", ossfmt); - return -1; - } - - return 0; -} - -#if defined DEBUG_MISMATCHES || defined DEBUG -static void oss_dump_info (struct oss_params *req, struct oss_params *obt) -{ - dolog ("parameter | requested value | obtained value\n"); - dolog ("format | %10d | %10d\n", req->fmt, obt->fmt); - dolog ("channels | %10d | %10d\n", - req->nchannels, obt->nchannels); - dolog ("frequency | %10d | %10d\n", req->freq, obt->freq); - dolog ("nfrags | %10d | %10d\n", req->nfrags, obt->nfrags); - dolog ("fragsize | %10d | %10d\n", - req->fragsize, obt->fragsize); -} -#endif - -static int oss_open (int in, struct oss_params *req, - struct oss_params *obt, int *pfd) -{ - int fd; - int mmmmssss; - audio_buf_info abinfo; - int fmt, freq, nchannels; - const char *dspname = in ? conf.devpath_in : conf.devpath_out; - const char *typ = in ? "ADC" : "DAC"; - - fd = open (dspname, (in ? O_RDONLY : O_WRONLY) | O_NONBLOCK); - if (-1 == fd) { - oss_logerr2 (errno, typ, "Failed to open `%s'\n", dspname); - return -1; - } - - freq = req->freq; - nchannels = req->nchannels; - fmt = req->fmt; - - if (ioctl (fd, SNDCTL_DSP_SAMPLESIZE, &fmt)) { - oss_logerr2 (errno, typ, "Failed to set sample size %d\n", req->fmt); - goto err; - } - - if (ioctl (fd, SNDCTL_DSP_CHANNELS, &nchannels)) { - oss_logerr2 (errno, typ, "Failed to set number of channels %d\n", - req->nchannels); - goto err; - } - - if (ioctl (fd, SNDCTL_DSP_SPEED, &freq)) { - oss_logerr2 (errno, typ, "Failed to set frequency %d\n", req->freq); - goto err; - } - - if (ioctl (fd, SNDCTL_DSP_NONBLOCK, NULL)) { - oss_logerr2 (errno, typ, "Failed to set non-blocking mode\n"); - goto err; - } - - mmmmssss = (req->nfrags << 16) | lsbindex (req->fragsize); - if (ioctl (fd, SNDCTL_DSP_SETFRAGMENT, &mmmmssss)) { - oss_logerr2 (errno, typ, "Failed to set buffer length (%d, %d)\n", - req->nfrags, req->fragsize); - goto err; - } - - if (ioctl (fd, in ? SNDCTL_DSP_GETISPACE : SNDCTL_DSP_GETOSPACE, &abinfo)) { - oss_logerr2 (errno, typ, "Failed to get buffer length\n"); - goto err; - } - - if (!abinfo.fragstotal || !abinfo.fragsize) { - AUD_log (AUDIO_CAP, "Returned bogus buffer information(%d, %d) for %s\n", - abinfo.fragstotal, abinfo.fragsize, typ); - goto err; - } - - obt->fmt = fmt; - obt->nchannels = nchannels; - obt->freq = freq; - obt->nfrags = abinfo.fragstotal; - obt->fragsize = abinfo.fragsize; - *pfd = fd; - -#ifdef DEBUG_MISMATCHES - if ((req->fmt != obt->fmt) || - (req->nchannels != obt->nchannels) || - (req->freq != obt->freq) || - (req->fragsize != obt->fragsize) || - (req->nfrags != obt->nfrags)) { - dolog ("Audio parameters mismatch\n"); - oss_dump_info (req, obt); - } -#endif - -#ifdef DEBUG - oss_dump_info (req, obt); -#endif - return 0; - - err: - oss_anal_close (&fd); - return -1; -} - -static int oss_run_out (HWVoiceOut *hw) -{ - OSSVoiceOut *oss = (OSSVoiceOut *) hw; - int err, rpos, live, decr; - int samples; - uint8_t *dst; - struct st_sample *src; - struct audio_buf_info abinfo; - struct count_info cntinfo; - int bufsize; - - live = audio_pcm_hw_get_live_out (hw); - if (!live) { - return 0; - } - - bufsize = hw->samples << hw->info.shift; - - if (oss->mmapped) { - int bytes; - - err = ioctl (oss->fd, SNDCTL_DSP_GETOPTR, &cntinfo); - if (err < 0) { - oss_logerr (errno, "SNDCTL_DSP_GETOPTR failed\n"); - return 0; - } - - if (cntinfo.ptr == oss->old_optr) { - if (abs (hw->samples - live) < 64) { - dolog ("warning: Overrun\n"); - } - return 0; - } - - if (cntinfo.ptr > oss->old_optr) { - bytes = cntinfo.ptr - oss->old_optr; - } - else { - bytes = bufsize + cntinfo.ptr - oss->old_optr; - } - - decr = audio_MIN (bytes >> hw->info.shift, live); - } - else { - err = ioctl (oss->fd, SNDCTL_DSP_GETOSPACE, &abinfo); - if (err < 0) { - oss_logerr (errno, "SNDCTL_DSP_GETOPTR failed\n"); - return 0; - } - - if (abinfo.bytes > bufsize) { - if (conf.debug) { - dolog ("warning: Invalid available size, size=%d bufsize=%d\n" - "please report your OS/audio hw to malc@pulsesoft.com\n", - abinfo.bytes, bufsize); - } - abinfo.bytes = bufsize; - } - - if (abinfo.bytes < 0) { - if (conf.debug) { - dolog ("warning: Invalid available size, size=%d bufsize=%d\n", - abinfo.bytes, bufsize); - } - return 0; - } - - decr = audio_MIN (abinfo.bytes >> hw->info.shift, live); - if (!decr) { - return 0; - } - } - - samples = decr; - rpos = hw->rpos; - while (samples) { - int left_till_end_samples = hw->samples - rpos; - int convert_samples = audio_MIN (samples, left_till_end_samples); - - src = hw->mix_buf + rpos; - dst = advance (oss->pcm_buf, rpos << hw->info.shift); - - hw->clip (dst, src, convert_samples); - if (!oss->mmapped) { - int written; - - written = write (oss->fd, dst, convert_samples << hw->info.shift); - /* XXX: follow errno recommendations ? */ - if (written == -1) { - oss_logerr ( - errno, - "Failed to write %d bytes of audio data from %p\n", - convert_samples << hw->info.shift, - dst - ); - continue; - } - - if (written != convert_samples << hw->info.shift) { - int wsamples = written >> hw->info.shift; - int wbytes = wsamples << hw->info.shift; - if (wbytes != written) { - dolog ("warning: Misaligned write %d (requested %d), " - "alignment %d\n", - wbytes, written, hw->info.align + 1); - } - decr -= wsamples; - rpos = (rpos + wsamples) % hw->samples; - break; - } - } - - rpos = (rpos + convert_samples) % hw->samples; - samples -= convert_samples; - } - if (oss->mmapped) { - oss->old_optr = cntinfo.ptr; - } - - hw->rpos = rpos; - return decr; -} - -static void oss_fini_out (HWVoiceOut *hw) -{ - int err; - OSSVoiceOut *oss = (OSSVoiceOut *) hw; - - ldebug ("oss_fini\n"); - oss_anal_close (&oss->fd); - - if (oss->pcm_buf) { - if (oss->mmapped) { - err = munmap (oss->pcm_buf, hw->samples << hw->info.shift); - if (err) { - oss_logerr (errno, "Failed to unmap buffer %p, size %d\n", - oss->pcm_buf, hw->samples << hw->info.shift); - } - } - else { - qemu_free (oss->pcm_buf); - } - oss->pcm_buf = NULL; - } -} - -static int oss_init_out (HWVoiceOut *hw, struct audsettings *as) -{ - OSSVoiceOut *oss = (OSSVoiceOut *) hw; - struct oss_params req, obt; - int endianness; - int err; - int fd; - audfmt_e effective_fmt; - struct audsettings obt_as; - - oss->fd = -1; - - req.fmt = aud_to_ossfmt (as->fmt); - req.freq = as->freq; - req.nchannels = as->nchannels; - req.fragsize = conf.fragsize; - req.nfrags = conf.nfrags; - - if (oss_open (0, &req, &obt, &fd)) { - return -1; - } - - err = oss_to_audfmt (obt.fmt, &effective_fmt, &endianness); - if (err) { - oss_anal_close (&fd); - return -1; - } - - obt_as.freq = obt.freq; - obt_as.nchannels = obt.nchannels; - obt_as.fmt = effective_fmt; - obt_as.endianness = endianness; - - audio_pcm_init_info (&hw->info, &obt_as); - oss->nfrags = obt.nfrags; - oss->fragsize = obt.fragsize; - - if (obt.nfrags * obt.fragsize & hw->info.align) { - dolog ("warning: Misaligned DAC buffer, size %d, alignment %d\n", - obt.nfrags * obt.fragsize, hw->info.align + 1); - } - - hw->samples = (obt.nfrags * obt.fragsize) >> hw->info.shift; - - oss->mmapped = 0; - if (conf.try_mmap) { - oss->pcm_buf = mmap ( - NULL, - hw->samples << hw->info.shift, - PROT_READ | PROT_WRITE, - MAP_SHARED, - fd, - 0 - ); - if (oss->pcm_buf == MAP_FAILED) { - oss_logerr (errno, "Failed to map %d bytes of DAC\n", - hw->samples << hw->info.shift); - } else { - int err; - int trig = 0; - if (ioctl (fd, SNDCTL_DSP_SETTRIGGER, &trig) < 0) { - oss_logerr (errno, "SNDCTL_DSP_SETTRIGGER 0 failed\n"); - } - else { - trig = PCM_ENABLE_OUTPUT; - if (ioctl (fd, SNDCTL_DSP_SETTRIGGER, &trig) < 0) { - oss_logerr ( - errno, - "SNDCTL_DSP_SETTRIGGER PCM_ENABLE_OUTPUT failed\n" - ); - } - else { - oss->mmapped = 1; - } - } - - if (!oss->mmapped) { - err = munmap (oss->pcm_buf, hw->samples << hw->info.shift); - if (err) { - oss_logerr (errno, "Failed to unmap buffer %p size %d\n", - oss->pcm_buf, hw->samples << hw->info.shift); - } - } - } - } - - if (!oss->mmapped) { - oss->pcm_buf = audio_calloc ( - AUDIO_FUNC, - hw->samples, - 1 << hw->info.shift - ); - if (!oss->pcm_buf) { - dolog ( - "Could not allocate DAC buffer (%d samples, each %d bytes)\n", - hw->samples, - 1 << hw->info.shift - ); - oss_anal_close (&fd); - return -1; - } - } - - oss->fd = fd; - return 0; -} - -static int oss_ctl_out (HWVoiceOut *hw, int cmd, ...) -{ - int trig; - OSSVoiceOut *oss = (OSSVoiceOut *) hw; - - if (!oss->mmapped) { - return 0; - } - - switch (cmd) { - case VOICE_ENABLE: - ldebug ("enabling voice\n"); - audio_pcm_info_clear_buf (&hw->info, oss->pcm_buf, hw->samples); - trig = PCM_ENABLE_OUTPUT; - if (ioctl (oss->fd, SNDCTL_DSP_SETTRIGGER, &trig) < 0) { - oss_logerr ( - errno, - "SNDCTL_DSP_SETTRIGGER PCM_ENABLE_OUTPUT failed\n" - ); - return -1; - } - break; - - case VOICE_DISABLE: - ldebug ("disabling voice\n"); - trig = 0; - if (ioctl (oss->fd, SNDCTL_DSP_SETTRIGGER, &trig) < 0) { - oss_logerr (errno, "SNDCTL_DSP_SETTRIGGER 0 failed\n"); - return -1; - } - break; - } - return 0; -} - -static int oss_init_in (HWVoiceIn *hw, struct audsettings *as) -{ - OSSVoiceIn *oss = (OSSVoiceIn *) hw; - struct oss_params req, obt; - int endianness; - int err; - int fd; - audfmt_e effective_fmt; - struct audsettings obt_as; - - oss->fd = -1; - - req.fmt = aud_to_ossfmt (as->fmt); - req.freq = as->freq; - req.nchannels = as->nchannels; - req.fragsize = conf.fragsize; - req.nfrags = conf.nfrags; - if (oss_open (1, &req, &obt, &fd)) { - return -1; - } - - err = oss_to_audfmt (obt.fmt, &effective_fmt, &endianness); - if (err) { - oss_anal_close (&fd); - return -1; - } - - obt_as.freq = obt.freq; - obt_as.nchannels = obt.nchannels; - obt_as.fmt = effective_fmt; - obt_as.endianness = endianness; - - audio_pcm_init_info (&hw->info, &obt_as); - oss->nfrags = obt.nfrags; - oss->fragsize = obt.fragsize; - - if (obt.nfrags * obt.fragsize & hw->info.align) { - dolog ("warning: Misaligned ADC buffer, size %d, alignment %d\n", - obt.nfrags * obt.fragsize, hw->info.align + 1); - } - - hw->samples = (obt.nfrags * obt.fragsize) >> hw->info.shift; - oss->pcm_buf = audio_calloc (AUDIO_FUNC, hw->samples, 1 << hw->info.shift); - if (!oss->pcm_buf) { - dolog ("Could not allocate ADC buffer (%d samples, each %d bytes)\n", - hw->samples, 1 << hw->info.shift); - oss_anal_close (&fd); - return -1; - } - - oss->fd = fd; - return 0; -} - -static void oss_fini_in (HWVoiceIn *hw) -{ - OSSVoiceIn *oss = (OSSVoiceIn *) hw; - - oss_anal_close (&oss->fd); - - if (oss->pcm_buf) { - qemu_free (oss->pcm_buf); - oss->pcm_buf = NULL; - } -} - -static int oss_run_in (HWVoiceIn *hw) -{ - OSSVoiceIn *oss = (OSSVoiceIn *) hw; - int hwshift = hw->info.shift; - int i; - int live = audio_pcm_hw_get_live_in (hw); - int dead = hw->samples - live; - size_t read_samples = 0; - struct { - int add; - int len; - } bufs[2] = { - { hw->wpos, 0 }, - { 0, 0 } - }; - - if (!dead) { - return 0; - } - - if (hw->wpos + dead > hw->samples) { - bufs[0].len = (hw->samples - hw->wpos) << hwshift; - bufs[1].len = (dead - (hw->samples - hw->wpos)) << hwshift; - } - else { - bufs[0].len = dead << hwshift; - } - - - for (i = 0; i < 2; ++i) { - ssize_t nread; - - if (bufs[i].len) { - void *p = advance (oss->pcm_buf, bufs[i].add << hwshift); - nread = read (oss->fd, p, bufs[i].len); - - if (nread > 0) { - if (nread & hw->info.align) { - dolog ("warning: Misaligned read %zd (requested %d), " - "alignment %d\n", nread, bufs[i].add << hwshift, - hw->info.align + 1); - } - read_samples += nread >> hwshift; - hw->conv (hw->conv_buf + bufs[i].add, p, nread >> hwshift, - &nominal_volume); - } - - if (bufs[i].len - nread) { - if (nread == -1) { - switch (errno) { - case EINTR: - case EAGAIN: - break; - default: - oss_logerr ( - errno, - "Failed to read %d bytes of audio (to %p)\n", - bufs[i].len, p - ); - break; - } - } - break; - } - } - } - - hw->wpos = (hw->wpos + read_samples) % hw->samples; - return read_samples; -} - -static int oss_read (SWVoiceIn *sw, void *buf, int size) -{ - return audio_pcm_sw_read (sw, buf, size); -} - -static int oss_ctl_in (HWVoiceIn *hw, int cmd, ...) -{ - (void) hw; - (void) cmd; - return 0; -} - -static void *oss_audio_init (void) -{ - return &conf; -} - -static void oss_audio_fini (void *opaque) -{ - (void) opaque; -} - -static struct audio_option oss_options[] = { - {"FRAGSIZE", AUD_OPT_INT, &conf.fragsize, - "Fragment size in bytes", NULL, 0}, - {"NFRAGS", AUD_OPT_INT, &conf.nfrags, - "Number of fragments", NULL, 0}, - {"MMAP", AUD_OPT_BOOL, &conf.try_mmap, - "Try using memory mapped access", NULL, 0}, - {"DAC_DEV", AUD_OPT_STR, &conf.devpath_out, - "Path to DAC device", NULL, 0}, - {"ADC_DEV", AUD_OPT_STR, &conf.devpath_in, - "Path to ADC device", NULL, 0}, - {"DEBUG", AUD_OPT_BOOL, &conf.debug, - "Turn on some debugging messages", NULL, 0}, - {NULL, 0, NULL, NULL, NULL, 0} -}; - -static struct audio_pcm_ops oss_pcm_ops = { - oss_init_out, - oss_fini_out, - oss_run_out, - oss_write, - oss_ctl_out, - - oss_init_in, - oss_fini_in, - oss_run_in, - oss_read, - oss_ctl_in -}; - -struct audio_driver oss_audio_driver = { - INIT_FIELD (name = ) "oss", - INIT_FIELD (descr = ) "OSS http://www.opensound.com", - INIT_FIELD (options = ) oss_options, - INIT_FIELD (init = ) oss_audio_init, - INIT_FIELD (fini = ) oss_audio_fini, - INIT_FIELD (pcm_ops = ) &oss_pcm_ops, - INIT_FIELD (can_be_default = ) 1, - INIT_FIELD (max_voices_out = ) INT_MAX, - INIT_FIELD (max_voices_in = ) INT_MAX, - INIT_FIELD (voice_size_out = ) sizeof (OSSVoiceOut), - INIT_FIELD (voice_size_in = ) sizeof (OSSVoiceIn) -}; diff --git a/qemu-0.11.0/audio/paaudio.c b/qemu-0.11.0/audio/paaudio.c deleted file mode 100644 index a50fccc..0000000 --- a/qemu-0.11.0/audio/paaudio.c +++ /dev/null @@ -1,515 +0,0 @@ -/* public domain */ -#include "qemu-common.h" -#include "audio.h" - -#include <pulse/simple.h> -#include <pulse/error.h> - -#define AUDIO_CAP "pulseaudio" -#include "audio_int.h" -#include "audio_pt_int.h" - -typedef struct { - HWVoiceOut hw; - int done; - int live; - int decr; - int rpos; - pa_simple *s; - void *pcm_buf; - struct audio_pt pt; -} PAVoiceOut; - -typedef struct { - HWVoiceIn hw; - int done; - int dead; - int incr; - int wpos; - pa_simple *s; - void *pcm_buf; - struct audio_pt pt; -} PAVoiceIn; - -static struct { - int samples; - int divisor; - char *server; - char *sink; - char *source; -} conf = { - 1024, - 2, - NULL, - NULL, - NULL -}; - -static void GCC_FMT_ATTR (2, 3) qpa_logerr (int err, const char *fmt, ...) -{ - va_list ap; - - va_start (ap, fmt); - AUD_vlog (AUDIO_CAP, fmt, ap); - va_end (ap); - - AUD_log (AUDIO_CAP, "Reason: %s\n", pa_strerror (err)); -} - -static void *qpa_thread_out (void *arg) -{ - PAVoiceOut *pa = arg; - HWVoiceOut *hw = &pa->hw; - int threshold; - - threshold = conf.divisor ? hw->samples / conf.divisor : 0; - - if (audio_pt_lock (&pa->pt, AUDIO_FUNC)) { - return NULL; - } - - for (;;) { - int decr, to_mix, rpos; - - for (;;) { - if (pa->done) { - goto exit; - } - - if (pa->live > threshold) { - break; - } - - if (audio_pt_wait (&pa->pt, AUDIO_FUNC)) { - goto exit; - } - } - - decr = to_mix = pa->live; - rpos = hw->rpos; - - if (audio_pt_unlock (&pa->pt, AUDIO_FUNC)) { - return NULL; - } - - while (to_mix) { - int error; - int chunk = audio_MIN (to_mix, hw->samples - rpos); - struct st_sample *src = hw->mix_buf + rpos; - - hw->clip (pa->pcm_buf, src, chunk); - - if (pa_simple_write (pa->s, pa->pcm_buf, - chunk << hw->info.shift, &error) < 0) { - qpa_logerr (error, "pa_simple_write failed\n"); - return NULL; - } - - rpos = (rpos + chunk) % hw->samples; - to_mix -= chunk; - } - - if (audio_pt_lock (&pa->pt, AUDIO_FUNC)) { - return NULL; - } - - pa->rpos = rpos; - pa->live -= decr; - pa->decr += decr; - } - - exit: - audio_pt_unlock (&pa->pt, AUDIO_FUNC); - return NULL; -} - -static int qpa_run_out (HWVoiceOut *hw) -{ - int live, decr; - PAVoiceOut *pa = (PAVoiceOut *) hw; - - if (audio_pt_lock (&pa->pt, AUDIO_FUNC)) { - return 0; - } - - live = audio_pcm_hw_get_live_out (hw); - decr = audio_MIN (live, pa->decr); - pa->decr -= decr; - pa->live = live - decr; - hw->rpos = pa->rpos; - if (pa->live > 0) { - audio_pt_unlock_and_signal (&pa->pt, AUDIO_FUNC); - } - else { - audio_pt_unlock (&pa->pt, AUDIO_FUNC); - } - return decr; -} - -static int qpa_write (SWVoiceOut *sw, void *buf, int len) -{ - return audio_pcm_sw_write (sw, buf, len); -} - -/* capture */ -static void *qpa_thread_in (void *arg) -{ - PAVoiceIn *pa = arg; - HWVoiceIn *hw = &pa->hw; - int threshold; - - threshold = conf.divisor ? hw->samples / conf.divisor : 0; - - if (audio_pt_lock (&pa->pt, AUDIO_FUNC)) { - return NULL; - } - - for (;;) { - int incr, to_grab, wpos; - - for (;;) { - if (pa->done) { - goto exit; - } - - if (pa->dead > threshold) { - break; - } - - if (audio_pt_wait (&pa->pt, AUDIO_FUNC)) { - goto exit; - } - } - - incr = to_grab = pa->dead; - wpos = hw->wpos; - - if (audio_pt_unlock (&pa->pt, AUDIO_FUNC)) { - return NULL; - } - - while (to_grab) { - int error; - int chunk = audio_MIN (to_grab, hw->samples - wpos); - void *buf = advance (pa->pcm_buf, wpos); - - if (pa_simple_read (pa->s, buf, - chunk << hw->info.shift, &error) < 0) { - qpa_logerr (error, "pa_simple_read failed\n"); - return NULL; - } - - hw->conv (hw->conv_buf + wpos, buf, chunk, &nominal_volume); - wpos = (wpos + chunk) % hw->samples; - to_grab -= chunk; - } - - if (audio_pt_lock (&pa->pt, AUDIO_FUNC)) { - return NULL; - } - - pa->wpos = wpos; - pa->dead -= incr; - pa->incr += incr; - } - - exit: - audio_pt_unlock (&pa->pt, AUDIO_FUNC); - return NULL; -} - -static int qpa_run_in (HWVoiceIn *hw) -{ - int live, incr, dead; - PAVoiceIn *pa = (PAVoiceIn *) hw; - - if (audio_pt_lock (&pa->pt, AUDIO_FUNC)) { - return 0; - } - - live = audio_pcm_hw_get_live_in (hw); - dead = hw->samples - live; - incr = audio_MIN (dead, pa->incr); - pa->incr -= incr; - pa->dead = dead - incr; - hw->wpos = pa->wpos; - if (pa->dead > 0) { - audio_pt_unlock_and_signal (&pa->pt, AUDIO_FUNC); - } - else { - audio_pt_unlock (&pa->pt, AUDIO_FUNC); - } - return incr; -} - -static int qpa_read (SWVoiceIn *sw, void *buf, int len) -{ - return audio_pcm_sw_read (sw, buf, len); -} - -static pa_sample_format_t audfmt_to_pa (audfmt_e afmt, int endianness) -{ - int format; - - switch (afmt) { - case AUD_FMT_S8: - case AUD_FMT_U8: - format = PA_SAMPLE_U8; - break; - case AUD_FMT_S16: - case AUD_FMT_U16: - format = endianness ? PA_SAMPLE_S16BE : PA_SAMPLE_S16LE; - break; - case AUD_FMT_S32: - case AUD_FMT_U32: - format = endianness ? PA_SAMPLE_S32BE : PA_SAMPLE_S32LE; - break; - default: - dolog ("Internal logic error: Bad audio format %d\n", afmt); - format = PA_SAMPLE_U8; - break; - } - return format; -} - -static audfmt_e pa_to_audfmt (pa_sample_format_t fmt, int *endianness) -{ - switch (fmt) { - case PA_SAMPLE_U8: - return AUD_FMT_U8; - case PA_SAMPLE_S16BE: - *endianness = 1; - return AUD_FMT_S16; - case PA_SAMPLE_S16LE: - *endianness = 0; - return AUD_FMT_S16; - case PA_SAMPLE_S32BE: - *endianness = 1; - return AUD_FMT_S32; - case PA_SAMPLE_S32LE: - *endianness = 0; - return AUD_FMT_S32; - default: - dolog ("Internal logic error: Bad pa_sample_format %d\n", fmt); - return AUD_FMT_U8; - } -} - -static int qpa_init_out (HWVoiceOut *hw, struct audsettings *as) -{ - int error; - static pa_sample_spec ss; - struct audsettings obt_as = *as; - PAVoiceOut *pa = (PAVoiceOut *) hw; - - ss.format = audfmt_to_pa (as->fmt, as->endianness); - ss.channels = as->nchannels; - ss.rate = as->freq; - - obt_as.fmt = pa_to_audfmt (ss.format, &obt_as.endianness); - - pa->s = pa_simple_new ( - conf.server, - "qemu", - PA_STREAM_PLAYBACK, - conf.sink, - "pcm.playback", - &ss, - NULL, /* channel map */ - NULL, /* buffering attributes */ - &error - ); - if (!pa->s) { - qpa_logerr (error, "pa_simple_new for playback failed\n"); - goto fail1; - } - - audio_pcm_init_info (&hw->info, &obt_as); - hw->samples = conf.samples; - pa->pcm_buf = audio_calloc (AUDIO_FUNC, hw->samples, 1 << hw->info.shift); - if (!pa->pcm_buf) { - dolog ("Could not allocate buffer (%d bytes)\n", - hw->samples << hw->info.shift); - goto fail2; - } - - if (audio_pt_init (&pa->pt, qpa_thread_out, hw, AUDIO_CAP, AUDIO_FUNC)) { - goto fail3; - } - - return 0; - - fail3: - qemu_free (pa->pcm_buf); - pa->pcm_buf = NULL; - fail2: - pa_simple_free (pa->s); - pa->s = NULL; - fail1: - return -1; -} - -static int qpa_init_in (HWVoiceIn *hw, struct audsettings *as) -{ - int error; - static pa_sample_spec ss; - struct audsettings obt_as = *as; - PAVoiceIn *pa = (PAVoiceIn *) hw; - - ss.format = audfmt_to_pa (as->fmt, as->endianness); - ss.channels = as->nchannels; - ss.rate = as->freq; - - obt_as.fmt = pa_to_audfmt (ss.format, &obt_as.endianness); - - pa->s = pa_simple_new ( - conf.server, - "qemu", - PA_STREAM_RECORD, - conf.source, - "pcm.capture", - &ss, - NULL, /* channel map */ - NULL, /* buffering attributes */ - &error - ); - if (!pa->s) { - qpa_logerr (error, "pa_simple_new for capture failed\n"); - goto fail1; - } - - audio_pcm_init_info (&hw->info, &obt_as); - hw->samples = conf.samples; - pa->pcm_buf = audio_calloc (AUDIO_FUNC, hw->samples, 1 << hw->info.shift); - if (!pa->pcm_buf) { - dolog ("Could not allocate buffer (%d bytes)\n", - hw->samples << hw->info.shift); - goto fail2; - } - - if (audio_pt_init (&pa->pt, qpa_thread_in, hw, AUDIO_CAP, AUDIO_FUNC)) { - goto fail3; - } - - return 0; - - fail3: - qemu_free (pa->pcm_buf); - pa->pcm_buf = NULL; - fail2: - pa_simple_free (pa->s); - pa->s = NULL; - fail1: - return -1; -} - -static void qpa_fini_out (HWVoiceOut *hw) -{ - void *ret; - PAVoiceOut *pa = (PAVoiceOut *) hw; - - audio_pt_lock (&pa->pt, AUDIO_FUNC); - pa->done = 1; - audio_pt_unlock_and_signal (&pa->pt, AUDIO_FUNC); - audio_pt_join (&pa->pt, &ret, AUDIO_FUNC); - - if (pa->s) { - pa_simple_free (pa->s); - pa->s = NULL; - } - - audio_pt_fini (&pa->pt, AUDIO_FUNC); - qemu_free (pa->pcm_buf); - pa->pcm_buf = NULL; -} - -static void qpa_fini_in (HWVoiceIn *hw) -{ - void *ret; - PAVoiceIn *pa = (PAVoiceIn *) hw; - - audio_pt_lock (&pa->pt, AUDIO_FUNC); - pa->done = 1; - audio_pt_unlock_and_signal (&pa->pt, AUDIO_FUNC); - audio_pt_join (&pa->pt, &ret, AUDIO_FUNC); - - if (pa->s) { - pa_simple_free (pa->s); - pa->s = NULL; - } - - audio_pt_fini (&pa->pt, AUDIO_FUNC); - qemu_free (pa->pcm_buf); - pa->pcm_buf = NULL; -} - -static int qpa_ctl_out (HWVoiceOut *hw, int cmd, ...) -{ - (void) hw; - (void) cmd; - return 0; -} - -static int qpa_ctl_in (HWVoiceIn *hw, int cmd, ...) -{ - (void) hw; - (void) cmd; - return 0; -} - -/* common */ -static void *qpa_audio_init (void) -{ - return &conf; -} - -static void qpa_audio_fini (void *opaque) -{ - (void) opaque; -} - -struct audio_option qpa_options[] = { - {"SAMPLES", AUD_OPT_INT, &conf.samples, - "buffer size in samples", NULL, 0}, - - {"DIVISOR", AUD_OPT_INT, &conf.divisor, - "threshold divisor", NULL, 0}, - - {"SERVER", AUD_OPT_STR, &conf.server, - "server address", NULL, 0}, - - {"SINK", AUD_OPT_STR, &conf.sink, - "sink device name", NULL, 0}, - - {"SOURCE", AUD_OPT_STR, &conf.source, - "source device name", NULL, 0}, - - {NULL, 0, NULL, NULL, NULL, 0} -}; - -static struct audio_pcm_ops qpa_pcm_ops = { - qpa_init_out, - qpa_fini_out, - qpa_run_out, - qpa_write, - qpa_ctl_out, - qpa_init_in, - qpa_fini_in, - qpa_run_in, - qpa_read, - qpa_ctl_in -}; - -struct audio_driver pa_audio_driver = { - INIT_FIELD (name = ) "pa", - INIT_FIELD (descr = ) "http://www.pulseaudio.org/", - INIT_FIELD (options = ) qpa_options, - INIT_FIELD (init = ) qpa_audio_init, - INIT_FIELD (fini = ) qpa_audio_fini, - INIT_FIELD (pcm_ops = ) &qpa_pcm_ops, - INIT_FIELD (can_be_default = ) 0, - INIT_FIELD (max_voices_out = ) INT_MAX, - INIT_FIELD (max_voices_in = ) INT_MAX, - INIT_FIELD (voice_size_out = ) sizeof (PAVoiceOut), - INIT_FIELD (voice_size_in = ) sizeof (PAVoiceIn) -}; diff --git a/qemu-0.11.0/audio/rate_template.h b/qemu-0.11.0/audio/rate_template.h deleted file mode 100644 index bd4b1c7..0000000 --- a/qemu-0.11.0/audio/rate_template.h +++ /dev/null @@ -1,111 +0,0 @@ -/* - * QEMU Mixing engine - * - * Copyright (c) 2004-2005 Vassili Karpov (malc) - * Copyright (c) 1998 Fabrice Bellard - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -/* - * Processed signed long samples from ibuf to obuf. - * Return number of samples processed. - */ -void NAME (void *opaque, struct st_sample *ibuf, struct st_sample *obuf, - int *isamp, int *osamp) -{ - struct rate *rate = opaque; - struct st_sample *istart, *iend; - struct st_sample *ostart, *oend; - struct st_sample ilast, icur, out; -#ifdef FLOAT_MIXENG - mixeng_real t; -#else - int64_t t; -#endif - - ilast = rate->ilast; - - istart = ibuf; - iend = ibuf + *isamp; - - ostart = obuf; - oend = obuf + *osamp; - - if (rate->opos_inc == (1ULL + UINT_MAX)) { - int i, n = *isamp > *osamp ? *osamp : *isamp; - for (i = 0; i < n; i++) { - OP (obuf[i].l, ibuf[i].l); - OP (obuf[i].r, ibuf[i].r); - } - *isamp = n; - *osamp = n; - return; - } - - while (obuf < oend) { - - /* Safety catch to make sure we have input samples. */ - if (ibuf >= iend) { - break; - } - - /* read as many input samples so that ipos > opos */ - - while (rate->ipos <= (rate->opos >> 32)) { - ilast = *ibuf++; - rate->ipos++; - /* See if we finished the input buffer yet */ - if (ibuf >= iend) { - goto the_end; - } - } - - icur = *ibuf; - - /* interpolate */ -#ifdef FLOAT_MIXENG -#ifdef RECIPROCAL - t = (rate->opos & UINT_MAX) * (1.f / UINT_MAX); -#else - t = (rate->opos & UINT_MAX) / (mixeng_real) UINT_MAX; -#endif - out.l = (ilast.l * (1.0 - t)) + icur.l * t; - out.r = (ilast.r * (1.0 - t)) + icur.r * t; -#else - t = rate->opos & 0xffffffff; - out.l = (ilast.l * ((int64_t) UINT_MAX - t) + icur.l * t) >> 32; - out.r = (ilast.r * ((int64_t) UINT_MAX - t) + icur.r * t) >> 32; -#endif - - /* output sample & increment position */ - OP (obuf->l, out.l); - OP (obuf->r, out.r); - obuf += 1; - rate->opos += rate->opos_inc; - } - -the_end: - *isamp = ibuf - istart; - *osamp = obuf - ostart; - rate->ilast = ilast; -} - -#undef NAME -#undef OP diff --git a/qemu-0.11.0/audio/sdlaudio.c b/qemu-0.11.0/audio/sdlaudio.c deleted file mode 100644 index dafef5d..0000000 --- a/qemu-0.11.0/audio/sdlaudio.c +++ /dev/null @@ -1,454 +0,0 @@ -/* - * QEMU SDL audio driver - * - * Copyright (c) 2004-2005 Vassili Karpov (malc) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -#include <SDL.h> -#include <SDL_thread.h> -#include "qemu-common.h" -#include "audio.h" - -#ifndef _WIN32 -#ifdef __sun__ -#define _POSIX_PTHREAD_SEMANTICS 1 -#elif defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__DragonFly__) -#include <pthread.h> -#endif -#include <signal.h> -#endif - -#define AUDIO_CAP "sdl" -#include "audio_int.h" - -typedef struct SDLVoiceOut { - HWVoiceOut hw; - int live; - int rpos; - int decr; -} SDLVoiceOut; - -static struct { - int nb_samples; -} conf = { - 1024 -}; - -static struct SDLAudioState { - int exit; - SDL_mutex *mutex; - SDL_sem *sem; - int initialized; -} glob_sdl; -typedef struct SDLAudioState SDLAudioState; - -static void GCC_FMT_ATTR (1, 2) sdl_logerr (const char *fmt, ...) -{ - va_list ap; - - va_start (ap, fmt); - AUD_vlog (AUDIO_CAP, fmt, ap); - va_end (ap); - - AUD_log (AUDIO_CAP, "Reason: %s\n", SDL_GetError ()); -} - -static int sdl_lock (SDLAudioState *s, const char *forfn) -{ - if (SDL_LockMutex (s->mutex)) { - sdl_logerr ("SDL_LockMutex for %s failed\n", forfn); - return -1; - } - return 0; -} - -static int sdl_unlock (SDLAudioState *s, const char *forfn) -{ - if (SDL_UnlockMutex (s->mutex)) { - sdl_logerr ("SDL_UnlockMutex for %s failed\n", forfn); - return -1; - } - return 0; -} - -static int sdl_post (SDLAudioState *s, const char *forfn) -{ - if (SDL_SemPost (s->sem)) { - sdl_logerr ("SDL_SemPost for %s failed\n", forfn); - return -1; - } - return 0; -} - -static int sdl_wait (SDLAudioState *s, const char *forfn) -{ - if (SDL_SemWait (s->sem)) { - sdl_logerr ("SDL_SemWait for %s failed\n", forfn); - return -1; - } - return 0; -} - -static int sdl_unlock_and_post (SDLAudioState *s, const char *forfn) -{ - if (sdl_unlock (s, forfn)) { - return -1; - } - - return sdl_post (s, forfn); -} - -static int aud_to_sdlfmt (audfmt_e fmt, int *shift) -{ - switch (fmt) { - case AUD_FMT_S8: - *shift = 0; - return AUDIO_S8; - - case AUD_FMT_U8: - *shift = 0; - return AUDIO_U8; - - case AUD_FMT_S16: - *shift = 1; - return AUDIO_S16LSB; - - case AUD_FMT_U16: - *shift = 1; - return AUDIO_U16LSB; - - default: - dolog ("Internal logic error: Bad audio format %d\n", fmt); -#ifdef DEBUG_AUDIO - abort (); -#endif - return AUDIO_U8; - } -} - -static int sdl_to_audfmt (int sdlfmt, audfmt_e *fmt, int *endianess) -{ - switch (sdlfmt) { - case AUDIO_S8: - *endianess = 0; - *fmt = AUD_FMT_S8; - break; - - case AUDIO_U8: - *endianess = 0; - *fmt = AUD_FMT_U8; - break; - - case AUDIO_S16LSB: - *endianess = 0; - *fmt = AUD_FMT_S16; - break; - - case AUDIO_U16LSB: - *endianess = 0; - *fmt = AUD_FMT_U16; - break; - - case AUDIO_S16MSB: - *endianess = 1; - *fmt = AUD_FMT_S16; - break; - - case AUDIO_U16MSB: - *endianess = 1; - *fmt = AUD_FMT_U16; - break; - - default: - dolog ("Unrecognized SDL audio format %d\n", sdlfmt); - return -1; - } - - return 0; -} - -static int sdl_open (SDL_AudioSpec *req, SDL_AudioSpec *obt) -{ - int status; -#ifndef _WIN32 - sigset_t new, old; - - /* Make sure potential threads created by SDL don't hog signals. */ - sigfillset (&new); - pthread_sigmask (SIG_BLOCK, &new, &old); -#endif - - status = SDL_OpenAudio (req, obt); - if (status) { - sdl_logerr ("SDL_OpenAudio failed\n"); - } - -#ifndef _WIN32 - pthread_sigmask (SIG_SETMASK, &old, NULL); -#endif - return status; -} - -static void sdl_close (SDLAudioState *s) -{ - if (s->initialized) { - sdl_lock (s, "sdl_close"); - s->exit = 1; - sdl_unlock_and_post (s, "sdl_close"); - SDL_PauseAudio (1); - SDL_CloseAudio (); - s->initialized = 0; - } -} - -static void sdl_callback (void *opaque, Uint8 *buf, int len) -{ - SDLVoiceOut *sdl = opaque; - SDLAudioState *s = &glob_sdl; - HWVoiceOut *hw = &sdl->hw; - int samples = len >> hw->info.shift; - - if (s->exit) { - return; - } - - while (samples) { - int to_mix, decr; - - /* dolog ("in callback samples=%d\n", samples); */ - sdl_wait (s, "sdl_callback"); - if (s->exit) { - return; - } - - if (sdl_lock (s, "sdl_callback")) { - return; - } - - if (audio_bug (AUDIO_FUNC, sdl->live < 0 || sdl->live > hw->samples)) { - dolog ("sdl->live=%d hw->samples=%d\n", - sdl->live, hw->samples); - return; - } - - if (!sdl->live) { - goto again; - } - - /* dolog ("in callback live=%d\n", live); */ - to_mix = audio_MIN (samples, sdl->live); - decr = to_mix; - while (to_mix) { - int chunk = audio_MIN (to_mix, hw->samples - hw->rpos); - struct st_sample *src = hw->mix_buf + hw->rpos; - - /* dolog ("in callback to_mix %d, chunk %d\n", to_mix, chunk); */ - hw->clip (buf, src, chunk); - sdl->rpos = (sdl->rpos + chunk) % hw->samples; - to_mix -= chunk; - buf += chunk << hw->info.shift; - } - samples -= decr; - sdl->live -= decr; - sdl->decr += decr; - - again: - if (sdl_unlock (s, "sdl_callback")) { - return; - } - } - /* dolog ("done len=%d\n", len); */ -} - -static int sdl_write_out (SWVoiceOut *sw, void *buf, int len) -{ - return audio_pcm_sw_write (sw, buf, len); -} - -static int sdl_run_out (HWVoiceOut *hw) -{ - int decr, live; - SDLVoiceOut *sdl = (SDLVoiceOut *) hw; - SDLAudioState *s = &glob_sdl; - - if (sdl_lock (s, "sdl_callback")) { - return 0; - } - - live = audio_pcm_hw_get_live_out (hw); - - if (sdl->decr > live) { - ldebug ("sdl->decr %d live %d sdl->live %d\n", - sdl->decr, - live, - sdl->live); - } - - decr = audio_MIN (sdl->decr, live); - sdl->decr -= decr; - - sdl->live = live - decr; - hw->rpos = sdl->rpos; - - if (sdl->live > 0) { - sdl_unlock_and_post (s, "sdl_callback"); - } - else { - sdl_unlock (s, "sdl_callback"); - } - return decr; -} - -static void sdl_fini_out (HWVoiceOut *hw) -{ - (void) hw; - - sdl_close (&glob_sdl); -} - -static int sdl_init_out (HWVoiceOut *hw, struct audsettings *as) -{ - SDLVoiceOut *sdl = (SDLVoiceOut *) hw; - SDLAudioState *s = &glob_sdl; - SDL_AudioSpec req, obt; - int shift; - int endianess; - int err; - audfmt_e effective_fmt; - struct audsettings obt_as; - - shift <<= as->nchannels == 2; - - req.freq = as->freq; - req.format = aud_to_sdlfmt (as->fmt, &shift); - req.channels = as->nchannels; - req.samples = conf.nb_samples; - req.callback = sdl_callback; - req.userdata = sdl; - - if (sdl_open (&req, &obt)) { - return -1; - } - - err = sdl_to_audfmt (obt.format, &effective_fmt, &endianess); - if (err) { - sdl_close (s); - return -1; - } - - obt_as.freq = obt.freq; - obt_as.nchannels = obt.channels; - obt_as.fmt = effective_fmt; - obt_as.endianness = endianess; - - audio_pcm_init_info (&hw->info, &obt_as); - hw->samples = obt.samples; - - s->initialized = 1; - s->exit = 0; - SDL_PauseAudio (0); - return 0; -} - -static int sdl_ctl_out (HWVoiceOut *hw, int cmd, ...) -{ - (void) hw; - - switch (cmd) { - case VOICE_ENABLE: - SDL_PauseAudio (0); - break; - - case VOICE_DISABLE: - SDL_PauseAudio (1); - break; - } - return 0; -} - -static void *sdl_audio_init (void) -{ - SDLAudioState *s = &glob_sdl; - - if (SDL_InitSubSystem (SDL_INIT_AUDIO)) { - sdl_logerr ("SDL failed to initialize audio subsystem\n"); - return NULL; - } - - s->mutex = SDL_CreateMutex (); - if (!s->mutex) { - sdl_logerr ("Failed to create SDL mutex\n"); - SDL_QuitSubSystem (SDL_INIT_AUDIO); - return NULL; - } - - s->sem = SDL_CreateSemaphore (0); - if (!s->sem) { - sdl_logerr ("Failed to create SDL semaphore\n"); - SDL_DestroyMutex (s->mutex); - SDL_QuitSubSystem (SDL_INIT_AUDIO); - return NULL; - } - - return s; -} - -static void sdl_audio_fini (void *opaque) -{ - SDLAudioState *s = opaque; - sdl_close (s); - SDL_DestroySemaphore (s->sem); - SDL_DestroyMutex (s->mutex); - SDL_QuitSubSystem (SDL_INIT_AUDIO); -} - -static struct audio_option sdl_options[] = { - {"SAMPLES", AUD_OPT_INT, &conf.nb_samples, - "Size of SDL buffer in samples", NULL, 0}, - {NULL, 0, NULL, NULL, NULL, 0} -}; - -static struct audio_pcm_ops sdl_pcm_ops = { - sdl_init_out, - sdl_fini_out, - sdl_run_out, - sdl_write_out, - sdl_ctl_out, - - NULL, - NULL, - NULL, - NULL, - NULL -}; - -struct audio_driver sdl_audio_driver = { - INIT_FIELD (name = ) "sdl", - INIT_FIELD (descr = ) "SDL http://www.libsdl.org", - INIT_FIELD (options = ) sdl_options, - INIT_FIELD (init = ) sdl_audio_init, - INIT_FIELD (fini = ) sdl_audio_fini, - INIT_FIELD (pcm_ops = ) &sdl_pcm_ops, - INIT_FIELD (can_be_default = ) 1, - INIT_FIELD (max_voices_out = ) 1, - INIT_FIELD (max_voices_in = ) 0, - INIT_FIELD (voice_size_out = ) sizeof (SDLVoiceOut), - INIT_FIELD (voice_size_in = ) 0 -}; diff --git a/qemu-0.11.0/audio/wavaudio.c b/qemu-0.11.0/audio/wavaudio.c deleted file mode 100644 index e50dac2..0000000 --- a/qemu-0.11.0/audio/wavaudio.c +++ /dev/null @@ -1,263 +0,0 @@ -/* - * QEMU WAV audio driver - * - * Copyright (c) 2004-2005 Vassili Karpov (malc) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -#include "hw/hw.h" -#include "qemu-timer.h" -#include "audio.h" - -#define AUDIO_CAP "wav" -#include "audio_int.h" - -typedef struct WAVVoiceOut { - HWVoiceOut hw; - QEMUFile *f; - int64_t old_ticks; - void *pcm_buf; - int total_samples; -} WAVVoiceOut; - -static struct { - struct audsettings settings; - const char *wav_path; -} conf = { - { - 44100, - 2, - AUD_FMT_S16, - 0 - }, - "qemu.wav" -}; - -static int wav_run_out (HWVoiceOut *hw) -{ - WAVVoiceOut *wav = (WAVVoiceOut *) hw; - int rpos, live, decr, samples; - uint8_t *dst; - struct st_sample *src; - int64_t now = qemu_get_clock (vm_clock); - int64_t ticks = now - wav->old_ticks; - int64_t bytes = (ticks * hw->info.bytes_per_second) / ticks_per_sec; - - if (bytes > INT_MAX) { - samples = INT_MAX >> hw->info.shift; - } - else { - samples = bytes >> hw->info.shift; - } - - live = audio_pcm_hw_get_live_out (hw); - if (!live) { - return 0; - } - - wav->old_ticks = now; - decr = audio_MIN (live, samples); - samples = decr; - rpos = hw->rpos; - while (samples) { - int left_till_end_samples = hw->samples - rpos; - int convert_samples = audio_MIN (samples, left_till_end_samples); - - src = hw->mix_buf + rpos; - dst = advance (wav->pcm_buf, rpos << hw->info.shift); - - hw->clip (dst, src, convert_samples); - qemu_put_buffer (wav->f, dst, convert_samples << hw->info.shift); - - rpos = (rpos + convert_samples) % hw->samples; - samples -= convert_samples; - wav->total_samples += convert_samples; - } - - hw->rpos = rpos; - return decr; -} - -static int wav_write_out (SWVoiceOut *sw, void *buf, int len) -{ - return audio_pcm_sw_write (sw, buf, len); -} - -/* VICE code: Store number as little endian. */ -static void le_store (uint8_t *buf, uint32_t val, int len) -{ - int i; - for (i = 0; i < len; i++) { - buf[i] = (uint8_t) (val & 0xff); - val >>= 8; - } -} - -static int wav_init_out (HWVoiceOut *hw, struct audsettings *as) -{ - WAVVoiceOut *wav = (WAVVoiceOut *) hw; - int bits16 = 0, stereo = 0; - uint8_t hdr[] = { - 0x52, 0x49, 0x46, 0x46, 0x00, 0x00, 0x00, 0x00, 0x57, 0x41, 0x56, - 0x45, 0x66, 0x6d, 0x74, 0x20, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, - 0x02, 0x00, 0x44, 0xac, 0x00, 0x00, 0x10, 0xb1, 0x02, 0x00, 0x04, - 0x00, 0x10, 0x00, 0x64, 0x61, 0x74, 0x61, 0x00, 0x00, 0x00, 0x00 - }; - struct audsettings wav_as = conf.settings; - - (void) as; - - stereo = wav_as.nchannels == 2; - switch (wav_as.fmt) { - case AUD_FMT_S8: - case AUD_FMT_U8: - bits16 = 0; - break; - - case AUD_FMT_S16: - case AUD_FMT_U16: - bits16 = 1; - break; - - case AUD_FMT_S32: - case AUD_FMT_U32: - dolog ("WAVE files can not handle 32bit formats\n"); - return -1; - } - - hdr[34] = bits16 ? 0x10 : 0x08; - - wav_as.endianness = 0; - audio_pcm_init_info (&hw->info, &wav_as); - - hw->samples = 1024; - wav->pcm_buf = audio_calloc (AUDIO_FUNC, hw->samples, 1 << hw->info.shift); - if (!wav->pcm_buf) { - dolog ("Could not allocate buffer (%d bytes)\n", - hw->samples << hw->info.shift); - return -1; - } - - le_store (hdr + 22, hw->info.nchannels, 2); - le_store (hdr + 24, hw->info.freq, 4); - le_store (hdr + 28, hw->info.freq << (bits16 + stereo), 4); - le_store (hdr + 32, 1 << (bits16 + stereo), 2); - - wav->f = qemu_fopen (conf.wav_path, "wb"); - if (!wav->f) { - dolog ("Failed to open wave file `%s'\nReason: %s\n", - conf.wav_path, strerror (errno)); - qemu_free (wav->pcm_buf); - wav->pcm_buf = NULL; - return -1; - } - - qemu_put_buffer (wav->f, hdr, sizeof (hdr)); - return 0; -} - -static void wav_fini_out (HWVoiceOut *hw) -{ - WAVVoiceOut *wav = (WAVVoiceOut *) hw; - uint8_t rlen[4]; - uint8_t dlen[4]; - uint32_t datalen = wav->total_samples << hw->info.shift; - uint32_t rifflen = datalen + 36; - - if (!wav->f) { - return; - } - - le_store (rlen, rifflen, 4); - le_store (dlen, datalen, 4); - - qemu_fseek (wav->f, 4, SEEK_SET); - qemu_put_buffer (wav->f, rlen, 4); - - qemu_fseek (wav->f, 32, SEEK_CUR); - qemu_put_buffer (wav->f, dlen, 4); - - qemu_fclose (wav->f); - wav->f = NULL; - - qemu_free (wav->pcm_buf); - wav->pcm_buf = NULL; -} - -static int wav_ctl_out (HWVoiceOut *hw, int cmd, ...) -{ - (void) hw; - (void) cmd; - return 0; -} - -static void *wav_audio_init (void) -{ - return &conf; -} - -static void wav_audio_fini (void *opaque) -{ - (void) opaque; - ldebug ("wav_fini"); -} - -static struct audio_option wav_options[] = { - {"FREQUENCY", AUD_OPT_INT, &conf.settings.freq, - "Frequency", NULL, 0}, - - {"FORMAT", AUD_OPT_FMT, &conf.settings.fmt, - "Format", NULL, 0}, - - {"DAC_FIXED_CHANNELS", AUD_OPT_INT, &conf.settings.nchannels, - "Number of channels (1 - mono, 2 - stereo)", NULL, 0}, - - {"PATH", AUD_OPT_STR, &conf.wav_path, - "Path to wave file", NULL, 0}, - {NULL, 0, NULL, NULL, NULL, 0} -}; - -static struct audio_pcm_ops wav_pcm_ops = { - wav_init_out, - wav_fini_out, - wav_run_out, - wav_write_out, - wav_ctl_out, - - NULL, - NULL, - NULL, - NULL, - NULL -}; - -struct audio_driver wav_audio_driver = { - INIT_FIELD (name = ) "wav", - INIT_FIELD (descr = ) - "WAV renderer http://wikipedia.org/wiki/WAV", - INIT_FIELD (options = ) wav_options, - INIT_FIELD (init = ) wav_audio_init, - INIT_FIELD (fini = ) wav_audio_fini, - INIT_FIELD (pcm_ops = ) &wav_pcm_ops, - INIT_FIELD (can_be_default = ) 0, - INIT_FIELD (max_voices_out = ) 1, - INIT_FIELD (max_voices_in = ) 0, - INIT_FIELD (voice_size_out = ) sizeof (WAVVoiceOut), - INIT_FIELD (voice_size_in = ) 0 -}; diff --git a/qemu-0.11.0/audio/wavcapture.c b/qemu-0.11.0/audio/wavcapture.c deleted file mode 100644 index 1f49cd1..0000000 --- a/qemu-0.11.0/audio/wavcapture.c +++ /dev/null @@ -1,161 +0,0 @@ -#include "hw/hw.h" -#include "monitor.h" -#include "audio.h" - -typedef struct { - QEMUFile *f; - int bytes; - char *path; - int freq; - int bits; - int nchannels; - CaptureVoiceOut *cap; -} WAVState; - -/* VICE code: Store number as little endian. */ -static void le_store (uint8_t *buf, uint32_t val, int len) -{ - int i; - for (i = 0; i < len; i++) { - buf[i] = (uint8_t) (val & 0xff); - val >>= 8; - } -} - -static void wav_notify (void *opaque, audcnotification_e cmd) -{ - (void) opaque; - (void) cmd; -} - -static void wav_destroy (void *opaque) -{ - WAVState *wav = opaque; - uint8_t rlen[4]; - uint8_t dlen[4]; - uint32_t datalen = wav->bytes; - uint32_t rifflen = datalen + 36; - - if (wav->f) { - le_store (rlen, rifflen, 4); - le_store (dlen, datalen, 4); - - qemu_fseek (wav->f, 4, SEEK_SET); - qemu_put_buffer (wav->f, rlen, 4); - - qemu_fseek (wav->f, 32, SEEK_CUR); - qemu_put_buffer (wav->f, dlen, 4); - qemu_fclose (wav->f); - } - - qemu_free (wav->path); -} - -static void wav_capture (void *opaque, void *buf, int size) -{ - WAVState *wav = opaque; - - qemu_put_buffer (wav->f, buf, size); - wav->bytes += size; -} - -static void wav_capture_destroy (void *opaque) -{ - WAVState *wav = opaque; - - AUD_del_capture (wav->cap, wav); -} - -static void wav_capture_info (void *opaque) -{ - WAVState *wav = opaque; - char *path = wav->path; - - monitor_printf(cur_mon, "Capturing audio(%d,%d,%d) to %s: %d bytes\n", - wav->freq, wav->bits, wav->nchannels, - path ? path : "<not available>", wav->bytes); -} - -static struct capture_ops wav_capture_ops = { - .destroy = wav_capture_destroy, - .info = wav_capture_info -}; - -int wav_start_capture (CaptureState *s, const char *path, int freq, - int bits, int nchannels) -{ - Monitor *mon = cur_mon; - WAVState *wav; - uint8_t hdr[] = { - 0x52, 0x49, 0x46, 0x46, 0x00, 0x00, 0x00, 0x00, 0x57, 0x41, 0x56, - 0x45, 0x66, 0x6d, 0x74, 0x20, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, - 0x02, 0x00, 0x44, 0xac, 0x00, 0x00, 0x10, 0xb1, 0x02, 0x00, 0x04, - 0x00, 0x10, 0x00, 0x64, 0x61, 0x74, 0x61, 0x00, 0x00, 0x00, 0x00 - }; - struct audsettings as; - struct audio_capture_ops ops; - int stereo, bits16, shift; - CaptureVoiceOut *cap; - - if (bits != 8 && bits != 16) { - monitor_printf(mon, "incorrect bit count %d, must be 8 or 16\n", bits); - return -1; - } - - if (nchannels != 1 && nchannels != 2) { - monitor_printf(mon, "incorrect channel count %d, must be 1 or 2\n", - nchannels); - return -1; - } - - stereo = nchannels == 2; - bits16 = bits == 16; - - as.freq = freq; - as.nchannels = 1 << stereo; - as.fmt = bits16 ? AUD_FMT_S16 : AUD_FMT_U8; - as.endianness = 0; - - ops.notify = wav_notify; - ops.capture = wav_capture; - ops.destroy = wav_destroy; - - wav = qemu_mallocz (sizeof (*wav)); - - shift = bits16 + stereo; - hdr[34] = bits16 ? 0x10 : 0x08; - - le_store (hdr + 22, as.nchannels, 2); - le_store (hdr + 24, freq, 4); - le_store (hdr + 28, freq << shift, 4); - le_store (hdr + 32, 1 << shift, 2); - - wav->f = qemu_fopen (path, "wb"); - if (!wav->f) { - monitor_printf(mon, "Failed to open wave file `%s'\nReason: %s\n", - path, strerror (errno)); - qemu_free (wav); - return -1; - } - - wav->path = qemu_strdup (path); - wav->bits = bits; - wav->nchannels = nchannels; - wav->freq = freq; - - qemu_put_buffer (wav->f, hdr, sizeof (hdr)); - - cap = AUD_add_capture (&as, &ops, wav); - if (!cap) { - monitor_printf(mon, "Failed to add audio capture\n"); - qemu_free (wav->path); - qemu_fclose (wav->f); - qemu_free (wav); - return -1; - } - - wav->cap = cap; - s->opaque = wav; - s->ops = wav_capture_ops; - return 0; -} diff --git a/qemu-0.11.0/balloon.h b/qemu-0.11.0/balloon.h deleted file mode 100644 index 60b4a5d..0000000 --- a/qemu-0.11.0/balloon.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Balloon - * - * Copyright IBM, Corp. 2008 - * - * Authors: - * Anthony Liguori aliguori@us.ibm.com - * - * This work is licensed under the terms of the GNU GPL, version 2. See - * the COPYING file in the top-level directory. - * - */ - -#ifndef _QEMU_BALLOON_H -#define _QEMU_BALLOON_H - -#include "cpu-defs.h" - -typedef ram_addr_t (QEMUBalloonEvent)(void *opaque, ram_addr_t target); - -void qemu_add_balloon_handler(QEMUBalloonEvent *func, void *opaque); - -void qemu_balloon(ram_addr_t target); - -ram_addr_t qemu_balloon_status(void); - -#endif diff --git a/qemu-0.11.0/block.c b/qemu-0.11.0/block.c deleted file mode 100644 index 39f726c..0000000 --- a/qemu-0.11.0/block.c +++ /dev/null @@ -1,1640 +0,0 @@ -/* - * QEMU System Emulator block driver - * - * Copyright (c) 2003 Fabrice Bellard - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -#include "config-host.h" -#ifdef HOST_BSD -/* include native header before sys-queue.h */ -#include <sys/queue.h> -#endif - -#include "qemu-common.h" -#include "monitor.h" -#include "block_int.h" -#include "module.h" - -#ifdef HOST_BSD -#include <sys/types.h> -#include <sys/stat.h> -#include <sys/ioctl.h> -#ifndef __DragonFly__ -#include <sys/disk.h> -#endif -#endif - -#ifdef _WIN32 -#include <windows.h> -#endif - -#define SECTOR_BITS 9 -#define SECTOR_SIZE (1 << SECTOR_BITS) - -static BlockDriverAIOCB *bdrv_aio_readv_em(BlockDriverState *bs, - int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, - BlockDriverCompletionFunc *cb, void *opaque); -static BlockDriverAIOCB *bdrv_aio_writev_em(BlockDriverState *bs, - int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, - BlockDriverCompletionFunc *cb, void *opaque); -static int bdrv_read_em(BlockDriverState *bs, int64_t sector_num, - uint8_t *buf, int nb_sectors); -static int bdrv_write_em(BlockDriverState *bs, int64_t sector_num, - const uint8_t *buf, int nb_sectors); - -BlockDriverState *bdrv_first; - -static BlockDriver *first_drv; - -int path_is_absolute(const char *path) -{ - const char *p; -#ifdef _WIN32 - /* specific case for names like: "\.\d:" */ - if (*path == '/' || *path == '\') - return 1; -#endif - p = strchr(path, ':'); - if (p) - p++; - else - p = path; -#ifdef _WIN32 - return (*p == '/' || *p == '\'); -#else - return (*p == '/'); -#endif -} - -/* if filename is absolute, just copy it to dest. Otherwise, build a - path to it by considering it is relative to base_path. URL are - supported. */ -void path_combine(char *dest, int dest_size, - const char *base_path, - const char *filename) -{ - const char *p, *p1; - int len; - - if (dest_size <= 0) - return; - if (path_is_absolute(filename)) { - pstrcpy(dest, dest_size, filename); - } else { - p = strchr(base_path, ':'); - if (p) - p++; - else - p = base_path; - p1 = strrchr(base_path, '/'); -#ifdef _WIN32 - { - const char *p2; - p2 = strrchr(base_path, '\'); - if (!p1 || p2 > p1) - p1 = p2; - } -#endif - if (p1) - p1++; - else - p1 = base_path; - if (p1 > p) - p = p1; - len = p - base_path; - if (len > dest_size - 1) - len = dest_size - 1; - memcpy(dest, base_path, len); - dest[len] = '\0'; - pstrcat(dest, dest_size, filename); - } -} - -void bdrv_register(BlockDriver *bdrv) -{ - if (!bdrv->bdrv_aio_readv) { - /* add AIO emulation layer */ - bdrv->bdrv_aio_readv = bdrv_aio_readv_em; - bdrv->bdrv_aio_writev = bdrv_aio_writev_em; - } else if (!bdrv->bdrv_read) { - /* add synchronous IO emulation layer */ - bdrv->bdrv_read = bdrv_read_em; - bdrv->bdrv_write = bdrv_write_em; - } - bdrv->next = first_drv; - first_drv = bdrv; -} - -/* create a new block device (by default it is empty) */ -BlockDriverState *bdrv_new(const char *device_name) -{ - BlockDriverState **pbs, *bs; - - bs = qemu_mallocz(sizeof(BlockDriverState)); - pstrcpy(bs->device_name, sizeof(bs->device_name), device_name); - if (device_name[0] != '\0') { - /* insert at the end */ - pbs = &bdrv_first; - while (*pbs != NULL) - pbs = &(*pbs)->next; - *pbs = bs; - } - return bs; -} - -BlockDriver *bdrv_find_format(const char *format_name) -{ - BlockDriver *drv1; - for(drv1 = first_drv; drv1 != NULL; drv1 = drv1->next) { - if (!strcmp(drv1->format_name, format_name)) - return drv1; - } - return NULL; -} - -int bdrv_create(BlockDriver *drv, const char* filename, - QEMUOptionParameter *options) -{ - if (!drv->bdrv_create) - return -ENOTSUP; - - return drv->bdrv_create(filename, options); -} - -#ifdef _WIN32 -void get_tmp_filename(char *filename, int size) -{ - char temp_dir[MAX_PATH]; - - GetTempPath(MAX_PATH, temp_dir); - GetTempFileName(temp_dir, "qem", 0, filename); -} -#else -void get_tmp_filename(char *filename, int size) -{ - int fd; - const char *tmpdir; - /* XXX: race condition possible */ - tmpdir = getenv("TMPDIR"); - if (!tmpdir) - tmpdir = "/tmp"; - snprintf(filename, size, "%s/vl.XXXXXX", tmpdir); - fd = mkstemp(filename); - close(fd); -} -#endif - -#ifdef _WIN32 -static int is_windows_drive_prefix(const char *filename) -{ - return (((filename[0] >= 'a' && filename[0] <= 'z') || - (filename[0] >= 'A' && filename[0] <= 'Z')) && - filename[1] == ':'); -} - -int is_windows_drive(const char *filename) -{ - if (is_windows_drive_prefix(filename) && - filename[2] == '\0') - return 1; - if (strstart(filename, "\\.\", NULL) || - strstart(filename, "//./", NULL)) - return 1; - return 0; -} -#endif - -static BlockDriver *find_protocol(const char *filename) -{ - BlockDriver *drv1; - char protocol[128]; - int len; - const char *p; - -#ifdef _WIN32 - if (is_windows_drive(filename) || - is_windows_drive_prefix(filename)) - return bdrv_find_format("raw"); -#endif - p = strchr(filename, ':'); - if (!p) - return bdrv_find_format("raw"); - len = p - filename; - if (len > sizeof(protocol) - 1) - len = sizeof(protocol) - 1; - memcpy(protocol, filename, len); - protocol[len] = '\0'; - for(drv1 = first_drv; drv1 != NULL; drv1 = drv1->next) { - if (drv1->protocol_name && - !strcmp(drv1->protocol_name, protocol)) - return drv1; - } - return NULL; -} - -/* - * Detect host devices. By convention, /dev/cdrom[N] is always - * recognized as a host CDROM. - */ -static BlockDriver *find_hdev_driver(const char *filename) -{ - int score_max = 0, score; - BlockDriver *drv = NULL, *d; - - for (d = first_drv; d; d = d->next) { - if (d->bdrv_probe_device) { - score = d->bdrv_probe_device(filename); - if (score > score_max) { - score_max = score; - drv = d; - } - } - } - - return drv; -} - -static BlockDriver *find_image_format(const char *filename) -{ - int ret, score, score_max; - BlockDriver *drv1, *drv; - uint8_t buf[2048]; - BlockDriverState *bs; - - drv = find_protocol(filename); - /* no need to test disk image formats for vvfat */ - if (drv && strcmp(drv->format_name, "vvfat") == 0) - return drv; - - ret = bdrv_file_open(&bs, filename, BDRV_O_RDONLY); - if (ret < 0) - return NULL; - ret = bdrv_pread(bs, 0, buf, sizeof(buf)); - bdrv_delete(bs); - if (ret < 0) { - return NULL; - } - - score_max = 0; - for(drv1 = first_drv; drv1 != NULL; drv1 = drv1->next) { - if (drv1->bdrv_probe) { - score = drv1->bdrv_probe(buf, ret, filename); - if (score > score_max) { - score_max = score; - drv = drv1; - } - } - } - return drv; -} - -int bdrv_file_open(BlockDriverState **pbs, const char *filename, int flags) -{ - BlockDriverState *bs; - int ret; - - bs = bdrv_new(""); - ret = bdrv_open2(bs, filename, flags | BDRV_O_FILE, NULL); - if (ret < 0) { - bdrv_delete(bs); - return ret; - } - bs->growable = 1; - *pbs = bs; - return 0; -} - -int bdrv_open(BlockDriverState *bs, const char *filename, int flags) -{ - return bdrv_open2(bs, filename, flags, NULL); -} - -int bdrv_open2(BlockDriverState *bs, const char *filename, int flags, - BlockDriver *drv) -{ - int ret, open_flags; - char tmp_filename[PATH_MAX]; - char backing_filename[PATH_MAX]; - - bs->read_only = 0; - bs->is_temporary = 0; - bs->encrypted = 0; - bs->valid_key = 0; - /* buffer_alignment defaulted to 512, drivers can change this value */ - bs->buffer_alignment = 512; - - if (flags & BDRV_O_SNAPSHOT) { - BlockDriverState *bs1; - int64_t total_size; - int is_protocol = 0; - BlockDriver *bdrv_qcow2; - QEMUOptionParameter *options; - - /* if snapshot, we create a temporary backing file and open it - instead of opening 'filename' directly */ - - /* if there is a backing file, use it */ - bs1 = bdrv_new(""); - ret = bdrv_open2(bs1, filename, 0, drv); - if (ret < 0) { - bdrv_delete(bs1); - return ret; - } - total_size = bdrv_getlength(bs1) >> SECTOR_BITS; - - if (bs1->drv && bs1->drv->protocol_name) - is_protocol = 1; - - bdrv_delete(bs1); - - get_tmp_filename(tmp_filename, sizeof(tmp_filename)); - - /* Real path is meaningless for protocols */ - if (is_protocol) - snprintf(backing_filename, sizeof(backing_filename), - "%s", filename); - else - realpath(filename, backing_filename); - - bdrv_qcow2 = bdrv_find_format("qcow2"); - options = parse_option_parameters("", bdrv_qcow2->create_options, NULL); - - set_option_parameter_int(options, BLOCK_OPT_SIZE, total_size * 512); - set_option_parameter(options, BLOCK_OPT_BACKING_FILE, backing_filename); - if (drv) { - set_option_parameter(options, BLOCK_OPT_BACKING_FMT, - drv->format_name); - } - - ret = bdrv_create(bdrv_qcow2, tmp_filename, options); - if (ret < 0) { - return ret; - } - - filename = tmp_filename; - drv = bdrv_qcow2; - bs->is_temporary = 1; - } - - pstrcpy(bs->filename, sizeof(bs->filename), filename); - if (flags & BDRV_O_FILE) { - drv = find_protocol(filename); - } else if (!drv) { - drv = find_hdev_driver(filename); - if (!drv) { - drv = find_image_format(filename); - } - } - if (!drv) { - ret = -ENOENT; - goto unlink_and_fail; - } - bs->drv = drv; - bs->opaque = qemu_mallocz(drv->instance_size); - /* Note: for compatibility, we open disk image files as RDWR, and - RDONLY as fallback */ - if (!(flags & BDRV_O_FILE)) - open_flags = BDRV_O_RDWR | (flags & BDRV_O_CACHE_MASK); - else - open_flags = flags & ~(BDRV_O_FILE | BDRV_O_SNAPSHOT); - ret = drv->bdrv_open(bs, filename, open_flags); - if ((ret == -EACCES || ret == -EPERM) && !(flags & BDRV_O_FILE)) { - ret = drv->bdrv_open(bs, filename, open_flags & ~BDRV_O_RDWR); - bs->read_only = 1; - } - if (ret < 0) { - qemu_free(bs->opaque); - bs->opaque = NULL; - bs->drv = NULL; - unlink_and_fail: - if (bs->is_temporary) - unlink(filename); - return ret; - } - if (drv->bdrv_getlength) { - bs->total_sectors = bdrv_getlength(bs) >> SECTOR_BITS; - } -#ifndef _WIN32 - if (bs->is_temporary) { - unlink(filename); - } -#endif - if (bs->backing_file[0] != '\0') { - /* if there is a backing file, use it */ - BlockDriver *back_drv = NULL; - bs->backing_hd = bdrv_new(""); - path_combine(backing_filename, sizeof(backing_filename), - filename, bs->backing_file); - if (bs->backing_format[0] != '\0') - back_drv = bdrv_find_format(bs->backing_format); - ret = bdrv_open2(bs->backing_hd, backing_filename, open_flags, - back_drv); - if (ret < 0) { - bdrv_close(bs); - return ret; - } - } - - if (!bdrv_key_required(bs)) { - /* call the change callback */ - bs->media_changed = 1; - if (bs->change_cb) - bs->change_cb(bs->change_opaque); - } - return 0; -} - -void bdrv_close(BlockDriverState *bs) -{ - if (bs->drv) { - if (bs->backing_hd) - bdrv_delete(bs->backing_hd); - bs->drv->bdrv_close(bs); - qemu_free(bs->opaque); -#ifdef _WIN32 - if (bs->is_temporary) { - unlink(bs->filename); - } -#endif - bs->opaque = NULL; - bs->drv = NULL; - - /* call the change callback */ - bs->media_changed = 1; - if (bs->change_cb) - bs->change_cb(bs->change_opaque); - } -} - -void bdrv_delete(BlockDriverState *bs) -{ - BlockDriverState **pbs; - - pbs = &bdrv_first; - while (*pbs != bs && *pbs != NULL) - pbs = &(*pbs)->next; - if (*pbs == bs) - *pbs = bs->next; - - bdrv_close(bs); - qemu_free(bs); -} - -/* - * Run consistency checks on an image - * - * Returns the number of errors or -errno when an internal error occurs - */ -int bdrv_check(BlockDriverState *bs) -{ - if (bs->drv->bdrv_check == NULL) { - return -ENOTSUP; - } - - return bs->drv->bdrv_check(bs); -} - -/* commit COW file into the raw image */ -int bdrv_commit(BlockDriverState *bs) -{ - BlockDriver *drv = bs->drv; - int64_t i, total_sectors; - int n, j; - unsigned char sector[512]; - - if (!drv) - return -ENOMEDIUM; - - if (bs->read_only) { - return -EACCES; - } - - if (!bs->backing_hd) { - return -ENOTSUP; - } - - total_sectors = bdrv_getlength(bs) >> SECTOR_BITS; - for (i = 0; i < total_sectors;) { - if (drv->bdrv_is_allocated(bs, i, 65536, &n)) { - for(j = 0; j < n; j++) { - if (bdrv_read(bs, i, sector, 1) != 0) { - return -EIO; - } - - if (bdrv_write(bs->backing_hd, i, sector, 1) != 0) { - return -EIO; - } - i++; - } - } else { - i += n; - } - } - - if (drv->bdrv_make_empty) - return drv->bdrv_make_empty(bs); - - return 0; -} - -static int bdrv_check_byte_request(BlockDriverState *bs, int64_t offset, - size_t size) -{ - int64_t len; - - if (!bdrv_is_inserted(bs)) - return -ENOMEDIUM; - - if (bs->growable) - return 0; - - len = bdrv_getlength(bs); - - if (offset < 0) - return -EIO; - - if ((offset > len) || (len - offset < size)) - return -EIO; - - return 0; -} - -static int bdrv_check_request(BlockDriverState *bs, int64_t sector_num, - int nb_sectors) -{ - return bdrv_check_byte_request(bs, sector_num * 512, nb_sectors * 512); -} - -/* return < 0 if error. See bdrv_write() for the return codes */ -int bdrv_read(BlockDriverState *bs, int64_t sector_num, - uint8_t *buf, int nb_sectors) -{ - BlockDriver *drv = bs->drv; - - if (!drv) - return -ENOMEDIUM; - if (bdrv_check_request(bs, sector_num, nb_sectors)) - return -EIO; - - return drv->bdrv_read(bs, sector_num, buf, nb_sectors); -} - -/* Return < 0 if error. Important errors are: - -EIO generic I/O error (may happen for all errors) - -ENOMEDIUM No media inserted. - -EINVAL Invalid sector number or nb_sectors - -EACCES Trying to write a read-only device -*/ -int bdrv_write(BlockDriverState *bs, int64_t sector_num, - const uint8_t *buf, int nb_sectors) -{ - BlockDriver *drv = bs->drv; - if (!bs->drv) - return -ENOMEDIUM; - if (bs->read_only) - return -EACCES; - if (bdrv_check_request(bs, sector_num, nb_sectors)) - return -EIO; - - return drv->bdrv_write(bs, sector_num, buf, nb_sectors); -} - -int bdrv_pread(BlockDriverState *bs, int64_t offset, - void *buf, int count1) -{ - uint8_t tmp_buf[SECTOR_SIZE]; - int len, nb_sectors, count; - int64_t sector_num; - - count = count1; - /* first read to align to sector start */ - len = (SECTOR_SIZE - offset) & (SECTOR_SIZE - 1); - if (len > count) - len = count; - sector_num = offset >> SECTOR_BITS; - if (len > 0) { - if (bdrv_read(bs, sector_num, tmp_buf, 1) < 0) - return -EIO; - memcpy(buf, tmp_buf + (offset & (SECTOR_SIZE - 1)), len); - count -= len; - if (count == 0) - return count1; - sector_num++; - buf += len; - } - - /* read the sectors "in place" */ - nb_sectors = count >> SECTOR_BITS; - if (nb_sectors > 0) { - if (bdrv_read(bs, sector_num, buf, nb_sectors) < 0) - return -EIO; - sector_num += nb_sectors; - len = nb_sectors << SECTOR_BITS; - buf += len; - count -= len; - } - - /* add data from the last sector */ - if (count > 0) { - if (bdrv_read(bs, sector_num, tmp_buf, 1) < 0) - return -EIO; - memcpy(buf, tmp_buf, count); - } - return count1; -} - -int bdrv_pwrite(BlockDriverState *bs, int64_t offset, - const void *buf, int count1) -{ - uint8_t tmp_buf[SECTOR_SIZE]; - int len, nb_sectors, count; - int64_t sector_num; - - count = count1; - /* first write to align to sector start */ - len = (SECTOR_SIZE - offset) & (SECTOR_SIZE - 1); - if (len > count) - len = count; - sector_num = offset >> SECTOR_BITS; - if (len > 0) { - if (bdrv_read(bs, sector_num, tmp_buf, 1) < 0) - return -EIO; - memcpy(tmp_buf + (offset & (SECTOR_SIZE - 1)), buf, len); - if (bdrv_write(bs, sector_num, tmp_buf, 1) < 0) - return -EIO; - count -= len; - if (count == 0) - return count1; - sector_num++; - buf += len; - } - - /* write the sectors "in place" */ - nb_sectors = count >> SECTOR_BITS; - if (nb_sectors > 0) { - if (bdrv_write(bs, sector_num, buf, nb_sectors) < 0) - return -EIO; - sector_num += nb_sectors; - len = nb_sectors << SECTOR_BITS; - buf += len; - count -= len; - } - - /* add data from the last sector */ - if (count > 0) { - if (bdrv_read(bs, sector_num, tmp_buf, 1) < 0) - return -EIO; - memcpy(tmp_buf, buf, count); - if (bdrv_write(bs, sector_num, tmp_buf, 1) < 0) - return -EIO; - } - return count1; -} - -/** - * Truncate file to 'offset' bytes (needed only for file protocols) - */ -int bdrv_truncate(BlockDriverState *bs, int64_t offset) -{ - BlockDriver *drv = bs->drv; - if (!drv) - return -ENOMEDIUM; - if (!drv->bdrv_truncate) - return -ENOTSUP; - return drv->bdrv_truncate(bs, offset); -} - -/** - * Length of a file in bytes. Return < 0 if error or unknown. - */ -int64_t bdrv_getlength(BlockDriverState *bs) -{ - BlockDriver *drv = bs->drv; - if (!drv) - return -ENOMEDIUM; - if (!drv->bdrv_getlength) { - /* legacy mode */ - return bs->total_sectors * SECTOR_SIZE; - } - return drv->bdrv_getlength(bs); -} - -/* return 0 as number of sectors if no device present or error */ -void bdrv_get_geometry(BlockDriverState *bs, uint64_t *nb_sectors_ptr) -{ - int64_t length; - length = bdrv_getlength(bs); - if (length < 0) - length = 0; - else - length = length >> SECTOR_BITS; - *nb_sectors_ptr = length; -} - -struct partition { - uint8_t boot_ind; /* 0x80 - active */ - uint8_t head; /* starting head */ - uint8_t sector; /* starting sector */ - uint8_t cyl; /* starting cylinder */ - uint8_t sys_ind; /* What partition type */ - uint8_t end_head; /* end head */ - uint8_t end_sector; /* end sector */ - uint8_t end_cyl; /* end cylinder */ - uint32_t start_sect; /* starting sector counting from 0 */ - uint32_t nr_sects; /* nr of sectors in partition */ -} __attribute__((packed)); - -/* try to guess the disk logical geometry from the MSDOS partition table. Return 0 if OK, -1 if could not guess */ -static int guess_disk_lchs(BlockDriverState *bs, - int *pcylinders, int *pheads, int *psectors) -{ - uint8_t buf[512]; - int ret, i, heads, sectors, cylinders; - struct partition *p; - uint32_t nr_sects; - uint64_t nb_sectors; - - bdrv_get_geometry(bs, &nb_sectors); - - ret = bdrv_read(bs, 0, buf, 1); - if (ret < 0) - return -1; - /* test msdos magic */ - if (buf[510] != 0x55 || buf[511] != 0xaa) - return -1; - for(i = 0; i < 4; i++) { - p = ((struct partition *)(buf + 0x1be)) + i; - nr_sects = le32_to_cpu(p->nr_sects); - if (nr_sects && p->end_head) { - /* We make the assumption that the partition terminates on - a cylinder boundary */ - heads = p->end_head + 1; - sectors = p->end_sector & 63; - if (sectors == 0) - continue; - cylinders = nb_sectors / (heads * sectors); - if (cylinders < 1 || cylinders > 16383) - continue; - *pheads = heads; - *psectors = sectors; - *pcylinders = cylinders; -#if 0 - printf("guessed geometry: LCHS=%d %d %d\n", - cylinders, heads, sectors); -#endif - return 0; - } - } - return -1; -} - -void bdrv_guess_geometry(BlockDriverState *bs, int *pcyls, int *pheads, int *psecs) -{ - int translation, lba_detected = 0; - int cylinders, heads, secs; - uint64_t nb_sectors; - - /* if a geometry hint is available, use it */ - bdrv_get_geometry(bs, &nb_sectors); - bdrv_get_geometry_hint(bs, &cylinders, &heads, &secs); - translation = bdrv_get_translation_hint(bs); - if (cylinders != 0) { - *pcyls = cylinders; - *pheads = heads; - *psecs = secs; - } else { - if (guess_disk_lchs(bs, &cylinders, &heads, &secs) == 0) { - if (heads > 16) { - /* if heads > 16, it means that a BIOS LBA - translation was active, so the default - hardware geometry is OK */ - lba_detected = 1; - goto default_geometry; - } else { - *pcyls = cylinders; - *pheads = heads; - *psecs = secs; - /* disable any translation to be in sync with - the logical geometry */ - if (translation == BIOS_ATA_TRANSLATION_AUTO) { - bdrv_set_translation_hint(bs, - BIOS_ATA_TRANSLATION_NONE); - } - } - } else { - default_geometry: - /* if no geometry, use a standard physical disk geometry */ - cylinders = nb_sectors / (16 * 63); - - if (cylinders > 16383) - cylinders = 16383; - else if (cylinders < 2) - cylinders = 2; - *pcyls = cylinders; - *pheads = 16; - *psecs = 63; - if ((lba_detected == 1) && (translation == BIOS_ATA_TRANSLATION_AUTO)) { - if ((*pcyls * *pheads) <= 131072) { - bdrv_set_translation_hint(bs, - BIOS_ATA_TRANSLATION_LARGE); - } else { - bdrv_set_translation_hint(bs, - BIOS_ATA_TRANSLATION_LBA); - } - } - } - bdrv_set_geometry_hint(bs, *pcyls, *pheads, *psecs); - } -} - -void bdrv_set_geometry_hint(BlockDriverState *bs, - int cyls, int heads, int secs) -{ - bs->cyls = cyls; - bs->heads = heads; - bs->secs = secs; -} - -void bdrv_set_type_hint(BlockDriverState *bs, int type) -{ - bs->type = type; - bs->removable = ((type == BDRV_TYPE_CDROM || - type == BDRV_TYPE_FLOPPY)); -} - -void bdrv_set_translation_hint(BlockDriverState *bs, int translation) -{ - bs->translation = translation; -} - -void bdrv_get_geometry_hint(BlockDriverState *bs, - int *pcyls, int *pheads, int *psecs) -{ - *pcyls = bs->cyls; - *pheads = bs->heads; - *psecs = bs->secs; -} - -int bdrv_get_type_hint(BlockDriverState *bs) -{ - return bs->type; -} - -int bdrv_get_translation_hint(BlockDriverState *bs) -{ - return bs->translation; -} - -int bdrv_is_removable(BlockDriverState *bs) -{ - return bs->removable; -} - -int bdrv_is_read_only(BlockDriverState *bs) -{ - return bs->read_only; -} - -int bdrv_is_sg(BlockDriverState *bs) -{ - return bs->sg; -} - -/* XXX: no longer used */ -void bdrv_set_change_cb(BlockDriverState *bs, - void (*change_cb)(void *opaque), void *opaque) -{ - bs->change_cb = change_cb; - bs->change_opaque = opaque; -} - -int bdrv_is_encrypted(BlockDriverState *bs) -{ - if (bs->backing_hd && bs->backing_hd->encrypted) - return 1; - return bs->encrypted; -} - -int bdrv_key_required(BlockDriverState *bs) -{ - BlockDriverState *backing_hd = bs->backing_hd; - - if (backing_hd && backing_hd->encrypted && !backing_hd->valid_key) - return 1; - return (bs->encrypted && !bs->valid_key); -} - -int bdrv_set_key(BlockDriverState *bs, const char *key) -{ - int ret; - if (bs->backing_hd && bs->backing_hd->encrypted) { - ret = bdrv_set_key(bs->backing_hd, key); - if (ret < 0) - return ret; - if (!bs->encrypted) - return 0; - } - if (!bs->encrypted || !bs->drv || !bs->drv->bdrv_set_key) - return -1; - ret = bs->drv->bdrv_set_key(bs, key); - if (ret < 0) { - bs->valid_key = 0; - } else if (!bs->valid_key) { - bs->valid_key = 1; - /* call the change callback now, we skipped it on open */ - bs->media_changed = 1; - if (bs->change_cb) - bs->change_cb(bs->change_opaque); - } - return ret; -} - -void bdrv_get_format(BlockDriverState *bs, char *buf, int buf_size) -{ - if (!bs->drv) { - buf[0] = '\0'; - } else { - pstrcpy(buf, buf_size, bs->drv->format_name); - } -} - -void bdrv_iterate_format(void (*it)(void *opaque, const char *name), - void *opaque) -{ - BlockDriver *drv; - - for (drv = first_drv; drv != NULL; drv = drv->next) { - it(opaque, drv->format_name); - } -} - -BlockDriverState *bdrv_find(const char *name) -{ - BlockDriverState *bs; - - for (bs = bdrv_first; bs != NULL; bs = bs->next) { - if (!strcmp(name, bs->device_name)) - return bs; - } - return NULL; -} - -void bdrv_iterate(void (*it)(void *opaque, BlockDriverState *bs), void *opaque) -{ - BlockDriverState *bs; - - for (bs = bdrv_first; bs != NULL; bs = bs->next) { - it(opaque, bs); - } -} - -const char *bdrv_get_device_name(BlockDriverState *bs) -{ - return bs->device_name; -} - -void bdrv_flush(BlockDriverState *bs) -{ - if (!bs->drv) - return; - if (bs->drv->bdrv_flush) - bs->drv->bdrv_flush(bs); - if (bs->backing_hd) - bdrv_flush(bs->backing_hd); -} - -void bdrv_flush_all(void) -{ - BlockDriverState *bs; - - for (bs = bdrv_first; bs != NULL; bs = bs->next) - if (bs->drv && !bdrv_is_read_only(bs) && - (!bdrv_is_removable(bs) || bdrv_is_inserted(bs))) - bdrv_flush(bs); -} - -/* - * Returns true iff the specified sector is present in the disk image. Drivers - * not implementing the functionality are assumed to not support backing files, - * hence all their sectors are reported as allocated. - * - * 'pnum' is set to the number of sectors (including and immediately following - * the specified sector) that are known to be in the same - * allocated/unallocated state. - * - * 'nb_sectors' is the max value 'pnum' should be set to. - */ -int bdrv_is_allocated(BlockDriverState *bs, int64_t sector_num, int nb_sectors, - int *pnum) -{ - int64_t n; - if (!bs->drv->bdrv_is_allocated) { - if (sector_num >= bs->total_sectors) { - *pnum = 0; - return 0; - } - n = bs->total_sectors - sector_num; - *pnum = (n < nb_sectors) ? (n) : (nb_sectors); - return 1; - } - return bs->drv->bdrv_is_allocated(bs, sector_num, nb_sectors, pnum); -} - -void bdrv_info(Monitor *mon) -{ - BlockDriverState *bs; - - for (bs = bdrv_first; bs != NULL; bs = bs->next) { - monitor_printf(mon, "%s:", bs->device_name); - monitor_printf(mon, " type="); - switch(bs->type) { - case BDRV_TYPE_HD: - monitor_printf(mon, "hd"); - break; - case BDRV_TYPE_CDROM: - monitor_printf(mon, "cdrom"); - break; - case BDRV_TYPE_FLOPPY: - monitor_printf(mon, "floppy"); - break; - } - monitor_printf(mon, " removable=%d", bs->removable); - if (bs->removable) { - monitor_printf(mon, " locked=%d", bs->locked); - } - if (bs->drv) { - monitor_printf(mon, " file="); - monitor_print_filename(mon, bs->filename); - if (bs->backing_file[0] != '\0') { - monitor_printf(mon, " backing_file="); - monitor_print_filename(mon, bs->backing_file); - } - monitor_printf(mon, " ro=%d", bs->read_only); - monitor_printf(mon, " drv=%s", bs->drv->format_name); - monitor_printf(mon, " encrypted=%d", bdrv_is_encrypted(bs)); - } else { - monitor_printf(mon, " [not inserted]"); - } - monitor_printf(mon, "\n"); - } -} - -/* The "info blockstats" command. */ -void bdrv_info_stats(Monitor *mon) -{ - BlockDriverState *bs; - - for (bs = bdrv_first; bs != NULL; bs = bs->next) { - monitor_printf(mon, "%s:" - " rd_bytes=%" PRIu64 - " wr_bytes=%" PRIu64 - " rd_operations=%" PRIu64 - " wr_operations=%" PRIu64 - "\n", - bs->device_name, - bs->rd_bytes, bs->wr_bytes, - bs->rd_ops, bs->wr_ops); - } -} - -const char *bdrv_get_encrypted_filename(BlockDriverState *bs) -{ - if (bs->backing_hd && bs->backing_hd->encrypted) - return bs->backing_file; - else if (bs->encrypted) - return bs->filename; - else - return NULL; -} - -void bdrv_get_backing_filename(BlockDriverState *bs, - char *filename, int filename_size) -{ - if (!bs->backing_hd) { - pstrcpy(filename, filename_size, ""); - } else { - pstrcpy(filename, filename_size, bs->backing_file); - } -} - -int bdrv_write_compressed(BlockDriverState *bs, int64_t sector_num, - const uint8_t *buf, int nb_sectors) -{ - BlockDriver *drv = bs->drv; - if (!drv) - return -ENOMEDIUM; - if (!drv->bdrv_write_compressed) - return -ENOTSUP; - if (bdrv_check_request(bs, sector_num, nb_sectors)) - return -EIO; - return drv->bdrv_write_compressed(bs, sector_num, buf, nb_sectors); -} - -int bdrv_get_info(BlockDriverState *bs, BlockDriverInfo *bdi) -{ - BlockDriver *drv = bs->drv; - if (!drv) - return -ENOMEDIUM; - if (!drv->bdrv_get_info) - return -ENOTSUP; - memset(bdi, 0, sizeof(*bdi)); - return drv->bdrv_get_info(bs, bdi); -} - -int bdrv_save_vmstate(BlockDriverState *bs, const uint8_t *buf, - int64_t pos, int size) -{ - BlockDriver *drv = bs->drv; - if (!drv) - return -ENOMEDIUM; - if (!drv->bdrv_save_vmstate) - return -ENOTSUP; - return drv->bdrv_save_vmstate(bs, buf, pos, size); -} - -int bdrv_load_vmstate(BlockDriverState *bs, uint8_t *buf, - int64_t pos, int size) -{ - BlockDriver *drv = bs->drv; - if (!drv) - return -ENOMEDIUM; - if (!drv->bdrv_load_vmstate) - return -ENOTSUP; - return drv->bdrv_load_vmstate(bs, buf, pos, size); -} - -/**************************************************************/ -/* handling of snapshots */ - -int bdrv_snapshot_create(BlockDriverState *bs, - QEMUSnapshotInfo *sn_info) -{ - BlockDriver *drv = bs->drv; - if (!drv) - return -ENOMEDIUM; - if (!drv->bdrv_snapshot_create) - return -ENOTSUP; - return drv->bdrv_snapshot_create(bs, sn_info); -} - -int bdrv_snapshot_goto(BlockDriverState *bs, - const char *snapshot_id) -{ - BlockDriver *drv = bs->drv; - if (!drv) - return -ENOMEDIUM; - if (!drv->bdrv_snapshot_goto) - return -ENOTSUP; - return drv->bdrv_snapshot_goto(bs, snapshot_id); -} - -int bdrv_snapshot_delete(BlockDriverState *bs, const char *snapshot_id) -{ - BlockDriver *drv = bs->drv; - if (!drv) - return -ENOMEDIUM; - if (!drv->bdrv_snapshot_delete) - return -ENOTSUP; - return drv->bdrv_snapshot_delete(bs, snapshot_id); -} - -int bdrv_snapshot_list(BlockDriverState *bs, - QEMUSnapshotInfo **psn_info) -{ - BlockDriver *drv = bs->drv; - if (!drv) - return -ENOMEDIUM; - if (!drv->bdrv_snapshot_list) - return -ENOTSUP; - return drv->bdrv_snapshot_list(bs, psn_info); -} - -#define NB_SUFFIXES 4 - -char *get_human_readable_size(char *buf, int buf_size, int64_t size) -{ - static const char suffixes[NB_SUFFIXES] = "KMGT"; - int64_t base; - int i; - - if (size <= 999) { - snprintf(buf, buf_size, "%" PRId64, size); - } else { - base = 1024; - for(i = 0; i < NB_SUFFIXES; i++) { - if (size < (10 * base)) { - snprintf(buf, buf_size, "%0.1f%c", - (double)size / base, - suffixes[i]); - break; - } else if (size < (1000 * base) || i == (NB_SUFFIXES - 1)) { - snprintf(buf, buf_size, "%" PRId64 "%c", - ((size + (base >> 1)) / base), - suffixes[i]); - break; - } - base = base * 1024; - } - } - return buf; -} - -char *bdrv_snapshot_dump(char *buf, int buf_size, QEMUSnapshotInfo *sn) -{ - char buf1[128], date_buf[128], clock_buf[128]; -#ifdef _WIN32 - struct tm *ptm; -#else - struct tm tm; -#endif - time_t ti; - int64_t secs; - - if (!sn) { - snprintf(buf, buf_size, - "%-10s%-20s%7s%20s%15s", - "ID", "TAG", "VM SIZE", "DATE", "VM CLOCK"); - } else { - ti = sn->date_sec; -#ifdef _WIN32 - ptm = localtime(&ti); - strftime(date_buf, sizeof(date_buf), - "%Y-%m-%d %H:%M:%S", ptm); -#else - localtime_r(&ti, &tm); - strftime(date_buf, sizeof(date_buf), - "%Y-%m-%d %H:%M:%S", &tm); -#endif - secs = sn->vm_clock_nsec / 1000000000; - snprintf(clock_buf, sizeof(clock_buf), - "%02d:%02d:%02d.%03d", - (int)(secs / 3600), - (int)((secs / 60) % 60), - (int)(secs % 60), - (int)((sn->vm_clock_nsec / 1000000) % 1000)); - snprintf(buf, buf_size, - "%-10s%-20s%7s%20s%15s", - sn->id_str, sn->name, - get_human_readable_size(buf1, sizeof(buf1), sn->vm_state_size), - date_buf, - clock_buf); - } - return buf; -} - - -/**************************************************************/ -/* async I/Os */ - -BlockDriverAIOCB *bdrv_aio_readv(BlockDriverState *bs, int64_t sector_num, - QEMUIOVector *qiov, int nb_sectors, - BlockDriverCompletionFunc *cb, void *opaque) -{ - BlockDriver *drv = bs->drv; - BlockDriverAIOCB *ret; - - if (!drv) - return NULL; - if (bdrv_check_request(bs, sector_num, nb_sectors)) - return NULL; - - ret = drv->bdrv_aio_readv(bs, sector_num, qiov, nb_sectors, - cb, opaque); - - if (ret) { - /* Update stats even though technically transfer has not happened. */ - bs->rd_bytes += (unsigned) nb_sectors * SECTOR_SIZE; - bs->rd_ops ++; - } - - return ret; -} - -BlockDriverAIOCB *bdrv_aio_writev(BlockDriverState *bs, int64_t sector_num, - QEMUIOVector *qiov, int nb_sectors, - BlockDriverCompletionFunc *cb, void *opaque) -{ - BlockDriver *drv = bs->drv; - BlockDriverAIOCB *ret; - - if (!drv) - return NULL; - if (bs->read_only) - return NULL; - if (bdrv_check_request(bs, sector_num, nb_sectors)) - return NULL; - - ret = drv->bdrv_aio_writev(bs, sector_num, qiov, nb_sectors, - cb, opaque); - - if (ret) { - /* Update stats even though technically transfer has not happened. */ - bs->wr_bytes += (unsigned) nb_sectors * SECTOR_SIZE; - bs->wr_ops ++; - } - - return ret; -} - -void bdrv_aio_cancel(BlockDriverAIOCB *acb) -{ - acb->pool->cancel(acb); -} - - -/**************************************************************/ -/* async block device emulation */ - -typedef struct BlockDriverAIOCBSync { - BlockDriverAIOCB common; - QEMUBH *bh; - int ret; - /* vector translation state */ - QEMUIOVector *qiov; - uint8_t *bounce; - int is_write; -} BlockDriverAIOCBSync; - -static void bdrv_aio_cancel_em(BlockDriverAIOCB *blockacb) -{ - BlockDriverAIOCBSync *acb = (BlockDriverAIOCBSync *)blockacb; - qemu_bh_delete(acb->bh); - acb->bh = NULL; - qemu_aio_release(acb); -} - -static AIOPool bdrv_em_aio_pool = { - .aiocb_size = sizeof(BlockDriverAIOCBSync), - .cancel = bdrv_aio_cancel_em, -}; - -static void bdrv_aio_bh_cb(void *opaque) -{ - BlockDriverAIOCBSync *acb = opaque; - - if (!acb->is_write) - qemu_iovec_from_buffer(acb->qiov, acb->bounce, acb->qiov->size); - qemu_vfree(acb->bounce); - acb->common.cb(acb->common.opaque, acb->ret); - qemu_bh_delete(acb->bh); - acb->bh = NULL; - qemu_aio_release(acb); -} - -static BlockDriverAIOCB *bdrv_aio_rw_vector(BlockDriverState *bs, - int64_t sector_num, - QEMUIOVector *qiov, - int nb_sectors, - BlockDriverCompletionFunc *cb, - void *opaque, - int is_write) - -{ - BlockDriverAIOCBSync *acb; - - acb = qemu_aio_get(&bdrv_em_aio_pool, bs, cb, opaque); - acb->is_write = is_write; - acb->qiov = qiov; - acb->bounce = qemu_blockalign(bs, qiov->size); - - if (!acb->bh) - acb->bh = qemu_bh_new(bdrv_aio_bh_cb, acb); - - if (is_write) { - qemu_iovec_to_buffer(acb->qiov, acb->bounce); - acb->ret = bdrv_write(bs, sector_num, acb->bounce, nb_sectors); - } else { - acb->ret = bdrv_read(bs, sector_num, acb->bounce, nb_sectors); - } - - qemu_bh_schedule(acb->bh); - - return &acb->common; -} - -static BlockDriverAIOCB *bdrv_aio_readv_em(BlockDriverState *bs, - int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, - BlockDriverCompletionFunc *cb, void *opaque) -{ - return bdrv_aio_rw_vector(bs, sector_num, qiov, nb_sectors, cb, opaque, 0); -} - -static BlockDriverAIOCB *bdrv_aio_writev_em(BlockDriverState *bs, - int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, - BlockDriverCompletionFunc *cb, void *opaque) -{ - return bdrv_aio_rw_vector(bs, sector_num, qiov, nb_sectors, cb, opaque, 1); -} - -/**************************************************************/ -/* sync block device emulation */ - -static void bdrv_rw_em_cb(void *opaque, int ret) -{ - *(int *)opaque = ret; -} - -#define NOT_DONE 0x7fffffff - -static int bdrv_read_em(BlockDriverState *bs, int64_t sector_num, - uint8_t *buf, int nb_sectors) -{ - int async_ret; - BlockDriverAIOCB *acb; - struct iovec iov; - QEMUIOVector qiov; - - async_ret = NOT_DONE; - iov.iov_base = (void *)buf; - iov.iov_len = nb_sectors * 512; - qemu_iovec_init_external(&qiov, &iov, 1); - acb = bdrv_aio_readv(bs, sector_num, &qiov, nb_sectors, - bdrv_rw_em_cb, &async_ret); - if (acb == NULL) - return -1; - - while (async_ret == NOT_DONE) { - qemu_aio_wait(); - } - - return async_ret; -} - -static int bdrv_write_em(BlockDriverState *bs, int64_t sector_num, - const uint8_t *buf, int nb_sectors) -{ - int async_ret; - BlockDriverAIOCB *acb; - struct iovec iov; - QEMUIOVector qiov; - - async_ret = NOT_DONE; - iov.iov_base = (void *)buf; - iov.iov_len = nb_sectors * 512; - qemu_iovec_init_external(&qiov, &iov, 1); - acb = bdrv_aio_writev(bs, sector_num, &qiov, nb_sectors, - bdrv_rw_em_cb, &async_ret); - if (acb == NULL) - return -1; - while (async_ret == NOT_DONE) { - qemu_aio_wait(); - } - return async_ret; -} - -void bdrv_init(void) -{ - module_call_init(MODULE_INIT_BLOCK); -} - -void *qemu_aio_get(AIOPool *pool, BlockDriverState *bs, - BlockDriverCompletionFunc *cb, void *opaque) -{ - BlockDriverAIOCB *acb; - - if (pool->free_aiocb) { - acb = pool->free_aiocb; - pool->free_aiocb = acb->next; - } else { - acb = qemu_mallocz(pool->aiocb_size); - acb->pool = pool; - } - acb->bs = bs; - acb->cb = cb; - acb->opaque = opaque; - return acb; -} - -void qemu_aio_release(void *p) -{ - BlockDriverAIOCB *acb = (BlockDriverAIOCB *)p; - AIOPool *pool = acb->pool; - acb->next = pool->free_aiocb; - pool->free_aiocb = acb; -} - -/**************************************************************/ -/* removable device support */ - -/** - * Return TRUE if the media is present - */ -int bdrv_is_inserted(BlockDriverState *bs) -{ - BlockDriver *drv = bs->drv; - int ret; - if (!drv) - return 0; - if (!drv->bdrv_is_inserted) - return 1; - ret = drv->bdrv_is_inserted(bs); - return ret; -} - -/** - * Return TRUE if the media changed since the last call to this - * function. It is currently only used for floppy disks - */ -int bdrv_media_changed(BlockDriverState *bs) -{ - BlockDriver *drv = bs->drv; - int ret; - - if (!drv || !drv->bdrv_media_changed) - ret = -ENOTSUP; - else - ret = drv->bdrv_media_changed(bs); - if (ret == -ENOTSUP) - ret = bs->media_changed; - bs->media_changed = 0; - return ret; -} - -/** - * If eject_flag is TRUE, eject the media. Otherwise, close the tray - */ -int bdrv_eject(BlockDriverState *bs, int eject_flag) -{ - BlockDriver *drv = bs->drv; - int ret; - - if (bs->locked) { - return -EBUSY; - } - - if (!drv || !drv->bdrv_eject) { - ret = -ENOTSUP; - } else { - ret = drv->bdrv_eject(bs, eject_flag); - } - if (ret == -ENOTSUP) { - if (eject_flag) - bdrv_close(bs); - ret = 0; - } - - return ret; -} - -int bdrv_is_locked(BlockDriverState *bs) -{ - return bs->locked; -} - -/** - * Lock or unlock the media (if it is locked, the user won't be able - * to eject it manually). - */ -void bdrv_set_locked(BlockDriverState *bs, int locked) -{ - BlockDriver *drv = bs->drv; - - bs->locked = locked; - if (drv && drv->bdrv_set_locked) { - drv->bdrv_set_locked(bs, locked); - } -} - -/* needed for generic scsi interface */ - -int bdrv_ioctl(BlockDriverState *bs, unsigned long int req, void *buf) -{ - BlockDriver *drv = bs->drv; - - if (drv && drv->bdrv_ioctl) - return drv->bdrv_ioctl(bs, req, buf); - return -ENOTSUP; -} - -BlockDriverAIOCB *bdrv_aio_ioctl(BlockDriverState *bs, - unsigned long int req, void *buf, - BlockDriverCompletionFunc *cb, void *opaque) -{ - BlockDriver *drv = bs->drv; - - if (drv && drv->bdrv_aio_ioctl) - return drv->bdrv_aio_ioctl(bs, req, buf, cb, opaque); - return NULL; -} - -void *qemu_blockalign(BlockDriverState *bs, size_t size) -{ - return qemu_memalign((bs && bs->buffer_alignment) ? bs->buffer_alignment : 512, size); -} diff --git a/qemu-0.11.0/block.h b/qemu-0.11.0/block.h deleted file mode 100644 index ccd4c1e..0000000 --- a/qemu-0.11.0/block.h +++ /dev/null @@ -1,168 +0,0 @@ -#ifndef BLOCK_H -#define BLOCK_H - -#include "qemu-aio.h" -#include "qemu-common.h" -#include "qemu-option.h" - -/* block.c */ -typedef struct BlockDriver BlockDriver; - -typedef struct BlockDriverInfo { - /* in bytes, 0 if irrelevant */ - int cluster_size; - /* offset at which the VM state can be saved (0 if not possible) */ - int64_t vm_state_offset; -} BlockDriverInfo; - -typedef struct QEMUSnapshotInfo { - char id_str[128]; /* unique snapshot id */ - /* the following fields are informative. They are not needed for - the consistency of the snapshot */ - char name[256]; /* user choosen name */ - uint32_t vm_state_size; /* VM state info size */ - uint32_t date_sec; /* UTC date of the snapshot */ - uint32_t date_nsec; - uint64_t vm_clock_nsec; /* VM clock relative to boot */ -} QEMUSnapshotInfo; - -#define BDRV_O_RDONLY 0x0000 -#define BDRV_O_RDWR 0x0002 -#define BDRV_O_ACCESS 0x0003 -#define BDRV_O_CREAT 0x0004 /* create an empty file */ -#define BDRV_O_SNAPSHOT 0x0008 /* open the file read only and save writes in a snapshot */ -#define BDRV_O_FILE 0x0010 /* open as a raw file (do not try to - use a disk image format on top of - it (default for - bdrv_file_open()) */ -#define BDRV_O_NOCACHE 0x0020 /* do not use the host page cache */ -#define BDRV_O_CACHE_WB 0x0040 /* use write-back caching */ - -#define BDRV_O_CACHE_MASK (BDRV_O_NOCACHE | BDRV_O_CACHE_WB) - -void bdrv_info(Monitor *mon); -void bdrv_info_stats(Monitor *mon); - -void bdrv_init(void); -BlockDriver *bdrv_find_format(const char *format_name); -int bdrv_create(BlockDriver *drv, const char* filename, - QEMUOptionParameter *options); -int bdrv_create2(BlockDriver *drv, - const char *filename, int64_t size_in_sectors, - const char *backing_file, const char *backing_format, - int flags); -BlockDriverState *bdrv_new(const char *device_name); -void bdrv_delete(BlockDriverState *bs); -int bdrv_file_open(BlockDriverState **pbs, const char *filename, int flags); -int bdrv_open(BlockDriverState *bs, const char *filename, int flags); -int bdrv_open2(BlockDriverState *bs, const char *filename, int flags, - BlockDriver *drv); -void bdrv_close(BlockDriverState *bs); -int bdrv_check(BlockDriverState *bs); -int bdrv_read(BlockDriverState *bs, int64_t sector_num, - uint8_t *buf, int nb_sectors); -int bdrv_write(BlockDriverState *bs, int64_t sector_num, - const uint8_t *buf, int nb_sectors); -int bdrv_pread(BlockDriverState *bs, int64_t offset, - void *buf, int count); -int bdrv_pwrite(BlockDriverState *bs, int64_t offset, - const void *buf, int count); -int bdrv_truncate(BlockDriverState *bs, int64_t offset); -int64_t bdrv_getlength(BlockDriverState *bs); -void bdrv_get_geometry(BlockDriverState *bs, uint64_t *nb_sectors_ptr); -void bdrv_guess_geometry(BlockDriverState *bs, int *pcyls, int *pheads, int *psecs); -int bdrv_commit(BlockDriverState *bs); -void bdrv_register(BlockDriver *bdrv); - -/* async block I/O */ -typedef struct BlockDriverAIOCB BlockDriverAIOCB; -typedef void BlockDriverCompletionFunc(void *opaque, int ret); - -BlockDriverAIOCB *bdrv_aio_readv(BlockDriverState *bs, int64_t sector_num, - QEMUIOVector *iov, int nb_sectors, - BlockDriverCompletionFunc *cb, void *opaque); -BlockDriverAIOCB *bdrv_aio_writev(BlockDriverState *bs, int64_t sector_num, - QEMUIOVector *iov, int nb_sectors, - BlockDriverCompletionFunc *cb, void *opaque); -void bdrv_aio_cancel(BlockDriverAIOCB *acb); - -/* sg packet commands */ -int bdrv_ioctl(BlockDriverState *bs, unsigned long int req, void *buf); -BlockDriverAIOCB *bdrv_aio_ioctl(BlockDriverState *bs, - unsigned long int req, void *buf, - BlockDriverCompletionFunc *cb, void *opaque); - -/* Ensure contents are flushed to disk. */ -void bdrv_flush(BlockDriverState *bs); -void bdrv_flush_all(void); - -int bdrv_is_allocated(BlockDriverState *bs, int64_t sector_num, int nb_sectors, - int *pnum); - -#define BDRV_TYPE_HD 0 -#define BDRV_TYPE_CDROM 1 -#define BDRV_TYPE_FLOPPY 2 -#define BIOS_ATA_TRANSLATION_AUTO 0 -#define BIOS_ATA_TRANSLATION_NONE 1 -#define BIOS_ATA_TRANSLATION_LBA 2 -#define BIOS_ATA_TRANSLATION_LARGE 3 -#define BIOS_ATA_TRANSLATION_RECHS 4 - -void bdrv_set_geometry_hint(BlockDriverState *bs, - int cyls, int heads, int secs); -void bdrv_set_type_hint(BlockDriverState *bs, int type); -void bdrv_set_translation_hint(BlockDriverState *bs, int translation); -void bdrv_get_geometry_hint(BlockDriverState *bs, - int *pcyls, int *pheads, int *psecs); -int bdrv_get_type_hint(BlockDriverState *bs); -int bdrv_get_translation_hint(BlockDriverState *bs); -int bdrv_is_removable(BlockDriverState *bs); -int bdrv_is_read_only(BlockDriverState *bs); -int bdrv_is_sg(BlockDriverState *bs); -int bdrv_is_inserted(BlockDriverState *bs); -int bdrv_media_changed(BlockDriverState *bs); -int bdrv_is_locked(BlockDriverState *bs); -void bdrv_set_locked(BlockDriverState *bs, int locked); -int bdrv_eject(BlockDriverState *bs, int eject_flag); -void bdrv_set_change_cb(BlockDriverState *bs, - void (*change_cb)(void *opaque), void *opaque); -void bdrv_get_format(BlockDriverState *bs, char *buf, int buf_size); -BlockDriverState *bdrv_find(const char *name); -void bdrv_iterate(void (*it)(void *opaque, BlockDriverState *bs), - void *opaque); -int bdrv_is_encrypted(BlockDriverState *bs); -int bdrv_key_required(BlockDriverState *bs); -int bdrv_set_key(BlockDriverState *bs, const char *key); -int bdrv_query_missing_keys(void); -void bdrv_iterate_format(void (*it)(void *opaque, const char *name), - void *opaque); -const char *bdrv_get_device_name(BlockDriverState *bs); -int bdrv_write_compressed(BlockDriverState *bs, int64_t sector_num, - const uint8_t *buf, int nb_sectors); -int bdrv_get_info(BlockDriverState *bs, BlockDriverInfo *bdi); - -const char *bdrv_get_encrypted_filename(BlockDriverState *bs); -void bdrv_get_backing_filename(BlockDriverState *bs, - char *filename, int filename_size); -int bdrv_snapshot_create(BlockDriverState *bs, - QEMUSnapshotInfo *sn_info); -int bdrv_snapshot_goto(BlockDriverState *bs, - const char *snapshot_id); -int bdrv_snapshot_delete(BlockDriverState *bs, const char *snapshot_id); -int bdrv_snapshot_list(BlockDriverState *bs, - QEMUSnapshotInfo **psn_info); -char *bdrv_snapshot_dump(char *buf, int buf_size, QEMUSnapshotInfo *sn); - -char *get_human_readable_size(char *buf, int buf_size, int64_t size); -int path_is_absolute(const char *path); -void path_combine(char *dest, int dest_size, - const char *base_path, - const char *filename); - -int bdrv_save_vmstate(BlockDriverState *bs, const uint8_t *buf, - int64_t pos, int size); - -int bdrv_load_vmstate(BlockDriverState *bs, uint8_t *buf, - int64_t pos, int size); - -#endif diff --git a/qemu-0.11.0/block/bochs.c b/qemu-0.11.0/block/bochs.c deleted file mode 100644 index bac81c4..0000000 --- a/qemu-0.11.0/block/bochs.c +++ /dev/null @@ -1,259 +0,0 @@ -/* - * Block driver for the various disk image formats used by Bochs - * Currently only for "growing" type in read-only mode - * - * Copyright (c) 2005 Alex Beregszaszi - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -#include "qemu-common.h" -#include "block_int.h" -#include "module.h" - -/**************************************************************/ - -#define HEADER_MAGIC "Bochs Virtual HD Image" -#define HEADER_VERSION 0x00020000 -#define HEADER_V1 0x00010000 -#define HEADER_SIZE 512 - -#define REDOLOG_TYPE "Redolog" -#define GROWING_TYPE "Growing" - -// not allocated: 0xffffffff - -// always little-endian -struct bochs_header_v1 { - char magic[32]; // "Bochs Virtual HD Image" - char type[16]; // "Redolog" - char subtype[16]; // "Undoable" / "Volatile" / "Growing" - uint32_t version; - uint32_t header; // size of header - - union { - struct { - uint32_t catalog; // num of entries - uint32_t bitmap; // bitmap size - uint32_t extent; // extent size - uint64_t disk; // disk size - char padding[HEADER_SIZE - 64 - 8 - 20]; - } redolog; - char padding[HEADER_SIZE - 64 - 8]; - } extra; -}; - -// always little-endian -struct bochs_header { - char magic[32]; // "Bochs Virtual HD Image" - char type[16]; // "Redolog" - char subtype[16]; // "Undoable" / "Volatile" / "Growing" - uint32_t version; - uint32_t header; // size of header - - union { - struct { - uint32_t catalog; // num of entries - uint32_t bitmap; // bitmap size - uint32_t extent; // extent size - uint32_t reserved; // for ??? - uint64_t disk; // disk size - char padding[HEADER_SIZE - 64 - 8 - 24]; - } redolog; - char padding[HEADER_SIZE - 64 - 8]; - } extra; -}; - -typedef struct BDRVBochsState { - int fd; - - uint32_t *catalog_bitmap; - int catalog_size; - - int data_offset; - - int bitmap_blocks; - int extent_blocks; - int extent_size; -} BDRVBochsState; - -static int bochs_probe(const uint8_t *buf, int buf_size, const char *filename) -{ - const struct bochs_header *bochs = (const void *)buf; - - if (buf_size < HEADER_SIZE) - return 0; - - if (!strcmp(bochs->magic, HEADER_MAGIC) && - !strcmp(bochs->type, REDOLOG_TYPE) && - !strcmp(bochs->subtype, GROWING_TYPE) && - ((le32_to_cpu(bochs->version) == HEADER_VERSION) || - (le32_to_cpu(bochs->version) == HEADER_V1))) - return 100; - - return 0; -} - -static int bochs_open(BlockDriverState *bs, const char *filename, int flags) -{ - BDRVBochsState *s = bs->opaque; - int fd, i; - struct bochs_header bochs; - struct bochs_header_v1 header_v1; - - fd = open(filename, O_RDWR | O_BINARY); - if (fd < 0) { - fd = open(filename, O_RDONLY | O_BINARY); - if (fd < 0) - return -1; - } - - bs->read_only = 1; // no write support yet - - s->fd = fd; - - if (read(fd, &bochs, sizeof(bochs)) != sizeof(bochs)) { - goto fail; - } - - if (strcmp(bochs.magic, HEADER_MAGIC) || - strcmp(bochs.type, REDOLOG_TYPE) || - strcmp(bochs.subtype, GROWING_TYPE) || - ((le32_to_cpu(bochs.version) != HEADER_VERSION) && - (le32_to_cpu(bochs.version) != HEADER_V1))) { - goto fail; - } - - if (le32_to_cpu(bochs.version) == HEADER_V1) { - memcpy(&header_v1, &bochs, sizeof(bochs)); - bs->total_sectors = le64_to_cpu(header_v1.extra.redolog.disk) / 512; - } else { - bs->total_sectors = le64_to_cpu(bochs.extra.redolog.disk) / 512; - } - - lseek(s->fd, le32_to_cpu(bochs.header), SEEK_SET); - - s->catalog_size = le32_to_cpu(bochs.extra.redolog.catalog); - s->catalog_bitmap = qemu_malloc(s->catalog_size * 4); - if (read(s->fd, s->catalog_bitmap, s->catalog_size * 4) != - s->catalog_size * 4) - goto fail; - for (i = 0; i < s->catalog_size; i++) - le32_to_cpus(&s->catalog_bitmap[i]); - - s->data_offset = le32_to_cpu(bochs.header) + (s->catalog_size * 4); - - s->bitmap_blocks = 1 + (le32_to_cpu(bochs.extra.redolog.bitmap) - 1) / 512; - s->extent_blocks = 1 + (le32_to_cpu(bochs.extra.redolog.extent) - 1) / 512; - - s->extent_size = le32_to_cpu(bochs.extra.redolog.extent); - - return 0; - fail: - close(fd); - return -1; -} - -static inline int seek_to_sector(BlockDriverState *bs, int64_t sector_num) -{ - BDRVBochsState *s = bs->opaque; - int64_t offset = sector_num * 512; - int64_t extent_index, extent_offset, bitmap_offset, block_offset; - char bitmap_entry; - - // seek to sector - extent_index = offset / s->extent_size; - extent_offset = (offset % s->extent_size) / 512; - - if (s->catalog_bitmap[extent_index] == 0xffffffff) - { -// fprintf(stderr, "page not allocated [%x - %x:%x]\n", -// sector_num, extent_index, extent_offset); - return -1; // not allocated - } - - bitmap_offset = s->data_offset + (512 * s->catalog_bitmap[extent_index] * - (s->extent_blocks + s->bitmap_blocks)); - block_offset = bitmap_offset + (512 * (s->bitmap_blocks + extent_offset)); - -// fprintf(stderr, "sect: %x [ext i: %x o: %x] -> %x bitmap: %x block: %x\n", -// sector_num, extent_index, extent_offset, -// le32_to_cpu(s->catalog_bitmap[extent_index]), -// bitmap_offset, block_offset); - - // read in bitmap for current extent - lseek(s->fd, bitmap_offset + (extent_offset / 8), SEEK_SET); - - read(s->fd, &bitmap_entry, 1); - - if (!((bitmap_entry >> (extent_offset % 8)) & 1)) - { -// fprintf(stderr, "sector (%x) in bitmap not allocated\n", -// sector_num); - return -1; // not allocated - } - - lseek(s->fd, block_offset, SEEK_SET); - - return 0; -} - -static int bochs_read(BlockDriverState *bs, int64_t sector_num, - uint8_t *buf, int nb_sectors) -{ - BDRVBochsState *s = bs->opaque; - int ret; - - while (nb_sectors > 0) { - if (!seek_to_sector(bs, sector_num)) - { - ret = read(s->fd, buf, 512); - if (ret != 512) - return -1; - } - else - memset(buf, 0, 512); - nb_sectors--; - sector_num++; - buf += 512; - } - return 0; -} - -static void bochs_close(BlockDriverState *bs) -{ - BDRVBochsState *s = bs->opaque; - qemu_free(s->catalog_bitmap); - close(s->fd); -} - -static BlockDriver bdrv_bochs = { - .format_name = "bochs", - .instance_size = sizeof(BDRVBochsState), - .bdrv_probe = bochs_probe, - .bdrv_open = bochs_open, - .bdrv_read = bochs_read, - .bdrv_close = bochs_close, -}; - -static void bdrv_bochs_init(void) -{ - bdrv_register(&bdrv_bochs); -} - -block_init(bdrv_bochs_init); diff --git a/qemu-0.11.0/block/cloop.c b/qemu-0.11.0/block/cloop.c deleted file mode 100644 index 06c687e..0000000 --- a/qemu-0.11.0/block/cloop.c +++ /dev/null @@ -1,171 +0,0 @@ -/* - * QEMU Block driver for CLOOP images - * - * Copyright (c) 2004 Johannes E. Schindelin - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -#include "qemu-common.h" -#include "block_int.h" -#include "module.h" -#include <zlib.h> - -typedef struct BDRVCloopState { - int fd; - uint32_t block_size; - uint32_t n_blocks; - uint64_t* offsets; - uint32_t sectors_per_block; - uint32_t current_block; - uint8_t *compressed_block; - uint8_t *uncompressed_block; - z_stream zstream; -} BDRVCloopState; - -static int cloop_probe(const uint8_t *buf, int buf_size, const char *filename) -{ - const char* magic_version_2_0="#!/bin/sh\n" - "#V2.0 Format\n" - "modprobe cloop file=$0 && mount -r -t iso9660 /dev/cloop $1\n"; - int length=strlen(magic_version_2_0); - if(length>buf_size) - length=buf_size; - if(!memcmp(magic_version_2_0,buf,length)) - return 2; - return 0; -} - -static int cloop_open(BlockDriverState *bs, const char *filename, int flags) -{ - BDRVCloopState *s = bs->opaque; - uint32_t offsets_size,max_compressed_block_size=1,i; - - s->fd = open(filename, O_RDONLY | O_BINARY); - if (s->fd < 0) - return -errno; - bs->read_only = 1; - - /* read header */ - if(lseek(s->fd,128,SEEK_SET)<0) { -cloop_close: - close(s->fd); - return -1; - } - if(read(s->fd,&s->block_size,4)<4) - goto cloop_close; - s->block_size=be32_to_cpu(s->block_size); - if(read(s->fd,&s->n_blocks,4)<4) - goto cloop_close; - s->n_blocks=be32_to_cpu(s->n_blocks); - - /* read offsets */ - offsets_size=s->n_blocks*sizeof(uint64_t); - s->offsets=(uint64_t*)qemu_malloc(offsets_size); - if(read(s->fd,s->offsets,offsets_size)<offsets_size) - goto cloop_close; - for(i=0;i<s->n_blocks;i++) { - s->offsets[i]=be64_to_cpu(s->offsets[i]); - if(i>0) { - uint32_t size=s->offsets[i]-s->offsets[i-1]; - if(size>max_compressed_block_size) - max_compressed_block_size=size; - } - } - - /* initialize zlib engine */ - s->compressed_block = qemu_malloc(max_compressed_block_size+1); - s->uncompressed_block = qemu_malloc(s->block_size); - if(inflateInit(&s->zstream) != Z_OK) - goto cloop_close; - s->current_block=s->n_blocks; - - s->sectors_per_block = s->block_size/512; - bs->total_sectors = s->n_blocks*s->sectors_per_block; - return 0; -} - -static inline int cloop_read_block(BDRVCloopState *s,int block_num) -{ - if(s->current_block != block_num) { - int ret; - uint32_t bytes = s->offsets[block_num+1]-s->offsets[block_num]; - - lseek(s->fd, s->offsets[block_num], SEEK_SET); - ret = read(s->fd, s->compressed_block, bytes); - if (ret != bytes) - return -1; - - s->zstream.next_in = s->compressed_block; - s->zstream.avail_in = bytes; - s->zstream.next_out = s->uncompressed_block; - s->zstream.avail_out = s->block_size; - ret = inflateReset(&s->zstream); - if(ret != Z_OK) - return -1; - ret = inflate(&s->zstream, Z_FINISH); - if(ret != Z_STREAM_END || s->zstream.total_out != s->block_size) - return -1; - - s->current_block = block_num; - } - return 0; -} - -static int cloop_read(BlockDriverState *bs, int64_t sector_num, - uint8_t *buf, int nb_sectors) -{ - BDRVCloopState *s = bs->opaque; - int i; - - for(i=0;i<nb_sectors;i++) { - uint32_t sector_offset_in_block=((sector_num+i)%s->sectors_per_block), - block_num=(sector_num+i)/s->sectors_per_block; - if(cloop_read_block(s, block_num) != 0) - return -1; - memcpy(buf+i*512,s->uncompressed_block+sector_offset_in_block*512,512); - } - return 0; -} - -static void cloop_close(BlockDriverState *bs) -{ - BDRVCloopState *s = bs->opaque; - close(s->fd); - if(s->n_blocks>0) - free(s->offsets); - free(s->compressed_block); - free(s->uncompressed_block); - inflateEnd(&s->zstream); -} - -static BlockDriver bdrv_cloop = { - .format_name = "cloop", - .instance_size = sizeof(BDRVCloopState), - .bdrv_probe = cloop_probe, - .bdrv_open = cloop_open, - .bdrv_read = cloop_read, - .bdrv_close = cloop_close, -}; - -static void bdrv_cloop_init(void) -{ - bdrv_register(&bdrv_cloop); -} - -block_init(bdrv_cloop_init); diff --git a/qemu-0.11.0/block/cow.c b/qemu-0.11.0/block/cow.c deleted file mode 100644 index 84818f1..0000000 --- a/qemu-0.11.0/block/cow.c +++ /dev/null @@ -1,299 +0,0 @@ -/* - * Block driver for the COW format - * - * Copyright (c) 2004 Fabrice Bellard - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -#ifndef _WIN32 -#include "qemu-common.h" -#include "block_int.h" -#include "module.h" -#include <sys/mman.h> - -/**************************************************************/ -/* COW block driver using file system holes */ - -/* user mode linux compatible COW file */ -#define COW_MAGIC 0x4f4f4f4d /* MOOO */ -#define COW_VERSION 2 - -struct cow_header_v2 { - uint32_t magic; - uint32_t version; - char backing_file[1024]; - int32_t mtime; - uint64_t size; - uint32_t sectorsize; -}; - -typedef struct BDRVCowState { - int fd; - uint8_t *cow_bitmap; /* if non NULL, COW mappings are used first */ - uint8_t *cow_bitmap_addr; /* mmap address of cow_bitmap */ - int cow_bitmap_size; - int64_t cow_sectors_offset; -} BDRVCowState; - -static int cow_probe(const uint8_t *buf, int buf_size, const char *filename) -{ - const struct cow_header_v2 *cow_header = (const void *)buf; - - if (buf_size >= sizeof(struct cow_header_v2) && - be32_to_cpu(cow_header->magic) == COW_MAGIC && - be32_to_cpu(cow_header->version) == COW_VERSION) - return 100; - else - return 0; -} - -static int cow_open(BlockDriverState *bs, const char *filename, int flags) -{ - BDRVCowState *s = bs->opaque; - int fd; - struct cow_header_v2 cow_header; - int64_t size; - - fd = open(filename, O_RDWR | O_BINARY | O_LARGEFILE); - if (fd < 0) { - fd = open(filename, O_RDONLY | O_BINARY | O_LARGEFILE); - if (fd < 0) - return -1; - } - s->fd = fd; - /* see if it is a cow image */ - if (read(fd, &cow_header, sizeof(cow_header)) != sizeof(cow_header)) { - goto fail; - } - - if (be32_to_cpu(cow_header.magic) != COW_MAGIC || - be32_to_cpu(cow_header.version) != COW_VERSION) { - goto fail; - } - - /* cow image found */ - size = be64_to_cpu(cow_header.size); - bs->total_sectors = size / 512; - - pstrcpy(bs->backing_file, sizeof(bs->backing_file), - cow_header.backing_file); - - /* mmap the bitmap */ - s->cow_bitmap_size = ((bs->total_sectors + 7) >> 3) + sizeof(cow_header); - s->cow_bitmap_addr = (void *)mmap(get_mmap_addr(s->cow_bitmap_size), - s->cow_bitmap_size, - PROT_READ | PROT_WRITE, - MAP_SHARED, s->fd, 0); - if (s->cow_bitmap_addr == MAP_FAILED) - goto fail; - s->cow_bitmap = s->cow_bitmap_addr + sizeof(cow_header); - s->cow_sectors_offset = (s->cow_bitmap_size + 511) & ~511; - return 0; - fail: - close(fd); - return -1; -} - -static inline void cow_set_bit(uint8_t *bitmap, int64_t bitnum) -{ - bitmap[bitnum / 8] |= (1 << (bitnum%8)); -} - -static inline int is_bit_set(const uint8_t *bitmap, int64_t bitnum) -{ - return !!(bitmap[bitnum / 8] & (1 << (bitnum%8))); -} - - -/* Return true if first block has been changed (ie. current version is - * in COW file). Set the number of continuous blocks for which that - * is true. */ -static inline int is_changed(uint8_t *bitmap, - int64_t sector_num, int nb_sectors, - int *num_same) -{ - int changed; - - if (!bitmap || nb_sectors == 0) { - *num_same = nb_sectors; - return 0; - } - - changed = is_bit_set(bitmap, sector_num); - for (*num_same = 1; *num_same < nb_sectors; (*num_same)++) { - if (is_bit_set(bitmap, sector_num + *num_same) != changed) - break; - } - - return changed; -} - -static int cow_is_allocated(BlockDriverState *bs, int64_t sector_num, - int nb_sectors, int *pnum) -{ - BDRVCowState *s = bs->opaque; - return is_changed(s->cow_bitmap, sector_num, nb_sectors, pnum); -} - -static int cow_read(BlockDriverState *bs, int64_t sector_num, - uint8_t *buf, int nb_sectors) -{ - BDRVCowState *s = bs->opaque; - int ret, n; - - while (nb_sectors > 0) { - if (is_changed(s->cow_bitmap, sector_num, nb_sectors, &n)) { - lseek(s->fd, s->cow_sectors_offset + sector_num * 512, SEEK_SET); - ret = read(s->fd, buf, n * 512); - if (ret != n * 512) - return -1; - } else { - if (bs->backing_hd) { - /* read from the base image */ - ret = bdrv_read(bs->backing_hd, sector_num, buf, n); - if (ret < 0) - return -1; - } else { - memset(buf, 0, n * 512); - } - } - nb_sectors -= n; - sector_num += n; - buf += n * 512; - } - return 0; -} - -static int cow_write(BlockDriverState *bs, int64_t sector_num, - const uint8_t *buf, int nb_sectors) -{ - BDRVCowState *s = bs->opaque; - int ret, i; - - lseek(s->fd, s->cow_sectors_offset + sector_num * 512, SEEK_SET); - ret = write(s->fd, buf, nb_sectors * 512); - if (ret != nb_sectors * 512) - return -1; - for (i = 0; i < nb_sectors; i++) - cow_set_bit(s->cow_bitmap, sector_num + i); - return 0; -} - -static void cow_close(BlockDriverState *bs) -{ - BDRVCowState *s = bs->opaque; - munmap((void *)s->cow_bitmap_addr, s->cow_bitmap_size); - close(s->fd); -} - -static int cow_create(const char *filename, QEMUOptionParameter *options) -{ - int fd, cow_fd; - struct cow_header_v2 cow_header; - struct stat st; - int64_t image_sectors = 0; - const char *image_filename = NULL; - - /* Read out options */ - while (options && options->name) { - if (!strcmp(options->name, BLOCK_OPT_SIZE)) { - image_sectors = options->value.n / 512; - } else if (!strcmp(options->name, BLOCK_OPT_BACKING_FILE)) { - image_filename = options->value.s; - } - options++; - } - - cow_fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, - 0644); - if (cow_fd < 0) - return -1; - memset(&cow_header, 0, sizeof(cow_header)); - cow_header.magic = cpu_to_be32(COW_MAGIC); - cow_header.version = cpu_to_be32(COW_VERSION); - if (image_filename) { - /* Note: if no file, we put a dummy mtime */ - cow_header.mtime = cpu_to_be32(0); - - fd = open(image_filename, O_RDONLY | O_BINARY); - if (fd < 0) { - close(cow_fd); - goto mtime_fail; - } - if (fstat(fd, &st) != 0) { - close(fd); - goto mtime_fail; - } - close(fd); - cow_header.mtime = cpu_to_be32(st.st_mtime); - mtime_fail: - pstrcpy(cow_header.backing_file, sizeof(cow_header.backing_file), - image_filename); - } - cow_header.sectorsize = cpu_to_be32(512); - cow_header.size = cpu_to_be64(image_sectors * 512); - write(cow_fd, &cow_header, sizeof(cow_header)); - /* resize to include at least all the bitmap */ - ftruncate(cow_fd, sizeof(cow_header) + ((image_sectors + 7) >> 3)); - close(cow_fd); - return 0; -} - -static void cow_flush(BlockDriverState *bs) -{ - BDRVCowState *s = bs->opaque; - fsync(s->fd); -} - -static QEMUOptionParameter cow_create_options[] = { - { - .name = BLOCK_OPT_SIZE, - .type = OPT_SIZE, - .help = "Virtual disk size" - }, - { - .name = BLOCK_OPT_BACKING_FILE, - .type = OPT_STRING, - .help = "File name of a base image" - }, - { NULL } -}; - -static BlockDriver bdrv_cow = { - .format_name = "cow", - .instance_size = sizeof(BDRVCowState), - .bdrv_probe = cow_probe, - .bdrv_open = cow_open, - .bdrv_read = cow_read, - .bdrv_write = cow_write, - .bdrv_close = cow_close, - .bdrv_create = cow_create, - .bdrv_flush = cow_flush, - .bdrv_is_allocated = cow_is_allocated, - - .create_options = cow_create_options, -}; - -static void bdrv_cow_init(void) -{ - bdrv_register(&bdrv_cow); -} - -block_init(bdrv_cow_init); -#endif diff --git a/qemu-0.11.0/block/curl.c b/qemu-0.11.0/block/curl.c deleted file mode 100644 index 3caa9be..0000000 --- a/qemu-0.11.0/block/curl.c +++ /dev/null @@ -1,562 +0,0 @@ -/* - * QEMU Block driver for CURL images - * - * Copyright (c) 2009 Alexander Graf agraf@suse.de - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -#include "qemu-common.h" -#include "block_int.h" -#include <curl/curl.h> - -// #define DEBUG -// #define DEBUG_VERBOSE - -#ifdef DEBUG_CURL -#define dprintf(fmt, ...) do { printf(fmt, ## __VA_ARGS__); } while (0) -#else -#define dprintf(fmt, ...) do { } while (0) -#endif - -#define CURL_NUM_STATES 8 -#define CURL_NUM_ACB 8 -#define SECTOR_SIZE 512 -#define READ_AHEAD_SIZE (256 * 1024) - -#define FIND_RET_NONE 0 -#define FIND_RET_OK 1 -#define FIND_RET_WAIT 2 - -struct BDRVCURLState; - -typedef struct CURLAIOCB { - BlockDriverAIOCB common; - QEMUIOVector *qiov; - size_t start; - size_t end; -} CURLAIOCB; - -typedef struct CURLState -{ - struct BDRVCURLState *s; - CURLAIOCB *acb[CURL_NUM_ACB]; - CURL *curl; - char *orig_buf; - size_t buf_start; - size_t buf_off; - size_t buf_len; - char range[128]; - char errmsg[CURL_ERROR_SIZE]; - char in_use; -} CURLState; - -typedef struct BDRVCURLState { - CURLM *multi; - size_t len; - CURLState states[CURL_NUM_STATES]; - char *url; - size_t readahead_size; -} BDRVCURLState; - -static void curl_clean_state(CURLState *s); -static void curl_multi_do(void *arg); - -static int curl_sock_cb(CURL *curl, curl_socket_t fd, int action, - void *s, void *sp) -{ - dprintf("CURL (AIO): Sock action %d on fd %d\n", action, fd); - switch (action) { - case CURL_POLL_IN: - qemu_aio_set_fd_handler(fd, curl_multi_do, NULL, NULL, s); - break; - case CURL_POLL_OUT: - qemu_aio_set_fd_handler(fd, NULL, curl_multi_do, NULL, s); - break; - case CURL_POLL_INOUT: - qemu_aio_set_fd_handler(fd, curl_multi_do, - curl_multi_do, NULL, s); - break; - case CURL_POLL_REMOVE: - qemu_aio_set_fd_handler(fd, NULL, NULL, NULL, NULL); - break; - } - - return 0; -} - -static size_t curl_size_cb(void *ptr, size_t size, size_t nmemb, void *opaque) -{ - CURLState *s = ((CURLState*)opaque); - size_t realsize = size * nmemb; - long long fsize; - - if(sscanf(ptr, "Content-Length: %lld", &fsize) == 1) - s->s->len = fsize; - - return realsize; -} - -static size_t curl_read_cb(void *ptr, size_t size, size_t nmemb, void *opaque) -{ - CURLState *s = ((CURLState*)opaque); - size_t realsize = size * nmemb; - int i; - - dprintf("CURL: Just reading %lld bytes\n", (unsigned long long)realsize); - - if (!s || !s->orig_buf) - goto read_end; - - memcpy(s->orig_buf + s->buf_off, ptr, realsize); - s->buf_off += realsize; - - for(i=0; i<CURL_NUM_ACB; i++) { - CURLAIOCB *acb = s->acb[i]; - - if (!acb) - continue; - - if ((s->buf_off >= acb->end)) { - qemu_iovec_from_buffer(acb->qiov, s->orig_buf + acb->start, - acb->end - acb->start); - acb->common.cb(acb->common.opaque, 0); - qemu_aio_release(acb); - s->acb[i] = NULL; - } - } - -read_end: - return realsize; -} - -static int curl_find_buf(BDRVCURLState *s, size_t start, size_t len, - CURLAIOCB *acb) -{ - int i; - size_t end = start + len; - - for (i=0; i<CURL_NUM_STATES; i++) { - CURLState *state = &s->states[i]; - size_t buf_end = (state->buf_start + state->buf_off); - size_t buf_fend = (state->buf_start + state->buf_len); - - if (!state->orig_buf) - continue; - if (!state->buf_off) - continue; - - // Does the existing buffer cover our section? - if ((start >= state->buf_start) && - (start <= buf_end) && - (end >= state->buf_start) && - (end <= buf_end)) - { - char *buf = state->orig_buf + (start - state->buf_start); - - qemu_iovec_from_buffer(acb->qiov, buf, len); - acb->common.cb(acb->common.opaque, 0); - - return FIND_RET_OK; - } - - // Wait for unfinished chunks - if ((start >= state->buf_start) && - (start <= buf_fend) && - (end >= state->buf_start) && - (end <= buf_fend)) - { - int j; - - acb->start = start - state->buf_start; - acb->end = acb->start + len; - - for (j=0; j<CURL_NUM_ACB; j++) { - if (!state->acb[j]) { - state->acb[j] = acb; - return FIND_RET_WAIT; - } - } - } - } - - return FIND_RET_NONE; -} - -static void curl_multi_do(void *arg) -{ - BDRVCURLState *s = (BDRVCURLState *)arg; - int running; - int r; - int msgs_in_queue; - - if (!s->multi) - return; - - do { - r = curl_multi_socket_all(s->multi, &running); - } while(r == CURLM_CALL_MULTI_PERFORM); - - /* Try to find done transfers, so we can free the easy - * handle again. */ - do { - CURLMsg *msg; - msg = curl_multi_info_read(s->multi, &msgs_in_queue); - - if (!msg) - break; - if (msg->msg == CURLMSG_NONE) - break; - - switch (msg->msg) { - case CURLMSG_DONE: - { - CURLState *state = NULL; - curl_easy_getinfo(msg->easy_handle, CURLINFO_PRIVATE, (char**)&state); - curl_clean_state(state); - break; - } - default: - msgs_in_queue = 0; - break; - } - } while(msgs_in_queue); -} - -static CURLState *curl_init_state(BDRVCURLState *s) -{ - CURLState *state = NULL; - int i, j; - - do { - for (i=0; i<CURL_NUM_STATES; i++) { - for (j=0; j<CURL_NUM_ACB; j++) - if (s->states[i].acb[j]) - continue; - if (s->states[i].in_use) - continue; - - state = &s->states[i]; - state->in_use = 1; - break; - } - if (!state) { - usleep(100); - curl_multi_do(s); - } - } while(!state); - - if (state->curl) - goto has_curl; - - state->curl = curl_easy_init(); - if (!state->curl) - return NULL; - curl_easy_setopt(state->curl, CURLOPT_URL, s->url); - curl_easy_setopt(state->curl, CURLOPT_TIMEOUT, 5); - curl_easy_setopt(state->curl, CURLOPT_WRITEFUNCTION, (void *)curl_read_cb); - curl_easy_setopt(state->curl, CURLOPT_WRITEDATA, (void *)state); - curl_easy_setopt(state->curl, CURLOPT_PRIVATE, (void *)state); - curl_easy_setopt(state->curl, CURLOPT_AUTOREFERER, 1); - curl_easy_setopt(state->curl, CURLOPT_FOLLOWLOCATION, 1); - curl_easy_setopt(state->curl, CURLOPT_NOSIGNAL, 1); - curl_easy_setopt(state->curl, CURLOPT_ERRORBUFFER, state->errmsg); - -#ifdef DEBUG_VERBOSE - curl_easy_setopt(state->curl, CURLOPT_VERBOSE, 1); -#endif - -has_curl: - - state->s = s; - - return state; -} - -static void curl_clean_state(CURLState *s) -{ - if (s->s->multi) - curl_multi_remove_handle(s->s->multi, s->curl); - s->in_use = 0; -} - -static int curl_open(BlockDriverState *bs, const char *filename, int flags) -{ - BDRVCURLState *s = bs->opaque; - CURLState *state = NULL; - double d; - - #define RA_OPTSTR ":readahead=" - char *file; - char *ra; - const char *ra_val; - int parse_state = 0; - - static int inited = 0; - - file = strdup(filename); - s->readahead_size = READ_AHEAD_SIZE; - - /* Parse a trailing ":readahead=#:" param, if present. */ - ra = file + strlen(file) - 1; - while (ra >= file) { - if (parse_state == 0) { - if (*ra == ':') - parse_state++; - else - break; - } else if (parse_state == 1) { - if (*ra > '9' || *ra < '0') { - char *opt_start = ra - strlen(RA_OPTSTR) + 1; - if (opt_start > file && - strncmp(opt_start, RA_OPTSTR, strlen(RA_OPTSTR)) == 0) { - ra_val = ra + 1; - ra -= strlen(RA_OPTSTR) - 1; - *ra = '\0'; - s->readahead_size = atoi(ra_val); - break; - } else { - break; - } - } - } - ra--; - } - - if ((s->readahead_size & 0x1ff) != 0) { - fprintf(stderr, "HTTP_READAHEAD_SIZE %Zd is not a multiple of 512\n", - s->readahead_size); - goto out_noclean; - } - - if (!inited) { - curl_global_init(CURL_GLOBAL_ALL); - inited = 1; - } - - dprintf("CURL: Opening %s\n", file); - s->url = file; - state = curl_init_state(s); - if (!state) - goto out_noclean; - - // Get file size - - curl_easy_setopt(state->curl, CURLOPT_NOBODY, 1); - curl_easy_setopt(state->curl, CURLOPT_WRITEFUNCTION, (void *)curl_size_cb); - if (curl_easy_perform(state->curl)) - goto out; - curl_easy_getinfo(state->curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &d); - curl_easy_setopt(state->curl, CURLOPT_WRITEFUNCTION, (void *)curl_read_cb); - curl_easy_setopt(state->curl, CURLOPT_NOBODY, 0); - if (d) - s->len = (size_t)d; - else if(!s->len) - goto out; - dprintf("CURL: Size = %lld\n", (long long)s->len); - - curl_clean_state(state); - curl_easy_cleanup(state->curl); - state->curl = NULL; - - // Now we know the file exists and its size, so let's - // initialize the multi interface! - - s->multi = curl_multi_init(); - curl_multi_setopt( s->multi, CURLMOPT_SOCKETDATA, s); - curl_multi_setopt( s->multi, CURLMOPT_SOCKETFUNCTION, curl_sock_cb ); - curl_multi_do(s); - - return 0; - -out: - fprintf(stderr, "CURL: Error opening file: %s\n", state->errmsg); - curl_easy_cleanup(state->curl); - state->curl = NULL; -out_noclean: - qemu_free(file); - return -EINVAL; -} - -static void curl_aio_cancel(BlockDriverAIOCB *blockacb) -{ - // Do we have to implement canceling? Seems to work without... -} - -static AIOPool curl_aio_pool = { - .aiocb_size = sizeof(CURLAIOCB), - .cancel = curl_aio_cancel, -}; - -static BlockDriverAIOCB *curl_aio_readv(BlockDriverState *bs, - int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, - BlockDriverCompletionFunc *cb, void *opaque) -{ - BDRVCURLState *s = bs->opaque; - CURLAIOCB *acb; - size_t start = sector_num * SECTOR_SIZE; - size_t end; - CURLState *state; - - acb = qemu_aio_get(&curl_aio_pool, bs, cb, opaque); - if (!acb) - return NULL; - - acb->qiov = qiov; - - // In case we have the requested data already (e.g. read-ahead), - // we can just call the callback and be done. - - switch (curl_find_buf(s, start, nb_sectors * SECTOR_SIZE, acb)) { - case FIND_RET_OK: - qemu_aio_release(acb); - // fall through - case FIND_RET_WAIT: - return &acb->common; - default: - break; - } - - // No cache found, so let's start a new request - - state = curl_init_state(s); - if (!state) - return NULL; - - acb->start = 0; - acb->end = (nb_sectors * SECTOR_SIZE); - - state->buf_off = 0; - if (state->orig_buf) - qemu_free(state->orig_buf); - state->buf_start = start; - state->buf_len = acb->end + s->readahead_size; - end = MIN(start + state->buf_len, s->len) - 1; - state->orig_buf = qemu_malloc(state->buf_len); - state->acb[0] = acb; - - snprintf(state->range, 127, "%lld-%lld", (long long)start, (long long)end); - dprintf("CURL (AIO): Reading %d at %lld (%s)\n", (nb_sectors * SECTOR_SIZE), start, state->range); - curl_easy_setopt(state->curl, CURLOPT_RANGE, state->range); - - curl_multi_add_handle(s->multi, state->curl); - curl_multi_do(s); - - return &acb->common; -} - -static void curl_close(BlockDriverState *bs) -{ - BDRVCURLState *s = bs->opaque; - int i; - - dprintf("CURL: Close\n"); - for (i=0; i<CURL_NUM_STATES; i++) { - if (s->states[i].in_use) - curl_clean_state(&s->states[i]); - if (s->states[i].curl) { - curl_easy_cleanup(s->states[i].curl); - s->states[i].curl = NULL; - } - if (s->states[i].orig_buf) { - qemu_free(s->states[i].orig_buf); - s->states[i].orig_buf = NULL; - } - } - if (s->multi) - curl_multi_cleanup(s->multi); - if (s->url) - free(s->url); -} - -static int64_t curl_getlength(BlockDriverState *bs) -{ - BDRVCURLState *s = bs->opaque; - return s->len; -} - -static BlockDriver bdrv_http = { - .format_name = "http", - .protocol_name = "http", - - .instance_size = sizeof(BDRVCURLState), - .bdrv_open = curl_open, - .bdrv_close = curl_close, - .bdrv_getlength = curl_getlength, - - .bdrv_aio_readv = curl_aio_readv, -}; - -static BlockDriver bdrv_https = { - .format_name = "https", - .protocol_name = "https", - - .instance_size = sizeof(BDRVCURLState), - .bdrv_open = curl_open, - .bdrv_close = curl_close, - .bdrv_getlength = curl_getlength, - - .bdrv_aio_readv = curl_aio_readv, -}; - -static BlockDriver bdrv_ftp = { - .format_name = "ftp", - .protocol_name = "ftp", - - .instance_size = sizeof(BDRVCURLState), - .bdrv_open = curl_open, - .bdrv_close = curl_close, - .bdrv_getlength = curl_getlength, - - .bdrv_aio_readv = curl_aio_readv, -}; - -static BlockDriver bdrv_ftps = { - .format_name = "ftps", - .protocol_name = "ftps", - - .instance_size = sizeof(BDRVCURLState), - .bdrv_open = curl_open, - .bdrv_close = curl_close, - .bdrv_getlength = curl_getlength, - - .bdrv_aio_readv = curl_aio_readv, -}; - -static BlockDriver bdrv_tftp = { - .format_name = "tftp", - .protocol_name = "tftp", - - .instance_size = sizeof(BDRVCURLState), - .bdrv_open = curl_open, - .bdrv_close = curl_close, - .bdrv_getlength = curl_getlength, - - .bdrv_aio_readv = curl_aio_readv, -}; - -static void curl_block_init(void) -{ - bdrv_register(&bdrv_http); - bdrv_register(&bdrv_https); - bdrv_register(&bdrv_ftp); - bdrv_register(&bdrv_ftps); - bdrv_register(&bdrv_tftp); -} - -block_init(curl_block_init); diff --git a/qemu-0.11.0/block/dmg.c b/qemu-0.11.0/block/dmg.c deleted file mode 100644 index 262560f..0000000 --- a/qemu-0.11.0/block/dmg.c +++ /dev/null @@ -1,301 +0,0 @@ -/* - * QEMU Block driver for DMG images - * - * Copyright (c) 2004 Johannes E. Schindelin - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -#include "qemu-common.h" -#include "block_int.h" -#include "bswap.h" -#include "module.h" -#include <zlib.h> - -typedef struct BDRVDMGState { - int fd; - - /* each chunk contains a certain number of sectors, - * offsets[i] is the offset in the .dmg file, - * lengths[i] is the length of the compressed chunk, - * sectors[i] is the sector beginning at offsets[i], - * sectorcounts[i] is the number of sectors in that chunk, - * the sectors array is ordered - * 0<=i<n_chunks */ - - uint32_t n_chunks; - uint32_t* types; - uint64_t* offsets; - uint64_t* lengths; - uint64_t* sectors; - uint64_t* sectorcounts; - uint32_t current_chunk; - uint8_t *compressed_chunk; - uint8_t *uncompressed_chunk; - z_stream zstream; -} BDRVDMGState; - -static int dmg_probe(const uint8_t *buf, int buf_size, const char *filename) -{ - int len=strlen(filename); - if(len>4 && !strcmp(filename+len-4,".dmg")) - return 2; - return 0; -} - -static off_t read_off(int fd) -{ - uint64_t buffer; - if(read(fd,&buffer,8)<8) - return 0; - return be64_to_cpu(buffer); -} - -static off_t read_uint32(int fd) -{ - uint32_t buffer; - if(read(fd,&buffer,4)<4) - return 0; - return be32_to_cpu(buffer); -} - -static int dmg_open(BlockDriverState *bs, const char *filename, int flags) -{ - BDRVDMGState *s = bs->opaque; - off_t info_begin,info_end,last_in_offset,last_out_offset; - uint32_t count; - uint32_t max_compressed_size=1,max_sectors_per_chunk=1,i; - - s->fd = open(filename, O_RDONLY | O_BINARY); - if (s->fd < 0) - return -errno; - bs->read_only = 1; - s->n_chunks = 0; - s->offsets = s->lengths = s->sectors = s->sectorcounts = NULL; - - /* read offset of info blocks */ - if(lseek(s->fd,-0x1d8,SEEK_END)<0) { -dmg_close: - close(s->fd); - /* open raw instead */ - bs->drv=bdrv_find_format("raw"); - return bs->drv->bdrv_open(bs, filename, flags); - } - info_begin=read_off(s->fd); - if(info_begin==0) - goto dmg_close; - if(lseek(s->fd,info_begin,SEEK_SET)<0) - goto dmg_close; - if(read_uint32(s->fd)!=0x100) - goto dmg_close; - if((count = read_uint32(s->fd))==0) - goto dmg_close; - info_end = info_begin+count; - if(lseek(s->fd,0xf8,SEEK_CUR)<0) - goto dmg_close; - - /* read offsets */ - last_in_offset = last_out_offset = 0; - while(lseek(s->fd,0,SEEK_CUR)<info_end) { - uint32_t type; - - count = read_uint32(s->fd); - if(count==0) - goto dmg_close; - type = read_uint32(s->fd); - if(type!=0x6d697368 || count<244) - lseek(s->fd,count-4,SEEK_CUR); - else { - int new_size, chunk_count; - if(lseek(s->fd,200,SEEK_CUR)<0) - goto dmg_close; - chunk_count = (count-204)/40; - new_size = sizeof(uint64_t) * (s->n_chunks + chunk_count); - s->types = qemu_realloc(s->types, new_size/2); - s->offsets = qemu_realloc(s->offsets, new_size); - s->lengths = qemu_realloc(s->lengths, new_size); - s->sectors = qemu_realloc(s->sectors, new_size); - s->sectorcounts = qemu_realloc(s->sectorcounts, new_size); - - for(i=s->n_chunks;i<s->n_chunks+chunk_count;i++) { - s->types[i] = read_uint32(s->fd); - if(s->types[i]!=0x80000005 && s->types[i]!=1 && s->types[i]!=2) { - if(s->types[i]==0xffffffff) { - last_in_offset = s->offsets[i-1]+s->lengths[i-1]; - last_out_offset = s->sectors[i-1]+s->sectorcounts[i-1]; - } - chunk_count--; - i--; - if(lseek(s->fd,36,SEEK_CUR)<0) - goto dmg_close; - continue; - } - read_uint32(s->fd); - s->sectors[i] = last_out_offset+read_off(s->fd); - s->sectorcounts[i] = read_off(s->fd); - s->offsets[i] = last_in_offset+read_off(s->fd); - s->lengths[i] = read_off(s->fd); - if(s->lengths[i]>max_compressed_size) - max_compressed_size = s->lengths[i]; - if(s->sectorcounts[i]>max_sectors_per_chunk) - max_sectors_per_chunk = s->sectorcounts[i]; - } - s->n_chunks+=chunk_count; - } - } - - /* initialize zlib engine */ - s->compressed_chunk = qemu_malloc(max_compressed_size+1); - s->uncompressed_chunk = qemu_malloc(512*max_sectors_per_chunk); - if(inflateInit(&s->zstream) != Z_OK) - goto dmg_close; - - s->current_chunk = s->n_chunks; - - return 0; -} - -static inline int is_sector_in_chunk(BDRVDMGState* s, - uint32_t chunk_num,int sector_num) -{ - if(chunk_num>=s->n_chunks || s->sectors[chunk_num]>sector_num || - s->sectors[chunk_num]+s->sectorcounts[chunk_num]<=sector_num) - return 0; - else - return -1; -} - -static inline uint32_t search_chunk(BDRVDMGState* s,int sector_num) -{ - /* binary search */ - uint32_t chunk1=0,chunk2=s->n_chunks,chunk3; - while(chunk1!=chunk2) { - chunk3 = (chunk1+chunk2)/2; - if(s->sectors[chunk3]>sector_num) - chunk2 = chunk3; - else if(s->sectors[chunk3]+s->sectorcounts[chunk3]>sector_num) - return chunk3; - else - chunk1 = chunk3; - } - return s->n_chunks; /* error */ -} - -static inline int dmg_read_chunk(BDRVDMGState *s,int sector_num) -{ - if(!is_sector_in_chunk(s,s->current_chunk,sector_num)) { - int ret; - uint32_t chunk = search_chunk(s,sector_num); - - if(chunk>=s->n_chunks) - return -1; - - s->current_chunk = s->n_chunks; - switch(s->types[chunk]) { - case 0x80000005: { /* zlib compressed */ - int i; - - ret = lseek(s->fd, s->offsets[chunk], SEEK_SET); - if(ret<0) - return -1; - - /* we need to buffer, because only the chunk as whole can be - * inflated. */ - i=0; - do { - ret = read(s->fd, s->compressed_chunk+i, s->lengths[chunk]-i); - if(ret<0 && errno==EINTR) - ret=0; - i+=ret; - } while(ret>=0 && ret+i<s->lengths[chunk]); - - if (ret != s->lengths[chunk]) - return -1; - - s->zstream.next_in = s->compressed_chunk; - s->zstream.avail_in = s->lengths[chunk]; - s->zstream.next_out = s->uncompressed_chunk; - s->zstream.avail_out = 512*s->sectorcounts[chunk]; - ret = inflateReset(&s->zstream); - if(ret != Z_OK) - return -1; - ret = inflate(&s->zstream, Z_FINISH); - if(ret != Z_STREAM_END || s->zstream.total_out != 512*s->sectorcounts[chunk]) - return -1; - break; } - case 1: /* copy */ - ret = read(s->fd, s->uncompressed_chunk, s->lengths[chunk]); - if (ret != s->lengths[chunk]) - return -1; - break; - case 2: /* zero */ - memset(s->uncompressed_chunk, 0, 512*s->sectorcounts[chunk]); - break; - } - s->current_chunk = chunk; - } - return 0; -} - -static int dmg_read(BlockDriverState *bs, int64_t sector_num, - uint8_t *buf, int nb_sectors) -{ - BDRVDMGState *s = bs->opaque; - int i; - - for(i=0;i<nb_sectors;i++) { - uint32_t sector_offset_in_chunk; - if(dmg_read_chunk(s, sector_num+i) != 0) - return -1; - sector_offset_in_chunk = sector_num+i-s->sectors[s->current_chunk]; - memcpy(buf+i*512,s->uncompressed_chunk+sector_offset_in_chunk*512,512); - } - return 0; -} - -static void dmg_close(BlockDriverState *bs) -{ - BDRVDMGState *s = bs->opaque; - close(s->fd); - if(s->n_chunks>0) { - free(s->types); - free(s->offsets); - free(s->lengths); - free(s->sectors); - free(s->sectorcounts); - } - free(s->compressed_chunk); - free(s->uncompressed_chunk); - inflateEnd(&s->zstream); -} - -static BlockDriver bdrv_dmg = { - .format_name = "dmg", - .instance_size = sizeof(BDRVDMGState), - .bdrv_probe = dmg_probe, - .bdrv_open = dmg_open, - .bdrv_read = dmg_read, - .bdrv_close = dmg_close, -}; - -static void bdrv_dmg_init(void) -{ - bdrv_register(&bdrv_dmg); -} - -block_init(bdrv_dmg_init); diff --git a/qemu-0.11.0/block/nbd.c b/qemu-0.11.0/block/nbd.c deleted file mode 100644 index 47d4778..0000000 --- a/qemu-0.11.0/block/nbd.c +++ /dev/null @@ -1,196 +0,0 @@ -/* - * QEMU Block driver for NBD - * - * Copyright (C) 2008 Bull S.A.S. - * Author: Laurent Vivier Laurent.Vivier@bull.net - * - * Some parts: - * Copyright (C) 2007 Anthony Liguori anthony@codemonkey.ws - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "qemu-common.h" -#include "nbd.h" -#include "module.h" - -#include <sys/types.h> -#include <unistd.h> - -typedef struct BDRVNBDState { - int sock; - off_t size; - size_t blocksize; -} BDRVNBDState; - -static int nbd_open(BlockDriverState *bs, const char* filename, int flags) -{ - BDRVNBDState *s = bs->opaque; - const char *host; - const char *unixpath; - int sock; - off_t size; - size_t blocksize; - int ret; - - if ((flags & BDRV_O_CREAT)) - return -EINVAL; - - if (!strstart(filename, "nbd:", &host)) - return -EINVAL; - - if (strstart(host, "unix:", &unixpath)) { - - if (unixpath[0] != '/') - return -EINVAL; - - sock = unix_socket_outgoing(unixpath); - - } else { - uint16_t port; - char *p, *r; - char hostname[128]; - - pstrcpy(hostname, 128, host); - - p = strchr(hostname, ':'); - if (p == NULL) - return -EINVAL; - - *p = '\0'; - p++; - - port = strtol(p, &r, 0); - if (r == p) - return -EINVAL; - sock = tcp_socket_outgoing(hostname, port); - } - - if (sock == -1) - return -errno; - - ret = nbd_receive_negotiate(sock, &size, &blocksize); - if (ret == -1) - return -errno; - - s->sock = sock; - s->size = size; - s->blocksize = blocksize; - - return 0; -} - -static int nbd_read(BlockDriverState *bs, int64_t sector_num, - uint8_t *buf, int nb_sectors) -{ - BDRVNBDState *s = bs->opaque; - struct nbd_request request; - struct nbd_reply reply; - - request.type = NBD_CMD_READ; - request.handle = (uint64_t)(intptr_t)bs; - request.from = sector_num * 512;; - request.len = nb_sectors * 512; - - if (nbd_send_request(s->sock, &request) == -1) - return -errno; - - if (nbd_receive_reply(s->sock, &reply) == -1) - return -errno; - - if (reply.error !=0) - return -reply.error; - - if (reply.handle != request.handle) - return -EIO; - - if (nbd_wr_sync(s->sock, buf, request.len, 1) != request.len) - return -EIO; - - return 0; -} - -static int nbd_write(BlockDriverState *bs, int64_t sector_num, - const uint8_t *buf, int nb_sectors) -{ - BDRVNBDState *s = bs->opaque; - struct nbd_request request; - struct nbd_reply reply; - - request.type = NBD_CMD_WRITE; - request.handle = (uint64_t)(intptr_t)bs; - request.from = sector_num * 512;; - request.len = nb_sectors * 512; - - if (nbd_send_request(s->sock, &request) == -1) - return -errno; - - if (nbd_wr_sync(s->sock, (uint8_t*)buf, request.len, 0) != request.len) - return -EIO; - - if (nbd_receive_reply(s->sock, &reply) == -1) - return -errno; - - if (reply.error !=0) - return -reply.error; - - if (reply.handle != request.handle) - return -EIO; - - return 0; -} - -static void nbd_close(BlockDriverState *bs) -{ - BDRVNBDState *s = bs->opaque; - struct nbd_request request; - - request.type = NBD_CMD_DISC; - request.handle = (uint64_t)(intptr_t)bs; - request.from = 0; - request.len = 0; - nbd_send_request(s->sock, &request); - - close(s->sock); -} - -static int64_t nbd_getlength(BlockDriverState *bs) -{ - BDRVNBDState *s = bs->opaque; - - return s->size; -} - -static BlockDriver bdrv_nbd = { - .format_name = "nbd", - .instance_size = sizeof(BDRVNBDState), - .bdrv_open = nbd_open, - .bdrv_read = nbd_read, - .bdrv_write = nbd_write, - .bdrv_close = nbd_close, - .bdrv_getlength = nbd_getlength, - .protocol_name = "nbd", -}; - -static void bdrv_nbd_init(void) -{ - bdrv_register(&bdrv_nbd); -} - -block_init(bdrv_nbd_init); diff --git a/qemu-0.11.0/block/parallels.c b/qemu-0.11.0/block/parallels.c deleted file mode 100644 index 0b64a5c..0000000 --- a/qemu-0.11.0/block/parallels.c +++ /dev/null @@ -1,181 +0,0 @@ -/* - * Block driver for Parallels disk image format - * - * Copyright (c) 2007 Alex Beregszaszi - * - * This code is based on comparing different disk images created by Parallels. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -#include "qemu-common.h" -#include "block_int.h" -#include "module.h" - -/**************************************************************/ - -#define HEADER_MAGIC "WithoutFreeSpace" -#define HEADER_VERSION 2 -#define HEADER_SIZE 64 - -// always little-endian -struct parallels_header { - char magic[16]; // "WithoutFreeSpace" - uint32_t version; - uint32_t heads; - uint32_t cylinders; - uint32_t tracks; - uint32_t catalog_entries; - uint32_t nb_sectors; - char padding[24]; -} __attribute__((packed)); - -typedef struct BDRVParallelsState { - int fd; - - uint32_t *catalog_bitmap; - int catalog_size; - - int tracks; -} BDRVParallelsState; - -static int parallels_probe(const uint8_t *buf, int buf_size, const char *filename) -{ - const struct parallels_header *ph = (const void *)buf; - - if (buf_size < HEADER_SIZE) - return 0; - - if (!memcmp(ph->magic, HEADER_MAGIC, 16) && - (le32_to_cpu(ph->version) == HEADER_VERSION)) - return 100; - - return 0; -} - -static int parallels_open(BlockDriverState *bs, const char *filename, int flags) -{ - BDRVParallelsState *s = bs->opaque; - int fd, i; - struct parallels_header ph; - - fd = open(filename, O_RDWR | O_BINARY | O_LARGEFILE); - if (fd < 0) { - fd = open(filename, O_RDONLY | O_BINARY | O_LARGEFILE); - if (fd < 0) - return -1; - } - - bs->read_only = 1; // no write support yet - - s->fd = fd; - - if (read(fd, &ph, sizeof(ph)) != sizeof(ph)) - goto fail; - - if (memcmp(ph.magic, HEADER_MAGIC, 16) || - (le32_to_cpu(ph.version) != HEADER_VERSION)) { - goto fail; - } - - bs->total_sectors = le32_to_cpu(ph.nb_sectors); - - if (lseek(s->fd, 64, SEEK_SET) != 64) - goto fail; - - s->tracks = le32_to_cpu(ph.tracks); - - s->catalog_size = le32_to_cpu(ph.catalog_entries); - s->catalog_bitmap = qemu_malloc(s->catalog_size * 4); - if (read(s->fd, s->catalog_bitmap, s->catalog_size * 4) != - s->catalog_size * 4) - goto fail; - for (i = 0; i < s->catalog_size; i++) - le32_to_cpus(&s->catalog_bitmap[i]); - - return 0; -fail: - if (s->catalog_bitmap) - qemu_free(s->catalog_bitmap); - close(fd); - return -1; -} - -static inline int seek_to_sector(BlockDriverState *bs, int64_t sector_num) -{ - BDRVParallelsState *s = bs->opaque; - uint32_t index, offset, position; - - index = sector_num / s->tracks; - offset = sector_num % s->tracks; - - // not allocated - if ((index > s->catalog_size) || (s->catalog_bitmap[index] == 0)) - return -1; - - position = (s->catalog_bitmap[index] + offset) * 512; - -// fprintf(stderr, "sector: %llx index=%x offset=%x pointer=%x position=%x\n", -// sector_num, index, offset, s->catalog_bitmap[index], position); - - if (lseek(s->fd, position, SEEK_SET) != position) - return -1; - - return 0; -} - -static int parallels_read(BlockDriverState *bs, int64_t sector_num, - uint8_t *buf, int nb_sectors) -{ - BDRVParallelsState *s = bs->opaque; - - while (nb_sectors > 0) { - if (!seek_to_sector(bs, sector_num)) { - if (read(s->fd, buf, 512) != 512) - return -1; - } else - memset(buf, 0, 512); - nb_sectors--; - sector_num++; - buf += 512; - } - return 0; -} - -static void parallels_close(BlockDriverState *bs) -{ - BDRVParallelsState *s = bs->opaque; - qemu_free(s->catalog_bitmap); - close(s->fd); -} - -static BlockDriver bdrv_parallels = { - .format_name = "parallels", - .instance_size = sizeof(BDRVParallelsState), - .bdrv_probe = parallels_probe, - .bdrv_open = parallels_open, - .bdrv_read = parallels_read, - .bdrv_close = parallels_close, -}; - -static void bdrv_parallels_init(void) -{ - bdrv_register(&bdrv_parallels); -} - -block_init(bdrv_parallels_init); diff --git a/qemu-0.11.0/block/qcow.c b/qemu-0.11.0/block/qcow.c deleted file mode 100644 index 7fc85ae..0000000 --- a/qemu-0.11.0/block/qcow.c +++ /dev/null @@ -1,954 +0,0 @@ -/* - * Block driver for the QCOW format - * - * Copyright (c) 2004-2006 Fabrice Bellard - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -#include "qemu-common.h" -#include "block_int.h" -#include "module.h" -#include <zlib.h> -#include "aes.h" - -/**************************************************************/ -/* QEMU COW block driver with compression and encryption support */ - -#define QCOW_MAGIC (('Q' << 24) | ('F' << 16) | ('I' << 8) | 0xfb) -#define QCOW_VERSION 1 - -#define QCOW_CRYPT_NONE 0 -#define QCOW_CRYPT_AES 1 - -#define QCOW_OFLAG_COMPRESSED (1LL << 63) - -typedef struct QCowHeader { - uint32_t magic; - uint32_t version; - uint64_t backing_file_offset; - uint32_t backing_file_size; - uint32_t mtime; - uint64_t size; /* in bytes */ - uint8_t cluster_bits; - uint8_t l2_bits; - uint32_t crypt_method; - uint64_t l1_table_offset; -} QCowHeader; - -#define L2_CACHE_SIZE 16 - -typedef struct BDRVQcowState { - BlockDriverState *hd; - int cluster_bits; - int cluster_size; - int cluster_sectors; - int l2_bits; - int l2_size; - int l1_size; - uint64_t cluster_offset_mask; - uint64_t l1_table_offset; - uint64_t *l1_table; - uint64_t *l2_cache; - uint64_t l2_cache_offsets[L2_CACHE_SIZE]; - uint32_t l2_cache_counts[L2_CACHE_SIZE]; - uint8_t *cluster_cache; - uint8_t *cluster_data; - uint64_t cluster_cache_offset; - uint32_t crypt_method; /* current crypt method, 0 if no key yet */ - uint32_t crypt_method_header; - AES_KEY aes_encrypt_key; - AES_KEY aes_decrypt_key; -} BDRVQcowState; - -static int decompress_cluster(BDRVQcowState *s, uint64_t cluster_offset); - -static int qcow_probe(const uint8_t *buf, int buf_size, const char *filename) -{ - const QCowHeader *cow_header = (const void *)buf; - - if (buf_size >= sizeof(QCowHeader) && - be32_to_cpu(cow_header->magic) == QCOW_MAGIC && - be32_to_cpu(cow_header->version) == QCOW_VERSION) - return 100; - else - return 0; -} - -static int qcow_open(BlockDriverState *bs, const char *filename, int flags) -{ - BDRVQcowState *s = bs->opaque; - int len, i, shift, ret; - QCowHeader header; - - ret = bdrv_file_open(&s->hd, filename, flags); - if (ret < 0) - return ret; - if (bdrv_pread(s->hd, 0, &header, sizeof(header)) != sizeof(header)) - goto fail; - be32_to_cpus(&header.magic); - be32_to_cpus(&header.version); - be64_to_cpus(&header.backing_file_offset); - be32_to_cpus(&header.backing_file_size); - be32_to_cpus(&header.mtime); - be64_to_cpus(&header.size); - be32_to_cpus(&header.crypt_method); - be64_to_cpus(&header.l1_table_offset); - - if (header.magic != QCOW_MAGIC || header.version != QCOW_VERSION) - goto fail; - if (header.size <= 1 || header.cluster_bits < 9) - goto fail; - if (header.crypt_method > QCOW_CRYPT_AES) - goto fail; - s->crypt_method_header = header.crypt_method; - if (s->crypt_method_header) - bs->encrypted = 1; - s->cluster_bits = header.cluster_bits; - s->cluster_size = 1 << s->cluster_bits; - s->cluster_sectors = 1 << (s->cluster_bits - 9); - s->l2_bits = header.l2_bits; - s->l2_size = 1 << s->l2_bits; - bs->total_sectors = header.size / 512; - s->cluster_offset_mask = (1LL << (63 - s->cluster_bits)) - 1; - - /* read the level 1 table */ - shift = s->cluster_bits + s->l2_bits; - s->l1_size = (header.size + (1LL << shift) - 1) >> shift; - - s->l1_table_offset = header.l1_table_offset; - s->l1_table = qemu_malloc(s->l1_size * sizeof(uint64_t)); - if (!s->l1_table) - goto fail; - if (bdrv_pread(s->hd, s->l1_table_offset, s->l1_table, s->l1_size * sizeof(uint64_t)) != - s->l1_size * sizeof(uint64_t)) - goto fail; - for(i = 0;i < s->l1_size; i++) { - be64_to_cpus(&s->l1_table[i]); - } - /* alloc L2 cache */ - s->l2_cache = qemu_malloc(s->l2_size * L2_CACHE_SIZE * sizeof(uint64_t)); - if (!s->l2_cache) - goto fail; - s->cluster_cache = qemu_malloc(s->cluster_size); - if (!s->cluster_cache) - goto fail; - s->cluster_data = qemu_malloc(s->cluster_size); - if (!s->cluster_data) - goto fail; - s->cluster_cache_offset = -1; - - /* read the backing file name */ - if (header.backing_file_offset != 0) { - len = header.backing_file_size; - if (len > 1023) - len = 1023; - if (bdrv_pread(s->hd, header.backing_file_offset, bs->backing_file, len) != len) - goto fail; - bs->backing_file[len] = '\0'; - } - return 0; - - fail: - qemu_free(s->l1_table); - qemu_free(s->l2_cache); - qemu_free(s->cluster_cache); - qemu_free(s->cluster_data); - bdrv_delete(s->hd); - return -1; -} - -static int qcow_set_key(BlockDriverState *bs, const char *key) -{ - BDRVQcowState *s = bs->opaque; - uint8_t keybuf[16]; - int len, i; - - memset(keybuf, 0, 16); - len = strlen(key); - if (len > 16) - len = 16; - /* XXX: we could compress the chars to 7 bits to increase - entropy */ - for(i = 0;i < len;i++) { - keybuf[i] = key[i]; - } - s->crypt_method = s->crypt_method_header; - - if (AES_set_encrypt_key(keybuf, 128, &s->aes_encrypt_key) != 0) - return -1; - if (AES_set_decrypt_key(keybuf, 128, &s->aes_decrypt_key) != 0) - return -1; -#if 0 - /* test */ - { - uint8_t in[16]; - uint8_t out[16]; - uint8_t tmp[16]; - for(i=0;i<16;i++) - in[i] = i; - AES_encrypt(in, tmp, &s->aes_encrypt_key); - AES_decrypt(tmp, out, &s->aes_decrypt_key); - for(i = 0; i < 16; i++) - printf(" %02x", tmp[i]); - printf("\n"); - for(i = 0; i < 16; i++) - printf(" %02x", out[i]); - printf("\n"); - } -#endif - return 0; -} - -/* The crypt function is compatible with the linux cryptoloop - algorithm for < 4 GB images. NOTE: out_buf == in_buf is - supported */ -static void encrypt_sectors(BDRVQcowState *s, int64_t sector_num, - uint8_t *out_buf, const uint8_t *in_buf, - int nb_sectors, int enc, - const AES_KEY *key) -{ - union { - uint64_t ll[2]; - uint8_t b[16]; - } ivec; - int i; - - for(i = 0; i < nb_sectors; i++) { - ivec.ll[0] = cpu_to_le64(sector_num); - ivec.ll[1] = 0; - AES_cbc_encrypt(in_buf, out_buf, 512, key, - ivec.b, enc); - sector_num++; - in_buf += 512; - out_buf += 512; - } -} - -/* 'allocate' is: - * - * 0 to not allocate. - * - * 1 to allocate a normal cluster (for sector indexes 'n_start' to - * 'n_end') - * - * 2 to allocate a compressed cluster of size - * 'compressed_size'. 'compressed_size' must be > 0 and < - * cluster_size - * - * return 0 if not allocated. - */ -static uint64_t get_cluster_offset(BlockDriverState *bs, - uint64_t offset, int allocate, - int compressed_size, - int n_start, int n_end) -{ - BDRVQcowState *s = bs->opaque; - int min_index, i, j, l1_index, l2_index; - uint64_t l2_offset, *l2_table, cluster_offset, tmp; - uint32_t min_count; - int new_l2_table; - - l1_index = offset >> (s->l2_bits + s->cluster_bits); - l2_offset = s->l1_table[l1_index]; - new_l2_table = 0; - if (!l2_offset) { - if (!allocate) - return 0; - /* allocate a new l2 entry */ - l2_offset = bdrv_getlength(s->hd); - /* round to cluster size */ - l2_offset = (l2_offset + s->cluster_size - 1) & ~(s->cluster_size - 1); - /* update the L1 entry */ - s->l1_table[l1_index] = l2_offset; - tmp = cpu_to_be64(l2_offset); - if (bdrv_pwrite(s->hd, s->l1_table_offset + l1_index * sizeof(tmp), - &tmp, sizeof(tmp)) != sizeof(tmp)) - return 0; - new_l2_table = 1; - } - for(i = 0; i < L2_CACHE_SIZE; i++) { - if (l2_offset == s->l2_cache_offsets[i]) { - /* increment the hit count */