├── .gitignore ├── .gitmodules ├── CODING_STYLE ├── COPYING ├── COPYING.LIB ├── Changelog ├── HACKING ├── LICENSE ├── MAINTAINERS ├── Makefile ├── Makefile.dis ├── Makefile.hw ├── Makefile.objs ├── Makefile.target ├── Makefile.user ├── QMP ├── README ├── qmp-events.txt ├── qmp-shell ├── qmp-spec.txt ├── qmp.py └── vm-info ├── README ├── TODO ├── VERSION ├── a.out.h ├── acl.c ├── acl.h ├── aes.c ├── aes.h ├── aio.c ├── alpha-dis.c ├── alpha.ld ├── arch_init.c ├── arch_init.h ├── arm-dis.c ├── arm-semi.c ├── arm.ld ├── async.c ├── audio ├── alsaaudio.c ├── audio.c ├── audio.h ├── audio_int.h ├── audio_pt_int.c ├── audio_pt_int.h ├── audio_template.h ├── audio_win_int.c ├── audio_win_int.h ├── coreaudio.c ├── dsound_template.h ├── dsoundaudio.c ├── esdaudio.c ├── fmodaudio.c ├── mixeng.c ├── mixeng.h ├── mixeng_template.h ├── noaudio.c ├── ossaudio.c ├── paaudio.c ├── rate_template.h ├── sdlaudio.c ├── wavaudio.c ├── wavcapture.c └── winwaveaudio.c ├── balloon.c ├── balloon.h ├── block-migration.c ├── block-migration.h ├── block.c ├── block.h ├── block ├── blkdebug.c ├── bochs.c ├── cloop.c ├── cow.c ├── curl.c ├── dmg.c ├── nbd.c ├── parallels.c ├── qcow.c ├── qcow2-cluster.c ├── qcow2-refcount.c ├── qcow2-snapshot.c ├── qcow2.c ├── qcow2.h ├── raw-posix-aio.h ├── raw-posix.c ├── raw-win32.c ├── raw.c ├── sheepdog.c ├── vdi.c ├── vmdk.c ├── vpc.c └── vvfat.c ├── block_int.h ├── blockdev.c ├── blockdev.h ├── bsd-user ├── bsd-mman.h ├── bsdload.c ├── elfload.c ├── errno_defs.h ├── freebsd │ ├── strace.list │ └── syscall_nr.h ├── i386 │ ├── syscall.h │ └── target_signal.h ├── main.c ├── mmap.c ├── netbsd │ ├── strace.list │ └── syscall_nr.h ├── openbsd │ ├── strace.list │ └── syscall_nr.h ├── qemu-types.h ├── qemu.h ├── signal.c ├── sparc │ ├── syscall.h │ └── target_signal.h ├── sparc64 │ ├── syscall.h │ └── target_signal.h ├── strace.c ├── syscall.c ├── syscall_defs.h ├── uaccess.c └── x86_64 │ ├── syscall.h │ └── target_signal.h ├── bswap.h ├── bt-host.c ├── bt-host.h ├── bt-vhci.c ├── buffered_file.c ├── buffered_file.h ├── cache-utils.c ├── cache-utils.h ├── check-qdict.c ├── check-qfloat.c ├── check-qint.c ├── check-qjson.c ├── check-qlist.c ├── check-qstring.c ├── cmd.c ├── cmd.h ├── config.h ├── configure ├── console.c ├── console.h ├── cpu-all.h ├── cpu-common.h ├── cpu-defs.h ├── cpu-exec.c ├── cpus.c ├── cpus.h ├── create_config ├── cris-dis.c ├── cursor.c ├── cursor_hidden.xpm ├── cursor_left_ptr.xpm ├── cutils.c ├── darwin-user ├── commpage.c ├── ioctls.h ├── ioctls_types.h ├── machload.c ├── main.c ├── mmap.c ├── qemu.h ├── signal.c ├── syscall.c └── syscalls.h ├── def-helper.h ├── default-configs ├── alpha-linux-user.mak ├── arm-linux-user.mak ├── arm-softmmu.mak ├── armeb-linux-user.mak ├── cris-linux-user.mak ├── cris-softmmu.mak ├── i386-bsd-user.mak ├── i386-darwin-user.mak ├── i386-linux-user.mak ├── i386-softmmu.mak ├── m68k-linux-user.mak ├── m68k-softmmu.mak ├── microblaze-linux-user.mak ├── microblaze-softmmu.mak ├── mips-linux-user.mak ├── mips-softmmu.mak ├── mips64-softmmu.mak ├── mips64el-softmmu.mak ├── mipsel-linux-user.mak ├── mipsel-softmmu.mak ├── ppc-darwin-user.mak ├── ppc-linux-user.mak ├── ppc-softmmu.mak ├── ppc64-linux-user.mak ├── ppc64-softmmu.mak ├── ppc64abi32-linux-user.mak ├── ppcemb-softmmu.mak ├── s390x-softmmu.mak ├── sh4-linux-user.mak ├── sh4-softmmu.mak ├── sh4eb-linux-user.mak ├── sh4eb-softmmu.mak ├── sparc-bsd-user.mak ├── sparc-linux-user.mak ├── sparc-softmmu.mak ├── sparc32plus-linux-user.mak ├── sparc64-bsd-user.mak ├── sparc64-linux-user.mak ├── sparc64-softmmu.mak ├── x86_64-bsd-user.mak ├── x86_64-linux-user.mak └── x86_64-softmmu.mak ├── device_tree.c ├── device_tree.h ├── dis-asm.h ├── disas.c ├── disas.h ├── dma-helpers.c ├── dma.h ├── docs ├── migration.txt ├── qdev-device-use.txt ├── specs │ └── ivshmem_device_spec.txt └── tracing.txt ├── dyngen-exec.h ├── elf.h ├── envlist.c ├── envlist.h ├── exec-all.h ├── exec.c ├── feature_to_c.sh ├── fpu ├── softfloat-macros.h ├── softfloat-native.c ├── softfloat-native.h ├── softfloat-specialize.h ├── softfloat.c └── softfloat.h ├── fsdev ├── qemu-fsdev.c └── qemu-fsdev.h ├── gdb-xml ├── arm-core.xml ├── arm-neon.xml ├── arm-vfp.xml ├── arm-vfp3.xml ├── cf-core.xml ├── cf-fp.xml ├── power-altivec.xml ├── power-core.xml ├── power-fpu.xml ├── power-spe.xml └── power64-core.xml ├── gdbstub.c ├── gdbstub.h ├── gen-icount.h ├── host-utils.c ├── host-utils.h ├── hpet.h ├── hppa-dis.c ├── hppa.ld ├── hw ├── 9p.h ├── a9mpcore.c ├── ac97.c ├── acpi.c ├── acpi.h ├── acpi_piix4.c ├── adb.c ├── adlib.c ├── ads7846.c ├── alpha_palcode.c ├── an5206.c ├── apb_pci.c ├── apb_pci.h ├── apic.c ├── apic.h ├── apm.c ├── apm.h ├── applesmc.c ├── arm-misc.h ├── arm11mpcore.c ├── arm_boot.c ├── arm_gic.c ├── arm_pic.c ├── arm_sysctl.c ├── arm_timer.c ├── armv7m.c ├── armv7m_nvic.c ├── audiodev.h ├── axis_dev88.c ├── baum.c ├── baum.h ├── bitbang_i2c.c ├── bitbang_i2c.h ├── blizzard.c ├── blizzard_template.h ├── boards.h ├── bonito.c ├── bt-hci-csr.c ├── bt-hci.c ├── bt-hid.c ├── bt-l2cap.c ├── bt-sdp.c ├── bt.c ├── bt.h ├── cbus.c ├── cdrom.c ├── cirrus_vga.c ├── cirrus_vga_rop.h ├── cirrus_vga_rop2.h ├── cris-boot.c ├── cris-boot.h ├── cris_pic_cpu.c ├── cs4231.c ├── cs4231a.c ├── cuda.c ├── debugcon.c ├── dec_pci.c ├── dec_pci.h ├── device-hotplug.c ├── devices.h ├── dma.c ├── dp8393x.c ├── ds1225y.c ├── ds1338.c ├── dummy_m68k.c ├── e1000.c ├── e1000_hw.h ├── ecc.c ├── eccmemctl.c ├── eepro100.c ├── eeprom93xx.c ├── eeprom93xx.h ├── elf_ops.h ├── empty_slot.c ├── empty_slot.h ├── es1370.c ├── escc.c ├── escc.h ├── esp.c ├── esp.h ├── etraxfs.c ├── etraxfs.h ├── etraxfs_dma.c ├── etraxfs_dma.h ├── etraxfs_eth.c ├── etraxfs_pic.c ├── etraxfs_ser.c ├── etraxfs_timer.c ├── event_notifier.c ├── event_notifier.h ├── fdc.c ├── fdc.h ├── file-op-9p.h ├── firmware_abi.h ├── flash.h ├── fmopl.c ├── fmopl.h ├── framebuffer.c ├── framebuffer.h ├── fw_cfg.c ├── fw_cfg.h ├── g364fb.c ├── grackle_pci.c ├── gt64xxx.c ├── gumstix.c ├── gus.c ├── gusemu.h ├── gusemu_hal.c ├── gusemu_mixer.c ├── gustate.h ├── heathrow_pic.c ├── hpet.c ├── hpet_emul.h ├── hw.h ├── i2c.c ├── i2c.h ├── i8254.c ├── i8259.c ├── ide.h ├── ide │ ├── cmd646.c │ ├── core.c │ ├── internal.h │ ├── isa.c │ ├── macio.c │ ├── microdrive.c │ ├── mmio.c │ ├── pci.c │ ├── pci.h │ ├── piix.c │ ├── qdev.c │ └── via.c ├── integratorcp.c ├── ioapic.c ├── irq.c ├── irq.h ├── isa-bus.c ├── isa.h ├── isa_mmio.c ├── ivshmem.c ├── jazz_led.c ├── lan9118.c ├── lance.c ├── lm832x.c ├── loader.c ├── loader.h ├── lsi53c895a.c ├── m48t59.c ├── mac_dbdma.c ├── mac_dbdma.h ├── mac_nvram.c ├── macio.c ├── mainstone.c ├── mainstone.h ├── marvell_88w8618_audio.c ├── max111x.c ├── max7310.c ├── mc146818rtc.c ├── mc146818rtc.h ├── mcf.h ├── mcf5206.c ├── mcf5208.c ├── mcf_fec.c ├── mcf_intc.c ├── mcf_uart.c ├── microblaze_pic_cpu.c ├── mips-bios.h ├── mips.h ├── mips_addr.c ├── mips_cpudevs.h ├── mips_fulong2e.c ├── mips_int.c ├── mips_jazz.c ├── mips_malta.c ├── mips_mipssim.c ├── mips_r4k.c ├── mips_timer.c ├── mipsnet.c ├── mpcore.c ├── msix.c ├── msix.h ├── msmouse.c ├── msmouse.h ├── mst_fpga.c ├── multiboot.c ├── multiboot.h ├── musicpal.c ├── nand.c ├── ne2000-isa.c ├── ne2000.c ├── ne2000.h ├── nseries.c ├── nvram.h ├── omap.h ├── omap1.c ├── omap2.c ├── omap_clk.c ├── omap_dma.c ├── omap_dss.c ├── omap_gpio.c ├── omap_gpmc.c ├── omap_gptimer.c ├── omap_i2c.c ├── omap_intc.c ├── omap_l4.c ├── omap_lcd_template.h ├── omap_lcdc.c ├── omap_mmc.c ├── omap_sdrc.c ├── omap_spi.c ├── omap_sx1.c ├── omap_synctimer.c ├── omap_tap.c ├── omap_uart.c ├── onenand.c ├── openpic.c ├── openpic.h ├── palm.c ├── parallel.c ├── pc.c ├── pc.h ├── pc_piix.c ├── pci-hotplug.c ├── pci.c ├── pci.h ├── pci_host.c ├── pci_host.h ├── pci_ids.h ├── pci_regs.h ├── pcie_host.c ├── pcie_host.h ├── pckbd.c ├── pcmcia.h ├── pcnet.c ├── pcnet.h ├── pcspk.c ├── petalogix_s3adsp1800_mmu.c ├── pflash_cfi01.c ├── pflash_cfi02.c ├── piix4.c ├── piix_pci.c ├── pixel_ops.h ├── pl011.c ├── pl022.c ├── pl031.c ├── pl050.c ├── pl061.c ├── pl080.c ├── pl110.c ├── pl110_template.h ├── pl181.c ├── pl190.c ├── pm_smbus.c ├── pm_smbus.h ├── ppc.c ├── ppc.h ├── ppc405.h ├── ppc405_boards.c ├── ppc405_uc.c ├── ppc440.c ├── ppc440.h ├── ppc440_bamboo.c ├── ppc4xx.h ├── ppc4xx_devs.c ├── ppc4xx_pci.c ├── ppc_mac.h ├── ppc_newworld.c ├── ppc_oldworld.c ├── ppc_prep.c ├── ppce500.h ├── ppce500_mpc8544ds.c ├── ppce500_pci.c ├── prep_pci.c ├── prep_pci.h ├── primecell.h ├── ps2.c ├── ps2.h ├── ptimer.c ├── pxa.h ├── pxa2xx.c ├── pxa2xx_dma.c ├── pxa2xx_gpio.c ├── pxa2xx_keypad.c ├── pxa2xx_lcd.c ├── pxa2xx_mmci.c ├── pxa2xx_pcmcia.c ├── pxa2xx_pic.c ├── pxa2xx_template.h ├── pxa2xx_timer.c ├── qdev-addr.c ├── qdev-addr.h ├── qdev-properties.c ├── qdev.c ├── qdev.h ├── r2d.c ├── rc4030.c ├── realview.c ├── realview_gic.c ├── rtl8139.c ├── s390-virtio-bus.c ├── s390-virtio-bus.h ├── s390-virtio.c ├── sb16.c ├── sbi.c ├── scsi-bus.c ├── scsi-defs.h ├── scsi-disk.c ├── scsi-generic.c ├── scsi.h ├── sd.c ├── sd.h ├── serial.c ├── sh.h ├── sh7750.c ├── sh7750_regnames.c ├── sh7750_regnames.h ├── sh7750_regs.h ├── sh_intc.c ├── sh_intc.h ├── sh_pci.c ├── sh_pci.h ├── sh_serial.c ├── sh_timer.c ├── sharpsl.h ├── shix.c ├── slavio_intctl.c ├── slavio_misc.c ├── slavio_timer.c ├── sm501.c ├── sm501_template.h ├── smbios.c ├── smbios.h ├── smbus.c ├── smbus.h ├── smbus_eeprom.c ├── smc91c111.c ├── soc_dma.c ├── soc_dma.h ├── sparc32_dma.c ├── sparc32_dma.h ├── spitz.c ├── ssd0303.c ├── ssd0323.c ├── ssi-sd.c ├── ssi.c ├── ssi.h ├── stellaris.c ├── stellaris_enet.c ├── stellaris_input.c ├── sun4c_intctl.c ├── sun4m.c ├── sun4m.h ├── sun4m_iommu.c ├── sun4u.c ├── syborg.c ├── syborg.h ├── syborg_fb.c ├── syborg_interrupt.c ├── syborg_keyboard.c ├── syborg_pointer.c ├── syborg_rtc.c ├── syborg_serial.c ├── syborg_timer.c ├── syborg_virtio.c ├── sysbus.c ├── sysbus.h ├── tc58128.c ├── tc6393xb.c ├── tc6393xb_template.h ├── tcx.c ├── tmp105.c ├── tosa.c ├── tsc2005.c ├── tsc210x.c ├── tusb6010.c ├── twl92230.c ├── unin_pci.c ├── usb-bt.c ├── usb-bus.c ├── usb-hid.c ├── usb-hub.c ├── usb-msd.c ├── usb-musb.c ├── usb-net.c ├── usb-ohci.c ├── usb-ohci.h ├── usb-serial.c ├── usb-uhci.c ├── usb-uhci.h ├── usb-wacom.c ├── usb.c ├── usb.h ├── versatile_pci.c ├── versatilepb.c ├── vga-isa-mm.c ├── vga-isa.c ├── vga-pci.c ├── vga.c ├── vga_int.h ├── vga_template.h ├── vhost.c ├── vhost.h ├── vhost_net.c ├── vhost_net.h ├── virtio-9p-debug.c ├── virtio-9p-debug.h ├── virtio-9p-local.c ├── virtio-9p.c ├── virtio-9p.h ├── virtio-balloon.c ├── virtio-balloon.h ├── virtio-blk.c ├── virtio-blk.h ├── virtio-console.c ├── virtio-net.c ├── virtio-net.h ├── virtio-pci.c ├── virtio-serial-bus.c ├── virtio-serial.h ├── virtio.c ├── virtio.h ├── vmmouse.c ├── vmport.c ├── vmware_vga.c ├── vmware_vga.h ├── vt82c686.c ├── vt82c686.h ├── watchdog.c ├── watchdog.h ├── wdt_i6300esb.c ├── wdt_ib700.c ├── wm8750.c ├── xen.h ├── xen_backend.c ├── xen_backend.h ├── xen_blkif.h ├── xen_common.h ├── xen_console.c ├── xen_devconfig.c ├── xen_disk.c ├── xen_domainbuild.c ├── xen_domainbuild.h ├── xen_machine_pv.c ├── xen_nic.c ├── xenfb.c ├── xilinx.h ├── xilinx_ethlite.c ├── xilinx_intc.c ├── xilinx_timer.c ├── xilinx_uartlite.c └── zaurus.c ├── hxtool ├── i386-dis.c ├── i386.ld ├── ia64-dis.c ├── ia64.ld ├── input.c ├── ioport-user.c ├── ioport.c ├── ioport.h ├── iov.c ├── iov.h ├── json-lexer.c ├── json-lexer.h ├── json-parser.c ├── json-parser.h ├── json-streamer.c ├── json-streamer.h ├── kvm-all.c ├── kvm-stub.c ├── kvm.h ├── libfdt_env.h ├── linux-aio.c ├── linux-user ├── alpha │ ├── syscall.h │ ├── syscall_nr.h │ ├── target_signal.h │ └── termbits.h ├── arm │ ├── nwfpe │ │ ├── double_cpdo.c │ │ ├── extended_cpdo.c │ │ ├── fpa11.c │ │ ├── fpa11.h │ │ ├── fpa11.inl │ │ ├── fpa11_cpdo.c │ │ ├── fpa11_cpdt.c │ │ ├── fpa11_cprt.c │ │ ├── fpopcode.c │ │ ├── fpopcode.h │ │ ├── fpsr.h │ │ └── single_cpdo.c │ ├── syscall.h │ ├── syscall_nr.h │ ├── target_signal.h │ └── termbits.h ├── cpu-uname.c ├── cpu-uname.h ├── cris │ ├── syscall.h │ ├── syscall_nr.h │ ├── target_signal.h │ └── termbits.h ├── elfload.c ├── errno_defs.h ├── flat.h ├── flatload.c ├── i386 │ ├── syscall.h │ ├── syscall_nr.h │ ├── target_signal.h │ └── termbits.h ├── ioctls.h ├── linux_loop.h ├── linuxload.c ├── m68k-sim.c ├── m68k │ ├── syscall.h │ ├── syscall_nr.h │ ├── target_signal.h │ └── termbits.h ├── main.c ├── microblaze │ ├── syscall.h │ ├── syscall_nr.h │ ├── target_signal.h │ └── termbits.h ├── mips │ ├── syscall.h │ ├── syscall_nr.h │ ├── target_signal.h │ └── termbits.h ├── mips64 │ ├── syscall.h │ ├── syscall_nr.h │ ├── target_signal.h │ └── termbits.h ├── mipsn32 │ ├── syscall.h │ ├── syscall_nr.h │ ├── target_signal.h │ └── termbits.h ├── mmap.c ├── ppc │ ├── syscall.h │ ├── syscall_nr.h │ ├── target_signal.h │ └── termbits.h ├── qemu-types.h ├── qemu.h ├── sh4 │ ├── syscall.h │ ├── syscall_nr.h │ ├── target_signal.h │ └── termbits.h ├── signal.c ├── socket.h ├── sparc │ ├── syscall.h │ ├── syscall_nr.h │ ├── target_signal.h │ └── termbits.h ├── sparc64 │ ├── syscall.h │ ├── syscall_nr.h │ ├── target_signal.h │ └── termbits.h ├── strace.c ├── strace.list ├── syscall.c ├── syscall_defs.h ├── syscall_types.h ├── uaccess.c ├── vm86.c └── x86_64 │ ├── syscall.h │ ├── syscall_nr.h │ ├── target_signal.h │ └── termbits.h ├── m68k-dis.c ├── m68k-semi.c ├── m68k.ld ├── microblaze-dis.c ├── migration-exec.c ├── migration-fd.c ├── migration-tcp.c ├── migration-unix.c ├── migration.c ├── migration.h ├── mips-dis.c ├── mips.ld ├── module.c ├── module.h ├── monitor.c ├── monitor.h ├── nbd.c ├── nbd.h ├── net-checksum.c ├── net.c ├── net.h ├── net ├── checksum.c ├── checksum.h ├── dump.c ├── dump.h ├── queue.c ├── queue.h ├── slirp.c ├── slirp.h ├── socket.c ├── socket.h ├── tap-aix.c ├── tap-bsd.c ├── tap-linux.c ├── tap-linux.h ├── tap-solaris.c ├── tap-win32.c ├── tap.c ├── tap.h ├── util.c ├── util.h ├── vde.c └── vde.h ├── notify.c ├── notify.h ├── os-posix.c ├── os-win32.c ├── osdep.c ├── osdep.h ├── path.c ├── pc-bios ├── Makefile ├── README ├── bamboo.dtb ├── bamboo.dts ├── bios.bin ├── gpxe-eepro100-80861209.rom ├── gpxe-eepro100-80861229.rom ├── keymaps │ ├── ar │ ├── common │ ├── da │ ├── de │ ├── de-ch │ ├── en-gb │ ├── en-us │ ├── es │ ├── et │ ├── fi │ ├── fo │ ├── fr │ ├── fr-be │ ├── fr-ca │ ├── fr-ch │ ├── hr │ ├── hu │ ├── is │ ├── it │ ├── ja │ ├── lt │ ├── lv │ ├── mk │ ├── modifiers │ ├── nl │ ├── nl-be │ ├── no │ ├── pl │ ├── pt │ ├── pt-br │ ├── ru │ ├── sl │ ├── sv │ ├── th │ └── tr ├── linuxboot.bin ├── mpc8544ds.dtb ├── mpc8544ds.dts ├── multiboot.bin ├── ohw.diff ├── openbios-ppc ├── openbios-sparc32 ├── openbios-sparc64 ├── optionrom │ ├── Makefile │ ├── linuxboot.S │ ├── multiboot.S │ ├── optionrom.h │ └── signrom.sh ├── petalogix-s3adsp1800.dtb ├── ppc_rom.bin ├── pxe-e1000.bin ├── pxe-ne2k_pci.bin ├── pxe-pcnet.bin ├── pxe-rtl8139.bin ├── pxe-virtio.bin ├── s390-zipl.rom ├── vgabios-cirrus.bin ├── vgabios.bin └── video.x ├── pci-ids.txt ├── poison.h ├── posix-aio-compat.c ├── ppc-dis.c ├── ppc.ld ├── ppc64.ld ├── qbool.c ├── qbool.h ├── qdict-test-data.txt ├── qdict.c ├── qdict.h ├── qemu-aio.h ├── qemu-barrier.h ├── qemu-binfmt-conf.sh ├── qemu-char.c ├── qemu-char.h ├── qemu-common.h ├── qemu-config.c ├── qemu-config.h ├── qemu-doc.texi ├── qemu-error.c ├── qemu-error.h ├── qemu-img-cmds.hx ├── qemu-img.c ├── qemu-img.texi ├── qemu-io.c ├── qemu-lock.h ├── qemu-log.h ├── qemu-malloc.c ├── qemu-monitor.hx ├── qemu-nbd.c ├── qemu-nbd.texi ├── qemu-objects.h ├── qemu-option.c ├── qemu-option.h ├── qemu-options.h ├── qemu-options.hx ├── qemu-os-posix.h ├── qemu-os-win32.h ├── qemu-queue.h ├── qemu-sockets.c ├── qemu-tech.texi ├── qemu-thread.c ├── qemu-thread.h ├── qemu-timer.c ├── qemu-timer.h ├── qemu-tool.c ├── qemu-x509.h ├── qemu.sasl ├── qemu_socket.h ├── qerror.c ├── qerror.h ├── qfloat.c ├── qfloat.h ├── qint.c ├── qint.h ├── qjson.c ├── qjson.h ├── qlist.c ├── qlist.h ├── qobject.h ├── qstring.c ├── qstring.h ├── readline.c ├── readline.h ├── rules.mak ├── runit.sh ├── rwhandler.c ├── rwhandler.h ├── s390-dis.c ├── s390.ld ├── savevm.c ├── sh4-dis.c ├── simpletrace.c ├── simpletrace.h ├── simpletrace.py ├── slirp ├── COPYRIGHT ├── bootp.c ├── bootp.h ├── cksum.c ├── debug.h ├── if.c ├── if.h ├── ip.h ├── ip_icmp.c ├── ip_icmp.h ├── ip_input.c ├── ip_output.c ├── libslirp.h ├── main.h ├── mbuf.c ├── mbuf.h ├── misc.c ├── misc.h ├── sbuf.c ├── sbuf.h ├── slirp.c ├── slirp.h ├── slirp_config.h ├── socket.c ├── socket.h ├── tcp.h ├── tcp_input.c ├── tcp_output.c ├── tcp_subr.c ├── tcp_timer.c ├── tcp_timer.h ├── tcp_var.h ├── tcpip.h ├── tftp.c ├── tftp.h ├── udp.c └── udp.h ├── softmmu-semi.h ├── softmmu_defs.h ├── softmmu_exec.h ├── softmmu_header.h ├── softmmu_template.h ├── sparc-dis.c ├── sparc.ld ├── sparc64.ld ├── sysconfigs └── target │ └── target-x86_64.conf ├── sysemu.h ├── tags ├── target-alpha ├── STATUS ├── cpu.h ├── exec.h ├── helper.c ├── helper.h ├── op_helper.c └── translate.c ├── target-arm ├── cpu.h ├── exec.h ├── helper.c ├── helpers.h ├── iwmmxt_helper.c ├── machine.c ├── neon_helper.c ├── op_addsub.h ├── op_helper.c └── translate.c ├── target-cris ├── cpu.h ├── crisv10-decode.h ├── crisv32-decode.h ├── exec.h ├── helper.c ├── helper.h ├── machine.c ├── mmu.c ├── mmu.h ├── op_helper.c ├── opcode-cris.h ├── translate.c └── translate_v10.c ├── target-i386 ├── BUGS ├── FLX_FAQ ├── FLX_README ├── FLX_TODO ├── PyQEMU.py ├── PyQEMU.py.bak ├── TODO ├── analysis │ ├── dump-analysis.py │ ├── dumpreader.py │ └── ida_mark_functions.py ├── analyze │ ├── analyze.py │ ├── callgraph.py │ ├── flxstats.py │ ├── graphauswertung.py │ └── viewgraph.py ├── configuration │ └── flx.json ├── cpu.h ├── cpuid.c ├── exec.h ├── flx_arithwindow.c ├── flx_arithwindow.h ├── flx_bbl.c ├── flx_bbl.h ├── flx_bbltrace.c ├── flx_bbltrace.h ├── flx_bbltranslate.c ├── flx_bbltranslate.h ├── flx_bblwindow.c ├── flx_bblwindow.h ├── flx_breakpoint.c ├── flx_breakpoint.h ├── flx_caballero.c ├── flx_caballero.h ├── flx_calltrace.c ├── flx_calltrace.h ├── flx_codesearch.c ├── flx_codesearch.h ├── flx_constsearch.c ├── flx_constsearch.h ├── flx_context.c ├── flx_context.h ├── flx_disas.c ├── flx_disas.h ├── flx_dump.c ├── flx_dump.h ├── flx_entropy.c ├── flx_entropy.h ├── flx_environment.c ├── flx_environment.h ├── flx_filter.c ├── flx_filter.h ├── flx_functionentropy.c ├── flx_functionentropy.h ├── flx_functiontaint.c ├── flx_functiontaint.h ├── flx_functiontrace.c ├── flx_functiontrace.h ├── flx_graph.c ├── flx_graph.h ├── flx_hashmap.c ├── flx_hashmap.h ├── flx_hooking.h ├── flx_instrument.c ├── flx_instrument.h ├── flx_memtrace.c ├── flx_memtrace.h ├── flx_memtrack.c ├── flx_memtrack.h ├── flx_optrace.c ├── flx_optrace.h ├── flx_process.h ├── flx_shadowmem.c ├── flx_shadowmem.h ├── flx_syscall.c ├── flx_syscall.h ├── flx_taintgraph.c ├── flx_taintgraph.h ├── flx_tbrestoring.c ├── flx_tbrestoring.h ├── hashmap.c ├── hashmap.h ├── helper.c ├── helper.h ├── helper_template.h ├── kvm.c ├── libshmatch │ ├── Makefile │ ├── acwrap.c │ ├── acwrap.h │ ├── aho-corasick.c │ ├── aho-corasick.h │ ├── shmatch.c │ ├── shmatch.h │ ├── slist.c │ ├── slist.h │ ├── test.c │ └── xalloc.h ├── machine.c ├── op_helper.c ├── ops_sse.h ├── ops_sse_header.h ├── pyqemu │ ├── Helpers.py │ ├── Structures.py │ ├── __init__.py │ ├── config.py │ ├── controls │ │ ├── __init__.py │ │ ├── control.py │ │ ├── dump.py │ │ ├── hook.py │ │ └── syscall.py │ ├── cpu.py │ ├── debug.py │ ├── dll.py │ ├── event.py │ ├── fhandle.py │ ├── heuristics │ │ ├── __init__.py │ │ ├── api.py │ │ ├── arithwindow.py │ │ ├── bblexec.py │ │ ├── caballero.py │ │ ├── codesearch.py │ │ ├── constsearch.py │ │ ├── functionentropy.py │ │ ├── functiontaint.py │ │ ├── functiontrace.py │ │ └── heuristic.py │ ├── instrumentation.py │ ├── memory.py │ ├── msg.py │ ├── operatingsystem.py │ ├── pefile.py │ ├── process.py │ ├── processinfo.py │ └── syscalls.py ├── scripts │ ├── dump-analysis.py │ ├── ida_mark_functions.py │ └── patch.py ├── svm.h ├── tags └── translate.c ├── target-m68k ├── cpu.h ├── exec.h ├── helper.c ├── helpers.h ├── m68k-qreg.h ├── machine.c ├── op_helper.c ├── qregs.def └── translate.c ├── target-microblaze ├── cpu.h ├── exec.h ├── helper.c ├── helper.h ├── machine.c ├── microblaze-decode.h ├── mmu.c ├── mmu.h ├── op_helper.c └── translate.c ├── target-mips ├── TODO ├── cpu.h ├── exec.h ├── helper.c ├── helper.h ├── machine.c ├── mips-defs.h ├── op_helper.c ├── translate.c └── translate_init.c ├── target-ppc ├── STATUS ├── cpu.h ├── exec.h ├── helper.c ├── helper.h ├── helper_regs.h ├── kvm.c ├── kvm_ppc.c ├── kvm_ppc.h ├── machine.c ├── mfrom_table.c ├── mfrom_table_gen.c ├── op_helper.c ├── translate.c └── translate_init.c ├── target-s390x ├── cpu.h ├── exec.h ├── helper.c ├── kvm.c ├── machine.c ├── op_helper.c └── translate.c ├── target-sh4 ├── README.sh4 ├── cpu.h ├── exec.h ├── helper.c ├── helper.h ├── machine.c ├── op_helper.c └── translate.c ├── target-sparc ├── TODO ├── cpu.h ├── exec.h ├── helper.c ├── helper.h ├── machine.c ├── op_helper.c └── translate.c ├── targphys.h ├── tcg-runtime.c ├── tcg ├── LICENSE ├── README ├── TODO ├── arm │ ├── tcg-target.c │ └── tcg-target.h ├── hppa │ ├── tcg-target.c │ └── tcg-target.h ├── i386 │ ├── tcg-target.c │ └── tcg-target.h ├── ia64 │ ├── tcg-target.c │ └── tcg-target.h ├── mips │ ├── tcg-target.c │ └── tcg-target.h ├── ppc │ ├── tcg-target.c │ └── tcg-target.h ├── ppc64 │ ├── tcg-target.c │ └── tcg-target.h ├── s390 │ ├── tcg-target.c │ └── tcg-target.h ├── sparc │ ├── tcg-target.c │ └── tcg-target.h ├── tags ├── tcg-op.h ├── tcg-opc.h ├── tcg-runtime.h ├── tcg.c └── tcg.h ├── tests ├── Makefile ├── alpha │ ├── Makefile │ ├── crt.s │ ├── hello-alpha.c │ ├── test-cond.c │ └── test-ovf.c ├── cris │ ├── .gdbinit │ ├── Makefile │ ├── README │ ├── check_abs.c │ ├── check_addc.c │ ├── check_addcm.c │ ├── check_addi.s │ ├── check_addiv32.s │ ├── check_addm.s │ ├── check_addo.c │ ├── check_addoq.c │ ├── check_addq.s │ ├── check_addr.s │ ├── check_addxc.s │ ├── check_addxm.s │ ├── check_addxr.s │ ├── check_andc.s │ ├── check_andm.s │ ├── check_andq.s │ ├── check_andr.s │ ├── check_asr.s │ ├── check_ba.s │ ├── check_bas.s │ ├── check_bcc.s │ ├── check_bound.c │ ├── check_boundc.s │ ├── check_boundr.s │ ├── check_btst.s │ ├── check_clearfv32.s │ ├── check_clrjmp1.s │ ├── check_cmp-2.s │ ├── check_cmpc.s │ ├── check_cmpm.s │ ├── check_cmpq.s │ ├── check_cmpr.s │ ├── check_cmpxc.s │ ├── check_cmpxm.s │ ├── check_dstep.s │ ├── check_ftag.c │ ├── check_gcctorture_pr28634-1.c │ ├── check_gcctorture_pr28634.c │ ├── check_glibc_kernelversion.c │ ├── check_hello.c │ ├── check_int64.c │ ├── check_jsr.s │ ├── check_lapc.s │ ├── check_lsl.s │ ├── check_lsr.s │ ├── check_lz.c │ ├── check_mapbrk.c │ ├── check_mcp.s │ ├── check_mmap1.c │ ├── check_mmap2.c │ ├── check_mmap3.c │ ├── check_movdelsr1.s │ ├── check_movecr.s │ ├── check_movei.s │ ├── check_movemr.s │ ├── check_movemrv32.s │ ├── check_moveq.c │ ├── check_mover.s │ ├── check_moverm.s │ ├── check_movmp.s │ ├── check_movpmv32.s │ ├── check_movpr.s │ ├── check_movprv32.s │ ├── check_movscr.s │ ├── check_movsm.s │ ├── check_movsr.s │ ├── check_movucr.s │ ├── check_movum.s │ ├── check_movur.s │ ├── check_mulv32.s │ ├── check_mulx.s │ ├── check_neg.s │ ├── check_not.s │ ├── check_openpf1.c │ ├── check_openpf2.c │ ├── check_openpf3.c │ ├── check_openpf4.c │ ├── check_openpf5.c │ ├── check_orc.s │ ├── check_orm.s │ ├── check_orq.s │ ├── check_orr.s │ ├── check_ret.s │ ├── check_scc.s │ ├── check_settls1.c │ ├── check_sigalrm.c │ ├── check_stat1.c │ ├── check_stat2.c │ ├── check_stat3.c │ ├── check_stat4.c │ ├── check_subc.s │ ├── check_subm.s │ ├── check_subq.s │ ├── check_subr.s │ ├── check_swap.c │ ├── check_time1.c │ ├── check_time2.c │ ├── check_xarith.s │ ├── crisutils.h │ ├── crt.s │ ├── sys.c │ ├── sys.h │ └── testutils.inc ├── hello-arm.c ├── hello-i386.c ├── hello-mips.c ├── linux-test.c ├── pi_10.com ├── qruncom.c ├── runcom.c ├── sha1.c ├── test-arm-iwmmxt.s ├── test-i386-code16.S ├── test-i386-muldiv.h ├── test-i386-shift.h ├── test-i386-ssse3.c ├── test-i386-vm86.S ├── test-i386.c ├── test-i386.h ├── test-mmap.c ├── test_path.c └── testthread.c ├── texi2pod.pl ├── thunk.c ├── thunk.h ├── trace-events ├── tracetool ├── translate-all.c ├── uboot_image.h ├── ui ├── cocoa.m ├── curses.c ├── curses_keys.h ├── d3des.c ├── d3des.h ├── keymaps.c ├── keymaps.h ├── sdl.c ├── sdl_keysym.h ├── sdl_zoom.c ├── sdl_zoom.h ├── sdl_zoom_template.h ├── vnc-auth-sasl.c ├── vnc-auth-sasl.h ├── vnc-auth-vencrypt.c ├── vnc-auth-vencrypt.h ├── vnc-enc-hextile-template.h ├── vnc-enc-hextile.c ├── vnc-enc-tight.c ├── vnc-enc-tight.h ├── vnc-enc-zlib.c ├── vnc-jobs-async.c ├── vnc-jobs-sync.c ├── vnc-jobs.h ├── vnc-palette.c ├── vnc-palette.h ├── vnc-tls.c ├── vnc-tls.h ├── vnc.c ├── vnc.h ├── vnc_keysym.h ├── x_keymap.c └── x_keymap.h ├── usb-bsd.c ├── usb-linux.c ├── usb-stub.c ├── vgafont.h ├── vl.c └── x86_64.ld /.gitignore: -------------------------------------------------------------------------------- 1 | config-devices.* 2 | config-all-devices.* 3 | config-host.* 4 | config-target.* 5 | trace.h 6 | trace.c 7 | *-softmmu 8 | *-darwin-user 9 | *-linux-user 10 | *-bsd-user 11 | libdis* 12 | libhw32 13 | libhw64 14 | libuser 15 | qemu-doc.html 16 | qemu-tech.html 17 | qemu-doc.info 18 | qemu-tech.info 19 | qemu.1 20 | qemu.pod 21 | qemu-img.1 22 | qemu-img.pod 23 | qemu-img 24 | qemu-nbd 25 | qemu-nbd.8 26 | qemu-nbd.pod 27 | qemu-options.def 28 | qemu-options.texi 29 | qemu-img-cmds.texi 30 | qemu-img-cmds.h 31 | qemu-io 32 | qemu-monitor.texi 33 | QMP/qmp-commands.txt 34 | .gdbinit 35 | *.a 36 | *.aux 37 | *.cp 38 | *.dvi 39 | *.exe 40 | *.fn 41 | *.ky 42 | *.log 43 | *.pdf 44 | *.pg 45 | *.pyc 46 | *.toc 47 | *.tp 48 | *.vr 49 | *.d 50 | *.o 51 | .pc 52 | patches 53 | pc-bios/bios-pq/status 54 | pc-bios/vgabios-pq/status 55 | pc-bios/optionrom/linuxboot.bin 56 | pc-bios/optionrom/multiboot.bin 57 | pc-bios/optionrom/multiboot.raw 58 | .stgit-* 59 | cscope.* 60 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "roms/vgabios"] 2 | path = roms/vgabios 3 | url = git://git.qemu.org/vgabios.git/ 4 | [submodule "roms/seabios"] 5 | path = roms/seabios 6 | url = git://git.qemu.org/seabios.git/ 7 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The following points clarify the QEMU license: 2 | 3 | 1) QEMU as a whole is released under the GNU General Public License 4 | 5 | 2) Parts of QEMU have specific licenses which are compatible with the 6 | GNU General Public License. Hence each source file contains its own 7 | licensing information. 8 | 9 | In particular, the QEMU virtual CPU core library (libqemu.a) is 10 | released under the GNU Lesser General Public License. Many hardware 11 | device emulation sources are released under the BSD license. 12 | 13 | 3) The Tiny Code Generator (TCG) is released under the BSD license 14 | (see license headers in files). 15 | 16 | 4) QEMU is a trademark of Fabrice Bellard. 17 | 18 | Fabrice Bellard. 19 | -------------------------------------------------------------------------------- /Makefile.dis: -------------------------------------------------------------------------------- 1 | # Makefile for disassemblers. 2 | 3 | include ../config-host.mak 4 | include config.mak 5 | include $(SRC_PATH)/rules.mak 6 | 7 | .PHONY: all 8 | 9 | $(call set-vpath, $(SRC_PATH)) 10 | 11 | QEMU_CFLAGS+=-I.. 12 | 13 | include $(SRC_PATH)/Makefile.objs 14 | 15 | all: $(libdis-y) 16 | # Dummy command so that make thinks it has done something 17 | @true 18 | 19 | clean: 20 | rm -f *.o *.d *.a *~ 21 | 22 | # Include automatically generated dependency files 23 | -include $(wildcard *.d */*.d) 24 | -------------------------------------------------------------------------------- /Makefile.hw: -------------------------------------------------------------------------------- 1 | # Makefile for qemu target independent devices. 2 | 3 | include ../config-host.mak 4 | include ../config-all-devices.mak 5 | include config.mak 6 | include $(SRC_PATH)/rules.mak 7 | 8 | .PHONY: all 9 | 10 | $(call set-vpath, $(SRC_PATH):$(SRC_PATH)/hw) 11 | 12 | QEMU_CFLAGS+=-I.. -I$(SRC_PATH)/fpu 13 | 14 | include $(SRC_PATH)/Makefile.objs 15 | 16 | all: $(hw-obj-y) 17 | # Dummy command so that make thinks it has done something 18 | @true 19 | 20 | clean: 21 | rm -f *.o */*.o *.d */*.d *.a */*.a *~ */*~ 22 | 23 | # Include automatically generated dependency files 24 | -include $(wildcard *.d */*.d) 25 | -------------------------------------------------------------------------------- /Makefile.user: -------------------------------------------------------------------------------- 1 | # Makefile for qemu target independent user files. 2 | 3 | include ../config-host.mak 4 | include $(SRC_PATH)/rules.mak 5 | -include config.mak 6 | 7 | .PHONY: all 8 | 9 | $(call set-vpath, $(SRC_PATH)) 10 | 11 | QEMU_CFLAGS+=-I.. 12 | 13 | include $(SRC_PATH)/Makefile.objs 14 | 15 | all: $(user-obj-y) 16 | # Dummy command so that make thinks it has done something 17 | @true 18 | 19 | clean: 20 | rm -f *.o *.d *.a *~ 21 | 22 | # Include automatically generated dependency files 23 | -include $(wildcard *.d */*.d) 24 | -------------------------------------------------------------------------------- /QMP/vm-info: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # 3 | # Print Virtual Machine information 4 | # 5 | # Usage: 6 | # 7 | # Start QEMU with: 8 | # 9 | # $ qemu [...] -monitor control,unix:./qmp,server 10 | # 11 | # Run vm-info: 12 | # 13 | # $ vm-info ./qmp 14 | # 15 | # Luiz Capitulino 16 | 17 | import qmp 18 | from sys import argv,exit 19 | 20 | def main(): 21 | if len(argv) != 2: 22 | print 'vm-info ' 23 | exit(1) 24 | 25 | qemu = qmp.QEMUMonitorProtocol(argv[1]) 26 | qemu.connect() 27 | qemu.send("qmp_capabilities") 28 | 29 | for cmd in [ 'version', 'kvm', 'status', 'uuid', 'balloon' ]: 30 | print cmd + ': ' + str(qemu.send('query-' + cmd)) 31 | 32 | if __name__ == '__main__': 33 | main() 34 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | Read the documentation in qemu-doc.html. 2 | 3 | Fabrice Bellard. 4 | 5 | PyQemu: 6 | look into target-i386/FLX_README 7 | 8 | PyQemu was a Project between Felix Matenaar, Felix Leder, 9 | Andre Wichmann and Elmar Gerhards-Padilla. 10 | 11 | The Paper can be found under: 12 | http://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=6461007&isnumber=6460999 13 | -------------------------------------------------------------------------------- /VERSION: -------------------------------------------------------------------------------- 1 | 0.13.50 2 | -------------------------------------------------------------------------------- /aes.h: -------------------------------------------------------------------------------- 1 | #ifndef QEMU_AES_H 2 | #define QEMU_AES_H 3 | 4 | #define AES_MAXNR 14 5 | #define AES_BLOCK_SIZE 16 6 | 7 | struct aes_key_st { 8 | uint32_t rd_key[4 *(AES_MAXNR + 1)]; 9 | int rounds; 10 | }; 11 | typedef struct aes_key_st AES_KEY; 12 | 13 | int AES_set_encrypt_key(const unsigned char *userKey, const int bits, 14 | AES_KEY *key); 15 | int AES_set_decrypt_key(const unsigned char *userKey, const int bits, 16 | AES_KEY *key); 17 | 18 | void AES_encrypt(const unsigned char *in, unsigned char *out, 19 | const AES_KEY *key); 20 | void AES_decrypt(const unsigned char *in, unsigned char *out, 21 | const AES_KEY *key); 22 | void AES_cbc_encrypt(const unsigned char *in, unsigned char *out, 23 | const unsigned long length, const AES_KEY *key, 24 | unsigned char *ivec, const int enc); 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /arch_init.h: -------------------------------------------------------------------------------- 1 | #ifndef QEMU_ARCH_INIT_H 2 | #define QEMU_ARCH_INIT_H 3 | 4 | extern const char arch_config_name[]; 5 | 6 | enum { 7 | QEMU_ARCH_ALL = -1, 8 | QEMU_ARCH_ALPHA = 1, 9 | QEMU_ARCH_ARM = 2, 10 | QEMU_ARCH_CRIS = 4, 11 | QEMU_ARCH_I386 = 8, 12 | QEMU_ARCH_M68K = 16, 13 | QEMU_ARCH_MICROBLAZE = 32, 14 | QEMU_ARCH_MIPS = 64, 15 | QEMU_ARCH_PPC = 128, 16 | QEMU_ARCH_S390X = 256, 17 | QEMU_ARCH_SH4 = 512, 18 | QEMU_ARCH_SPARC = 1024, 19 | }; 20 | 21 | extern const uint32_t arch_type; 22 | 23 | void select_soundhw(const char *optarg); 24 | int ram_save_live(Monitor *mon, QEMUFile *f, int stage, void *opaque); 25 | int ram_load(QEMUFile *f, void *opaque, int version_id); 26 | void do_acpitable_option(const char *optarg); 27 | void do_smbios_option(const char *optarg); 28 | void cpudef_init(void); 29 | int audio_available(void); 30 | int kvm_available(void); 31 | int xen_available(void); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /audio/audio_pt_int.h: -------------------------------------------------------------------------------- 1 | #ifndef QEMU_AUDIO_PT_INT_H 2 | #define QEMU_AUDIO_PT_INT_H 3 | 4 | #include 5 | 6 | struct audio_pt { 7 | const char *drv; 8 | pthread_t thread; 9 | pthread_cond_t cond; 10 | pthread_mutex_t mutex; 11 | }; 12 | 13 | int audio_pt_init (struct audio_pt *, void *(*) (void *), void *, 14 | const char *, const char *); 15 | int audio_pt_fini (struct audio_pt *, const char *); 16 | int audio_pt_lock (struct audio_pt *, const char *); 17 | int audio_pt_unlock (struct audio_pt *, const char *); 18 | int audio_pt_wait (struct audio_pt *, const char *); 19 | int audio_pt_unlock_and_signal (struct audio_pt *, const char *); 20 | int audio_pt_join (struct audio_pt *, void **, const char *); 21 | 22 | #endif /* audio_pt_int.h */ 23 | -------------------------------------------------------------------------------- /audio/audio_win_int.h: -------------------------------------------------------------------------------- 1 | #ifndef AUDIO_WIN_INT_H 2 | #define AUDIO_WIN_INT_H 3 | 4 | int waveformat_from_audio_settings (WAVEFORMATEX *wfx, 5 | struct audsettings *as); 6 | 7 | int waveformat_to_audio_settings (WAVEFORMATEX *wfx, 8 | struct audsettings *as); 9 | 10 | #endif /* AUDIO_WIN_INT_H */ 11 | -------------------------------------------------------------------------------- /balloon.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Balloon 3 | * 4 | * Copyright IBM, Corp. 2008 5 | * 6 | * Authors: 7 | * Anthony Liguori 8 | * 9 | * This work is licensed under the terms of the GNU GPL, version 2. See 10 | * the COPYING file in the top-level directory. 11 | * 12 | */ 13 | 14 | #ifndef _QEMU_BALLOON_H 15 | #define _QEMU_BALLOON_H 16 | 17 | #include "monitor.h" 18 | 19 | typedef void (QEMUBalloonEvent)(void *opaque, ram_addr_t target, 20 | MonitorCompletion cb, void *cb_data); 21 | 22 | void qemu_add_balloon_handler(QEMUBalloonEvent *func, void *opaque); 23 | 24 | int qemu_balloon(ram_addr_t target, MonitorCompletion cb, void *opaque); 25 | 26 | int qemu_balloon_status(MonitorCompletion cb, void *opaque); 27 | 28 | void monitor_print_balloon(Monitor *mon, const QObject *data); 29 | int do_info_balloon(Monitor *mon, MonitorCompletion cb, void *opaque); 30 | int do_balloon(Monitor *mon, const QDict *params, 31 | MonitorCompletion cb, void *opaque); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /block-migration.h: -------------------------------------------------------------------------------- 1 | /* 2 | * QEMU live block migration 3 | * 4 | * Copyright IBM, Corp. 2009 5 | * 6 | * Authors: 7 | * Liran Schour 8 | * 9 | * This work is licensed under the terms of the GNU GPL, version 2. See 10 | * the COPYING file in the top-level directory. 11 | * 12 | */ 13 | 14 | #ifndef BLOCK_MIGRATION_H 15 | #define BLOCK_MIGRATION_H 16 | 17 | void blk_mig_init(void); 18 | int blk_mig_active(void); 19 | uint64_t blk_mig_bytes_transferred(void); 20 | uint64_t blk_mig_bytes_remaining(void); 21 | uint64_t blk_mig_bytes_total(void); 22 | 23 | #endif /* BLOCK_MIGRATION_H */ 24 | -------------------------------------------------------------------------------- /bsd-user/i386/target_signal.h: -------------------------------------------------------------------------------- 1 | #ifndef TARGET_SIGNAL_H 2 | #define TARGET_SIGNAL_H 3 | 4 | #include "cpu.h" 5 | 6 | /* this struct defines a stack used during syscall handling */ 7 | 8 | typedef struct target_sigaltstack { 9 | abi_ulong ss_sp; 10 | abi_long ss_flags; 11 | abi_ulong ss_size; 12 | } target_stack_t; 13 | 14 | 15 | static inline abi_ulong get_sp_from_cpustate(CPUX86State *state) 16 | { 17 | return state->regs[R_ESP]; 18 | } 19 | 20 | #endif /* TARGET_SIGNAL_H */ 21 | -------------------------------------------------------------------------------- /bsd-user/qemu-types.h: -------------------------------------------------------------------------------- 1 | #ifndef QEMU_TYPES_H 2 | #define QEMU_TYPES_H 3 | #include "cpu.h" 4 | 5 | #ifdef TARGET_ABI32 6 | typedef uint32_t abi_ulong; 7 | typedef int32_t abi_long; 8 | #define TARGET_ABI_FMT_lx "%08x" 9 | #define TARGET_ABI_FMT_ld "%d" 10 | #define TARGET_ABI_FMT_lu "%u" 11 | #define TARGET_ABI_BITS 32 12 | #else 13 | typedef target_ulong abi_ulong; 14 | typedef target_long abi_long; 15 | #define TARGET_ABI_FMT_lx TARGET_FMT_lx 16 | #define TARGET_ABI_FMT_ld TARGET_FMT_ld 17 | #define TARGET_ABI_FMT_lu TARGET_FMT_lu 18 | #define TARGET_ABI_BITS TARGET_LONG_BITS 19 | /* for consistency, define ABI32 too */ 20 | #if TARGET_ABI_BITS == 32 21 | #define TARGET_ABI32 1 22 | #endif 23 | #endif 24 | #endif 25 | -------------------------------------------------------------------------------- /bsd-user/sparc/syscall.h: -------------------------------------------------------------------------------- 1 | struct target_pt_regs { 2 | abi_ulong psr; 3 | abi_ulong pc; 4 | abi_ulong npc; 5 | abi_ulong y; 6 | abi_ulong u_regs[16]; 7 | }; 8 | 9 | #define UNAME_MACHINE "sun4" 10 | -------------------------------------------------------------------------------- /bsd-user/sparc/target_signal.h: -------------------------------------------------------------------------------- 1 | #ifndef TARGET_SIGNAL_H 2 | #define TARGET_SIGNAL_H 3 | 4 | #include "cpu.h" 5 | 6 | /* this struct defines a stack used during syscall handling */ 7 | 8 | typedef struct target_sigaltstack { 9 | abi_ulong ss_sp; 10 | abi_long ss_flags; 11 | abi_ulong ss_size; 12 | } target_stack_t; 13 | 14 | 15 | #ifndef UREG_I6 16 | #define UREG_I6 6 17 | #endif 18 | #ifndef UREG_FP 19 | #define UREG_FP UREG_I6 20 | #endif 21 | 22 | static inline abi_ulong get_sp_from_cpustate(CPUSPARCState *state) 23 | { 24 | return state->regwptr[UREG_FP]; 25 | } 26 | 27 | #endif /* TARGET_SIGNAL_H */ 28 | -------------------------------------------------------------------------------- /bsd-user/sparc64/syscall.h: -------------------------------------------------------------------------------- 1 | struct target_pt_regs { 2 | abi_ulong u_regs[16]; 3 | abi_ulong tstate; 4 | abi_ulong pc; 5 | abi_ulong npc; 6 | abi_ulong y; 7 | abi_ulong fprs; 8 | }; 9 | 10 | #define UNAME_MACHINE "sun4u" 11 | -------------------------------------------------------------------------------- /bsd-user/sparc64/target_signal.h: -------------------------------------------------------------------------------- 1 | #ifndef TARGET_SIGNAL_H 2 | #define TARGET_SIGNAL_H 3 | 4 | #include "cpu.h" 5 | 6 | /* this struct defines a stack used during syscall handling */ 7 | 8 | typedef struct target_sigaltstack { 9 | abi_ulong ss_sp; 10 | abi_long ss_flags; 11 | abi_ulong ss_size; 12 | } target_stack_t; 13 | 14 | 15 | #ifndef UREG_I6 16 | #define UREG_I6 6 17 | #endif 18 | #ifndef UREG_FP 19 | #define UREG_FP UREG_I6 20 | #endif 21 | 22 | static inline abi_ulong get_sp_from_cpustate(CPUSPARCState *state) 23 | { 24 | return state->regwptr[UREG_FP]; 25 | } 26 | 27 | #endif /* TARGET_SIGNAL_H */ 28 | -------------------------------------------------------------------------------- /bsd-user/x86_64/target_signal.h: -------------------------------------------------------------------------------- 1 | #ifndef TARGET_SIGNAL_H 2 | #define TARGET_SIGNAL_H 3 | 4 | #include "cpu.h" 5 | 6 | /* this struct defines a stack used during syscall handling */ 7 | 8 | typedef struct target_sigaltstack { 9 | abi_ulong ss_sp; 10 | abi_long ss_flags; 11 | abi_ulong ss_size; 12 | } target_stack_t; 13 | 14 | static inline abi_ulong get_sp_from_cpustate(CPUX86State *state) 15 | { 16 | return state->regs[R_ESP]; 17 | } 18 | 19 | #endif /* TARGET_SIGNAL_H */ 20 | -------------------------------------------------------------------------------- /bt-host.h: -------------------------------------------------------------------------------- 1 | #ifndef BT_HOST_H 2 | #define BT_HOST_H 3 | 4 | struct HCIInfo; 5 | 6 | /* bt-host.c */ 7 | struct HCIInfo *bt_host_hci(const char *id); 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /buffered_file.h: -------------------------------------------------------------------------------- 1 | /* 2 | * QEMU buffered QEMUFile 3 | * 4 | * Copyright IBM, Corp. 2008 5 | * 6 | * Authors: 7 | * Anthony Liguori 8 | * 9 | * This work is licensed under the terms of the GNU GPL, version 2. See 10 | * the COPYING file in the top-level directory. 11 | * 12 | */ 13 | 14 | #ifndef QEMU_BUFFERED_FILE_H 15 | #define QEMU_BUFFERED_FILE_H 16 | 17 | #include "hw/hw.h" 18 | 19 | typedef ssize_t (BufferedPutFunc)(void *opaque, const void *data, size_t size); 20 | typedef void (BufferedPutReadyFunc)(void *opaque); 21 | typedef void (BufferedWaitForUnfreezeFunc)(void *opaque); 22 | typedef int (BufferedCloseFunc)(void *opaque); 23 | 24 | QEMUFile *qemu_fopen_ops_buffered(void *opaque, size_t xfer_limit, 25 | BufferedPutFunc *put_buffer, 26 | BufferedPutReadyFunc *put_ready, 27 | BufferedWaitForUnfreezeFunc *wait_for_unfreeze, 28 | BufferedCloseFunc *close); 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /config.h: -------------------------------------------------------------------------------- 1 | #include "config-host.h" 2 | #include "config-target.h" 3 | -------------------------------------------------------------------------------- /cpus.h: -------------------------------------------------------------------------------- 1 | #ifndef QEMU_CPUS_H 2 | #define QEMU_CPUS_H 3 | 4 | /* cpus.c */ 5 | int qemu_init_main_loop(void); 6 | void qemu_main_loop_start(void); 7 | void resume_all_vcpus(void); 8 | void pause_all_vcpus(void); 9 | 10 | /* vl.c */ 11 | extern int smp_cores; 12 | extern int smp_threads; 13 | extern int debug_requested; 14 | extern int vmstop_requested; 15 | void vm_state_notify(int running, int reason); 16 | bool cpu_exec_all(void); 17 | void set_numa_modes(void); 18 | void set_cpu_log(const char *optarg); 19 | void list_cpus(FILE *f, int (*cpu_fprintf)(FILE *f, const char *fmt, ...), 20 | const char *optarg); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /darwin-user/ioctls.h: -------------------------------------------------------------------------------- 1 | /* emulated ioctl list */ 2 | 3 | IOCTL(TIOCGETA, IOC_R, MK_PTR(MK_STRUCT(STRUCT_termios))) 4 | IOCTL(TIOCSETA, IOC_W, MK_PTR(MK_STRUCT(STRUCT_termios))) 5 | -------------------------------------------------------------------------------- /darwin-user/ioctls_types.h: -------------------------------------------------------------------------------- 1 | STRUCT(termios, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, MK_ARRAY(TYPE_CHAR, 20), TYPE_INT, TYPE_INT) 2 | -------------------------------------------------------------------------------- /default-configs/alpha-linux-user.mak: -------------------------------------------------------------------------------- 1 | # Default configuration for alpha-linux-user 2 | -------------------------------------------------------------------------------- /default-configs/arm-linux-user.mak: -------------------------------------------------------------------------------- 1 | # Default configuration for arm-linux-user 2 | 3 | CONFIG_GDBSTUB_XML=y 4 | -------------------------------------------------------------------------------- /default-configs/arm-softmmu.mak: -------------------------------------------------------------------------------- 1 | # Default configuration for arm-softmmu 2 | 3 | CONFIG_GDBSTUB_XML=y 4 | CONFIG_USB_OHCI=y 5 | CONFIG_ISA_MMIO=y 6 | CONFIG_NAND=y 7 | CONFIG_ECC=y 8 | CONFIG_SERIAL=y 9 | CONFIG_PTIMER=y 10 | CONFIG_SD=y 11 | CONFIG_IDE_CORE=y 12 | CONFIG_MAX7310=y 13 | CONFIG_WM8750=y 14 | CONFIG_TWL92230=y 15 | CONFIG_TSC2005=y 16 | CONFIG_LM832X=y 17 | CONFIG_TMP105=y 18 | CONFIG_STELLARIS_INPUT=y 19 | CONFIG_SSD0303=y 20 | CONFIG_SSD0323=y 21 | CONFIG_ADS7846=y 22 | CONFIG_MAX111X=y 23 | CONFIG_SSI=y 24 | CONFIG_SSI_SD=y 25 | CONFIG_LAN9118=y 26 | CONFIG_SMC91C111=y 27 | CONFIG_DS1338=y 28 | CONFIG_VIRTIO_PCI=y 29 | CONFIG_PFLASH_CFI01=y 30 | CONFIG_PFLASH_CFI02=y 31 | -------------------------------------------------------------------------------- /default-configs/armeb-linux-user.mak: -------------------------------------------------------------------------------- 1 | # Default configuration for armeb-linux-user 2 | 3 | CONFIG_GDBSTUB_XML=y 4 | -------------------------------------------------------------------------------- /default-configs/cris-linux-user.mak: -------------------------------------------------------------------------------- 1 | # Default configuration for cris-linux-user 2 | -------------------------------------------------------------------------------- /default-configs/cris-softmmu.mak: -------------------------------------------------------------------------------- 1 | # Default configuration for cris-softmmu 2 | 3 | CONFIG_NAND=y 4 | CONFIG_PTIMER=y 5 | CONFIG_VIRTIO_PCI=y 6 | CONFIG_PFLASH_CFI02=y 7 | -------------------------------------------------------------------------------- /default-configs/i386-bsd-user.mak: -------------------------------------------------------------------------------- 1 | # Default configuration for i386-bsd-user 2 | -------------------------------------------------------------------------------- /default-configs/i386-darwin-user.mak: -------------------------------------------------------------------------------- 1 | # Default configuration for i386-darwin-user 2 | -------------------------------------------------------------------------------- /default-configs/i386-linux-user.mak: -------------------------------------------------------------------------------- 1 | # Default configuration for i386-linux-user 2 | -------------------------------------------------------------------------------- /default-configs/i386-softmmu.mak: -------------------------------------------------------------------------------- 1 | # Default configuration for i386-softmmu 2 | 3 | CONFIG_USB_OHCI=y 4 | CONFIG_VGA_PCI=y 5 | CONFIG_VGA_ISA=y 6 | CONFIG_VMWARE_VGA=y 7 | CONFIG_SERIAL=y 8 | CONFIG_PARALLEL=y 9 | CONFIG_I8254=y 10 | CONFIG_PCSPK=y 11 | CONFIG_PCKBD=y 12 | CONFIG_USB_UHCI=y 13 | CONFIG_FDC=y 14 | CONFIG_ACPI=y 15 | CONFIG_APM=y 16 | CONFIG_DMA=y 17 | CONFIG_IDE_CORE=y 18 | CONFIG_IDE_QDEV=y 19 | CONFIG_IDE_PCI=y 20 | CONFIG_IDE_ISA=y 21 | CONFIG_IDE_PIIX=y 22 | CONFIG_NE2000_ISA=y 23 | CONFIG_PIIX_PCI=y 24 | CONFIG_SOUND=y 25 | CONFIG_VIRTIO_PCI=y 26 | -------------------------------------------------------------------------------- /default-configs/m68k-linux-user.mak: -------------------------------------------------------------------------------- 1 | # Default configuration for m68k-linux-user 2 | 3 | CONFIG_GDBSTUB_XML=y 4 | -------------------------------------------------------------------------------- /default-configs/m68k-softmmu.mak: -------------------------------------------------------------------------------- 1 | # Default configuration for m68k-softmmu 2 | 3 | CONFIG_GDBSTUB_XML=y 4 | CONFIG_PTIMER=y 5 | CONFIG_VIRTIO_PCI=y 6 | -------------------------------------------------------------------------------- /default-configs/microblaze-linux-user.mak: -------------------------------------------------------------------------------- 1 | # Default configuration for microblaze-linux-user 2 | -------------------------------------------------------------------------------- /default-configs/microblaze-softmmu.mak: -------------------------------------------------------------------------------- 1 | # Default configuration for microblaze-softmmu 2 | 3 | CONFIG_PTIMER=y 4 | CONFIG_VIRTIO_PCI=y 5 | CONFIG_PFLASH_CFI01=y 6 | -------------------------------------------------------------------------------- /default-configs/mips-linux-user.mak: -------------------------------------------------------------------------------- 1 | # Default configuration for mips-linux-user 2 | -------------------------------------------------------------------------------- /default-configs/mips-softmmu.mak: -------------------------------------------------------------------------------- 1 | # Default configuration for mips-softmmu 2 | 3 | CONFIG_ISA_MMIO=y 4 | CONFIG_ESP=y 5 | CONFIG_VGA_PCI=y 6 | CONFIG_VGA_ISA=y 7 | CONFIG_VGA_ISA_MM=y 8 | CONFIG_VMWARE_VGA=y 9 | CONFIG_SERIAL=y 10 | CONFIG_PARALLEL=y 11 | CONFIG_I8254=y 12 | CONFIG_PCSPK=y 13 | CONFIG_PCKBD=y 14 | CONFIG_USB_UHCI=y 15 | CONFIG_FDC=y 16 | CONFIG_ACPI=y 17 | CONFIG_APM=y 18 | CONFIG_DMA=y 19 | CONFIG_PIIX4=y 20 | CONFIG_IDE_CORE=y 21 | CONFIG_IDE_QDEV=y 22 | CONFIG_IDE_PCI=y 23 | CONFIG_IDE_ISA=y 24 | CONFIG_IDE_PIIX=y 25 | CONFIG_NE2000_ISA=y 26 | CONFIG_SOUND=y 27 | CONFIG_VIRTIO_PCI=y 28 | CONFIG_RC4030=y 29 | CONFIG_DP8393X=y 30 | CONFIG_DS1225Y=y 31 | CONFIG_MIPSNET=y 32 | CONFIG_PFLASH_CFI01=y 33 | -------------------------------------------------------------------------------- /default-configs/mips64-softmmu.mak: -------------------------------------------------------------------------------- 1 | # Default configuration for mips64-softmmu 2 | 3 | CONFIG_ISA_MMIO=y 4 | CONFIG_ESP=y 5 | CONFIG_VGA_PCI=y 6 | CONFIG_VGA_ISA=y 7 | CONFIG_VGA_ISA_MM=y 8 | CONFIG_VMWARE_VGA=y 9 | CONFIG_SERIAL=y 10 | CONFIG_PARALLEL=y 11 | CONFIG_I8254=y 12 | CONFIG_PCSPK=y 13 | CONFIG_PCKBD=y 14 | CONFIG_USB_UHCI=y 15 | CONFIG_FDC=y 16 | CONFIG_ACPI=y 17 | CONFIG_APM=y 18 | CONFIG_DMA=y 19 | CONFIG_PIIX4=y 20 | CONFIG_IDE_CORE=y 21 | CONFIG_IDE_QDEV=y 22 | CONFIG_IDE_PCI=y 23 | CONFIG_IDE_ISA=y 24 | CONFIG_IDE_PIIX=y 25 | CONFIG_NE2000_ISA=y 26 | CONFIG_SOUND=y 27 | CONFIG_VIRTIO_PCI=y 28 | CONFIG_RC4030=y 29 | CONFIG_DP8393X=y 30 | CONFIG_DS1225Y=y 31 | CONFIG_MIPSNET=y 32 | CONFIG_PFLASH_CFI01=y 33 | -------------------------------------------------------------------------------- /default-configs/mips64el-softmmu.mak: -------------------------------------------------------------------------------- 1 | # Default configuration for mips64el-softmmu 2 | 3 | CONFIG_ISA_MMIO=y 4 | CONFIG_ESP=y 5 | CONFIG_VGA_PCI=y 6 | CONFIG_VGA_ISA=y 7 | CONFIG_VGA_ISA_MM=y 8 | CONFIG_VMWARE_VGA=y 9 | CONFIG_SERIAL=y 10 | CONFIG_PARALLEL=y 11 | CONFIG_I8254=y 12 | CONFIG_PCSPK=y 13 | CONFIG_PCKBD=y 14 | CONFIG_USB_UHCI=y 15 | CONFIG_FDC=y 16 | CONFIG_ACPI=y 17 | CONFIG_APM=y 18 | CONFIG_DMA=y 19 | CONFIG_PIIX4=y 20 | CONFIG_IDE_CORE=y 21 | CONFIG_IDE_QDEV=y 22 | CONFIG_IDE_PCI=y 23 | CONFIG_IDE_ISA=y 24 | CONFIG_IDE_PIIX=y 25 | CONFIG_IDE_VIA=y 26 | CONFIG_NE2000_ISA=y 27 | CONFIG_SOUND=y 28 | CONFIG_VIRTIO_PCI=y 29 | CONFIG_RC4030=y 30 | CONFIG_DP8393X=y 31 | CONFIG_DS1225Y=y 32 | CONFIG_MIPSNET=y 33 | CONFIG_PFLASH_CFI01=y 34 | CONFIG_FULONG=y 35 | -------------------------------------------------------------------------------- /default-configs/mipsel-linux-user.mak: -------------------------------------------------------------------------------- 1 | # Default configuration for mipsel-linux-user 2 | -------------------------------------------------------------------------------- /default-configs/mipsel-softmmu.mak: -------------------------------------------------------------------------------- 1 | # Default configuration for mipsel-softmmu 2 | 3 | CONFIG_ISA_MMIO=y 4 | CONFIG_ESP=y 5 | CONFIG_VGA_PCI=y 6 | CONFIG_VGA_ISA=y 7 | CONFIG_VGA_ISA_MM=y 8 | CONFIG_VMWARE_VGA=y 9 | CONFIG_SERIAL=y 10 | CONFIG_PARALLEL=y 11 | CONFIG_I8254=y 12 | CONFIG_PCSPK=y 13 | CONFIG_PCKBD=y 14 | CONFIG_USB_UHCI=y 15 | CONFIG_FDC=y 16 | CONFIG_ACPI=y 17 | CONFIG_APM=y 18 | CONFIG_DMA=y 19 | CONFIG_PIIX4=y 20 | CONFIG_IDE_CORE=y 21 | CONFIG_IDE_QDEV=y 22 | CONFIG_IDE_PCI=y 23 | CONFIG_IDE_ISA=y 24 | CONFIG_IDE_PIIX=y 25 | CONFIG_NE2000_ISA=y 26 | CONFIG_SOUND=y 27 | CONFIG_VIRTIO_PCI=y 28 | CONFIG_RC4030=y 29 | CONFIG_DP8393X=y 30 | CONFIG_DS1225Y=y 31 | CONFIG_MIPSNET=y 32 | CONFIG_PFLASH_CFI01=y 33 | -------------------------------------------------------------------------------- /default-configs/ppc-darwin-user.mak: -------------------------------------------------------------------------------- 1 | # Default configuration for ppc-darwin-user 2 | 3 | CONFIG_GDBSTUB_XML=y 4 | -------------------------------------------------------------------------------- /default-configs/ppc-linux-user.mak: -------------------------------------------------------------------------------- 1 | # Default configuration for ppc-linux-user 2 | 3 | CONFIG_GDBSTUB_XML=y 4 | -------------------------------------------------------------------------------- /default-configs/ppc-softmmu.mak: -------------------------------------------------------------------------------- 1 | # Default configuration for ppc-softmmu 2 | 3 | CONFIG_GDBSTUB_XML=y 4 | CONFIG_USB_OHCI=y 5 | CONFIG_ISA_MMIO=y 6 | CONFIG_ESCC=y 7 | CONFIG_M48T59=y 8 | CONFIG_VGA_PCI=y 9 | CONFIG_SERIAL=y 10 | CONFIG_I8254=y 11 | CONFIG_PCKBD=y 12 | CONFIG_FDC=y 13 | CONFIG_DMA=y 14 | CONFIG_OPENPIC=y 15 | CONFIG_PREP_PCI=y 16 | CONFIG_MACIO=y 17 | CONFIG_CUDA=y 18 | CONFIG_ADB=y 19 | CONFIG_MAC_NVRAM=y 20 | CONFIG_MAC_DBDMA=y 21 | CONFIG_HEATHROW_PIC=y 22 | CONFIG_GRACKLE_PCI=y 23 | CONFIG_UNIN_PCI=y 24 | CONFIG_DEC_PCI=y 25 | CONFIG_PPCE500_PCI=y 26 | CONFIG_IDE_CORE=y 27 | CONFIG_IDE_QDEV=y 28 | CONFIG_IDE_PCI=y 29 | CONFIG_IDE_ISA=y 30 | CONFIG_IDE_CMD646=y 31 | CONFIG_IDE_MACIO=y 32 | CONFIG_NE2000_ISA=y 33 | CONFIG_SOUND=y 34 | CONFIG_VIRTIO_PCI=y 35 | CONFIG_PFLASH_CFI02=y 36 | -------------------------------------------------------------------------------- /default-configs/ppc64-linux-user.mak: -------------------------------------------------------------------------------- 1 | # Default configuration for ppc64-linux-user 2 | 3 | CONFIG_GDBSTUB_XML=y 4 | -------------------------------------------------------------------------------- /default-configs/ppc64-softmmu.mak: -------------------------------------------------------------------------------- 1 | # Default configuration for ppc64-softmmu 2 | 3 | CONFIG_GDBSTUB_XML=y 4 | CONFIG_USB_OHCI=y 5 | CONFIG_ISA_MMIO=y 6 | CONFIG_ESCC=y 7 | CONFIG_M48T59=y 8 | CONFIG_VGA_PCI=y 9 | CONFIG_SERIAL=y 10 | CONFIG_I8254=y 11 | CONFIG_PCKBD=y 12 | CONFIG_FDC=y 13 | CONFIG_DMA=y 14 | CONFIG_OPENPIC=y 15 | CONFIG_PREP_PCI=y 16 | CONFIG_MACIO=y 17 | CONFIG_CUDA=y 18 | CONFIG_ADB=y 19 | CONFIG_MAC_NVRAM=y 20 | CONFIG_MAC_DBDMA=y 21 | CONFIG_HEATHROW_PIC=y 22 | CONFIG_GRACKLE_PCI=y 23 | CONFIG_UNIN_PCI=y 24 | CONFIG_DEC_PCI=y 25 | CONFIG_PPCE500_PCI=y 26 | CONFIG_IDE_CORE=y 27 | CONFIG_IDE_QDEV=y 28 | CONFIG_IDE_PCI=y 29 | CONFIG_IDE_ISA=y 30 | CONFIG_IDE_CMD646=y 31 | CONFIG_IDE_MACIO=y 32 | CONFIG_NE2000_ISA=y 33 | CONFIG_SOUND=y 34 | CONFIG_VIRTIO_PCI=y 35 | CONFIG_PFLASH_CFI02=y 36 | -------------------------------------------------------------------------------- /default-configs/ppc64abi32-linux-user.mak: -------------------------------------------------------------------------------- 1 | # Default configuration for ppc64abi32-linux-user 2 | 3 | CONFIG_GDBSTUB_XML=y 4 | -------------------------------------------------------------------------------- /default-configs/ppcemb-softmmu.mak: -------------------------------------------------------------------------------- 1 | # Default configuration for ppcemb-softmmu 2 | 3 | CONFIG_GDBSTUB_XML=y 4 | CONFIG_USB_OHCI=y 5 | CONFIG_ISA_MMIO=y 6 | CONFIG_ESCC=y 7 | CONFIG_M48T59=y 8 | CONFIG_VGA_PCI=y 9 | CONFIG_SERIAL=y 10 | CONFIG_I8254=y 11 | CONFIG_PCKBD=y 12 | CONFIG_FDC=y 13 | CONFIG_DMA=y 14 | CONFIG_OPENPIC=y 15 | CONFIG_PREP_PCI=y 16 | CONFIG_MACIO=y 17 | CONFIG_CUDA=y 18 | CONFIG_ADB=y 19 | CONFIG_MAC_NVRAM=y 20 | CONFIG_MAC_DBDMA=y 21 | CONFIG_HEATHROW_PIC=y 22 | CONFIG_GRACKLE_PCI=y 23 | CONFIG_UNIN_PCI=y 24 | CONFIG_DEC_PCI=y 25 | CONFIG_PPCE500_PCI=y 26 | CONFIG_IDE_CORE=y 27 | CONFIG_IDE_QDEV=y 28 | CONFIG_IDE_PCI=y 29 | CONFIG_IDE_ISA=y 30 | CONFIG_IDE_CMD646=y 31 | CONFIG_IDE_MACIO=y 32 | CONFIG_NE2000_ISA=y 33 | CONFIG_SOUND=y 34 | CONFIG_VIRTIO_PCI=y 35 | CONFIG_PFLASH_CFI02=y 36 | -------------------------------------------------------------------------------- /default-configs/s390x-softmmu.mak: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pleed/pyqemu/a8bfd2186e347c6343ae3564a890e0fdf96a4d51/default-configs/s390x-softmmu.mak -------------------------------------------------------------------------------- /default-configs/sh4-linux-user.mak: -------------------------------------------------------------------------------- 1 | # Default configuration for sh4-linux-user 2 | -------------------------------------------------------------------------------- /default-configs/sh4-softmmu.mak: -------------------------------------------------------------------------------- 1 | # Default configuration for sh4-softmmu 2 | 3 | CONFIG_USB_OHCI=y 4 | CONFIG_SERIAL=y 5 | CONFIG_PTIMER=y 6 | CONFIG_VIRTIO_PCI=y 7 | CONFIG_IDE_CORE=y 8 | CONFIG_PFLASH_CFI02=y 9 | CONFIG_ISA_MMIO=y 10 | -------------------------------------------------------------------------------- /default-configs/sh4eb-linux-user.mak: -------------------------------------------------------------------------------- 1 | # Default configuration for sh4eb-linux-user 2 | -------------------------------------------------------------------------------- /default-configs/sh4eb-softmmu.mak: -------------------------------------------------------------------------------- 1 | # Default configuration for sh4eb-softmmu 2 | 3 | CONFIG_USB_OHCI=y 4 | CONFIG_SERIAL=y 5 | CONFIG_PTIMER=y 6 | CONFIG_VIRTIO_PCI=y 7 | CONFIG_IDE_CORE=y 8 | CONFIG_PFLASH_CFI02=y 9 | CONFIG_ISA_MMIO=y 10 | -------------------------------------------------------------------------------- /default-configs/sparc-bsd-user.mak: -------------------------------------------------------------------------------- 1 | # Default configuration for sparc-bsd-user 2 | -------------------------------------------------------------------------------- /default-configs/sparc-linux-user.mak: -------------------------------------------------------------------------------- 1 | # Default configuration for sparc-linux-user 2 | -------------------------------------------------------------------------------- /default-configs/sparc-softmmu.mak: -------------------------------------------------------------------------------- 1 | # Default configuration for sparc-softmmu 2 | 3 | CONFIG_ECC=y 4 | CONFIG_ESP=y 5 | CONFIG_ESCC=y 6 | CONFIG_M48T59=y 7 | CONFIG_PTIMER=y 8 | CONFIG_FDC=y 9 | CONFIG_VIRTIO_PCI=y 10 | CONFIG_EMPTY_SLOT=y 11 | -------------------------------------------------------------------------------- /default-configs/sparc32plus-linux-user.mak: -------------------------------------------------------------------------------- 1 | # Default configuration for sparc32plus-linux-user 2 | -------------------------------------------------------------------------------- /default-configs/sparc64-bsd-user.mak: -------------------------------------------------------------------------------- 1 | # Default configuration for sparc64-bsd-user 2 | -------------------------------------------------------------------------------- /default-configs/sparc64-linux-user.mak: -------------------------------------------------------------------------------- 1 | # Default configuration for sparc64-linux-user 2 | -------------------------------------------------------------------------------- /default-configs/sparc64-softmmu.mak: -------------------------------------------------------------------------------- 1 | # Default configuration for sparc64-softmmu 2 | 3 | CONFIG_ISA_MMIO=y 4 | CONFIG_M48T59=y 5 | CONFIG_PTIMER=y 6 | CONFIG_VGA_PCI=y 7 | CONFIG_SERIAL=y 8 | CONFIG_PARALLEL=y 9 | CONFIG_PCKBD=y 10 | CONFIG_FDC=y 11 | CONFIG_IDE_CORE=y 12 | CONFIG_IDE_QDEV=y 13 | CONFIG_IDE_PCI=y 14 | CONFIG_IDE_ISA=y 15 | CONFIG_IDE_CMD646=y 16 | CONFIG_VIRTIO_PCI=y 17 | -------------------------------------------------------------------------------- /default-configs/x86_64-bsd-user.mak: -------------------------------------------------------------------------------- 1 | # Default configuration for x86_64-bsd-user 2 | -------------------------------------------------------------------------------- /default-configs/x86_64-linux-user.mak: -------------------------------------------------------------------------------- 1 | # Default configuration for x86_64-linux-user 2 | -------------------------------------------------------------------------------- /default-configs/x86_64-softmmu.mak: -------------------------------------------------------------------------------- 1 | # Default configuration for x86_64-softmmu 2 | 3 | CONFIG_USB_OHCI=y 4 | CONFIG_VGA_PCI=y 5 | CONFIG_VGA_ISA=y 6 | CONFIG_VMWARE_VGA=y 7 | CONFIG_SERIAL=y 8 | CONFIG_PARALLEL=y 9 | CONFIG_I8254=y 10 | CONFIG_PCSPK=y 11 | CONFIG_PCKBD=y 12 | CONFIG_USB_UHCI=y 13 | CONFIG_FDC=y 14 | CONFIG_ACPI=y 15 | CONFIG_APM=y 16 | CONFIG_DMA=y 17 | CONFIG_IDE_CORE=y 18 | CONFIG_IDE_QDEV=y 19 | CONFIG_IDE_PCI=y 20 | CONFIG_IDE_ISA=y 21 | CONFIG_IDE_PIIX=y 22 | CONFIG_NE2000_ISA=y 23 | CONFIG_PIIX_PCI=y 24 | CONFIG_SOUND=y 25 | CONFIG_VIRTIO_PCI=y 26 | -------------------------------------------------------------------------------- /device_tree.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Header with function prototypes to help device tree manipulation using 3 | * libfdt. It also provides functions to read entries from device tree proc 4 | * interface. 5 | * 6 | * Copyright 2008 IBM Corporation. 7 | * Authors: Jerone Young 8 | * Hollis Blanchard 9 | * 10 | * This work is licensed under the GNU GPL license version 2 or later. 11 | * 12 | */ 13 | 14 | #ifndef __DEVICE_TREE_H__ 15 | #define __DEVICE_TREE_H__ 16 | 17 | void *load_device_tree(const char *filename_path, int *sizep); 18 | 19 | int qemu_devtree_setprop(void *fdt, const char *node_path, 20 | const char *property, uint32_t *val_array, int size); 21 | int qemu_devtree_setprop_cell(void *fdt, const char *node_path, 22 | const char *property, uint32_t val); 23 | int qemu_devtree_setprop_string(void *fdt, const char *node_path, 24 | const char *property, const char *string); 25 | 26 | #endif /* __DEVICE_TREE_H__ */ 27 | -------------------------------------------------------------------------------- /envlist.h: -------------------------------------------------------------------------------- 1 | #ifndef ENVLIST_H 2 | #define ENVLIST_H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | typedef struct envlist envlist_t; 9 | 10 | extern envlist_t *envlist_create(void); 11 | extern void envlist_free(envlist_t *); 12 | extern int envlist_setenv(envlist_t *, const char *); 13 | extern int envlist_unsetenv(envlist_t *, const char *); 14 | extern int envlist_parse_set(envlist_t *, const char *); 15 | extern int envlist_parse_unset(envlist_t *, const char *); 16 | extern char **envlist_to_environ(const envlist_t *, size_t *); 17 | 18 | #ifdef __cplusplus 19 | } 20 | #endif 21 | 22 | #endif /* ENVLIST_H */ 23 | -------------------------------------------------------------------------------- /gdb-xml/cf-fp.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | , 21 | 22 | 23 | -------------------------------------------------------------------------------- /hpet.h: -------------------------------------------------------------------------------- 1 | #ifndef __HPET__ 2 | #define __HPET__ 1 3 | 4 | 5 | 6 | struct hpet_info { 7 | unsigned long hi_ireqfreq; /* Hz */ 8 | unsigned long hi_flags; /* information */ 9 | unsigned short hi_hpet; 10 | unsigned short hi_timer; 11 | }; 12 | 13 | #define HPET_INFO_PERIODIC 0x0001 /* timer is periodic */ 14 | 15 | #define HPET_IE_ON _IO('h', 0x01) /* interrupt on */ 16 | #define HPET_IE_OFF _IO('h', 0x02) /* interrupt off */ 17 | #define HPET_INFO _IOR('h', 0x03, struct hpet_info) 18 | #define HPET_EPI _IO('h', 0x04) /* enable periodic */ 19 | #define HPET_DPI _IO('h', 0x05) /* disable periodic */ 20 | #define HPET_IRQFREQ _IOW('h', 0x6, unsigned long) /* IRQFREQ usec */ 21 | 22 | #endif /* !__HPET__ */ 23 | -------------------------------------------------------------------------------- /hw/9p.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Virtio 9p 3 | * 4 | * Copyright IBM, Corp. 2010 5 | * 6 | * Authors: 7 | * Aneesh Kumar K.V 8 | * 9 | * This work is licensed under the terms of the GNU GPL, version 2. See 10 | * the COPYING file in the top-level directory. 11 | * 12 | */ 13 | 14 | #ifndef QEMU_9P_H 15 | #define QEMU_9P_H 16 | 17 | typedef struct V9fsConf 18 | { 19 | /* tag name for the device */ 20 | char *tag; 21 | char *fsdev_id; 22 | } V9fsConf; 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /hw/a9mpcore.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Cortex-A9MPCore internal peripheral emulation. 3 | * 4 | * Copyright (c) 2009 CodeSourcery. 5 | * Written by Paul Brook 6 | * 7 | * This code is licenced under the GPL. 8 | */ 9 | 10 | /* 64 external IRQ lines. */ 11 | #define GIC_NIRQ 96 12 | #include "mpcore.c" 13 | 14 | static SysBusDeviceInfo mpcore_priv_info = { 15 | .init = mpcore_priv_init, 16 | .qdev.name = "a9mpcore_priv", 17 | .qdev.size = sizeof(mpcore_priv_state), 18 | .qdev.props = (Property[]) { 19 | DEFINE_PROP_UINT32("num-cpu", mpcore_priv_state, num_cpu, 1), 20 | DEFINE_PROP_END_OF_LIST(), 21 | } 22 | }; 23 | 24 | static void a9mpcore_register_devices(void) 25 | { 26 | sysbus_register_withprop(&mpcore_priv_info); 27 | } 28 | 29 | device_init(a9mpcore_register_devices) 30 | -------------------------------------------------------------------------------- /hw/apb_pci.h: -------------------------------------------------------------------------------- 1 | #ifndef APB_PCI_H 2 | #define APB_PCI_H 3 | 4 | #include "qemu-common.h" 5 | 6 | PCIBus *pci_apb_init(target_phys_addr_t special_base, 7 | target_phys_addr_t mem_base, 8 | qemu_irq *pic, PCIBus **bus2, PCIBus **bus3); 9 | #endif 10 | -------------------------------------------------------------------------------- /hw/apic.h: -------------------------------------------------------------------------------- 1 | #ifndef APIC_H 2 | #define APIC_H 3 | 4 | #include "qemu-common.h" 5 | 6 | /* apic.c */ 7 | void apic_deliver_irq(uint8_t dest, uint8_t dest_mode, 8 | uint8_t delivery_mode, 9 | uint8_t vector_num, uint8_t polarity, 10 | uint8_t trigger_mode); 11 | int apic_accept_pic_intr(DeviceState *s); 12 | void apic_deliver_pic_intr(DeviceState *s, int level); 13 | int apic_get_interrupt(DeviceState *s); 14 | void apic_reset_irq_delivered(void); 15 | int apic_get_irq_delivered(void); 16 | void cpu_set_apic_base(DeviceState *s, uint64_t val); 17 | uint64_t cpu_get_apic_base(DeviceState *s); 18 | void cpu_set_apic_tpr(DeviceState *s, uint8_t val); 19 | uint8_t cpu_get_apic_tpr(DeviceState *s); 20 | void apic_init_reset(DeviceState *s); 21 | void apic_sipi(DeviceState *s); 22 | 23 | /* pc.c */ 24 | int cpu_is_bsp(CPUState *env); 25 | DeviceState *cpu_get_current_apic(void); 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /hw/apm.h: -------------------------------------------------------------------------------- 1 | #ifndef APM_H 2 | #define APM_H 3 | 4 | #include 5 | #include "qemu-common.h" 6 | #include "hw.h" 7 | 8 | typedef void (*apm_ctrl_changed_t)(uint32_t val, void *arg); 9 | 10 | typedef struct APMState { 11 | uint8_t apmc; 12 | uint8_t apms; 13 | 14 | apm_ctrl_changed_t callback; 15 | void *arg; 16 | } APMState; 17 | 18 | void apm_init(APMState *s, apm_ctrl_changed_t callback, void *arg); 19 | 20 | extern const VMStateDescription vmstate_apm; 21 | 22 | #endif /* APM_H */ 23 | -------------------------------------------------------------------------------- /hw/audiodev.h: -------------------------------------------------------------------------------- 1 | /* es1370.c */ 2 | int es1370_init(PCIBus *bus); 3 | 4 | /* sb16.c */ 5 | int SB16_init(qemu_irq *pic); 6 | 7 | /* adlib.c */ 8 | int Adlib_init(qemu_irq *pic); 9 | 10 | /* gus.c */ 11 | int GUS_init(qemu_irq *pic); 12 | 13 | /* ac97.c */ 14 | int ac97_init(PCIBus *buf); 15 | 16 | /* cs4231a.c */ 17 | int cs4231a_init(qemu_irq *pic); 18 | -------------------------------------------------------------------------------- /hw/bitbang_i2c.h: -------------------------------------------------------------------------------- 1 | #ifndef BITBANG_I2C_H 2 | #define BITBANG_I2C_H 3 | 4 | #include "i2c.h" 5 | 6 | typedef struct bitbang_i2c_interface bitbang_i2c_interface; 7 | 8 | #define BITBANG_I2C_SDA 0 9 | #define BITBANG_I2C_SCL 1 10 | 11 | bitbang_i2c_interface *bitbang_i2c_init(i2c_bus *bus); 12 | int bitbang_i2c_set(bitbang_i2c_interface *i2c, int line, int level); 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /hw/boards.h: -------------------------------------------------------------------------------- 1 | /* Declarations for use by board files for creating devices. */ 2 | 3 | #ifndef HW_BOARDS_H 4 | #define HW_BOARDS_H 5 | 6 | #include "qdev.h" 7 | 8 | typedef void QEMUMachineInitFunc(ram_addr_t ram_size, 9 | const char *boot_device, 10 | const char *kernel_filename, 11 | const char *kernel_cmdline, 12 | const char *initrd_filename, 13 | const char *cpu_model); 14 | 15 | typedef struct QEMUMachine { 16 | const char *name; 17 | const char *alias; 18 | const char *desc; 19 | QEMUMachineInitFunc *init; 20 | int use_scsi; 21 | int max_cpus; 22 | unsigned int no_serial:1, 23 | no_parallel:1, 24 | use_virtcon:1, 25 | no_vga:1, 26 | no_floppy:1, 27 | no_cdrom:1, 28 | no_sdcard:1; 29 | int is_default; 30 | GlobalProperty *compat_props; 31 | struct QEMUMachine *next; 32 | } QEMUMachine; 33 | 34 | int qemu_register_machine(QEMUMachine *m); 35 | 36 | extern QEMUMachine *current_machine; 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /hw/cris-boot.h: -------------------------------------------------------------------------------- 1 | 2 | struct cris_load_info 3 | { 4 | const char *image_filename; 5 | const char *cmdline; 6 | int image_size; 7 | 8 | target_phys_addr_t entry; 9 | }; 10 | 11 | void cris_load_image(CPUState *env, struct cris_load_info *li); 12 | -------------------------------------------------------------------------------- /hw/dec_pci.h: -------------------------------------------------------------------------------- 1 | #ifndef DEC_PCI_H 2 | #define DEC_PCI_H 3 | 4 | #include "qemu-common.h" 5 | 6 | PCIBus *pci_dec_21154_init(PCIBus *parent_bus, int devfn); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /hw/ds1225y.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pleed/pyqemu/a8bfd2186e347c6343ae3564a890e0fdf96a4d51/hw/ds1225y.c -------------------------------------------------------------------------------- /hw/empty_slot.h: -------------------------------------------------------------------------------- 1 | /* empty_slot.c */ 2 | void empty_slot_init(target_phys_addr_t addr, uint64_t slot_size); 3 | -------------------------------------------------------------------------------- /hw/escc.h: -------------------------------------------------------------------------------- 1 | /* escc.c */ 2 | #define ESCC_SIZE 4 3 | int escc_init(target_phys_addr_t base, qemu_irq irqA, qemu_irq irqB, 4 | CharDriverState *chrA, CharDriverState *chrB, 5 | int clock, int it_shift); 6 | 7 | void slavio_serial_ms_kbd_init(target_phys_addr_t base, qemu_irq irq, 8 | int disabled, int clock, int it_shift); 9 | -------------------------------------------------------------------------------- /hw/esp.h: -------------------------------------------------------------------------------- 1 | #ifndef QEMU_HW_ESP_H 2 | #define QEMU_HW_ESP_H 3 | 4 | /* esp.c */ 5 | #define ESP_MAX_DEVS 7 6 | typedef void (*ESPDMAMemoryReadWriteFunc)(void *opaque, uint8_t *buf, int len); 7 | void esp_init(target_phys_addr_t espaddr, int it_shift, 8 | ESPDMAMemoryReadWriteFunc dma_memory_read, 9 | ESPDMAMemoryReadWriteFunc dma_memory_write, 10 | void *dma_opaque, qemu_irq irq, qemu_irq *reset, 11 | qemu_irq *dma_enable); 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /hw/etraxfs_dma.h: -------------------------------------------------------------------------------- 1 | struct etraxfs_dma_client 2 | { 3 | /* DMA controller. */ 4 | int channel; 5 | void *ctrl; 6 | 7 | /* client. */ 8 | struct 9 | { 10 | int (*push)(void *opaque, unsigned char *buf, int len); 11 | void (*pull)(void *opaque); 12 | void *opaque; 13 | } client; 14 | }; 15 | 16 | void *etraxfs_dmac_init(target_phys_addr_t base, int nr_channels); 17 | void etraxfs_dmac_connect(void *opaque, int channel, qemu_irq *line, 18 | int input); 19 | void etraxfs_dmac_connect_client(void *opaque, int c, 20 | struct etraxfs_dma_client *cl); 21 | int etraxfs_dmac_input(struct etraxfs_dma_client *client, 22 | void *buf, int len, int eop); 23 | -------------------------------------------------------------------------------- /hw/event_notifier.h: -------------------------------------------------------------------------------- 1 | #ifndef QEMU_EVENT_NOTIFIER_H 2 | #define QEMU_EVENT_NOTIFIER_H 3 | 4 | #include "qemu-common.h" 5 | 6 | struct EventNotifier { 7 | int fd; 8 | }; 9 | 10 | int event_notifier_init(EventNotifier *, int active); 11 | void event_notifier_cleanup(EventNotifier *); 12 | int event_notifier_get_fd(EventNotifier *); 13 | int event_notifier_test_and_clear(EventNotifier *); 14 | int event_notifier_test(EventNotifier *); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /hw/fdc.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pleed/pyqemu/a8bfd2186e347c6343ae3564a890e0fdf96a4d51/hw/fdc.c -------------------------------------------------------------------------------- /hw/fdc.h: -------------------------------------------------------------------------------- 1 | #ifndef HW_FDC_H 2 | #define HW_FDC_H 3 | 4 | /* fdc.c */ 5 | #define MAX_FD 2 6 | 7 | typedef struct FDCtrl FDCtrl; 8 | 9 | FDCtrl *fdctrl_init_isa(DriveInfo **fds); 10 | FDCtrl *fdctrl_init_sysbus(qemu_irq irq, int dma_chann, 11 | target_phys_addr_t mmio_base, DriveInfo **fds); 12 | FDCtrl *sun4m_fdctrl_init(qemu_irq irq, target_phys_addr_t io_base, 13 | DriveInfo **fds, qemu_irq *fdc_tc); 14 | int fdctrl_get_drive_type(FDCtrl *fdctrl, int drive_num); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /hw/framebuffer.h: -------------------------------------------------------------------------------- 1 | #ifndef QEMU_FRAMEBUFFER_H 2 | #define QEMU_FRAMEBUFFER_H 3 | 4 | /* Framebuffer device helper routines. */ 5 | 6 | typedef void (*drawfn)(void *, uint8_t *, const uint8_t *, int, int); 7 | 8 | void framebuffer_update_display( 9 | DisplayState *ds, 10 | target_phys_addr_t base, 11 | int cols, 12 | int rows, 13 | int src_width, 14 | int dest_row_pitch, 15 | int dest_col_pitch, 16 | int invalidate, 17 | drawfn fn, 18 | void *opaque, 19 | int *first_row, 20 | int *last_row); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /hw/ide.h: -------------------------------------------------------------------------------- 1 | #ifndef HW_IDE_H 2 | #define HW_IDE_H 3 | 4 | #include "isa.h" 5 | #include "pci.h" 6 | 7 | /* ide-isa.c */ 8 | ISADevice *isa_ide_init(int iobase, int iobase2, int isairq, 9 | DriveInfo *hd0, DriveInfo *hd1); 10 | 11 | /* ide-pci.c */ 12 | void pci_cmd646_ide_init(PCIBus *bus, DriveInfo **hd_table, 13 | int secondary_ide_enabled); 14 | PCIDevice *pci_piix3_ide_init(PCIBus *bus, DriveInfo **hd_table, int devfn); 15 | PCIDevice *pci_piix4_ide_init(PCIBus *bus, DriveInfo **hd_table, int devfn); 16 | void vt82c686b_ide_init(PCIBus *bus, DriveInfo **hd_table, int devfn); 17 | 18 | /* ide-macio.c */ 19 | int pmac_ide_init (DriveInfo **hd_table, qemu_irq irq, 20 | void *dbdma, int channel, qemu_irq dma_irq); 21 | 22 | /* ide-mmio.c */ 23 | void mmio_ide_init (target_phys_addr_t membase, target_phys_addr_t membase2, 24 | qemu_irq irq, int shift, 25 | DriveInfo *hd0, DriveInfo *hd1); 26 | 27 | void ide_get_bs(BlockDriverState *bs[], BusState *qbus); 28 | 29 | #endif /* HW_IDE_H */ 30 | -------------------------------------------------------------------------------- /hw/ide/pci.h: -------------------------------------------------------------------------------- 1 | #ifndef HW_IDE_PCI_H 2 | #define HW_IDE_PCI_H 3 | 4 | #include 5 | 6 | typedef struct PCIIDEState { 7 | PCIDevice dev; 8 | IDEBus bus[2]; 9 | BMDMAState bmdma[2]; 10 | uint32_t secondary; /* used only for cmd646 */ 11 | } PCIIDEState; 12 | 13 | void bmdma_cmd_writeb(void *opaque, uint32_t addr, uint32_t val); 14 | uint32_t bmdma_addr_readb(void *opaque, uint32_t addr); 15 | void bmdma_addr_writeb(void *opaque, uint32_t addr, uint32_t val); 16 | uint32_t bmdma_addr_readw(void *opaque, uint32_t addr); 17 | void bmdma_addr_writew(void *opaque, uint32_t addr, uint32_t val); 18 | uint32_t bmdma_addr_readl(void *opaque, uint32_t addr); 19 | void bmdma_addr_writel(void *opaque, uint32_t addr, uint32_t val); 20 | void pci_ide_create_devs(PCIDevice *dev, DriveInfo **hd_table); 21 | 22 | extern const VMStateDescription vmstate_ide_pci; 23 | #endif 24 | -------------------------------------------------------------------------------- /hw/irq.h: -------------------------------------------------------------------------------- 1 | #ifndef QEMU_IRQ_H 2 | #define QEMU_IRQ_H 3 | 4 | /* Generic IRQ/GPIO pin infrastructure. */ 5 | 6 | /* FIXME: Rmove one of these. */ 7 | typedef void (*qemu_irq_handler)(void *opaque, int n, int level); 8 | typedef void SetIRQFunc(void *opaque, int irq_num, int level); 9 | 10 | void qemu_set_irq(qemu_irq irq, int level); 11 | 12 | static inline void qemu_irq_raise(qemu_irq irq) 13 | { 14 | qemu_set_irq(irq, 1); 15 | } 16 | 17 | static inline void qemu_irq_lower(qemu_irq irq) 18 | { 19 | qemu_set_irq(irq, 0); 20 | } 21 | 22 | static inline void qemu_irq_pulse(qemu_irq irq) 23 | { 24 | qemu_set_irq(irq, 1); 25 | qemu_set_irq(irq, 0); 26 | } 27 | 28 | /* Returns an array of N IRQs. */ 29 | qemu_irq *qemu_allocate_irqs(qemu_irq_handler handler, void *opaque, int n); 30 | void qemu_free_irqs(qemu_irq *s); 31 | 32 | /* Returns a new IRQ with opposite polarity. */ 33 | qemu_irq qemu_irq_invert(qemu_irq irq); 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /hw/jazz_led.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pleed/pyqemu/a8bfd2186e347c6343ae3564a890e0fdf96a4d51/hw/jazz_led.c -------------------------------------------------------------------------------- /hw/mainstone.h: -------------------------------------------------------------------------------- 1 | /* 2 | * PXA270-based Intel Mainstone platforms. 3 | * 4 | * Copyright (c) 2007 by Armin Kuster or 5 | * 6 | * 7 | * This code is licensed under the GNU GPL v2. 8 | */ 9 | 10 | #ifndef __MAINSTONE_H__ 11 | #define __MAINSTONE_H__ 12 | 13 | /* Device addresses */ 14 | #define MST_FPGA_PHYS 0x08000000 15 | #define MST_ETH_PHYS 0x10000300 16 | #define MST_FLASH_0 0x00000000 17 | #define MST_FLASH_1 0x04000000 18 | 19 | /* IRQ definitions */ 20 | #define MMC_IRQ 0 21 | #define USIM_IRQ 1 22 | #define USBC_IRQ 2 23 | #define ETHERNET_IRQ 3 24 | #define AC97_IRQ 4 25 | #define PEN_IRQ 5 26 | #define MSINS_IRQ 6 27 | #define EXBRD_IRQ 7 28 | #define S0_CD_IRQ 9 29 | #define S0_STSCHG_IRQ 10 30 | #define S0_IRQ 11 31 | #define S1_CD_IRQ 13 32 | #define S1_STSCHG_IRQ 14 33 | #define S1_IRQ 15 34 | 35 | extern qemu_irq 36 | *mst_irq_init(PXA2xxState *cpu, uint32_t base, int irq); 37 | 38 | #endif /* __MAINSTONE_H__ */ 39 | -------------------------------------------------------------------------------- /hw/mc146818rtc.h: -------------------------------------------------------------------------------- 1 | #ifndef MC146818RTC_H 2 | #define MC146818RTC_H 3 | 4 | #include "isa.h" 5 | 6 | #define RTC_ISA_IRQ 8 7 | 8 | ISADevice *rtc_init(int base_year, qemu_irq intercept_irq); 9 | void rtc_set_memory(ISADevice *dev, int addr, int val); 10 | void rtc_set_date(ISADevice *dev, const struct tm *tm); 11 | 12 | #endif /* !MC146818RTC_H */ 13 | -------------------------------------------------------------------------------- /hw/mcf.h: -------------------------------------------------------------------------------- 1 | #ifndef HW_MCF_H 2 | #define HW_MCF_H 3 | /* Motorola ColdFire device prototypes. */ 4 | 5 | /* mcf_uart.c */ 6 | uint32_t mcf_uart_read(void *opaque, target_phys_addr_t addr); 7 | void mcf_uart_write(void *opaque, target_phys_addr_t addr, uint32_t val); 8 | void *mcf_uart_init(qemu_irq irq, CharDriverState *chr); 9 | void mcf_uart_mm_init(target_phys_addr_t base, qemu_irq irq, 10 | CharDriverState *chr); 11 | 12 | /* mcf_intc.c */ 13 | qemu_irq *mcf_intc_init(target_phys_addr_t base, CPUState *env); 14 | 15 | /* mcf_fec.c */ 16 | void mcf_fec_init(NICInfo *nd, target_phys_addr_t base, qemu_irq *irq); 17 | 18 | /* mcf5206.c */ 19 | qemu_irq *mcf5206_init(uint32_t base, CPUState *env); 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /hw/mips-bios.h: -------------------------------------------------------------------------------- 1 | #include "cpu.h" 2 | 3 | #define BIOS_SIZE (4 * 1024 * 1024) 4 | #ifdef TARGET_WORDS_BIGENDIAN 5 | #define BIOS_FILENAME "mips_bios.bin" 6 | #else 7 | #define BIOS_FILENAME "mipsel_bios.bin" 8 | #endif 9 | -------------------------------------------------------------------------------- /hw/mips_cpudevs.h: -------------------------------------------------------------------------------- 1 | #ifndef HW_MIPS_CPUDEVS_H 2 | #define HW_MIPS_CPUDEVS_H 3 | /* Definitions for MIPS CPU internal devices. */ 4 | 5 | /* mips_addr.c */ 6 | uint64_t cpu_mips_kseg0_to_phys(void *opaque, uint64_t addr); 7 | uint64_t cpu_mips_phys_to_kseg0(void *opaque, uint64_t addr); 8 | 9 | /* mips_int.c */ 10 | void cpu_mips_irq_init_cpu(CPUState *env); 11 | 12 | /* mips_timer.c */ 13 | void cpu_mips_clock_init(CPUState *); 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /hw/msix.h: -------------------------------------------------------------------------------- 1 | #ifndef QEMU_MSIX_H 2 | #define QEMU_MSIX_H 3 | 4 | #include "qemu-common.h" 5 | #include "pci.h" 6 | 7 | int msix_init(PCIDevice *pdev, unsigned short nentries, 8 | unsigned bar_nr, unsigned bar_size); 9 | 10 | void msix_write_config(PCIDevice *pci_dev, uint32_t address, 11 | uint32_t val, int len); 12 | 13 | void msix_mmio_map(PCIDevice *pci_dev, int region_num, 14 | pcibus_t addr, pcibus_t size, int type); 15 | 16 | int msix_uninit(PCIDevice *d); 17 | 18 | void msix_save(PCIDevice *dev, QEMUFile *f); 19 | void msix_load(PCIDevice *dev, QEMUFile *f); 20 | 21 | int msix_enabled(PCIDevice *dev); 22 | int msix_present(PCIDevice *dev); 23 | 24 | uint32_t msix_bar_size(PCIDevice *dev); 25 | 26 | int msix_vector_use(PCIDevice *dev, unsigned vector); 27 | void msix_vector_unuse(PCIDevice *dev, unsigned vector); 28 | void msix_unuse_all_vectors(PCIDevice *dev); 29 | 30 | void msix_notify(PCIDevice *dev, unsigned vector); 31 | 32 | void msix_reset(PCIDevice *dev); 33 | 34 | extern int msix_supported; 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /hw/msmouse.h: -------------------------------------------------------------------------------- 1 | /* msmouse.c */ 2 | CharDriverState *qemu_chr_open_msmouse(QemuOpts *opts); 3 | -------------------------------------------------------------------------------- /hw/multiboot.h: -------------------------------------------------------------------------------- 1 | #ifndef QEMU_MULTIBOOT_H 2 | #define QEMU_MULTIBOOT_H 3 | 4 | int load_multiboot(void *fw_cfg, 5 | FILE *f, 6 | const char *kernel_filename, 7 | const char *initrd_filename, 8 | const char *kernel_cmdline, 9 | int kernel_file_size, 10 | uint8_t *header); 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /hw/openpic.h: -------------------------------------------------------------------------------- 1 | #if !defined(__OPENPIC_H__) 2 | #define __OPENPIC_H__ 3 | 4 | /* OpenPIC have 5 outputs per CPU connected and one IRQ out single output */ 5 | enum { 6 | OPENPIC_OUTPUT_INT = 0, /* IRQ */ 7 | OPENPIC_OUTPUT_CINT, /* critical IRQ */ 8 | OPENPIC_OUTPUT_MCK, /* Machine check event */ 9 | OPENPIC_OUTPUT_DEBUG, /* Inconditional debug event */ 10 | OPENPIC_OUTPUT_RESET, /* Core reset event */ 11 | OPENPIC_OUTPUT_NB, 12 | }; 13 | 14 | qemu_irq *openpic_init (PCIBus *bus, int *pmem_index, int nb_cpus, 15 | qemu_irq **irqs, qemu_irq irq_out); 16 | qemu_irq *mpic_init (target_phys_addr_t base, int nb_cpus, 17 | qemu_irq **irqs, qemu_irq irq_out); 18 | #endif /* __OPENPIC_H__ */ 19 | -------------------------------------------------------------------------------- /hw/pm_smbus.h: -------------------------------------------------------------------------------- 1 | #ifndef PM_SMBUS_H 2 | #define PM_SMBUS_H 3 | 4 | typedef struct PMSMBus { 5 | i2c_bus *smbus; 6 | 7 | uint8_t smb_stat; 8 | uint8_t smb_ctl; 9 | uint8_t smb_cmd; 10 | uint8_t smb_addr; 11 | uint8_t smb_data0; 12 | uint8_t smb_data1; 13 | uint8_t smb_data[32]; 14 | uint8_t smb_index; 15 | } PMSMBus; 16 | 17 | void pm_smbus_init(DeviceState *parent, PMSMBus *smb); 18 | void smb_ioport_writeb(void *opaque, uint32_t addr, uint32_t val); 19 | uint32_t smb_ioport_readb(void *opaque, uint32_t addr); 20 | 21 | #endif /* !PM_SMBUS_H */ 22 | -------------------------------------------------------------------------------- /hw/ppc440.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Qemu PowerPC 440 board emualtion 3 | * 4 | * Copyright 2007 IBM Corporation. 5 | * Authors: Jerone Young 6 | * Christian Ehrhardt 7 | * 8 | * This work is licensed under the GNU GPL licence version 2 or later 9 | * 10 | */ 11 | 12 | #ifndef QEMU_PPC440_H 13 | #define QEMU_PPC440_H 14 | 15 | #include "hw.h" 16 | 17 | CPUState *ppc440ep_init(ram_addr_t *ram_size, PCIBus **pcip, 18 | const unsigned int pci_irq_nrs[4], int do_init, 19 | const char *cpu_model); 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /hw/ppce500.h: -------------------------------------------------------------------------------- 1 | /* 2 | * QEMU PowerPC E500 emulation shared definitions 3 | * 4 | * Copyright (C) 2009 Freescale Semiconductor, Inc. All rights reserved. 5 | * 6 | * Author: Yu Liu, 7 | * 8 | * This file is derived from hw/ppc440.h 9 | * the copyright for that material belongs to the original owners. 10 | * 11 | * This is free software; you can redistribute it and/or modify 12 | * it under the terms of the GNU General Public License as published by 13 | * the Free Software Foundation; either version 2 of the License, or 14 | * (at your option) any later version. 15 | */ 16 | 17 | #if !defined(PPC_E500_H) 18 | #define PPC_E500_H 19 | 20 | PCIBus *ppce500_pci_init(qemu_irq *pic, target_phys_addr_t registers); 21 | 22 | #endif /* !defined(PPC_E500_H) */ 23 | -------------------------------------------------------------------------------- /hw/prep_pci.h: -------------------------------------------------------------------------------- 1 | #ifndef QEMU_PREP_PCI_H 2 | #define QEMU_PREP_PCI_H 3 | 4 | #include "qemu-common.h" 5 | 6 | PCIBus *pci_prep_init(qemu_irq *pic); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /hw/primecell.h: -------------------------------------------------------------------------------- 1 | #ifndef PRIMECELL_H 2 | #define PRIMECELL_H 3 | 4 | /* Declarations for ARM PrimeCell based periperals. */ 5 | /* Also includes some devices that are currently only used by the 6 | ARM boards. */ 7 | 8 | /* pl080.c */ 9 | void *pl080_init(uint32_t base, qemu_irq irq, int nchannels); 10 | 11 | /* arm_sysctl.c */ 12 | void arm_sysctl_init(uint32_t base, uint32_t sys_id, uint32_t proc_id); 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /hw/ps2.h: -------------------------------------------------------------------------------- 1 | /* ps2.c */ 2 | void *ps2_kbd_init(void (*update_irq)(void *, int), void *update_arg); 3 | void *ps2_mouse_init(void (*update_irq)(void *, int), void *update_arg); 4 | void ps2_write_mouse(void *, int val); 5 | void ps2_write_keyboard(void *, int val); 6 | uint32_t ps2_read_data(void *); 7 | void ps2_queue(void *, int b); 8 | void ps2_keyboard_set_translation(void *opaque, int mode); 9 | void ps2_mouse_fake_event(void *opaque); 10 | -------------------------------------------------------------------------------- /hw/qdev-addr.c: -------------------------------------------------------------------------------- 1 | #include "qdev.h" 2 | #include "qdev-addr.h" 3 | #include "targphys.h" 4 | 5 | /* --- target physical address --- */ 6 | 7 | static int parse_taddr(DeviceState *dev, Property *prop, const char *str) 8 | { 9 | target_phys_addr_t *ptr = qdev_get_prop_ptr(dev, prop); 10 | 11 | *ptr = strtoull(str, NULL, 16); 12 | return 0; 13 | } 14 | 15 | static int print_taddr(DeviceState *dev, Property *prop, char *dest, size_t len) 16 | { 17 | target_phys_addr_t *ptr = qdev_get_prop_ptr(dev, prop); 18 | return snprintf(dest, len, "0x" TARGET_FMT_plx, *ptr); 19 | } 20 | 21 | PropertyInfo qdev_prop_taddr = { 22 | .name = "taddr", 23 | .type = PROP_TYPE_TADDR, 24 | .size = sizeof(target_phys_addr_t), 25 | .parse = parse_taddr, 26 | .print = print_taddr, 27 | }; 28 | 29 | void qdev_prop_set_taddr(DeviceState *dev, const char *name, target_phys_addr_t value) 30 | { 31 | qdev_prop_set(dev, name, &value, PROP_TYPE_TADDR); 32 | } 33 | -------------------------------------------------------------------------------- /hw/qdev-addr.h: -------------------------------------------------------------------------------- 1 | #define DEFINE_PROP_TADDR(_n, _s, _f, _d) \ 2 | DEFINE_PROP_DEFAULT(_n, _s, _f, _d, qdev_prop_taddr, target_phys_addr_t) 3 | 4 | extern PropertyInfo qdev_prop_taddr; 5 | void qdev_prop_set_taddr(DeviceState *dev, const char *name, target_phys_addr_t value); 6 | -------------------------------------------------------------------------------- /hw/sh7750_regnames.h: -------------------------------------------------------------------------------- 1 | #ifndef _SH7750_REGNAMES_H 2 | #define _SH7750_REGNAMES_H 3 | 4 | const char *regname(uint32_t addr); 5 | 6 | #endif /* _SH7750_REGNAMES_H */ 7 | -------------------------------------------------------------------------------- /hw/sh_pci.h: -------------------------------------------------------------------------------- 1 | #ifndef QEMU_SH_PCI_H 2 | #define QEMU_SH_PCI_H 3 | 4 | #include "qemu-common.h" 5 | 6 | PCIBus *sh_pci_register_bus(pci_set_irq_fn set_irq, pci_map_irq_fn map_irq, 7 | void *pic, int devfn_min, int nirq); 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /hw/sharpsl.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Common declarations for the Zaurii. 3 | * 4 | * This file is licensed under the GNU GPL. 5 | */ 6 | #ifndef QEMU_SHARPSL_H 7 | #define QEMU_SHARPSL_H 8 | 9 | #define zaurus_printf(format, ...) \ 10 | fprintf(stderr, "%s: " format, __FUNCTION__, ##__VA_ARGS__) 11 | 12 | /* zaurus.c */ 13 | typedef struct ScoopInfo ScoopInfo; 14 | ScoopInfo *scoop_init(PXA2xxState *cpu, 15 | int instance, target_phys_addr_t target_base); 16 | void scoop_gpio_set(void *opaque, int line, int level); 17 | qemu_irq *scoop_gpio_in_get(ScoopInfo *s); 18 | void scoop_gpio_out_set(ScoopInfo *s, int line, 19 | qemu_irq handler); 20 | 21 | #define SL_PXA_PARAM_BASE 0xa0000a00 22 | void sl_bootparam_write(target_phys_addr_t ptr); 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /hw/sparc32_dma.h: -------------------------------------------------------------------------------- 1 | #ifndef SPARC32_DMA_H 2 | #define SPARC32_DMA_H 3 | 4 | /* sparc32_dma.c */ 5 | void ledma_memory_read(void *opaque, target_phys_addr_t addr, 6 | uint8_t *buf, int len, int do_bswap); 7 | void ledma_memory_write(void *opaque, target_phys_addr_t addr, 8 | uint8_t *buf, int len, int do_bswap); 9 | void espdma_memory_read(void *opaque, uint8_t *buf, int len); 10 | void espdma_memory_write(void *opaque, uint8_t *buf, int len); 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /hw/syborg.h: -------------------------------------------------------------------------------- 1 | #ifndef _SYBORG_H 2 | #define _SYBORG_H 3 | 4 | #define SYBORG_ID_PLATFORM 0xc51d1000 5 | #define SYBORG_ID_INT 0xc51d0000 6 | #define SYBORG_ID_SERIAL 0xc51d0001 7 | #define SYBORG_ID_KEYBOARD 0xc51d0002 8 | #define SYBORG_ID_TIMER 0xc51d0003 9 | #define SYBORG_ID_RTC 0xc51d0004 10 | #define SYBORG_ID_MOUSE 0xc51d0005 11 | #define SYBORG_ID_TOUCHSCREEN 0xc51d0006 12 | #define SYBORG_ID_FRAMEBUFFER 0xc51d0007 13 | #define SYBORG_ID_HOSTFS 0xc51d0008 14 | #define SYBORG_ID_SNAPSHOT 0xc51d0009 15 | #define SYBORG_ID_VIRTIO 0xc51d000a 16 | #define SYBORG_ID_NAND 0xc51d000b 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /hw/tc6393xb_template.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pleed/pyqemu/a8bfd2186e347c6343ae3564a890e0fdf96a4d51/hw/tc6393xb_template.h -------------------------------------------------------------------------------- /hw/usb-ohci.h: -------------------------------------------------------------------------------- 1 | #ifndef QEMU_USB_OHCI_H 2 | #define QEMU_USB_OHCI_H 3 | 4 | #include "qemu-common.h" 5 | 6 | void usb_ohci_init_pci(struct PCIBus *bus, int devfn); 7 | 8 | #endif 9 | 10 | -------------------------------------------------------------------------------- /hw/usb-uhci.h: -------------------------------------------------------------------------------- 1 | #ifndef QEMU_USB_UHCI_H 2 | #define QEMU_USB_UHCI_H 3 | 4 | #include "qemu-common.h" 5 | 6 | void usb_uhci_piix3_init(PCIBus *bus, int devfn); 7 | void usb_uhci_piix4_init(PCIBus *bus, int devfn); 8 | void usb_uhci_vt82c686b_init(PCIBus *bus, int devfn); 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /hw/vhost_net.h: -------------------------------------------------------------------------------- 1 | #ifndef VHOST_NET_H 2 | #define VHOST_NET_H 3 | 4 | #include "net.h" 5 | 6 | struct vhost_net; 7 | typedef struct vhost_net VHostNetState; 8 | 9 | VHostNetState *vhost_net_init(VLANClientState *backend, int devfd); 10 | 11 | int vhost_net_start(VHostNetState *net, VirtIODevice *dev); 12 | void vhost_net_stop(VHostNetState *net, VirtIODevice *dev); 13 | 14 | void vhost_net_cleanup(VHostNetState *net); 15 | 16 | unsigned vhost_net_get_features(VHostNetState *net, unsigned features); 17 | void vhost_net_ack_features(VHostNetState *net, unsigned features); 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /hw/virtio-9p-debug.h: -------------------------------------------------------------------------------- 1 | #ifndef _QEMU_VIRTIO_9P_DEBUG_H 2 | #define _QEMU_VIRTIO_9P_DEBUG_H 3 | 4 | void pprint_pdu(V9fsPDU *pdu); 5 | 6 | #endif 7 | -------------------------------------------------------------------------------- /hw/vmport.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pleed/pyqemu/a8bfd2186e347c6343ae3564a890e0fdf96a4d51/hw/vmport.c -------------------------------------------------------------------------------- /hw/vmware_vga.h: -------------------------------------------------------------------------------- 1 | #ifndef QEMU_VMWARE_VGA_H 2 | #define QEMU_VMWARE_VGA_H 3 | 4 | #include "qemu-common.h" 5 | 6 | /* vmware_vga.c */ 7 | void pci_vmsvga_init(PCIBus *bus); 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /hw/vt82c686.h: -------------------------------------------------------------------------------- 1 | #ifndef HW_VT82C686_H 2 | #define HW_VT82C686_H 3 | 4 | /* vt82c686.c */ 5 | int vt82c686b_init(PCIBus * bus, int devfn); 6 | void vt82c686b_ac97_init(PCIBus *bus, int devfn); 7 | void vt82c686b_mc97_init(PCIBus *bus, int devfn); 8 | i2c_bus *vt82c686b_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base, 9 | qemu_irq sci_irq); 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /hw/xen.h: -------------------------------------------------------------------------------- 1 | #ifndef QEMU_HW_XEN_H 2 | #define QEMU_HW_XEN_H 1 3 | /* 4 | * public xen header 5 | * stuff needed outside xen-*.c, i.e. interfaces to qemu. 6 | * must not depend on any xen headers being present in 7 | * /usr/include/xen, so it can be included unconditionally. 8 | */ 9 | #include 10 | 11 | /* xen-machine.c */ 12 | enum xen_mode { 13 | XEN_EMULATE = 0, // xen emulation, using xenner (default) 14 | XEN_CREATE, // create xen domain 15 | XEN_ATTACH // attach to xen domain created by xend 16 | }; 17 | 18 | extern uint32_t xen_domid; 19 | extern enum xen_mode xen_mode; 20 | 21 | #endif /* QEMU_HW_XEN_H */ 22 | -------------------------------------------------------------------------------- /hw/xen_common.h: -------------------------------------------------------------------------------- 1 | #ifndef QEMU_HW_XEN_COMMON_H 2 | #define QEMU_HW_XEN_COMMON_H 1 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | #include "hw.h" 12 | #include "xen.h" 13 | #include "qemu-queue.h" 14 | 15 | /* 16 | * tweaks needed to build with different xen versions 17 | * 0x00030205 -> 3.1.0 18 | * 0x00030207 -> 3.2.0 19 | * 0x00030208 -> unstable 20 | */ 21 | #include 22 | #if __XEN_LATEST_INTERFACE_VERSION__ < 0x00030205 23 | # define evtchn_port_or_error_t int 24 | #endif 25 | #if __XEN_LATEST_INTERFACE_VERSION__ < 0x00030207 26 | # define xc_map_foreign_pages xc_map_foreign_batch 27 | #endif 28 | #if __XEN_LATEST_INTERFACE_VERSION__ < 0x00030208 29 | # define xen_mb() mb() 30 | # define xen_rmb() rmb() 31 | # define xen_wmb() wmb() 32 | #endif 33 | 34 | #endif /* QEMU_HW_XEN_COMMON_H */ 35 | -------------------------------------------------------------------------------- /hw/xen_domainbuild.h: -------------------------------------------------------------------------------- 1 | #ifndef QEMU_HW_XEN_DOMAINBUILD_H 2 | #define QEMU_HW_XEN_DOMAINBUILD_H 1 3 | 4 | #include "xen_common.h" 5 | 6 | int xenstore_domain_init1(const char *kernel, const char *ramdisk, 7 | const char *cmdline); 8 | int xenstore_domain_init2(int xenstore_port, int xenstore_mfn, 9 | int console_port, int console_mfn); 10 | int xen_domain_build_pv(const char *kernel, const char *ramdisk, 11 | const char *cmdline); 12 | 13 | #endif /* QEMU_HW_XEN_DOMAINBUILD_H */ 14 | -------------------------------------------------------------------------------- /iov.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Helpers for getting linearized buffers from iov / filling buffers into iovs 3 | * 4 | * Copyright (C) 2010 Red Hat, Inc. 5 | * 6 | * Author(s): 7 | * Amit Shah 8 | * 9 | * This work is licensed under the terms of the GNU GPL, version 2. See 10 | * the COPYING file in the top-level directory. 11 | */ 12 | 13 | #include "qemu-common.h" 14 | 15 | size_t iov_from_buf(struct iovec *iov, unsigned int iovcnt, 16 | const void *buf, size_t size); 17 | size_t iov_to_buf(const struct iovec *iov, const unsigned int iovcnt, 18 | void *buf, size_t offset, size_t size); 19 | size_t iov_size(const struct iovec *iov, const unsigned int iovcnt); 20 | -------------------------------------------------------------------------------- /json-parser.h: -------------------------------------------------------------------------------- 1 | /* 2 | * JSON Parser 3 | * 4 | * Copyright IBM, Corp. 2009 5 | * 6 | * Authors: 7 | * Anthony Liguori 8 | * 9 | * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. 10 | * See the COPYING.LIB file in the top-level directory. 11 | * 12 | */ 13 | 14 | #ifndef QEMU_JSON_PARSER_H 15 | #define QEMU_JSON_PARSER_H 16 | 17 | #include "qemu-common.h" 18 | #include "qlist.h" 19 | 20 | QObject *json_parser_parse(QList *tokens, va_list *ap); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /json-streamer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * JSON streaming support 3 | * 4 | * Copyright IBM, Corp. 2009 5 | * 6 | * Authors: 7 | * Anthony Liguori 8 | * 9 | * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. 10 | * See the COPYING.LIB file in the top-level directory. 11 | * 12 | */ 13 | 14 | #ifndef QEMU_JSON_STREAMER_H 15 | #define QEMU_JSON_STREAMER_H 16 | 17 | #include "qlist.h" 18 | #include "json-lexer.h" 19 | 20 | typedef struct JSONMessageParser 21 | { 22 | void (*emit)(struct JSONMessageParser *parser, QList *tokens); 23 | JSONLexer lexer; 24 | int brace_count; 25 | int bracket_count; 26 | QList *tokens; 27 | } JSONMessageParser; 28 | 29 | void json_message_parser_init(JSONMessageParser *parser, 30 | void (*func)(JSONMessageParser *, QList *)); 31 | 32 | int json_message_parser_feed(JSONMessageParser *parser, 33 | const char *buffer, size_t size); 34 | 35 | int json_message_parser_flush(JSONMessageParser *parser); 36 | 37 | void json_message_parser_destroy(JSONMessageParser *parser); 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /linux-user/arm/nwfpe/fpopcode.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pleed/pyqemu/a8bfd2186e347c6343ae3564a890e0fdf96a4d51/linux-user/arm/nwfpe/fpopcode.h -------------------------------------------------------------------------------- /linux-user/arm/syscall.h: -------------------------------------------------------------------------------- 1 | 2 | /* this struct defines the way the registers are stored on the 3 | stack during a system call. */ 4 | 5 | struct target_pt_regs { 6 | abi_long uregs[18]; 7 | }; 8 | 9 | #define ARM_cpsr uregs[16] 10 | #define ARM_pc uregs[15] 11 | #define ARM_lr uregs[14] 12 | #define ARM_sp uregs[13] 13 | #define ARM_ip uregs[12] 14 | #define ARM_fp uregs[11] 15 | #define ARM_r10 uregs[10] 16 | #define ARM_r9 uregs[9] 17 | #define ARM_r8 uregs[8] 18 | #define ARM_r7 uregs[7] 19 | #define ARM_r6 uregs[6] 20 | #define ARM_r5 uregs[5] 21 | #define ARM_r4 uregs[4] 22 | #define ARM_r3 uregs[3] 23 | #define ARM_r2 uregs[2] 24 | #define ARM_r1 uregs[1] 25 | #define ARM_r0 uregs[0] 26 | #define ARM_ORIG_r0 uregs[17] 27 | 28 | #define ARM_SYSCALL_BASE 0x900000 29 | #define ARM_THUMB_SYSCALL 0 30 | 31 | #define ARM_NR_BASE 0xf0000 32 | #define ARM_NR_cacheflush (ARM_NR_BASE + 2) 33 | #define ARM_NR_set_tls (ARM_NR_BASE + 5) 34 | 35 | #define ARM_NR_semihosting 0x123456 36 | #define ARM_NR_thumb_semihosting 0xAB 37 | 38 | #if defined(TARGET_WORDS_BIGENDIAN) 39 | #define UNAME_MACHINE "armv5teb" 40 | #else 41 | #define UNAME_MACHINE "armv5tel" 42 | #endif 43 | -------------------------------------------------------------------------------- /linux-user/arm/target_signal.h: -------------------------------------------------------------------------------- 1 | #ifndef TARGET_SIGNAL_H 2 | #define TARGET_SIGNAL_H 3 | 4 | #include "cpu.h" 5 | 6 | /* this struct defines a stack used during syscall handling */ 7 | 8 | typedef struct target_sigaltstack { 9 | abi_ulong ss_sp; 10 | abi_long ss_flags; 11 | abi_ulong ss_size; 12 | } target_stack_t; 13 | 14 | 15 | /* 16 | * sigaltstack controls 17 | */ 18 | #define TARGET_SS_ONSTACK 1 19 | #define TARGET_SS_DISABLE 2 20 | 21 | #define TARGET_MINSIGSTKSZ 2048 22 | #define TARGET_SIGSTKSZ 8192 23 | 24 | static inline abi_ulong get_sp_from_cpustate(CPUARMState *state) 25 | { 26 | return state->regs[13]; 27 | } 28 | 29 | #endif /* TARGET_SIGNAL_H */ 30 | -------------------------------------------------------------------------------- /linux-user/cpu-uname.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pleed/pyqemu/a8bfd2186e347c6343ae3564a890e0fdf96a4d51/linux-user/cpu-uname.c -------------------------------------------------------------------------------- /linux-user/cpu-uname.h: -------------------------------------------------------------------------------- 1 | const char *cpu_to_uname_machine(void *cpu_env); 2 | -------------------------------------------------------------------------------- /linux-user/cris/target_signal.h: -------------------------------------------------------------------------------- 1 | #ifndef TARGET_SIGNAL_H 2 | #define TARGET_SIGNAL_H 3 | 4 | #include "cpu.h" 5 | 6 | /* this struct defines a stack used during syscall handling */ 7 | 8 | typedef struct target_sigaltstack { 9 | abi_ulong ss_sp; 10 | abi_ulong ss_size; 11 | abi_long ss_flags; 12 | } target_stack_t; 13 | 14 | 15 | /* 16 | * sigaltstack controls 17 | */ 18 | #define TARGET_SS_ONSTACK 1 19 | #define TARGET_SS_DISABLE 2 20 | 21 | #define TARGET_MINSIGSTKSZ 2048 22 | #define TARGET_SIGSTKSZ 8192 23 | 24 | static inline abi_ulong get_sp_from_cpustate(CPUCRISState *state) 25 | { 26 | return state->regs[14]; 27 | } 28 | 29 | #endif /* TARGET_SIGNAL_H */ 30 | -------------------------------------------------------------------------------- /linux-user/i386/target_signal.h: -------------------------------------------------------------------------------- 1 | #ifndef TARGET_SIGNAL_H 2 | #define TARGET_SIGNAL_H 3 | 4 | #include "cpu.h" 5 | 6 | /* this struct defines a stack used during syscall handling */ 7 | 8 | typedef struct target_sigaltstack { 9 | abi_ulong ss_sp; 10 | abi_long ss_flags; 11 | abi_ulong ss_size; 12 | } target_stack_t; 13 | 14 | 15 | /* 16 | * sigaltstack controls 17 | */ 18 | #define TARGET_SS_ONSTACK 1 19 | #define TARGET_SS_DISABLE 2 20 | 21 | #define TARGET_MINSIGSTKSZ 2048 22 | #define TARGET_SIGSTKSZ 8192 23 | 24 | static inline abi_ulong get_sp_from_cpustate(CPUX86State *state) 25 | { 26 | return state->regs[R_ESP]; 27 | } 28 | 29 | #endif /* TARGET_SIGNAL_H */ 30 | -------------------------------------------------------------------------------- /linux-user/m68k/syscall.h: -------------------------------------------------------------------------------- 1 | 2 | /* this struct defines the way the registers are stored on the 3 | stack during a system call. */ 4 | 5 | struct target_pt_regs { 6 | abi_long d1, d2, d3, d4, d5, d6, d7; 7 | abi_long a0, a1, a2, a3, a4, a5, a6; 8 | abi_ulong d0; 9 | abi_ulong usp; 10 | abi_ulong orig_d0; 11 | int16_t stkadj; 12 | uint16_t sr; 13 | abi_ulong pc; 14 | uint16_t fntvex; 15 | uint16_t __fill; 16 | }; 17 | 18 | 19 | #define UNAME_MACHINE "m68k" 20 | 21 | void do_m68k_simcall(CPUState *, int); 22 | -------------------------------------------------------------------------------- /linux-user/m68k/target_signal.h: -------------------------------------------------------------------------------- 1 | #ifndef TARGET_SIGNAL_H 2 | #define TARGET_SIGNAL_H 3 | 4 | #include "cpu.h" 5 | 6 | /* this struct defines a stack used during syscall handling */ 7 | 8 | typedef struct target_sigaltstack { 9 | abi_ulong ss_sp; 10 | abi_long ss_flags; 11 | abi_ulong ss_size; 12 | } target_stack_t; 13 | 14 | 15 | /* 16 | * sigaltstack controls 17 | */ 18 | #define TARGET_SS_ONSTACK 1 19 | #define TARGET_SS_DISABLE 2 20 | 21 | #define TARGET_MINSIGSTKSZ 2048 22 | #define TARGET_SIGSTKSZ 8192 23 | 24 | static inline abi_ulong get_sp_from_cpustate(CPUM68KState *state) 25 | { 26 | return state->aregs[7]; 27 | } 28 | 29 | #endif /* TARGET_SIGNAL_H */ 30 | -------------------------------------------------------------------------------- /linux-user/microblaze/target_signal.h: -------------------------------------------------------------------------------- 1 | #ifndef TARGET_SIGNAL_H 2 | #define TARGET_SIGNAL_H 3 | 4 | #include "cpu.h" 5 | 6 | /* this struct defines a stack used during syscall handling */ 7 | 8 | typedef struct target_sigaltstack { 9 | abi_ulong ss_sp; 10 | abi_ulong ss_size; 11 | abi_long ss_flags; 12 | } target_stack_t; 13 | 14 | 15 | /* 16 | * sigaltstack controls 17 | */ 18 | #define TARGET_SS_ONSTACK 1 19 | #define TARGET_SS_DISABLE 2 20 | 21 | #define TARGET_MINSIGSTKSZ 2048 22 | #define TARGET_SIGSTKSZ 8192 23 | 24 | static inline abi_ulong get_sp_from_cpustate(CPUMBState *state) 25 | { 26 | return state->regs[14]; 27 | } 28 | 29 | #endif /* TARGET_SIGNAL_H */ 30 | -------------------------------------------------------------------------------- /linux-user/mips/target_signal.h: -------------------------------------------------------------------------------- 1 | #ifndef TARGET_SIGNAL_H 2 | #define TARGET_SIGNAL_H 3 | 4 | #include "cpu.h" 5 | 6 | /* this struct defines a stack used during syscall handling */ 7 | 8 | typedef struct target_sigaltstack { 9 | abi_long ss_sp; 10 | abi_ulong ss_size; 11 | abi_long ss_flags; 12 | } target_stack_t; 13 | 14 | 15 | /* 16 | * sigaltstack controls 17 | */ 18 | #define TARGET_SS_ONSTACK 1 19 | #define TARGET_SS_DISABLE 2 20 | 21 | #define TARGET_MINSIGSTKSZ 2048 22 | #define TARGET_SIGSTKSZ 8192 23 | 24 | static inline abi_ulong get_sp_from_cpustate(CPUMIPSState *state) 25 | { 26 | return state->active_tc.gpr[29]; 27 | } 28 | 29 | #endif /* TARGET_SIGNAL_H */ 30 | -------------------------------------------------------------------------------- /linux-user/mips64/target_signal.h: -------------------------------------------------------------------------------- 1 | #ifndef TARGET_SIGNAL_H 2 | #define TARGET_SIGNAL_H 3 | 4 | #include "cpu.h" 5 | 6 | /* this struct defines a stack used during syscall handling */ 7 | 8 | typedef struct target_sigaltstack { 9 | abi_long ss_sp; 10 | abi_ulong ss_size; 11 | abi_long ss_flags; 12 | } target_stack_t; 13 | 14 | 15 | /* 16 | * sigaltstack controls 17 | */ 18 | #define TARGET_SS_ONSTACK 1 19 | #define TARGET_SS_DISABLE 2 20 | 21 | #define TARGET_MINSIGSTKSZ 2048 22 | #define TARGET_SIGSTKSZ 8192 23 | 24 | static inline abi_ulong get_sp_from_cpustate(CPUMIPSState *state) 25 | { 26 | return state->active_tc.gpr[29]; 27 | } 28 | 29 | #endif /* TARGET_SIGNAL_H */ 30 | -------------------------------------------------------------------------------- /linux-user/mipsn32/target_signal.h: -------------------------------------------------------------------------------- 1 | #ifndef TARGET_SIGNAL_H 2 | #define TARGET_SIGNAL_H 3 | 4 | #include "cpu.h" 5 | 6 | /* this struct defines a stack used during syscall handling */ 7 | 8 | typedef struct target_sigaltstack { 9 | int32_t ss_sp; 10 | uint32_t ss_size; 11 | int32_t ss_flags; 12 | } target_stack_t; 13 | 14 | 15 | /* 16 | * sigaltstack controls 17 | */ 18 | #define TARGET_SS_ONSTACK 1 19 | #define TARGET_SS_DISABLE 2 20 | 21 | #define TARGET_MINSIGSTKSZ 2048 22 | #define TARGET_SIGSTKSZ 8192 23 | 24 | static inline target_ulong get_sp_from_cpustate(CPUMIPSState *state) 25 | { 26 | return state->active_tc.gpr[29]; 27 | } 28 | 29 | #endif /* TARGET_SIGNAL_H */ 30 | -------------------------------------------------------------------------------- /linux-user/ppc/target_signal.h: -------------------------------------------------------------------------------- 1 | #ifndef TARGET_SIGNAL_H 2 | #define TARGET_SIGNAL_H 3 | 4 | #include "cpu.h" 5 | 6 | /* this struct defines a stack used during syscall handling */ 7 | 8 | typedef struct target_sigaltstack { 9 | abi_ulong ss_sp; 10 | int ss_flags; 11 | abi_ulong ss_size; 12 | } target_stack_t; 13 | 14 | 15 | /* 16 | * sigaltstack controls 17 | */ 18 | #define TARGET_SS_ONSTACK 1 19 | #define TARGET_SS_DISABLE 2 20 | 21 | #define TARGET_MINSIGSTKSZ 2048 22 | #define TARGET_SIGSTKSZ 8192 23 | 24 | static inline abi_ulong get_sp_from_cpustate(CPUPPCState *state) 25 | { 26 | return state->gpr[1]; 27 | } 28 | 29 | #endif /* TARGET_SIGNAL_H */ 30 | -------------------------------------------------------------------------------- /linux-user/qemu-types.h: -------------------------------------------------------------------------------- 1 | #ifndef QEMU_TYPES_H 2 | #define QEMU_TYPES_H 3 | #include "cpu.h" 4 | 5 | #ifdef TARGET_ABI32 6 | typedef uint32_t abi_ulong; 7 | typedef int32_t abi_long; 8 | #define TARGET_ABI_FMT_lx "%08x" 9 | #define TARGET_ABI_FMT_ld "%d" 10 | #define TARGET_ABI_FMT_lu "%u" 11 | #define TARGET_ABI_BITS 32 12 | #else 13 | typedef target_ulong abi_ulong; 14 | typedef target_long abi_long; 15 | #define TARGET_ABI_FMT_lx TARGET_FMT_lx 16 | #define TARGET_ABI_FMT_ld TARGET_FMT_ld 17 | #define TARGET_ABI_FMT_lu TARGET_FMT_lu 18 | #define TARGET_ABI_BITS TARGET_LONG_BITS 19 | /* for consistency, define ABI32 too */ 20 | #if TARGET_ABI_BITS == 32 21 | #define TARGET_ABI32 1 22 | #endif 23 | #endif 24 | #endif 25 | -------------------------------------------------------------------------------- /linux-user/sh4/syscall.h: -------------------------------------------------------------------------------- 1 | struct target_pt_regs { 2 | unsigned long regs[16]; 3 | unsigned long pc; 4 | unsigned long pr; 5 | unsigned long sr; 6 | unsigned long gbr; 7 | unsigned long mach; 8 | unsigned long macl; 9 | long tra; 10 | }; 11 | 12 | #define UNAME_MACHINE "sh4" 13 | -------------------------------------------------------------------------------- /linux-user/sh4/target_signal.h: -------------------------------------------------------------------------------- 1 | #ifndef TARGET_SIGNAL_H 2 | #define TARGET_SIGNAL_H 3 | 4 | #include "cpu.h" 5 | 6 | /* this struct defines a stack used during syscall handling */ 7 | 8 | typedef struct target_sigaltstack { 9 | abi_ulong ss_sp; 10 | abi_long ss_flags; 11 | abi_ulong ss_size; 12 | } target_stack_t; 13 | 14 | 15 | /* 16 | * sigaltstack controls 17 | */ 18 | #define TARGET_SS_ONSTACK 1 19 | #define TARGET_SS_DISABLE 2 20 | 21 | #define TARGET_MINSIGSTKSZ 2048 22 | #define TARGET_SIGSTKSZ 8192 23 | 24 | static inline abi_ulong get_sp_from_cpustate(CPUSH4State *state) 25 | { 26 | return state->gregs[15]; 27 | } 28 | 29 | #endif /* TARGET_SIGNAL_H */ 30 | -------------------------------------------------------------------------------- /linux-user/sparc/syscall.h: -------------------------------------------------------------------------------- 1 | struct target_pt_regs { 2 | abi_ulong psr; 3 | abi_ulong pc; 4 | abi_ulong npc; 5 | abi_ulong y; 6 | abi_ulong u_regs[16]; 7 | }; 8 | 9 | #define UNAME_MACHINE "sun4" 10 | -------------------------------------------------------------------------------- /linux-user/sparc/target_signal.h: -------------------------------------------------------------------------------- 1 | #ifndef TARGET_SIGNAL_H 2 | #define TARGET_SIGNAL_H 3 | 4 | #include "cpu.h" 5 | 6 | /* this struct defines a stack used during syscall handling */ 7 | 8 | typedef struct target_sigaltstack { 9 | abi_ulong ss_sp; 10 | abi_long ss_flags; 11 | abi_ulong ss_size; 12 | } target_stack_t; 13 | 14 | 15 | /* 16 | * sigaltstack controls 17 | */ 18 | #define TARGET_SS_ONSTACK 1 19 | #define TARGET_SS_DISABLE 2 20 | 21 | #define TARGET_MINSIGSTKSZ 4096 22 | #define TARGET_SIGSTKSZ 16384 23 | 24 | #ifndef UREG_I6 25 | #define UREG_I6 6 26 | #endif 27 | #ifndef UREG_FP 28 | #define UREG_FP UREG_I6 29 | #endif 30 | 31 | static inline abi_ulong get_sp_from_cpustate(CPUSPARCState *state) 32 | { 33 | return state->regwptr[UREG_FP]; 34 | } 35 | 36 | #endif /* TARGET_SIGNAL_H */ 37 | -------------------------------------------------------------------------------- /linux-user/sparc64/syscall.h: -------------------------------------------------------------------------------- 1 | struct target_pt_regs { 2 | abi_ulong u_regs[16]; 3 | abi_ulong tstate; 4 | abi_ulong pc; 5 | abi_ulong npc; 6 | abi_ulong y; 7 | abi_ulong fprs; 8 | }; 9 | 10 | #define UNAME_MACHINE "sun4u" 11 | -------------------------------------------------------------------------------- /linux-user/sparc64/target_signal.h: -------------------------------------------------------------------------------- 1 | #ifndef TARGET_SIGNAL_H 2 | #define TARGET_SIGNAL_H 3 | 4 | #include "cpu.h" 5 | 6 | /* this struct defines a stack used during syscall handling */ 7 | 8 | typedef struct target_sigaltstack { 9 | abi_ulong ss_sp; 10 | abi_long ss_flags; 11 | abi_ulong ss_size; 12 | } target_stack_t; 13 | 14 | 15 | /* 16 | * sigaltstack controls 17 | */ 18 | #define TARGET_SS_ONSTACK 1 19 | #define TARGET_SS_DISABLE 2 20 | 21 | #define TARGET_MINSIGSTKSZ 4096 22 | #define TARGET_SIGSTKSZ 16384 23 | 24 | #ifndef UREG_I6 25 | #define UREG_I6 6 26 | #endif 27 | #ifndef UREG_FP 28 | #define UREG_FP UREG_I6 29 | #endif 30 | 31 | static inline abi_ulong get_sp_from_cpustate(CPUSPARCState *state) 32 | { 33 | return state->regwptr[UREG_FP]; 34 | } 35 | 36 | #endif /* TARGET_SIGNAL_H */ 37 | -------------------------------------------------------------------------------- /linux-user/x86_64/target_signal.h: -------------------------------------------------------------------------------- 1 | #ifndef TARGET_SIGNAL_H 2 | #define TARGET_SIGNAL_H 3 | 4 | #include "cpu.h" 5 | 6 | /* this struct defines a stack used during syscall handling */ 7 | 8 | typedef struct target_sigaltstack { 9 | abi_ulong ss_sp; 10 | abi_long ss_flags; 11 | abi_ulong ss_size; 12 | } target_stack_t; 13 | 14 | 15 | /* 16 | * sigaltstack controls 17 | */ 18 | #define TARGET_SS_ONSTACK 1 19 | #define TARGET_SS_DISABLE 2 20 | 21 | #define TARGET_MINSIGSTKSZ 2048 22 | #define TARGET_SIGSTKSZ 8192 23 | 24 | static inline abi_ulong get_sp_from_cpustate(CPUX86State *state) 25 | { 26 | return state->regs[R_ESP]; 27 | } 28 | 29 | #endif /* TARGET_SIGNAL_H */ 30 | -------------------------------------------------------------------------------- /notify.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Notifier lists 3 | * 4 | * Copyright IBM, Corp. 2010 5 | * 6 | * Authors: 7 | * Anthony Liguori 8 | * 9 | * This work is licensed under the terms of the GNU GPL, version 2. See 10 | * the COPYING file in the top-level directory. 11 | * 12 | */ 13 | 14 | #include "qemu-common.h" 15 | #include "notify.h" 16 | 17 | void notifier_list_init(NotifierList *list) 18 | { 19 | QTAILQ_INIT(&list->notifiers); 20 | } 21 | 22 | void notifier_list_add(NotifierList *list, Notifier *notifier) 23 | { 24 | QTAILQ_INSERT_HEAD(&list->notifiers, notifier, node); 25 | } 26 | 27 | void notifier_list_remove(NotifierList *list, Notifier *notifier) 28 | { 29 | QTAILQ_REMOVE(&list->notifiers, notifier, node); 30 | } 31 | 32 | void notifier_list_notify(NotifierList *list) 33 | { 34 | Notifier *notifier, *next; 35 | 36 | QTAILQ_FOREACH_SAFE(notifier, &list->notifiers, node, next) { 37 | notifier->notify(notifier); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /notify.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Notifier lists 3 | * 4 | * Copyright IBM, Corp. 2010 5 | * 6 | * Authors: 7 | * Anthony Liguori 8 | * 9 | * This work is licensed under the terms of the GNU GPL, version 2. See 10 | * the COPYING file in the top-level directory. 11 | * 12 | */ 13 | 14 | #ifndef QEMU_NOTIFY_H 15 | #define QEMU_NOTIFY_H 16 | 17 | #include "qemu-queue.h" 18 | 19 | typedef struct Notifier Notifier; 20 | 21 | struct Notifier 22 | { 23 | void (*notify)(Notifier *notifier); 24 | QTAILQ_ENTRY(Notifier) node; 25 | }; 26 | 27 | typedef struct NotifierList 28 | { 29 | QTAILQ_HEAD(, Notifier) notifiers; 30 | } NotifierList; 31 | 32 | #define NOTIFIER_LIST_INITIALIZER(head) \ 33 | { QTAILQ_HEAD_INITIALIZER((head).notifiers) } 34 | 35 | void notifier_list_init(NotifierList *list); 36 | 37 | void notifier_list_add(NotifierList *list, Notifier *notifier); 38 | 39 | void notifier_list_remove(NotifierList *list, Notifier *notifier); 40 | 41 | void notifier_list_notify(NotifierList *list); 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /pc-bios/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # NOTE: only compilable with x86 cross compile tools 3 | # 4 | include ../config-host.mak 5 | 6 | DEFINES= 7 | 8 | TARGETS= 9 | 10 | all: $(TARGETS) 11 | 12 | %.o: %.S 13 | $(CC) $(DEFINES) -c -o $@ $< 14 | 15 | %.dtb: %.dts 16 | dtc -I dts -O dtb -o $@ $< 17 | 18 | clean: 19 | rm -f $(TARGETS) *.o *~ 20 | -------------------------------------------------------------------------------- /pc-bios/bamboo.dtb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pleed/pyqemu/a8bfd2186e347c6343ae3564a890e0fdf96a4d51/pc-bios/bamboo.dtb -------------------------------------------------------------------------------- /pc-bios/bios.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pleed/pyqemu/a8bfd2186e347c6343ae3564a890e0fdf96a4d51/pc-bios/bios.bin -------------------------------------------------------------------------------- /pc-bios/gpxe-eepro100-80861209.rom: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pleed/pyqemu/a8bfd2186e347c6343ae3564a890e0fdf96a4d51/pc-bios/gpxe-eepro100-80861209.rom -------------------------------------------------------------------------------- /pc-bios/gpxe-eepro100-80861229.rom: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pleed/pyqemu/a8bfd2186e347c6343ae3564a890e0fdf96a4d51/pc-bios/gpxe-eepro100-80861229.rom -------------------------------------------------------------------------------- /pc-bios/keymaps/en-us: -------------------------------------------------------------------------------- 1 | # generated from XKB map us 2 | include common 3 | map 0x409 4 | exclam 0x02 shift 5 | at 0x03 shift 6 | numbersign 0x04 shift 7 | dollar 0x05 shift 8 | percent 0x06 shift 9 | asciicircum 0x07 shift 10 | ampersand 0x08 shift 11 | asterisk 0x09 shift 12 | parenleft 0x0a shift 13 | parenright 0x0b shift 14 | minus 0x0c 15 | underscore 0x0c shift 16 | equal 0x0d 17 | plus 0x0d shift 18 | bracketleft 0x1a 19 | braceleft 0x1a shift 20 | bracketright 0x1b 21 | braceright 0x1b shift 22 | semicolon 0x27 23 | colon 0x27 shift 24 | apostrophe 0x28 25 | quotedbl 0x28 shift 26 | grave 0x29 27 | asciitilde 0x29 shift 28 | backslash 0x2b 29 | bar 0x2b shift 30 | comma 0x33 31 | less 0x33 shift 32 | period 0x34 33 | greater 0x34 shift 34 | slash 0x35 35 | question 0x35 shift 36 | -------------------------------------------------------------------------------- /pc-bios/keymaps/fr-ca: -------------------------------------------------------------------------------- 1 | # Canadian French 2 | # By Simon Germain 3 | include common 4 | map 0xc0c 5 | 6 | backslash 0x29 altgr 7 | plusminus 0x2 altgr 8 | at 0x3 altgr 9 | sterling 0x4 altgr 10 | cent 0x5 altgr 11 | currency 0x6 altgr 12 | notsign 0x7 altgr 13 | bar 0x29 shift 14 | twosuperior 0x9 altgr 15 | threesuperior 0xa altgr 16 | onequarter 0xb altgr 17 | onehalf 0xc altgr 18 | threequarters 0xd altgr 19 | section 0x18 altgr 20 | paragraph 0x19 altgr 21 | bracketleft 0x1a altgr 22 | bracketright 0x1b altgr 23 | asciitilde 0x27 altgr 24 | braceleft 0x28 altgr 25 | braceright 0x2b altgr 26 | less 0x2b 27 | greater 0x2b shift 28 | guillemotleft 0x56 29 | guillemotright 0x56 shift 30 | degree 0x56 altgr 31 | mu 0x32 altgr 32 | eacute 0x35 33 | dead_acute 0x35 altgr 34 | dead_grave 0x28 35 | dead_circumflex 0x1a 36 | dead_circumflex 0x1a shift 37 | dead_cedilla 0x1b 38 | dead_diaeresis 0x1b shift 39 | exclam 0x2 shift 40 | quotedbl 0x3 shift 41 | slash 0x4 shift 42 | dollar 0x5 shift 43 | percent 0x6 shift 44 | question 0x7 shift 45 | ampersand 0x8 shift 46 | asterisk 0x9 shift 47 | parenleft 0xa shift 48 | parenright 0xb shift 49 | underscore 0xc shift 50 | plus 0xd shift 51 | -------------------------------------------------------------------------------- /pc-bios/keymaps/is: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pleed/pyqemu/a8bfd2186e347c6343ae3564a890e0fdf96a4d51/pc-bios/keymaps/is -------------------------------------------------------------------------------- /pc-bios/keymaps/modifiers: -------------------------------------------------------------------------------- 1 | Shift_R 0x36 2 | Shift_L 0x2a 3 | 4 | Alt_R 0xb8 5 | Mode_switch 0xb8 6 | ISO_Level3_Shift 0xb8 7 | Alt_L 0x38 8 | 9 | Control_R 0x9d 10 | Control_L 0x1d 11 | 12 | # Translate Super to Windows keys. 13 | # This is hardcoded. See documentation for details. 14 | Super_R 0xdc 15 | Super_L 0xdb 16 | 17 | # Translate Menu to the Windows Application key. 18 | Menu 0xdd 19 | -------------------------------------------------------------------------------- /pc-bios/keymaps/nl-be: -------------------------------------------------------------------------------- 1 | # Dutch (Belgium) 2 | map 0x813 3 | include common 4 | -------------------------------------------------------------------------------- /pc-bios/linuxboot.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pleed/pyqemu/a8bfd2186e347c6343ae3564a890e0fdf96a4d51/pc-bios/linuxboot.bin -------------------------------------------------------------------------------- /pc-bios/mpc8544ds.dtb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pleed/pyqemu/a8bfd2186e347c6343ae3564a890e0fdf96a4d51/pc-bios/mpc8544ds.dtb -------------------------------------------------------------------------------- /pc-bios/multiboot.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pleed/pyqemu/a8bfd2186e347c6343ae3564a890e0fdf96a4d51/pc-bios/multiboot.bin -------------------------------------------------------------------------------- /pc-bios/openbios-ppc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pleed/pyqemu/a8bfd2186e347c6343ae3564a890e0fdf96a4d51/pc-bios/openbios-ppc -------------------------------------------------------------------------------- /pc-bios/openbios-sparc32: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pleed/pyqemu/a8bfd2186e347c6343ae3564a890e0fdf96a4d51/pc-bios/openbios-sparc32 -------------------------------------------------------------------------------- /pc-bios/openbios-sparc64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pleed/pyqemu/a8bfd2186e347c6343ae3564a890e0fdf96a4d51/pc-bios/openbios-sparc64 -------------------------------------------------------------------------------- /pc-bios/optionrom/Makefile: -------------------------------------------------------------------------------- 1 | all: build-all 2 | # Dummy command so that make thinks it has done something 3 | @true 4 | 5 | include ../../config-host.mak 6 | include $(SRC_PATH)/rules.mak 7 | 8 | $(call set-vpath, $(SRC_PATH)/pc-bios/optionrom) 9 | 10 | .PHONY : all clean build-all 11 | 12 | CFLAGS := -Wall -Wstrict-prototypes -Werror -fomit-frame-pointer -fno-builtin 13 | CFLAGS += -I$(SRC_PATH) 14 | CFLAGS += $(call cc-option, $(CFLAGS), -fno-stack-protector) 15 | QEMU_CFLAGS = $(CFLAGS) 16 | 17 | build-all: multiboot.bin linuxboot.bin 18 | 19 | %.img: %.o 20 | $(call quiet-command,$(LD) -Ttext 0 -e _start -s -o $@ $<," Building $(TARGET_DIR)$@") 21 | 22 | %.raw: %.img 23 | $(call quiet-command,$(OBJCOPY) -O binary -j .text $< $@," Building $(TARGET_DIR)$@") 24 | 25 | %.bin: %.raw 26 | $(call quiet-command,$(SHELL) $(SRC_PATH)/pc-bios/optionrom/signrom.sh $< $@," Signing $(TARGET_DIR)$@") 27 | 28 | clean: 29 | rm -f *.o *.d *.raw *.img *.bin *~ 30 | -------------------------------------------------------------------------------- /pc-bios/petalogix-s3adsp1800.dtb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pleed/pyqemu/a8bfd2186e347c6343ae3564a890e0fdf96a4d51/pc-bios/petalogix-s3adsp1800.dtb -------------------------------------------------------------------------------- /pc-bios/ppc_rom.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pleed/pyqemu/a8bfd2186e347c6343ae3564a890e0fdf96a4d51/pc-bios/ppc_rom.bin -------------------------------------------------------------------------------- /pc-bios/pxe-e1000.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pleed/pyqemu/a8bfd2186e347c6343ae3564a890e0fdf96a4d51/pc-bios/pxe-e1000.bin -------------------------------------------------------------------------------- /pc-bios/pxe-ne2k_pci.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pleed/pyqemu/a8bfd2186e347c6343ae3564a890e0fdf96a4d51/pc-bios/pxe-ne2k_pci.bin -------------------------------------------------------------------------------- /pc-bios/pxe-pcnet.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pleed/pyqemu/a8bfd2186e347c6343ae3564a890e0fdf96a4d51/pc-bios/pxe-pcnet.bin -------------------------------------------------------------------------------- /pc-bios/pxe-rtl8139.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pleed/pyqemu/a8bfd2186e347c6343ae3564a890e0fdf96a4d51/pc-bios/pxe-rtl8139.bin -------------------------------------------------------------------------------- /pc-bios/pxe-virtio.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pleed/pyqemu/a8bfd2186e347c6343ae3564a890e0fdf96a4d51/pc-bios/pxe-virtio.bin -------------------------------------------------------------------------------- /pc-bios/s390-zipl.rom: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pleed/pyqemu/a8bfd2186e347c6343ae3564a890e0fdf96a4d51/pc-bios/s390-zipl.rom -------------------------------------------------------------------------------- /pc-bios/vgabios-cirrus.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pleed/pyqemu/a8bfd2186e347c6343ae3564a890e0fdf96a4d51/pc-bios/vgabios-cirrus.bin -------------------------------------------------------------------------------- /pc-bios/vgabios.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pleed/pyqemu/a8bfd2186e347c6343ae3564a890e0fdf96a4d51/pc-bios/vgabios.bin -------------------------------------------------------------------------------- /pc-bios/video.x: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pleed/pyqemu/a8bfd2186e347c6343ae3564a890e0fdf96a4d51/pc-bios/video.x -------------------------------------------------------------------------------- /pci-ids.txt: -------------------------------------------------------------------------------- 1 | 2 | PCI IDs for qemu 3 | ================ 4 | 5 | Red Hat, Inc. donates a part of its device ID range to qemu, to be used for 6 | virtual devices. The vendor ID is 1af4 (formerly Qumranet ID). 7 | 8 | The 1000 -> 10ff device ID range is used for VirtIO devices. 9 | 10 | The 1100 device ID is used as PCI Subsystem ID for existing hardware 11 | devices emulated by qemu. 12 | 13 | All other device IDs are reserved. 14 | 15 | 16 | VirtIO Device IDs 17 | ----------------- 18 | 19 | 1af4:1000 network device 20 | 1af4:1001 block device 21 | 1af4:1002 balloon device 22 | 1af4:1003 console device 23 | 24 | 1af4:1004 Reserved. 25 | to Contact Gerd Hoffmann to get a 26 | 1af4:10ef device ID assigned for your new virtio device. 27 | 28 | 1af4:10f0 Available for experimental usage without registration. Must get 29 | to official ID when the code leaves the test lab (i.e. when seeking 30 | 1af4:10ff upstream merge or shipping a distro/product) to avoid conflicts. 31 | 32 | -------------------------------------------------------------------------------- /qbool.h: -------------------------------------------------------------------------------- 1 | /* 2 | * QBool Module 3 | * 4 | * Copyright IBM, Corp. 2009 5 | * 6 | * Authors: 7 | * Anthony Liguori 8 | * 9 | * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. 10 | * See the COPYING.LIB file in the top-level directory. 11 | * 12 | */ 13 | 14 | #ifndef QBOOL_H 15 | #define QBOOL_H 16 | 17 | #include 18 | #include "qobject.h" 19 | 20 | typedef struct QBool { 21 | QObject_HEAD; 22 | int value; 23 | } QBool; 24 | 25 | QBool *qbool_from_int(int value); 26 | int qbool_get_int(const QBool *qb); 27 | QBool *qobject_to_qbool(const QObject *obj); 28 | 29 | #endif /* QBOOL_H */ 30 | -------------------------------------------------------------------------------- /qemu-barrier.h: -------------------------------------------------------------------------------- 1 | #ifndef __QEMU_BARRIER_H 2 | #define __QEMU_BARRIER_H 1 3 | 4 | /* FIXME: arch dependant, x86 version */ 5 | #define smp_wmb() asm volatile("" ::: "memory") 6 | 7 | /* Compiler barrier */ 8 | #define barrier() asm volatile("" ::: "memory") 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /qemu-config.h: -------------------------------------------------------------------------------- 1 | #ifndef QEMU_CONFIG_H 2 | #define QEMU_CONFIG_H 3 | 4 | extern QemuOptsList qemu_fsdev_opts; 5 | extern QemuOptsList qemu_virtfs_opts; 6 | 7 | QemuOptsList *qemu_find_opts(const char *group); 8 | void qemu_add_opts(QemuOptsList *list); 9 | int qemu_set_option(const char *str); 10 | int qemu_global_option(const char *str); 11 | void qemu_add_globals(void); 12 | 13 | void qemu_config_write(FILE *fp); 14 | int qemu_config_parse(FILE *fp, QemuOptsList **lists, const char *fname); 15 | 16 | int qemu_read_config_file(const char *filename); 17 | 18 | #endif /* QEMU_CONFIG_H */ 19 | -------------------------------------------------------------------------------- /qemu-objects.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Include all QEMU objects. 3 | * 4 | * Copyright (C) 2009 Red Hat Inc. 5 | * 6 | * Authors: 7 | * Luiz Capitulino 8 | * 9 | * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. 10 | * See the COPYING.LIB file in the top-level directory. 11 | */ 12 | 13 | #ifndef QEMU_OBJECTS_H 14 | #define QEMU_OBJECTS_H 15 | 16 | #include "qobject.h" 17 | #include "qint.h" 18 | #include "qfloat.h" 19 | #include "qbool.h" 20 | #include "qstring.h" 21 | #include "qdict.h" 22 | #include "qlist.h" 23 | #include "qjson.h" 24 | 25 | #endif /* QEMU_OBJECTS_H */ 26 | -------------------------------------------------------------------------------- /qemu-x509.h: -------------------------------------------------------------------------------- 1 | #ifndef QEMU_X509_H 2 | #define QEMU_X509_H 3 | 4 | #define X509_CA_CERT_FILE "ca-cert.pem" 5 | #define X509_CA_CRL_FILE "ca-crl.pem" 6 | #define X509_SERVER_KEY_FILE "server-key.pem" 7 | #define X509_SERVER_CERT_FILE "server-cert.pem" 8 | 9 | #endif /* QEMU_X509_H */ 10 | -------------------------------------------------------------------------------- /qfloat.h: -------------------------------------------------------------------------------- 1 | /* 2 | * QFloat Module 3 | * 4 | * Copyright IBM, Corp. 2009 5 | * 6 | * Authors: 7 | * Anthony Liguori 8 | * 9 | * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. 10 | * See the COPYING.LIB file in the top-level directory. 11 | * 12 | */ 13 | 14 | #ifndef QFLOAT_H 15 | #define QFLOAT_H 16 | 17 | #include 18 | #include "qobject.h" 19 | 20 | typedef struct QFloat { 21 | QObject_HEAD; 22 | double value; 23 | } QFloat; 24 | 25 | QFloat *qfloat_from_double(double value); 26 | double qfloat_get_double(const QFloat *qi); 27 | QFloat *qobject_to_qfloat(const QObject *obj); 28 | 29 | #endif /* QFLOAT_H */ 30 | -------------------------------------------------------------------------------- /qint.h: -------------------------------------------------------------------------------- 1 | /* 2 | * QInt Module 3 | * 4 | * Copyright (C) 2009 Red Hat Inc. 5 | * 6 | * Authors: 7 | * Luiz Capitulino 8 | * 9 | * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. 10 | * See the COPYING.LIB file in the top-level directory. 11 | */ 12 | 13 | #ifndef QINT_H 14 | #define QINT_H 15 | 16 | #include 17 | #include "qobject.h" 18 | 19 | typedef struct QInt { 20 | QObject_HEAD; 21 | int64_t value; 22 | } QInt; 23 | 24 | QInt *qint_from_int(int64_t value); 25 | int64_t qint_get_int(const QInt *qi); 26 | QInt *qobject_to_qint(const QObject *obj); 27 | 28 | #endif /* QINT_H */ 29 | -------------------------------------------------------------------------------- /qjson.h: -------------------------------------------------------------------------------- 1 | /* 2 | * QObject JSON integration 3 | * 4 | * Copyright IBM, Corp. 2009 5 | * 6 | * Authors: 7 | * Anthony Liguori 8 | * 9 | * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. 10 | * See the COPYING.LIB file in the top-level directory. 11 | * 12 | */ 13 | 14 | #ifndef QJSON_H 15 | #define QJSON_H 16 | 17 | #include 18 | #include "qobject.h" 19 | #include "qstring.h" 20 | 21 | QObject *qobject_from_json(const char *string); 22 | QObject *qobject_from_jsonf(const char *string, ...) 23 | __attribute__((__format__ (__printf__, 1, 2))); 24 | QObject *qobject_from_jsonv(const char *string, va_list *ap); 25 | 26 | QString *qobject_to_json(const QObject *obj); 27 | 28 | #endif /* QJSON_H */ 29 | -------------------------------------------------------------------------------- /qstring.h: -------------------------------------------------------------------------------- 1 | /* 2 | * QString Module 3 | * 4 | * Copyright (C) 2009 Red Hat Inc. 5 | * 6 | * Authors: 7 | * Luiz Capitulino 8 | * 9 | * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. 10 | * See the COPYING.LIB file in the top-level directory. 11 | */ 12 | 13 | #ifndef QSTRING_H 14 | #define QSTRING_H 15 | 16 | #include 17 | #include "qobject.h" 18 | 19 | typedef struct QString { 20 | QObject_HEAD; 21 | char *string; 22 | size_t length; 23 | size_t capacity; 24 | } QString; 25 | 26 | QString *qstring_new(void); 27 | QString *qstring_from_str(const char *str); 28 | QString *qstring_from_substr(const char *str, int start, int end); 29 | const char *qstring_get_str(const QString *qstring); 30 | void qstring_append_int(QString *qstring, int64_t value); 31 | void qstring_append(QString *qstring, const char *str); 32 | void qstring_append_chr(QString *qstring, int c); 33 | QString *qobject_to_qstring(const QObject *obj); 34 | 35 | #endif /* QSTRING_H */ 36 | -------------------------------------------------------------------------------- /rwhandler.h: -------------------------------------------------------------------------------- 1 | #ifndef READ_WRITE_HANDLER_H 2 | #define READ_WRITE_HANDLER_H 3 | 4 | #include "qemu-common.h" 5 | #include "ioport.h" 6 | 7 | typedef struct ReadWriteHandler ReadWriteHandler; 8 | 9 | /* len is guaranteed to be one of 1, 2 or 4, addr is guaranteed to fit in an 10 | * appropriate type (io/memory/etc). They do not need to be range checked. */ 11 | typedef void WriteHandlerFunc(ReadWriteHandler *, pcibus_t addr, 12 | uint32_t value, int len); 13 | typedef uint32_t ReadHandlerFunc(ReadWriteHandler *, pcibus_t addr, int len); 14 | 15 | struct ReadWriteHandler { 16 | WriteHandlerFunc *write; 17 | ReadHandlerFunc *read; 18 | }; 19 | 20 | /* Helpers for when we want to use a single routine with length. */ 21 | /* CPU memory handler: both read and write must be present. */ 22 | int cpu_register_io_memory_simple(ReadWriteHandler *); 23 | /* io port handler: can supply only read or write handlers. */ 24 | int register_ioport_simple(ReadWriteHandler *, 25 | pio_addr_t start, int length, int size); 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /slirp/debug.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1995 Danny Gasparovski. 3 | * 4 | * Please read the file COPYRIGHT for the 5 | * terms and conditions of the copyright. 6 | */ 7 | 8 | //#define DEBUG 1 9 | 10 | #ifdef DEBUG 11 | 12 | #define DBG_CALL 0x1 13 | #define DBG_MISC 0x2 14 | #define DBG_ERROR 0x4 15 | 16 | #define dfd stderr 17 | 18 | extern int slirp_debug; 19 | 20 | #define DEBUG_CALL(x) if (slirp_debug & DBG_CALL) { fprintf(dfd, "%s...\n", x); fflush(dfd); } 21 | #define DEBUG_ARG(x, y) if (slirp_debug & DBG_CALL) { fputc(' ', dfd); fprintf(dfd, x, y); fputc('\n', dfd); fflush(dfd); } 22 | #define DEBUG_ARGS(x) if (slirp_debug & DBG_CALL) { fprintf x ; fflush(dfd); } 23 | #define DEBUG_MISC(x) if (slirp_debug & DBG_MISC) { fprintf x ; fflush(dfd); } 24 | #define DEBUG_ERROR(x) if (slirp_debug & DBG_ERROR) {fprintf x ; fflush(dfd); } 25 | 26 | #else 27 | 28 | #define DEBUG_CALL(x) 29 | #define DEBUG_ARG(x, y) 30 | #define DEBUG_ARGS(x) 31 | #define DEBUG_MISC(x) 32 | #define DEBUG_ERROR(x) 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /slirp/if.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1995 Danny Gasparovski. 3 | * 4 | * Please read the file COPYRIGHT for the 5 | * terms and conditions of the copyright. 6 | */ 7 | 8 | #ifndef _IF_H_ 9 | #define _IF_H_ 10 | 11 | #define IF_COMPRESS 0x01 /* We want compression */ 12 | #define IF_NOCOMPRESS 0x02 /* Do not do compression */ 13 | #define IF_AUTOCOMP 0x04 /* Autodetect (default) */ 14 | #define IF_NOCIDCOMP 0x08 /* CID compression */ 15 | 16 | #define IF_MTU 1500 17 | #define IF_MRU 1500 18 | #define IF_COMP IF_AUTOCOMP /* Flags for compression */ 19 | 20 | /* 2 for alignment, 14 for ethernet, 40 for TCP/IP */ 21 | #define IF_MAXLINKHDR (2 + 14 + 40) 22 | 23 | #define ifs_init(ifm) ((ifm)->ifs_next = (ifm)->ifs_prev = (ifm)) 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /slirp/sbuf.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1995 Danny Gasparovski. 3 | * 4 | * Please read the file COPYRIGHT for the 5 | * terms and conditions of the copyright. 6 | */ 7 | 8 | #ifndef _SBUF_H_ 9 | #define _SBUF_H_ 10 | 11 | #define sbflush(sb) sbdrop((sb),(sb)->sb_cc) 12 | #define sbspace(sb) ((sb)->sb_datalen - (sb)->sb_cc) 13 | 14 | struct sbuf { 15 | u_int sb_cc; /* actual chars in buffer */ 16 | u_int sb_datalen; /* Length of data */ 17 | char *sb_wptr; /* write pointer. points to where the next 18 | * bytes should be written in the sbuf */ 19 | char *sb_rptr; /* read pointer. points to where the next 20 | * byte should be read from the sbuf */ 21 | char *sb_data; /* Actual data */ 22 | }; 23 | 24 | void sbfree(struct sbuf *); 25 | void sbdrop(struct sbuf *, int); 26 | void sbreserve(struct sbuf *, int); 27 | void sbappend(struct socket *, struct mbuf *); 28 | void sbcopy(struct sbuf *, int, int, char *); 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /slirp/tftp.h: -------------------------------------------------------------------------------- 1 | /* tftp defines */ 2 | 3 | #define TFTP_SESSIONS_MAX 3 4 | 5 | #define TFTP_SERVER 69 6 | 7 | #define TFTP_RRQ 1 8 | #define TFTP_WRQ 2 9 | #define TFTP_DATA 3 10 | #define TFTP_ACK 4 11 | #define TFTP_ERROR 5 12 | #define TFTP_OACK 6 13 | 14 | #define TFTP_FILENAME_MAX 512 15 | 16 | struct tftp_t { 17 | struct ip ip; 18 | struct udphdr udp; 19 | uint16_t tp_op; 20 | union { 21 | struct { 22 | uint16_t tp_block_nr; 23 | uint8_t tp_buf[512]; 24 | } tp_data; 25 | struct { 26 | uint16_t tp_error_code; 27 | uint8_t tp_msg[512]; 28 | } tp_error; 29 | uint8_t tp_buf[512 + 2]; 30 | } x; 31 | }; 32 | 33 | struct tftp_session { 34 | Slirp *slirp; 35 | char *filename; 36 | 37 | struct in_addr client_ip; 38 | uint16_t client_port; 39 | 40 | int timestamp; 41 | }; 42 | 43 | void tftp_input(struct mbuf *m); 44 | -------------------------------------------------------------------------------- /target-cris/helper.h: -------------------------------------------------------------------------------- 1 | #include "def-helper.h" 2 | 3 | DEF_HELPER_1(raise_exception, void, i32) 4 | DEF_HELPER_1(tlb_flush_pid, void, i32) 5 | DEF_HELPER_1(spc_write, void, i32) 6 | DEF_HELPER_3(dump, void, i32, i32, i32) 7 | DEF_HELPER_0(rfe, void); 8 | DEF_HELPER_0(rfn, void); 9 | 10 | DEF_HELPER_2(movl_sreg_reg, void, i32, i32) 11 | DEF_HELPER_2(movl_reg_sreg, void, i32, i32) 12 | 13 | DEF_HELPER_FLAGS_1(lz, TCG_CALL_PURE, i32, i32); 14 | DEF_HELPER_FLAGS_3(btst, TCG_CALL_PURE, i32, i32, i32, i32); 15 | 16 | DEF_HELPER_FLAGS_3(evaluate_flags_muls, TCG_CALL_PURE, i32, i32, i32, i32) 17 | DEF_HELPER_FLAGS_3(evaluate_flags_mulu, TCG_CALL_PURE, i32, i32, i32, i32) 18 | DEF_HELPER_FLAGS_4(evaluate_flags_mcp, TCG_CALL_PURE, i32, i32, i32, i32, i32) 19 | DEF_HELPER_FLAGS_4(evaluate_flags_alu_4, TCG_CALL_PURE, i32, i32, i32, i32, i32) 20 | DEF_HELPER_FLAGS_4(evaluate_flags_sub_4, TCG_CALL_PURE, i32, i32, i32, i32, i32) 21 | DEF_HELPER_FLAGS_2(evaluate_flags_move_4, TCG_CALL_PURE, i32, i32, i32) 22 | DEF_HELPER_FLAGS_2(evaluate_flags_move_2, TCG_CALL_PURE, i32, i32, i32) 23 | DEF_HELPER_0(evaluate_flags, void) 24 | DEF_HELPER_0(top_evaluate_flags, void) 25 | 26 | #include "def-helper.h" 27 | -------------------------------------------------------------------------------- /target-cris/mmu.h: -------------------------------------------------------------------------------- 1 | #define CRIS_MMU_ERR_EXEC 0 2 | #define CRIS_MMU_ERR_READ 1 3 | #define CRIS_MMU_ERR_WRITE 2 4 | #define CRIS_MMU_ERR_FLUSH 3 5 | 6 | struct cris_mmu_result 7 | { 8 | uint32_t phy; 9 | int prot; 10 | int bf_vec; 11 | }; 12 | 13 | void cris_mmu_init(CPUState *env); 14 | void cris_mmu_flush_pid(CPUState *env, uint32_t pid); 15 | int cris_mmu_translate(struct cris_mmu_result *res, 16 | CPUState *env, uint32_t vaddr, 17 | int rw, int mmu_idx, int debug); 18 | -------------------------------------------------------------------------------- /target-i386/BUGS: -------------------------------------------------------------------------------- 1 | type(new_cr3) = 2 | Traceback (most recent call last): 3 | File "/usr/lib/python2.6/PyQEMU.py", line 39, in event_update_cr3 4 | if KNOWN_Processes.has_key(new_cr3): 5 | TypeError: an integer is required 6 | type(new_cr3) = 7 | 8 | Exception raised in event_update_cr3, new_cr3 is set to int as in all other cases 9 | -------------------------------------------------------------------------------- /target-i386/FLX_TODO: -------------------------------------------------------------------------------- 1 | - Make PyQemu more flexible towards generic instrumentation/analysis requirements 2 | 3 | - Redesign process management to enable separate process instrumentation 4 | 5 | - Find/implement a solution for the shared library instrumentation problem 6 | 1. translation cache for each process (may be a bad idea because of hot-patching) 7 | 2. check events when they occur to see if the process did register them 8 | 9 | - Redesign the operating system status reading interface to allow systems beyond windows XP 10 | 11 | - Define a generic instrumentation API to allow virtual CPUs beyon i386 compatible ones 12 | -------------------------------------------------------------------------------- /target-i386/analysis/dumpreader.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import glob 4 | import struct 5 | 6 | class Dumpfile: 7 | MEM_ACCESS = 0 8 | FUNCTION = 1 9 | 10 | def __init__(self, filename): 11 | self.name, self.pid, self.tid = filename.split(" ")[:3] 12 | self.filename = filename 13 | self.dumpfile = open(filename,"r") 14 | 15 | def get_bytes(self, count): 16 | bytes = self.dumpfile.read(count) 17 | if len(bytes) < count: 18 | raise Exception("READ ERROR in file: %s"%self.filename) 19 | 20 | def next(self): 21 | event_type = self.get_bytes(1) 22 | 23 | def read_function_event(self): 24 | def read_memory_event(self): 25 | 26 | 27 | 28 | 29 | class Dumpreader(list): 30 | def __init__(self, path): 31 | list.__init__(self) 32 | dumpfiles = glob.glob(path+"/*.dump") 33 | for dumpfile in dumpfiles: 34 | self.append(Dumpfile(dumpfile)) 35 | -------------------------------------------------------------------------------- /target-i386/analysis/ida_mark_functions.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | addressfile = open("pyqemu_functions", "r") 3 | entries = [] 4 | for line in addressfile: 5 | line = line.strip() 6 | desc, addr = line.split(",") 7 | entries.append((desc, int(addr,16))) 8 | unique_found = set(entries) 9 | mark_objects = {} 10 | functions = {} 11 | 12 | for desc, addr in unique_found: 13 | fname = GetFunctionName(addr) 14 | if functions.has_key(fname): 15 | descs, addr, color = functions[fname] 16 | descs.append(desc) 17 | functions[fname] = (descs, addr, color) 18 | else: 19 | functions[fname] = ([desc], addr, 0xaaaaaa) 20 | 21 | for descs, addr, color in functions.values(): 22 | descs.sort() 23 | description = "\n".join(descs) 24 | SetFunctionCmt(addr, description, 1) 25 | SetColor(addr, CIC_FUNC, color) 26 | 27 | addressfile.close() 28 | 29 | print "Marked all functions - respawn function window to workaround IDA displaying bug" 30 | -------------------------------------------------------------------------------- /target-i386/analyze/callgraph.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import pygraphviz as pgv 4 | import sys 5 | 6 | class CallGraphAnalyzer: 7 | def __init__(self, dumpfile): 8 | self.dumpfile = dumpfile 9 | self.threads = {} 10 | 11 | def parseLine(self, line): 12 | line = line.strip() 13 | if not ", Call:" in line and not ", Ret:" in line: 14 | return None 15 | p,t,e = line.split(",") 16 | print str(p) 17 | print str(t) 18 | print str(e) 19 | p = p.split(":")[1][1:] 20 | t = t.split(":")[1][1:] 21 | e,a = map(lambda x: x.strip(), e.split(": ")) 22 | return p,t,e,a 23 | 24 | def run(self): 25 | callstack = [] 26 | readfile = open(self.dumpfile,"r") 27 | for line in readfile: 28 | tmp = self.parseLine(line) 29 | if tmp is None: 30 | continue 31 | pid,tid,event,arg = tmp 32 | 33 | def usage(): 34 | print "%s "%sys.argv[0] 35 | 36 | if __name__ == "__main__": 37 | if len(sys.argv) < 2: 38 | print usage() 39 | sys.exit(0) 40 | else: 41 | analyzer = CallGraphAnalyzer(sys.argv[1]) 42 | analyzer.run() 43 | -------------------------------------------------------------------------------- /target-i386/analyze/viewgraph.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import pygraphviz as pgv 3 | import sys 4 | import random 5 | import time 6 | import os 7 | 8 | if __name__ == "__main__": 9 | for name in sys.argv[1:]: 10 | random.seed(time.time()) 11 | filename = str(random.random())[2:] 12 | graph = pgv.AGraph(file=name) 13 | graph.layout() 14 | filename = "/tmp/"+filename+".png" 15 | graph.draw(filename) 16 | os.system("evince "+filename) 17 | -------------------------------------------------------------------------------- /target-i386/flx_arithwindow.h: -------------------------------------------------------------------------------- 1 | #ifndef FLX_ARITHWINDOW 2 | #define FLX_ARITHWINDOW 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #include "flx_instrument.h" 11 | #include "flx_bbltranslate.h" 12 | 13 | typedef int(*arithwindow_handler)(uint32_t); 14 | 15 | void flx_arithwindow_init(arithwindow_handler); 16 | void flx_arithwindow_enable(uint32_t, float); 17 | void flx_arithwindow_disable(void); 18 | void flx_arithwindow_destroy(void); 19 | int flx_arithwindow_bblexec(uint32_t, uint32_t); 20 | int flx_arithwindow_bbltranslate(flx_bbl* bbl); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /target-i386/flx_bbltrace.h: -------------------------------------------------------------------------------- 1 | #ifndef FLX_BBLTRACE 2 | #define FLX_BBLTRACE 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #include "flx_instrument.h" 11 | 12 | #define MAX_BBLTRACE_HANDLERS 16 13 | 14 | typedef int(*bbltrace_handler)(uint32_t, uint32_t); 15 | 16 | extern bbltrace_handler flx_bbltrace_handler; 17 | 18 | void flx_bbltrace_init(void); 19 | void flx_bbltrace_register_handler(bbltrace_handler handler); 20 | void flx_bbltrace_unregister_handler(bbltrace_handler handler); 21 | void flx_bbltrace_enable(void); 22 | void flx_bbltrace_disable(void); 23 | void flx_bbltrace_event(uint32_t, uint32_t); 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /target-i386/flx_bbltranslate.h: -------------------------------------------------------------------------------- 1 | #ifndef FLX_BBLTRANSLATE 2 | #define FLX_BBLTRANSLATE 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #include "flx_instrument.h" 11 | #include "flx_bbl.h" 12 | 13 | #define MAX_BBLTRANSLATE_HANDLERS 16 14 | 15 | #define FLX_BBLTRANSLATE_HOOK(function) do{if(flx_state.global_active && flx_state.bbltranslate_active && (flx_state.filter_active && flx_filter_search_by_addr(pc_ptr))) function;}while(0) 16 | 17 | typedef int(*bbltranslate_handler)(flx_bbl*); 18 | 19 | void flx_bbltranslate_init(void); 20 | void flx_bbltranslate_enable(void); 21 | void flx_bbltranslate_disable(void); 22 | 23 | void flx_bbltranslate_bbl_new(uint32_t); 24 | void flx_bbltranslate_bbl_end(void); 25 | void flx_bbltranslate_insn(enum insn_type insn); 26 | void flx_bbltranslate_bbl_size(uint32_t); 27 | uint32_t flx_bbltranslate_bbl_addr(void); 28 | 29 | void flx_bbltranslate_register_handler(bbltranslate_handler); 30 | void flx_bbltranslate_unregister_handler(bbltranslate_handler); 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /target-i386/flx_bblwindow.h: -------------------------------------------------------------------------------- 1 | #ifndef FLX_BBLWINDOW 2 | #define FLX_BBLWINDOW 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #include "flx_instrument.h" 11 | #include "flx_bbltranslate.h" 12 | 13 | void flx_bblwindow_init(void); 14 | void flx_bblwindow_enable(uint32_t); 15 | void flx_bblwindow_disable(void); 16 | int flx_bblwindow_bblexec(uint32_t, uint32_t); 17 | int flx_bblwindow_get(uint32_t, uint32_t*); 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /target-i386/flx_breakpoint.h: -------------------------------------------------------------------------------- 1 | #ifndef _FLX_BREAKPOINT_H 2 | #define _FLX_BREAKPOINT_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | extern avl_tree_t *bps; 9 | 10 | typedef struct { 11 | uint32_t addr; 12 | avl_tree_t *processes; 13 | } flx_breakpoint; 14 | 15 | void flx_breakpoint_init(void); 16 | void flx_breakpoint_insert(uint32_t addr, uint32_t cr3); 17 | int flx_breakpoint_delete(uint32_t addr, uint32_t cr3); 18 | int flx_breakpoint_search(uint32_t addr, uint32_t cr3); 19 | int flx_breakpoint_search_addr(uint32_t addr, uint32_t *next); 20 | 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /target-i386/flx_codesearch.h: -------------------------------------------------------------------------------- 1 | #ifndef FLX_CODESEARCH 2 | #define FLX_CODESEARCH 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #include "flx_instrument.h" 11 | #include "flx_memtrace.h" 12 | #include "flx_calltrace.h" 13 | 14 | #define FLX_INSN_CHAIN_RESIZE 1024 15 | 16 | typedef struct insn_chain insn_chain; 17 | struct insn_chain { 18 | uint32_t* data; 19 | uint32_t* eips; 20 | uint32_t len; 21 | uint32_t size; 22 | insn_chain* next; 23 | }; 24 | 25 | typedef int(*codesearch_handler)(uint32_t, uint8_t*, uint32_t); 26 | 27 | void flx_codesearch_init(codesearch_handler handler); 28 | void flx_codesearch_enable(void); 29 | void flx_codesearch_disable(void); 30 | void flx_codesearch_search(void); 31 | int flx_codesearch_bbl(uint32_t, uint32_t); 32 | int flx_codesearch_calltrace(uint32_t, uint32_t, uint32_t, uint32_t, flx_call_type); 33 | void flx_codesearch_pattern(uint8_t* , uint32_t); 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /target-i386/flx_constsearch.h: -------------------------------------------------------------------------------- 1 | #ifndef FLX_CONSTSEARCH 2 | #define FLX_CONSTSEARCH 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #include "flx_instrument.h" 11 | #include "flx_memtrace.h" 12 | #include "flx_calltrace.h" 13 | 14 | typedef int(*constsearch_handler)(uint32_t, uint32_t); 15 | 16 | void flx_constsearch_init(constsearch_handler handler); 17 | void flx_constsearch_enable(void); 18 | void flx_constsearch_disable(void); 19 | void flx_constsearch_search(void); 20 | int flx_constsearch_memaccess(uint32_t, uint32_t, uint8_t, uint8_t); 21 | void flx_constsearch_pattern(uint8_t* , uint32_t); 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /target-i386/flx_context.h: -------------------------------------------------------------------------------- 1 | #ifndef FLX_CONTEXT 2 | #define FLX_CONTEXT 3 | 4 | #include 5 | 6 | #include "flx_instrument.h" 7 | 8 | typedef int (*context_destructor)(void*); 9 | 10 | typedef struct { 11 | uint16_t pid; 12 | uint16_t tid; 13 | char* procname; 14 | 15 | void *calltrace; 16 | void *memtrace; 17 | void *constsearch; 18 | void *taintstack; 19 | void *dump; 20 | void *insnchain; 21 | context_destructor calltrace_destructor; 22 | context_destructor memtrace_destructor; 23 | context_destructor constsearch_destructor; 24 | context_destructor taintgraph_destructor; 25 | context_destructor dump_destructor; 26 | context_destructor codesearch_destructor; 27 | } flx_context; 28 | 29 | void flx_context_init(void); 30 | void flx_context_set(int32_t, int32_t, const char* procname); 31 | flx_context* flx_context_current(void); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /target-i386/flx_disas.h: -------------------------------------------------------------------------------- 1 | #ifndef FLX_DISAS 2 | #define FLX_DISAS 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | typedef struct { 11 | uint8_t* s; 12 | uint32_t size; 13 | } flx_disassembly; 14 | 15 | flx_disassembly* 16 | flx_disas_bbl(uint32_t addr); 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /target-i386/flx_dump.h: -------------------------------------------------------------------------------- 1 | #ifndef FLX_DUMP 2 | #define FLX_DUMP 3 | 4 | enum flx_events { 5 | MEM_ACCESS, 6 | FUNCTION, 7 | BBLEXEC, 8 | BBLTRANSLATE, 9 | }; 10 | 11 | typedef struct __attribute__((__packed__)){ 12 | uint8_t event_type; 13 | uint32_t eip; 14 | uint8_t type; 15 | } flx_dump_functionevent; 16 | 17 | typedef struct __attribute__((__packed__)){ 18 | uint8_t event_type; 19 | uint32_t address; 20 | uint32_t value; 21 | uint8_t options; 22 | } flx_dump_memaccess; 23 | 24 | typedef struct __attribute__((__packed__)){ 25 | uint8_t event_type; 26 | uint32_t addr; 27 | } flx_dump_exec; 28 | 29 | typedef struct __attribute__((__packed__)){ 30 | uint8_t event_type; 31 | uint32_t icount; 32 | uint32_t total_count; 33 | uint32_t movcount; 34 | uint32_t addr; 35 | uint32_t insn[]; 36 | } flx_dump_translate; 37 | 38 | 39 | 40 | void flx_dump_init(void); 41 | void flx_dump_destroy(void); 42 | void flx_dump_enable(const char* dumpfile); 43 | void flx_dump_disable(void); 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /target-i386/flx_entropy.h: -------------------------------------------------------------------------------- 1 | #ifndef FLX_ENTROPY 2 | #define FLX_ENTROPY 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #include "flx_instrument.h" 11 | 12 | typedef int(*entropy_handler)(float, float); 13 | 14 | extern entropy_handler flx_entropy_handler; 15 | 16 | void flx_entropy_init(entropy_handler handler); 17 | void flx_entropy_enable(float); 18 | void flx_entropy_disable(void); 19 | int flx_entropy_callevent(uint32_t, uint32_t, uint32_t, uint32_t flx_call_type); 20 | int flx_entropy_memaccess(uint32_t, uint32_t, uint8_t, uint8_t); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /target-i386/flx_environment.h: -------------------------------------------------------------------------------- 1 | #ifndef FLX_ENVIRONMENT 2 | #define FLX_ENVIRONMENT 3 | 4 | #include "cpu.h" 5 | #include "flx_hashmap.h" 6 | #include "flx_instrument.h" 7 | 8 | void flx_environment_init(void); 9 | void flx_environment_destroy(void); 10 | void flx_environment_save_state(CPUState*); 11 | CPUState* flx_environment_get_state(uint32_t); 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /target-i386/flx_filter.h: -------------------------------------------------------------------------------- 1 | #ifndef FLX_FILTER 2 | #define FLX_FILTER 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #define MAX_NUM_PAGES 1<<20 11 | 12 | void flx_filter_init(void); 13 | void flx_filter_destroy(void); 14 | void flx_filter_enable(void); 15 | void flx_filter_disable(void); 16 | int flx_filter_search_by_addr(uint32_t address); 17 | int flx_filter_del_by_addr(uint32_t address); 18 | int flx_filter_del_by_range(uint32_t start, uint32_t end); 19 | int flx_filter_search_by_range(uint32_t start, uint32_t end); 20 | int flx_filter_add_by_addr(uint32_t address); 21 | int flx_filter_add_by_range(uint32_t start, uint32_t end); 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /target-i386/flx_functionentropy.h: -------------------------------------------------------------------------------- 1 | #ifndef FLX_FUNCTION_ENTROPY 2 | #define FLX_FUNCTION_ENTROPY 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #include "flx_instrument.h" 11 | #include "flx_memtrace.h" 12 | #include "flx_calltrace.h" 13 | 14 | typedef int(*functionentropy_handler)(float, uint32_t); 15 | 16 | void flx_functionentropy_init(functionentropy_handler handler); 17 | void flx_functionentropy_enable(float); 18 | void flx_functionentropy_disable(void); 19 | int flx_functionentropy_memaccess(uint32_t, uint32_t, uint8_t, uint8_t); 20 | int flx_functionentropy_functionevent(uint32_t old_eip, uint32_t new_eip, uint32_t next_eip, uint32_t esp, flx_call_type type); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /target-i386/flx_functiontaint.h: -------------------------------------------------------------------------------- 1 | #ifndef FLX_FUNCTION_TAINT 2 | #define FLX_FUNCTION_TAINT 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #include "flx_instrument.h" 11 | #include "flx_memtrace.h" 12 | #include "flx_calltrace.h" 13 | 14 | typedef int(*functiontaint_handler)(float, uint32_t); 15 | 16 | void flx_functiontaint_init(functiontaint_handler handler); 17 | void flx_functiontaint_enable(float); 18 | void flx_functiontaint_disable(void); 19 | int flx_functiontaint_memaccess(uint32_t, uint32_t, uint8_t, uint8_t); 20 | int flx_functiontaint_functionevent(uint32_t old_eip, uint32_t new_eip, uint32_t next_eip, uint32_t esp, flx_call_type type); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /target-i386/flx_functiontrace.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #include "flx_instrument.h" 7 | #include "flx_calltrace.h" 8 | #include "flx_functiontrace.h" 9 | 10 | /* 11 | * This module provides high level event generation 12 | * for the python interface to build shadow callstacks 13 | * in the python layer. 14 | */ 15 | 16 | functiontrace_handler flx_functiontrace_handler = NULL; 17 | 18 | void flx_functiontrace_init(functiontrace_handler handler){ 19 | flx_functiontrace_handler = handler; 20 | } 21 | 22 | void flx_functiontrace_enable(void){ 23 | flx_calltrace_enable(); 24 | flx_calltrace_register_handler(flx_functiontrace_event); 25 | flx_state.functiontrace_active = 1; 26 | } 27 | 28 | void flx_functiontrace_disable(void){ 29 | flx_calltrace_unregister_handler(flx_functiontrace_event); 30 | flx_state.functiontrace_active = 0; 31 | } 32 | 33 | int flx_functiontrace_event(uint32_t old_eip, uint32_t new_eip, uint32_t next_eip, uint32_t esp, flx_call_type type){ 34 | flx_functiontrace_handler(new_eip, type); 35 | return 0; 36 | } 37 | 38 | -------------------------------------------------------------------------------- /target-i386/flx_functiontrace.h: -------------------------------------------------------------------------------- 1 | #ifndef FLX_FUNCTIONTRACE 2 | #define FLX_FUNCTIONTRACE 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #include "flx_instrument.h" 11 | #include "flx_calltrace.h" 12 | 13 | typedef int(*functiontrace_handler)(uint32_t new_eip, flx_call_type type); 14 | 15 | extern functiontrace_handler flx_functiontrace_handler; 16 | 17 | void flx_functiontrace_init(functiontrace_handler handler); 18 | void flx_functiontrace_enable(void); 19 | void flx_functiontrace_disable(void); 20 | int flx_functiontrace_event(uint32_t, uint32_t, uint32_t, uint32_t, flx_call_type); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /target-i386/flx_graph.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | typedef avl_tree_t flx_graph; 5 | typedef uint32_t vertex_iterator; 6 | typedef uint32_t edge_iterator; 7 | 8 | typedef struct { 9 | avl_tree_t* edges; 10 | uint32_t v; 11 | } vertex; 12 | 13 | typedef struct { 14 | vertex** vertices; 15 | uint32_t num; 16 | } vertex_block; 17 | 18 | flx_graph* flx_graph_alloc(void); 19 | void flx_graph_dealloc(flx_graph* graph); 20 | vertex* flx_graph_add_vertex(flx_graph* graph, uint32_t v); 21 | void flx_graph_add_edge(flx_graph* graph, uint32_t u, uint32_t v); 22 | 23 | vertex_iterator flx_graph_iterator_new(void); 24 | vertex* flx_graph_iterate(flx_graph* graph, vertex_iterator* i); 25 | edge_iterator flx_edge_iterator_new(void); 26 | vertex* flx_edge_iterate(vertex* v, edge_iterator* i); 27 | 28 | float flx_taint_quotient(flx_graph* g); 29 | 30 | -------------------------------------------------------------------------------- /target-i386/flx_hashmap.h: -------------------------------------------------------------------------------- 1 | #ifndef FLX_HASHMAP 2 | #define FLX_HASHMAP 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #include "hashmap.h" 12 | 13 | #define FLX_HASHMAP_INITIAL_SIZE 1<<20 14 | 15 | typedef int(*hashmap_hash)(void*); 16 | typedef uint8_t(*hashmap_equals)(void*, void*); 17 | typedef void(*hashmap_destructor)(void*); 18 | 19 | typedef struct{ 20 | Hashmap* map; 21 | hashmap_destructor item_destructor; 22 | hashmap_destructor key_destructor; 23 | } hmap; 24 | 25 | hmap* flx_hashmap_new(hashmap_hash hash, hashmap_equals equ, hashmap_destructor key_destruct, hashmap_destructor item_destruct); 26 | hmap* flx_hashmap_delete(hmap* h); 27 | void* flx_hashmap_put(hmap* h, void* key, void* value); 28 | void* flx_hashmap_get(hmap* h, void* key); 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /target-i386/flx_memtrace.h: -------------------------------------------------------------------------------- 1 | #ifndef FLX_MEMTRACE 2 | #define FLX_MEMTRACE 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #define MAX_MEMTRACE_HANDLERS 16 9 | 10 | typedef int(*memtrace_handler)(uint32_t, uint32_t, uint8_t, uint8_t); 11 | 12 | void flx_memtrace_init(void); 13 | void flx_memtrace_enable(void); 14 | void flx_memtrace_disable(void); 15 | void flx_memtrace_event(uint32_t address, uint32_t value, uint8_t size, uint8_t iswrite); 16 | void flx_memtrace_register_handler(memtrace_handler); 17 | void flx_memtrace_unregister_handler(memtrace_handler); 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /target-i386/flx_memtrack.h: -------------------------------------------------------------------------------- 1 | #ifndef FLX_MEMTRACK 2 | #define FLX_MEMTRACK 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | typedef avl_tree_t memtracker; 10 | typedef uint32_t memtrack_iterator; 11 | 12 | typedef struct { 13 | uint32_t addr; 14 | uint8_t value; 15 | } memory_byte; 16 | 17 | memtracker* flx_memtrack_new(void); 18 | void flx_memtrack_delete(memtracker* tracker); 19 | void flx_memtrack_store(memtracker* tracker, uint32_t address, uint8_t value, uint8_t overwrite); 20 | uint8_t flx_memtrack_load(memtracker* tracker, uint32_t address, uint8_t* value); 21 | void flx_memtrack_merge(memtracker* dst, memtracker* src, uint8_t overwrite); 22 | 23 | memtrack_iterator flx_memtrack_iterator(void); 24 | memory_byte* flx_memtrack_iterate(memtracker* tracker, memtrack_iterator* iter); 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /target-i386/flx_optrace.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #include "exec-all.h" 7 | #include "cpu.h" 8 | 9 | #include "flx_instrument.h" 10 | #include "flx_optrace.h" 11 | 12 | /* 13 | * NOT USED 14 | * Was implemented to distribute events on the execution 15 | * of specific instruction classes. This is done by 16 | * annoating basic blocks now which is much faster. 17 | */ 18 | 19 | optrace_handler flx_optrace_handler = 0; 20 | 21 | void flx_optrace_init(optrace_handler handler){ 22 | flx_optrace_handler = handler; 23 | } 24 | 25 | void flx_optrace_enable(void){ 26 | tb_flush(current_environment); 27 | flx_state.optrace_active = 1; 28 | } 29 | 30 | void flx_optrace_disable(void){ 31 | tb_flush(current_environment); 32 | flx_state.optrace_active = 0; 33 | } 34 | 35 | void flx_optrace_event(uint32_t eip, uint32_t opcode){ 36 | if(likely(flx_optrace_handler)) 37 | flx_optrace_handler(eip, opcode); 38 | else 39 | printf("failed to initialize flx_optrace handler!\n"); 40 | } 41 | 42 | int flx_optrace_status(void){ 43 | return flx_state.optrace_active; 44 | 45 | -------------------------------------------------------------------------------- /target-i386/flx_optrace.h: -------------------------------------------------------------------------------- 1 | #ifndef FLX_OPTRACE 2 | #define FLX_OPTRACE 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | enum { 9 | FLX_OP_OR, 10 | FLX_OP_AND, 11 | FLX_OP_XOR, 12 | FLX_OP_ROL, 13 | FLX_OP_ROR, 14 | FLX_OP_RCL, 15 | FLX_OP_RCR, 16 | FLX_OP_SHL, 17 | FLX_OP_SHR, 18 | FLX_OP_SHL1, 19 | FLX_OP_SAR, 20 | }; 21 | 22 | typedef int(*optrace_handler)(uint32_t, uint32_t); 23 | 24 | extern optrace_handler flx_optrace_handler; 25 | 26 | void flx_optrace_init(optrace_handler handler); 27 | void flx_optrace_enable(void); 28 | void flx_optrace_disable(void); 29 | void flx_optrace_event(uint32_t eip, uint32_t opcode); 30 | int flx_optrace_status(void); 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /target-i386/flx_process.h: -------------------------------------------------------------------------------- 1 | #ifndef FLX_PROCESS 2 | #define FLX_PROCESS 3 | 4 | #include 5 | 6 | /* 7 | * NOT USED 8 | */ 9 | 10 | #include "flx_instrument.h" 11 | 12 | typedef struct { 13 | uint16_t pid; 14 | } flx_process; 15 | 16 | void 17 | flx_process* flx_process_new(uint16_t); 18 | void flx_process_delete(flx_process*); 19 | flx_thread* flx_process_get(uint16_t); 20 | flx_thread* flx_process_current(void); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /target-i386/flx_syscall.h: -------------------------------------------------------------------------------- 1 | #ifndef FLX_SYSCALL 2 | #define FLX_SYSCALL 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #include "flx_instrument.h" 11 | #include "flx_bbltranslate.h" 12 | 13 | typedef int(*syscall_handler)(uint32_t); 14 | 15 | void flx_syscall_init(syscall_handler); 16 | void flx_syscall_enable(void); 17 | void flx_syscall_disable(void); 18 | void flx_syscall_destroy(void); 19 | void flx_syscall_event(uint32_t); 20 | void flx_syscall_hook(uint32_t); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /target-i386/flx_taintgraph.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | typedef avl_tree_t flx_graph; 5 | typedef uint32_t vertex_iterator; 6 | typedef uint32_t edge_iterator; 7 | 8 | typedef struct { 9 | avl_tree_t* edges; 10 | uint32_t v; 11 | } vertex; 12 | 13 | typedef struct { 14 | vertex** vertices; 15 | uint32_t num; 16 | } vertex_block; 17 | 18 | flx_graph* flx_graph_alloc(void); 19 | void flx_graph_dealloc(flx_graph* graph); 20 | vertex* flx_graph_add_vertex(flx_graph* graph, uint32_t v); 21 | void flx_graph_add_edge(flx_graph* graph, uint32_t u, uint32_t v); 22 | 23 | vertex_iterator flx_graph_iterator_new(void); 24 | vertex* flx_graph_iterate(flx_graph* graph, vertex_iterator* i); 25 | edge_iterator flx_edge_iterator_new(void); 26 | vertex* flx_edge_iterate(vertex* v, edge_iterator* i); 27 | 28 | float flx_taint_quotient(flx_graph* g); 29 | 30 | -------------------------------------------------------------------------------- /target-i386/flx_tbrestoring.h: -------------------------------------------------------------------------------- 1 | #ifndef _FLX_TBRESTORE_H 2 | #define _FLX_TBRESTORE_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | typedef struct { 9 | int i; 10 | int j; 11 | } flx_tb_cache; 12 | 13 | typedef struct { 14 | uint32_t cr3; 15 | flx_tb_cache* cache; 16 | } flx_process_tb; 17 | 18 | void flx_tbrestore_init(void); 19 | void flx_tbrestore_new(uint32_t cr3); 20 | void flx_tbrestore_delete(uint32_t cr3); 21 | int flx_tbrestore_save(uint32_t cr3); 22 | int flx_tbrestore_restore(uint32_t cr3); 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /target-i386/libshmatch/Makefile: -------------------------------------------------------------------------------- 1 | CC = /usr/bin/gcc 2 | CFLAGS = -fPIC -O3 -Wall -Werror -D_GNU_SOURCE 3 | LDFLAGS = 4 | OBJ = aho-corasick.o slist.o shmatch.o acwrap.o 5 | TESTOBJ = test.o $(OBJ) 6 | 7 | libshmatch: $(OBJ) 8 | $(CC) $(CFLAGS) -shared -o libshmatch.so $(OBJ) $(LDFLAGS) 9 | 10 | test: $(TESTOBJ) 11 | $(CC) $(CFLAGS) -o test $(TESTOBJ) $(LDFLAGS) 12 | 13 | %.o: %.c 14 | $(CC) $(CFLAGS) -c $< 15 | 16 | clean: 17 | rm -rf *.o 18 | rm -f test 19 | rm -f libshmatch.so 20 | -------------------------------------------------------------------------------- /target-i386/pyqemu/Helpers.py: -------------------------------------------------------------------------------- 1 | 2 | import PyFlxInstrument 3 | from Structures import * 4 | 5 | PAGESIZE = 4096 6 | USER_KERNEL_SPLIT = 0x80000000 7 | current_process = None 8 | 9 | DUMP_UNSPECIFIED = 0 10 | DUMP_IMAGE = 1 11 | DUMP_PARTIAL = 2 12 | DUMP_FULL = 4 13 | DUMP_INITIAL = 8 14 | 15 | IMAGE_TYPE_UNKNOWN = 0 16 | IMAGE_TYPE_DLL = 1 17 | IMAGE_TYPE_EXE = 2 18 | 19 | NULL = 0 20 | 21 | def kernelspace(addr): 22 | return not userspace(addr) 23 | 24 | def userspace(addr): 25 | if addr & 0x80000000: 26 | return False 27 | return True 28 | 29 | class PageFaultException( Exception): 30 | def __init__( self, value): 31 | self.value = value 32 | 33 | def __str__( self): 34 | return "Page Fault at address 0x%08x, pdb 0x%08x" % self.value 35 | 36 | 37 | -------------------------------------------------------------------------------- /target-i386/pyqemu/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | __all__ = [ 3 | "config", 4 | "dll", 5 | "event", 6 | "fhandle", 7 | "Helpers", 8 | "pefile", 9 | "processinfo", 10 | "Structures", 11 | "syscalls", 12 | "cpu", 13 | "msg", 14 | "process", 15 | "memory", 16 | "operatingsystem", 17 | "controls", 18 | ] 19 | -------------------------------------------------------------------------------- /target-i386/pyqemu/config.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env 2 | 3 | import json 4 | 5 | class ConfigException(Exception): 6 | pass 7 | 8 | class _ConfigLoader(dict): 9 | def __init__(self, filename): 10 | self.file = open(filename,"r") 11 | 12 | def load(self, file): 13 | raise ConfigException("Implement in inherited class") 14 | 15 | def close(self): 16 | self.file.close() 17 | self.file = None 18 | 19 | def __del__(self): 20 | if self.file is not None: 21 | self.close() 22 | 23 | class _JsonConfigLoader(_ConfigLoader): 24 | def load(self): 25 | return json.load(self.file) 26 | 27 | class ConfigLoaderFactory: 28 | @classmethod 29 | def create(cls, configtype, configfile, configclass): 30 | if configtype == "json": 31 | return configclass(_JsonConfigLoader(configfile).load()) 32 | raise ConfigException("Unknown type of configuration file - file: %s, type: %s"%(configfile, configtype)) 33 | 34 | class QemuFlxConfig(dict): 35 | def __init__(self, *args): 36 | dict.__init__(self, *args) 37 | if not self.isValid(): 38 | raise Exception("Invalid config file!") 39 | 40 | def isValid(self): 41 | return True 42 | -------------------------------------------------------------------------------- /target-i386/pyqemu/controls/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | __all__ = [ 3 | "control", 4 | "syscall", 5 | "dump", 6 | "hook", 7 | ] 8 | -------------------------------------------------------------------------------- /target-i386/pyqemu/controls/control.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | class ProcessControl: 4 | """ Process Controlling API for customization """ 5 | def __init__(self, process, options): 6 | self.process = process 7 | self.options = options 8 | self.setupCallbacks() 9 | 10 | def setupCallbacks(self): 11 | """ Called on instrumentation init for each process """ 12 | raise Exception("Implement in inherited class") 13 | 14 | def attach(self, event_type, function): 15 | """ Hook into event handling """ 16 | self.process.eventHandlers[event_type].attach(self.PREFIX, function) 17 | 18 | def detach(self, event_type): 19 | """ Remove hook from event handling """ 20 | self.process.eventHandlers[event_type].detach(self.PREFIX) 21 | 22 | def log(self, msg): 23 | self.process.log(msg) 24 | 25 | def getCurrentFunction(self): 26 | return self.process.hardware.instrumentation.function_lookup() 27 | current_function = property(getCurrentFunction) 28 | 29 | control = None 30 | -------------------------------------------------------------------------------- /target-i386/pyqemu/controls/dump.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | from control import ProcessControl 4 | 5 | class DumpControl(ProcessControl): 6 | """ Sets dump configuration option in process instance """ 7 | def setupCallbacks(self): 8 | self.process.onInstrumentationInit(lambda: self.process.hardware.instrumentation.dump_enable(self.options["dump"])) 9 | 10 | control = DumpControl 11 | -------------------------------------------------------------------------------- /target-i386/pyqemu/debug.py: -------------------------------------------------------------------------------- 1 | 2 | def debug_shell(): 3 | traceback.print_exception(*sys.exc_info()) 4 | import code 5 | code.interact("DBG",local = locals()) 6 | sys.exit(-1) 7 | 8 | -------------------------------------------------------------------------------- /target-i386/pyqemu/heuristics/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | __all__ = [ 3 | "heuristic", 4 | "caballero", 5 | "bblexec", 6 | "arithwindow", 7 | "functiontrace", 8 | "functionentropy", 9 | "api", 10 | "constsearch", 11 | "codesearch", 12 | "functiontaint", 13 | ] 14 | -------------------------------------------------------------------------------- /target-i386/pyqemu/heuristics/arithwindow.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | from heuristic import PyQemuHeuristic 4 | 5 | class ArithwindowHeuristic(PyQemuHeuristic): 6 | """ Logging class for the arithwindow c implementation """ 7 | PREFIX = "Arithwindow" 8 | def setupCallbacks(self): 9 | self.process.onInstrumentationInit(lambda: self.process.hardware.instrumentation.arithwindow_enable(self.options["window_size"], self.options["threshold"])) 10 | self.attach("arithwindow", self.onArithwindowEvent) 11 | 12 | def onArithwindowEvent(self, process, event): 13 | self.log("%s,0x%x"%(self.PREFIX, event.eip)) 14 | 15 | heuristic = ArithwindowHeuristic 16 | -------------------------------------------------------------------------------- /target-i386/pyqemu/heuristics/bblexec.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | from heuristic import PyQemuHeuristic 4 | 5 | class BBLExecHeuristic(PyQemuHeuristic): 6 | """ Basic Block execution Logging """ 7 | PREFIX = "BBLExec" 8 | def setupCallbacks(self): 9 | self.process.onInstrumentationInit(lambda: self.process.hardware.instrumentation.bbltrace_enable()) 10 | self.attach("bbl", self.onBBLExec) 11 | 12 | def onBBLExec(self, process, event): 13 | self.log("%s(0x%x,0x%x)"%(self.PREFIX, event.eip, event.esp)) 14 | 15 | heuristic = BBLExecHeuristic 16 | -------------------------------------------------------------------------------- /target-i386/pyqemu/heuristics/caballero.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | from heuristic import PyQemuHeuristic 4 | 5 | class CaballeroHeuristic(PyQemuHeuristic): 6 | """ Logging class for the caballero heuristic """ 7 | PREFIX = "Caballero" 8 | def setupCallbacks(self): 9 | self.process.onInstrumentationInit(lambda: self.process.hardware.instrumentation.caballero_enable(self.options["min_icount"], self.options["threshold"])) 10 | self.attach("caballero", self.onCaballeroBBLTranslate) 11 | 12 | def onCaballeroBBLTranslate(self, process, event): 13 | self.log("%s %f,0x%x"%(self.PREFIX, float(event.arith)/float(event.icount), event.eip)) 14 | 15 | heuristic = CaballeroHeuristic 16 | -------------------------------------------------------------------------------- /target-i386/pyqemu/heuristics/functionentropy.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | from heuristic import PyQemuHeuristic 4 | 5 | class FunctionEntropyHeuristic(PyQemuHeuristic): 6 | """ Logging class for the entropy heuristic """ 7 | PREFIX = "Function Entropy Trace" 8 | 9 | def setupCallbacks(self): 10 | self.process.onInstrumentationInit(lambda: self.process.hardware.instrumentation.functionentropy_enable(self.options["threshold"])) 11 | self.attach("functionentropy", self.onFunctionEntropyEvent) 12 | 13 | def onFunctionEntropyEvent(self, process, event): 14 | self.log("Function(0x%x, 0x%x, %f)"%(self.current_function, event.start, event.entropychange)) 15 | 16 | heuristic = FunctionEntropyHeuristic 17 | -------------------------------------------------------------------------------- /target-i386/pyqemu/heuristics/functiontaint.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | from heuristic import PyQemuHeuristic 4 | 5 | class FunctionTaintHeuristic(PyQemuHeuristic): 6 | """ Logging class for the taint heuristic """ 7 | PREFIX = "Function Taint Trace" 8 | 9 | def setupCallbacks(self): 10 | self.process.onInstrumentationInit(lambda: self.process.hardware.instrumentation.functiontaint_enable(self.options["threshold"])) 11 | self.attach("functiontaint", self.onFunctionTaintEvent) 12 | 13 | def onFunctionTaintEvent(self, process, event): 14 | self.log("Taint(0x%x, 0x%x, %f)"%(self.current_function, event.start, event.quotient)) 15 | 16 | heuristic = FunctionTaintHeuristic 17 | -------------------------------------------------------------------------------- /target-i386/pyqemu/heuristics/functiontrace.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | from heuristic import PyQemuHeuristic 4 | 5 | class FunctionTraceHeuristic(PyQemuHeuristic): 6 | """ Logging class for the function heuristic """ 7 | PREFIX = "Functiontrace" 8 | 9 | def setupCallbacks(self): 10 | self.process.onInstrumentationInit(lambda: self.process.hardware.instrumentation.functiontrace_enable()) 11 | self.attach("functiontrace", self.onFunctionTraceEvent) 12 | 13 | def onFunctionTraceEvent(self, process, event): 14 | if event.isCall(): 15 | self.log("Call(0x%x)"%(event.eip)) 16 | elif event.isRet(): 17 | self.log("Ret(0x%x)"%(event.eip)) 18 | elif event.isLateRet(): 19 | self.log("LateRet(0x%x)"%(event.eip)) 20 | else: 21 | raise Exception("Unknown Function trace event type") 22 | 23 | heuristic = FunctionTraceHeuristic 24 | -------------------------------------------------------------------------------- /target-i386/pyqemu/heuristics/heuristic.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | class PyQemuHeuristic: 4 | """ Base class for heuristic logging """ 5 | def __init__(self, process, options): 6 | self.process = process 7 | self.options = options 8 | self.setupCallbacks() 9 | 10 | def setupCallbacks(self): 11 | raise Exception("Implement in inherited class") 12 | 13 | def attach(self, event_type, function): 14 | self.process.eventHandlers[event_type].attach(self.PREFIX, function) 15 | 16 | def detach(self, event_type): 17 | self.process.eventHandlers[event_type].detach(self.PREFIX) 18 | 19 | def log(self, msg): 20 | self.process.log(msg) 21 | 22 | def getCurrentFunction(self): 23 | return self.process.hardware.instrumentation.function_lookup() 24 | current_function = property(getCurrentFunction) 25 | -------------------------------------------------------------------------------- /target-i386/scripts/ida_mark_functions.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | addressfile = open("X:\\pyqemu_functions", "r") 3 | entries = [] 4 | for line in addressfile: 5 | line = line.strip() 6 | addr = line.split(",")[-1] 7 | desc = line 8 | entries.append((desc, int(addr,16))) 9 | unique_found = set(entries) 10 | mark_objects = {} 11 | functions = {} 12 | 13 | for desc, addr in unique_found: 14 | fname = GetFunctionName(addr) 15 | if functions.has_key(fname): 16 | descs, addr, color = functions[fname] 17 | descs.append(desc) 18 | functions[fname] = (descs, addr, color) 19 | else: 20 | functions[fname] = ([desc], addr, 0xaaaaaa) 21 | 22 | for descs, addr, color in functions.values(): 23 | descs.sort() 24 | description = "\n".join(descs) 25 | SetFunctionCmt(addr, description, 1) 26 | SetColor(addr, CIC_FUNC, color) 27 | 28 | addressfile.close() 29 | 30 | print "Marked all functions - respawn function window to workaround IDA displaying bug" 31 | -------------------------------------------------------------------------------- /target-i386/scripts/patch.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | from idautils import * 4 | from idaapi import * 5 | from idc import * 6 | 7 | page_directory = "X:\\pages\\" 8 | segments = [] 9 | for seg in Segments(): 10 | segments.append((seg, GetSegmentAttr(seg, SEGATTR_END))) 11 | 12 | for seg in segments: 13 | start,end = seg 14 | print "Patching Segment: 0x%x - 0x%x"%(start,end) 15 | while start < end: 16 | f = open(page_directory+hex(start), "rb") 17 | mem = f.read() 18 | f.close() 19 | for offset in range(4096): 20 | PatchByte(start+offset, ord(mem[offset])) 21 | for offset in range(4096): 22 | auto_make_code(start+offset) 23 | start += 4096 24 | analyze_area(start,end) 25 | analyze_area(0, 0xffffffff) 26 | -------------------------------------------------------------------------------- /target-m68k/m68k-qreg.h: -------------------------------------------------------------------------------- 1 | enum { 2 | #define DEFO32(name, offset) QREG_##name, 3 | #define DEFR(name, reg, mode) QREG_##name, 4 | #define DEFF64(name, offset) QREG_##name, 5 | QREG_NULL, 6 | #include "qregs.def" 7 | TARGET_NUM_QREGS = 0x100 8 | #undef DEFO32 9 | #undef DEFR 10 | #undef DEFF64 11 | }; 12 | -------------------------------------------------------------------------------- /target-m68k/machine.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pleed/pyqemu/a8bfd2186e347c6343ae3564a890e0fdf96a4d51/target-m68k/machine.c -------------------------------------------------------------------------------- /target-m68k/qregs.def: -------------------------------------------------------------------------------- 1 | DEFF64(FP_RESULT, fp_result) 2 | DEFO32(PC, pc) 3 | DEFO32(SR, sr) 4 | DEFO32(CC_OP, cc_op) 5 | DEFO32(CC_DEST, cc_dest) 6 | DEFO32(CC_SRC, cc_src) 7 | DEFO32(CC_X, cc_x) 8 | DEFO32(DIV1, div1) 9 | DEFO32(DIV2, div2) 10 | DEFO32(EXCEPTION, exception_index) 11 | DEFO32(HALTED, halted) 12 | DEFO32(MACSR, macsr) 13 | DEFO32(MAC_MASK, mac_mask) 14 | -------------------------------------------------------------------------------- /target-microblaze/machine.c: -------------------------------------------------------------------------------- 1 | #include "hw/hw.h" 2 | #include "hw/boards.h" 3 | 4 | void cpu_save(QEMUFile *f, void *opaque) 5 | { 6 | } 7 | 8 | int cpu_load(QEMUFile *f, void *opaque, int version_id) 9 | { 10 | return 0; 11 | } 12 | -------------------------------------------------------------------------------- /target-ppc/kvm_ppc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2008 IBM Corporation. 3 | * Authors: Hollis Blanchard 4 | * 5 | * This work is licensed under the GNU GPL license version 2 or later. 6 | * 7 | */ 8 | 9 | #ifndef __KVM_PPC_H__ 10 | #define __KVM_PPC_H__ 11 | 12 | void kvmppc_init(void); 13 | void kvmppc_fdt_update(void *fdt); 14 | int kvmppc_read_host_property(const char *node_path, const char *prop, 15 | void *val, size_t len); 16 | 17 | uint32_t kvmppc_get_tbfreq(void); 18 | int kvmppc_get_hypercall(CPUState *env, uint8_t *buf, int buf_len); 19 | int kvmppc_set_interrupt(CPUState *env, int irq, int level); 20 | 21 | #ifndef KVM_INTERRUPT_SET 22 | #define KVM_INTERRUPT_SET -1 23 | #endif 24 | 25 | #ifndef KVM_INTERRUPT_UNSET 26 | #define KVM_INTERRUPT_UNSET -2 27 | #endif 28 | 29 | #ifndef KVM_INTERRUPT_SET_LEVEL 30 | #define KVM_INTERRUPT_SET_LEVEL -3 31 | #endif 32 | 33 | #endif /* __KVM_PPC_H__ */ 34 | -------------------------------------------------------------------------------- /target-ppc/mfrom_table_gen.c: -------------------------------------------------------------------------------- 1 | #define _GNU_SOURCE 2 | #include 3 | #include 4 | #include 5 | 6 | int main (void) 7 | { 8 | double d; 9 | uint8_t n; 10 | int i; 11 | 12 | printf("static const uint8_t mfrom_ROM_table[602] =\n{\n "); 13 | for (i = 0; i < 602; i++) { 14 | /* Extremly decomposed: 15 | * -T0 / 256 16 | * T0 = 256 * log10(10 + 1.0) + 0.5 17 | */ 18 | d = -i; 19 | d /= 256.0; 20 | d = exp10(d); 21 | d += 1.0; 22 | d = log10(d); 23 | d *= 256; 24 | d += 0.5; 25 | n = d; 26 | printf("%3d, ", n); 27 | if ((i & 7) == 7) 28 | printf("\n "); 29 | } 30 | printf("\n};\n"); 31 | 32 | return 0; 33 | } 34 | -------------------------------------------------------------------------------- /target-s390x/machine.c: -------------------------------------------------------------------------------- 1 | /* 2 | * QEMU S390x machine definitions 3 | * 4 | * Copyright (c) 2009 Alexander Graf 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2 of the License, or (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, see . 18 | */ 19 | 20 | #include "hw/hw.h" 21 | #include "hw/boards.h" 22 | 23 | void cpu_save(QEMUFile *f, void *opaque) 24 | { 25 | } 26 | 27 | int cpu_load(QEMUFile *f, void *opaque, int version_id) 28 | { 29 | return 0; 30 | } 31 | -------------------------------------------------------------------------------- /target-sh4/machine.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pleed/pyqemu/a8bfd2186e347c6343ae3564a890e0fdf96a4d51/target-sh4/machine.c -------------------------------------------------------------------------------- /target-sparc/exec.h: -------------------------------------------------------------------------------- 1 | #ifndef EXEC_SPARC_H 2 | #define EXEC_SPARC_H 1 3 | #include "config.h" 4 | #include "dyngen-exec.h" 5 | 6 | register struct CPUSPARCState *env asm(AREG0); 7 | 8 | #include "cpu.h" 9 | #include "exec-all.h" 10 | 11 | #if !defined(CONFIG_USER_ONLY) 12 | #include "softmmu_exec.h" 13 | #endif /* !defined(CONFIG_USER_ONLY) */ 14 | 15 | /* op_helper.c */ 16 | void do_interrupt(CPUState *env); 17 | 18 | static inline int cpu_has_work(CPUState *env1) 19 | { 20 | return (env1->interrupt_request & CPU_INTERRUPT_HARD) && 21 | cpu_interrupts_enabled(env1); 22 | } 23 | 24 | 25 | static inline int cpu_halted(CPUState *env1) { 26 | if (!env1->halted) 27 | return 0; 28 | if (cpu_has_work(env1)) { 29 | env1->halted = 0; 30 | return 0; 31 | } 32 | return EXCP_HALTED; 33 | } 34 | 35 | static inline void cpu_pc_from_tb(CPUState *env, TranslationBlock *tb) 36 | { 37 | env->pc = tb->pc; 38 | env->npc = tb->cs_base; 39 | } 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /targphys.h: -------------------------------------------------------------------------------- 1 | /* Define target_phys_addr_t if it exists. */ 2 | 3 | #ifndef TARGPHYS_H 4 | #define TARGPHYS_H 5 | 6 | #ifdef TARGET_PHYS_ADDR_BITS 7 | /* target_phys_addr_t is the type of a physical address (its size can 8 | be different from 'target_ulong'). */ 9 | 10 | #if TARGET_PHYS_ADDR_BITS == 32 11 | typedef uint32_t target_phys_addr_t; 12 | #define TARGET_PHYS_ADDR_MAX UINT32_MAX 13 | #define TARGET_FMT_plx "%08x" 14 | #elif TARGET_PHYS_ADDR_BITS == 64 15 | typedef uint64_t target_phys_addr_t; 16 | #define TARGET_PHYS_ADDR_MAX UINT64_MAX 17 | #define TARGET_FMT_plx "%016" PRIx64 18 | #endif 19 | #endif 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /tcg/LICENSE: -------------------------------------------------------------------------------- 1 | All the files in this directory and subdirectories are released under 2 | a BSD like license (see header in each file). No other license is 3 | accepted. 4 | -------------------------------------------------------------------------------- /tcg/TODO: -------------------------------------------------------------------------------- 1 | - Add new instructions such as: clz, ctz, popcnt. 2 | 3 | - See if it is worth exporting mul2, mulu2, div2, divu2. 4 | 5 | - Support of globals saved in fixed registers between TBs. 6 | 7 | Ideas: 8 | 9 | - Move the slow part of the qemu_ld/st ops after the end of the TB. 10 | 11 | - Change exception syntax to get closer to QOP system (exception 12 | parameters given with a specific instruction). 13 | 14 | - Add float and vector support. 15 | -------------------------------------------------------------------------------- /tcg/tcg-runtime.h: -------------------------------------------------------------------------------- 1 | #ifndef TCG_RUNTIME_H 2 | #define TCG_RUNTIME_H 3 | 4 | /* tcg-runtime.c */ 5 | int32_t tcg_helper_div_i32(int32_t arg1, int32_t arg2); 6 | int32_t tcg_helper_rem_i32(int32_t arg1, int32_t arg2); 7 | uint32_t tcg_helper_divu_i32(uint32_t arg1, uint32_t arg2); 8 | uint32_t tcg_helper_remu_i32(uint32_t arg1, uint32_t arg2); 9 | 10 | int64_t tcg_helper_shl_i64(int64_t arg1, int64_t arg2); 11 | int64_t tcg_helper_shr_i64(int64_t arg1, int64_t arg2); 12 | int64_t tcg_helper_sar_i64(int64_t arg1, int64_t arg2); 13 | int64_t tcg_helper_div_i64(int64_t arg1, int64_t arg2); 14 | int64_t tcg_helper_rem_i64(int64_t arg1, int64_t arg2); 15 | uint64_t tcg_helper_divu_i64(uint64_t arg1, uint64_t arg2); 16 | uint64_t tcg_helper_remu_i64(uint64_t arg1, uint64_t arg2); 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /tests/alpha/Makefile: -------------------------------------------------------------------------------- 1 | CROSS=alpha-linux-gnu- 2 | CC=$(CROSS)gcc 3 | AS=$(CROSS)as 4 | 5 | SIM=../../alpha-linux-user/qemu-alpha 6 | 7 | CFLAGS=-O 8 | LINK=$(CC) -o $@ crt.o $< -nostdlib 9 | 10 | TESTS=test-cond test-cmov 11 | 12 | all: hello-alpha $(TESTS) 13 | 14 | hello-alpha: hello-alpha.o crt.o 15 | $(LINK) 16 | 17 | test-cond: test-cond.o crt.o 18 | $(LINK) 19 | 20 | test-cmov.o: test-cond.c 21 | $(CC) -c $(CFLAGS) -DTEST_CMOV -o $@ $< 22 | 23 | test-cmov: test-cmov.o crt.o 24 | $(LINK) 25 | 26 | test-ovf: test-ovf.o crt.o 27 | $(LINK) 28 | 29 | check: $(TESTS) 30 | for f in $(TESTS); do $(SIM) $$f || exit 1; done 31 | 32 | clean: 33 | $(RM) *.o *~ hello-alpha $(TESTS) 34 | 35 | .PHONY: clean all check 36 | -------------------------------------------------------------------------------- /tests/alpha/crt.s: -------------------------------------------------------------------------------- 1 | .text 2 | 3 | .globl _start 4 | .ent _start,0 5 | _start: 6 | .frame $15,0,$15 7 | br $29,1f 8 | 1: ldgp $29, 0($29) 9 | .prologue 0 10 | ldq $27,main($29) !literal!1 11 | jsr $26,($27) 12 | or $0,$0,$16 13 | .end _start 14 | 15 | .globl _exit 16 | _exit: 17 | lda $0,1 18 | callsys 19 | 20 | call_pal 0 21 | 22 | .globl write 23 | write: 24 | lda $0,4 25 | callsys 26 | ret 27 | -------------------------------------------------------------------------------- /tests/alpha/hello-alpha.c: -------------------------------------------------------------------------------- 1 | int main (void) 2 | { 3 | write (1, "hello\n", 6); 4 | return 0; 5 | } 6 | -------------------------------------------------------------------------------- /tests/alpha/test-ovf.c: -------------------------------------------------------------------------------- 1 | static long test_subqv (long a, long b) 2 | { 3 | long res; 4 | 5 | asm ("subq/v %1,%2,%0" 6 | : "=r" (res) : "r" (a), "r" (b)); 7 | return res; 8 | } 9 | static struct { 10 | long (*func)(long, long); 11 | long a; 12 | long b; 13 | long r; 14 | } vectors[] = 15 | { 16 | {test_subqv, 0, 0x7d54000, 0xfffffffff82ac000L} 17 | }; 18 | 19 | int main (void) 20 | { 21 | int i; 22 | 23 | for (i = 0; i < sizeof (vectors)/sizeof(vectors[0]); i++) 24 | if ((*vectors[i].func)(vectors[i].a, vectors[i].b) != vectors[i].r) { 25 | write(1, "Failed\n", 7); 26 | } 27 | write(1, "OK\n", 3); 28 | return 0; 29 | } 30 | -------------------------------------------------------------------------------- /tests/cris/.gdbinit: -------------------------------------------------------------------------------- 1 | b main 2 | b _fail 3 | b exit 4 | display /i $pc 5 | display /x $srp 6 | display /x $r0 7 | display /x $r1 8 | display /x $r2 9 | display /x $r3 10 | display /x $r4 11 | display /t $ccs 12 | -------------------------------------------------------------------------------- /tests/cris/README: -------------------------------------------------------------------------------- 1 | Test-suite for the cris port. Heavily based on the test-suite for the CRIS port of sim by Hans-Peter Nilsson. 2 | -------------------------------------------------------------------------------- /tests/cris/check_abs.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "sys.h" 5 | #include "crisutils.h" 6 | 7 | extern inline int cris_abs(int n) { 8 | int r; 9 | asm ("abs\t%1, %0\n" : "=r" (r) : "r" (n)); 10 | return r; 11 | } 12 | 13 | extern inline void 14 | verify_abs(int val, int res, 15 | const int n, const int z, const int v, const int c) 16 | { 17 | int r; 18 | 19 | cris_tst_cc_init(); 20 | r = cris_abs(val); 21 | cris_tst_cc(n, z, v, c); 22 | if (r != res) 23 | err(); 24 | } 25 | 26 | int main(void) 27 | { 28 | verify_abs(-1, 1, 0, 0, 0, 0); 29 | verify_abs(0x80000000, 0x80000000, 1, 0, 0, 0); 30 | verify_abs(0x7fffffff, 0x7fffffff, 0, 0, 0, 0); 31 | verify_abs(42, 42, 0, 0, 0, 0); 32 | verify_abs(1, 1, 0, 0, 0, 0); 33 | verify_abs(0xffff, 0xffff, 0, 0, 0, 0); 34 | verify_abs(0xffff, 0xffff, 0, 0, 0, 0); 35 | verify_abs(-31, 0x1f, 0, 0, 0, 0); 36 | verify_abs(0, 0, 0, 1, 0, 0); 37 | pass(); 38 | return 0; 39 | } 40 | -------------------------------------------------------------------------------- /tests/cris/check_addi.s: -------------------------------------------------------------------------------- 1 | # mach: crisv0 crisv3 crisv8 crisv10 crisv32 2 | # output: 0\n1\n2\n4\nbe02460f\n69d035a6\nc16c14d4\n 3 | 4 | .include "testutils.inc" 5 | start 6 | moveq 0,r3 7 | moveq 0,r4 8 | clearf zcvn 9 | addi r4.b,r3 10 | test_cc 0 0 0 0 11 | checkr3 0 12 | 13 | moveq 0,r3 14 | moveq 1,r4 15 | setf zcvn 16 | addi r4.b,r3 17 | test_cc 1 1 1 1 18 | checkr3 1 19 | 20 | moveq 0,r3 21 | moveq 1,r4 22 | setf cv 23 | clearf zn 24 | addi r4.w,r3 25 | test_cc 0 0 1 1 26 | checkr3 2 27 | 28 | moveq 0,r3 29 | moveq 1,r4 30 | clearf cv 31 | setf zn 32 | addi r4.d,r3 33 | test_cc 1 1 0 0 34 | checkr3 4 35 | 36 | move.d 0x12345678,r3 37 | move.d 0xabcdef97,r4 38 | clearf cn 39 | setf zv 40 | addi r4.b,r3 41 | test_cc 0 1 1 0 42 | checkr3 be02460f 43 | 44 | move.d 0x12345678,r3 45 | move.d 0xabcdef97,r4 46 | setf cn 47 | clearf zv 48 | addi r4.w,r3 49 | test_cc 1 0 0 1 50 | checkr3 69d035a6 51 | 52 | move.d 0x12345678,r3 53 | move.d 0xabcdef97,r4 54 | addi r4.d,r3 55 | checkr3 c16c14d4 56 | 57 | quit 58 | -------------------------------------------------------------------------------- /tests/cris/check_addoq.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "sys.h" 5 | #include "crisutils.h" 6 | 7 | /* this would be better to do in asm, it's an orgy in GCC inline asm now. */ 8 | 9 | /* ACR will be clobbered. */ 10 | #define cris_addoq(o, v) \ 11 | asm volatile ("addoq\t%1, %0, $acr\n" : : "r" (v), "i" (o) : "acr"); 12 | 13 | 14 | int main(void) 15 | { 16 | int x[3] = {0x55aa77ff, 0xccff2244, 0x88ccee19}; 17 | int *p, *t = x + 1; 18 | 19 | cris_tst_cc_init(); 20 | asm volatile ("setf\tzvnc\n"); 21 | cris_addoq(0, t); 22 | cris_tst_cc(1, 1, 1, 1); 23 | asm volatile ("move.d\t$acr, %0\n" : "=r" (p)); 24 | if (*p != 0xccff2244) 25 | err(); 26 | 27 | cris_tst_cc_init(); 28 | asm volatile ("setf\tzvnc\n"); 29 | cris_addoq(4, t); 30 | cris_tst_cc(0, 0, 0, 0); 31 | asm volatile ("move.d\t$acr, %0\n" : "=r" (p)); 32 | if (*p != 0x88ccee19) 33 | err(); 34 | 35 | cris_tst_cc_init(); 36 | asm volatile ("clearf\tzvnc\n"); 37 | cris_addoq(-8, t + 1); 38 | cris_tst_cc(0, 0, 0, 0); 39 | asm volatile ("move.d\t$acr, %0\n" : "=r" (p)); 40 | if (*p != 0x55aa77ff) 41 | err(); 42 | pass(); 43 | return 0; 44 | } 45 | -------------------------------------------------------------------------------- /tests/cris/check_addq.s: -------------------------------------------------------------------------------- 1 | # mach: crisv3 crisv8 crisv10 crisv32 2 | # output: ffffffff\n0\n1\n100\n10000\n47\n67\na6\n80000001\n 3 | 4 | .include "testutils.inc" 5 | start 6 | moveq -2,r3 7 | addq 1,r3 8 | test_cc 1 0 0 0 9 | checkr3 ffffffff 10 | 11 | addq 1,r3 12 | test_cc 0 1 0 1 13 | checkr3 0 14 | 15 | addq 1,r3 16 | test_cc 0 0 0 0 17 | checkr3 1 18 | 19 | move.d 0xff,r3 20 | addq 1,r3 21 | test_cc 0 0 0 0 22 | checkr3 100 23 | 24 | move.d 0xffff,r3 25 | addq 1,r3 26 | test_cc 0 0 0 0 27 | checkr3 10000 28 | 29 | move.d 0x42,r3 30 | addq 5,r3 31 | test_cc 0 0 0 0 32 | checkr3 47 33 | 34 | addq 32,r3 35 | test_cc 0 0 0 0 36 | checkr3 67 37 | 38 | addq 63,r3 39 | test_cc 0 0 0 0 40 | checkr3 a6 41 | 42 | move.d 0x7ffffffe,r3 43 | addq 3,r3 44 | test_cc 1 0 1 0 45 | checkr3 80000001 46 | 47 | quit 48 | -------------------------------------------------------------------------------- /tests/cris/check_andq.s: -------------------------------------------------------------------------------- 1 | # mach: crisv0 crisv3 crisv8 crisv10 crisv32 2 | # output: 2\n2\nffff\nffffffff\n1f\nffffffe0\n78134452\n0\n 3 | 4 | .include "testutils.inc" 5 | start 6 | moveq -1,r3 7 | andq 2,r3 8 | test_move_cc 0 0 0 0 9 | checkr3 2 10 | 11 | moveq 2,r3 12 | andq -1,r3 13 | test_move_cc 0 0 0 0 14 | checkr3 2 15 | 16 | move.d 0xffff,r3 17 | andq -1,r3 18 | test_move_cc 0 0 0 0 19 | checkr3 ffff 20 | 21 | moveq -1,r3 22 | andq -1,r3 23 | test_move_cc 1 0 0 0 24 | checkr3 ffffffff 25 | 26 | moveq -1,r3 27 | andq 31,r3 28 | test_move_cc 0 0 0 0 29 | checkr3 1f 30 | 31 | moveq -1,r3 32 | andq -32,r3 33 | test_move_cc 1 0 0 0 34 | checkr3 ffffffe0 35 | 36 | move.d 0x78134457,r3 37 | andq -14,r3 38 | test_move_cc 0 0 0 0 39 | checkr3 78134452 40 | 41 | moveq 0,r3 42 | andq -14,r3 43 | test_move_cc 0 1 0 0 44 | checkr3 0 45 | 46 | quit 47 | -------------------------------------------------------------------------------- /tests/cris/check_clearfv32.s: -------------------------------------------------------------------------------- 1 | # mach: crisv32 2 | # output: ef\nef\n 3 | 4 | ; Check that "clearf x" doesn't trivially fail. 5 | 6 | .include "testutils.inc" 7 | start 8 | setf puixnzvc 9 | clearf x ; Actually, x would be cleared by almost-all other insns. 10 | move ccs,r3 11 | and.d 0xff, $r3 12 | checkr3 ef 13 | 14 | setf puixnzvc 15 | moveq 0, $r3 ; moveq should only clear the xflag. 16 | move ccs,r3 17 | and.d 0xff, $r3 18 | checkr3 ef 19 | quit 20 | -------------------------------------------------------------------------------- /tests/cris/check_clrjmp1.s: -------------------------------------------------------------------------------- 1 | # mach: crisv3 crisv8 crisv10 crisv32 2 | # output: ffffff00\n 3 | 4 | ; A bug resulting in a non-effectual clear.b discovered running the GCC 5 | ; testsuite; jump actually wrote to p0. 6 | 7 | .include "testutils.inc" 8 | 9 | start 10 | jump 1f 11 | nop 12 | .p2align 8 13 | 1: 14 | move.d y,r4 15 | 16 | .if 0 ;0 == ..asm.arch.cris.v32 17 | ; There was a bug causing this insn to set special register p0 18 | ; (byte-clear) to 8 (low 8 bits of location after insn). 19 | jump [r4+] 20 | .endif 21 | 22 | 1: 23 | move.d 0f,r4 24 | 25 | ; The corresponding bug would cause this insn too, to set p0. 26 | jump r4 27 | nop 28 | quit 29 | 0: 30 | moveq -1,r3 31 | clear.b r3 32 | checkr3 ffffff00 33 | quit 34 | 35 | y: 36 | .dword 1b 37 | -------------------------------------------------------------------------------- /tests/cris/check_cmp-2.s: -------------------------------------------------------------------------------- 1 | 2 | 3 | .include "testutils.inc" 4 | 5 | start 6 | 7 | move.d 4294967283, $r0 8 | move.d $r0, $r10 9 | cmp.d $r0, $r10 10 | beq 1f 11 | move.d $r10, $r3 12 | fail 13 | 1: 14 | pass 15 | quit 16 | -------------------------------------------------------------------------------- /tests/cris/check_dstep.s: -------------------------------------------------------------------------------- 1 | # mach: crisv0 crisv3 crisv8 crisv10 crisv32 2 | # output: fffffffc\n4\nffff\nfffffffe\n9bf3911b\n0\n 3 | 4 | .include "testutils.inc" 5 | start 6 | moveq -1,r3 7 | moveq 2,r4 8 | dstep r4,r3 9 | test_move_cc 1 0 0 0 10 | checkr3 fffffffc 11 | 12 | moveq 2,r3 13 | moveq -1,r4 14 | dstep r4,r3 15 | test_move_cc 0 0 0 0 16 | checkr3 4 17 | 18 | move.d 0xffff,r4 19 | move.d r4,r3 20 | dstep r4,r3 21 | test_move_cc 0 0 0 0 22 | checkr3 ffff 23 | 24 | moveq -1,r4 25 | move.d r4,r3 26 | dstep r4,r3 27 | test_move_cc 1 0 0 0 28 | checkr3 fffffffe 29 | 30 | move.d 0x5432f789,r4 31 | move.d 0x78134452,r3 32 | dstep r4,r3 33 | test_move_cc 1 0 0 0 34 | checkr3 9bf3911b 35 | 36 | move.d 0xffff,r3 37 | move.d 0x1fffe,r4 38 | dstep r4,r3 39 | test_move_cc 0 1 0 0 40 | checkr3 0 41 | 42 | quit 43 | -------------------------------------------------------------------------------- /tests/cris/check_ftag.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "sys.h" 5 | #include "crisutils.h" 6 | 7 | extern inline void cris_ftag_i(unsigned int x) { 8 | register unsigned int v asm("$r10") = x; 9 | asm ("ftagi\t[%0]\n" : : "r" (v) ); 10 | } 11 | extern inline void cris_ftag_d(unsigned int x) { 12 | register unsigned int v asm("$r10") = x; 13 | asm ("ftagd\t[%0]\n" : : "r" (v) ); 14 | } 15 | extern inline void cris_fidx_i(unsigned int x) { 16 | register unsigned int v asm("$r10") = x; 17 | asm ("fidxi\t[%0]\n" : : "r" (v) ); 18 | } 19 | extern inline void cris_fidx_d(unsigned int x) { 20 | register unsigned int v asm("$r10") = x; 21 | asm ("fidxd\t[%0]\n" : : "r" (v) ); 22 | } 23 | 24 | 25 | int main(void) 26 | { 27 | cris_ftag_i(0); 28 | cris_ftag_d(0); 29 | cris_fidx_i(0); 30 | cris_fidx_d(0); 31 | pass(); 32 | return 0; 33 | } 34 | -------------------------------------------------------------------------------- /tests/cris/check_gcctorture_pr28634-1.c: -------------------------------------------------------------------------------- 1 | /* PR rtl-optimization/28634. On targets with delayed branches, 2 | dbr_schedule could do the next iteration's addition in the 3 | branch delay slot, then subtract the value again if the branch 4 | wasn't taken. This can lead to rounding errors. */ 5 | int x = -1; 6 | int y = 1; 7 | int 8 | main (void) 9 | { 10 | while (y > 0) 11 | y += x; 12 | if (y != x + 1) 13 | abort (); 14 | exit (0); 15 | } 16 | -------------------------------------------------------------------------------- /tests/cris/check_gcctorture_pr28634.c: -------------------------------------------------------------------------------- 1 | /* PR rtl-optimization/28634. On targets with delayed branches, 2 | dbr_schedule could do the next iteration's addition in the 3 | branch delay slot, then subtract the value again if the branch 4 | wasn't taken. This can lead to rounding errors. */ 5 | double x = -0x1.0p53; 6 | double y = 1; 7 | int 8 | main (void) 9 | { 10 | while (y > 0) 11 | y += x; 12 | if (y != x + 1) 13 | abort (); 14 | exit (0); 15 | } 16 | -------------------------------------------------------------------------------- /tests/cris/check_hello.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | int main () 4 | { 5 | printf ("pass\n"); 6 | exit (0); 7 | } 8 | -------------------------------------------------------------------------------- /tests/cris/check_int64.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "sys.h" 5 | #include "crisutils.h" 6 | 7 | 8 | extern inline int64_t add64(const int64_t a, const int64_t b) { 9 | return a + b; 10 | } 11 | 12 | extern inline int64_t sub64(const int64_t a, const int64_t b) { 13 | return a - b; 14 | } 15 | 16 | int main(void) 17 | { 18 | int64_t a = 1; 19 | int64_t b = 2; 20 | 21 | /* FIXME: add some tests. */ 22 | a = add64(a, b); 23 | if (a != 3) 24 | err(); 25 | 26 | a = sub64(a, b); 27 | if (a != 1) 28 | err(); 29 | 30 | a = add64(a, -4); 31 | if (a != -3) 32 | err(); 33 | 34 | a = add64(a, 3); 35 | if (a != 0) 36 | err(); 37 | 38 | a = 0; 39 | a = sub64(a, 1); 40 | if (a != -1) 41 | err(); 42 | 43 | pass(); 44 | return 0; 45 | } 46 | -------------------------------------------------------------------------------- /tests/cris/check_lapc.s: -------------------------------------------------------------------------------- 1 | # mach: crisv32 2 | # output: 0\n0\nfffffffa\nfffffffe\nffffffda\n1e\n1e\n0\n 3 | 4 | .include "testutils.inc" 5 | 6 | ; To accommodate dumpr3 with more than one instruction, keep it 7 | ; out of lapc operand ranges and difference calculations. 8 | 9 | start 10 | lapc.d 0f,r3 11 | 0: 12 | sub.d .,r3 13 | checkr3 0 14 | 15 | lapcq 0f,r3 16 | 0: 17 | sub.d .,r3 18 | checkr3 0 19 | 20 | lapc.d .,r3 21 | sub.d .,r3 22 | checkr3 fffffffa 23 | 24 | lapcq .,r3 25 | sub.d .,r3 26 | checkr3 fffffffe 27 | 28 | 0: 29 | .rept 16 30 | nop 31 | .endr 32 | lapc.d 0b,r3 33 | sub.d .,r3 34 | checkr3 ffffffda 35 | 36 | setf zcvn 37 | lapc.d 0f,r3 38 | test_cc 1 1 1 1 39 | sub.d .,r3 40 | nop 41 | nop 42 | nop 43 | nop 44 | nop 45 | nop 46 | nop 47 | nop 48 | nop 49 | nop 50 | nop 51 | nop 52 | 0: 53 | checkr3 1e 54 | 0: 55 | lapcq 0f,r3 56 | sub.d 0b,r3 57 | nop 58 | nop 59 | nop 60 | nop 61 | nop 62 | nop 63 | nop 64 | nop 65 | nop 66 | nop 67 | nop 68 | 0: 69 | checkr3 1e 70 | clearf cn 71 | setf zv 72 | 1: 73 | lapcq .,r3 74 | test_cc 0 1 1 0 75 | sub.d 1b,r3 76 | checkr3 0 77 | 78 | quit 79 | -------------------------------------------------------------------------------- /tests/cris/check_lz.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "sys.h" 5 | 6 | extern inline int cris_lz(int x) 7 | { 8 | int r; 9 | asm ("lz\t%1, %0\n" : "=r" (r) : "r" (x)); 10 | return r; 11 | } 12 | 13 | void check_lz(void) 14 | { 15 | int i; 16 | 17 | if (cris_lz(0) != 32) 18 | err(); 19 | if (cris_lz(1) != 31) 20 | err(); 21 | if (cris_lz(2) != 30) 22 | err(); 23 | if (cris_lz(4) != 29) 24 | err(); 25 | if (cris_lz(8) != 28) 26 | err(); 27 | 28 | /* try all positions with a single bit. */ 29 | for (i = 1; i < 32; i++) { 30 | if (cris_lz(1 << (i-1)) != (32 - i)) 31 | err(); 32 | } 33 | 34 | /* try all positions with all bits. */ 35 | for (i = 1; i < 32; i++) { 36 | /* split up this computation to clarify it. */ 37 | uint32_t val; 38 | val = (unsigned int)-1 >> (32 - i); 39 | if (cris_lz(val) != (32 - i)) 40 | err(); 41 | } 42 | } 43 | 44 | int main(void) 45 | { 46 | check_lz(); 47 | pass(); 48 | exit(0); 49 | } 50 | -------------------------------------------------------------------------------- /tests/cris/check_mapbrk.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | /* Basic sanity check that syscalls to implement malloc (brk, mmap2, 5 | munmap) are trivially functional. */ 6 | 7 | int main () 8 | { 9 | void *p1, *p2, *p3, *p4, *p5, *p6; 10 | 11 | if ((p1 = malloc (8100)) == NULL 12 | || (p2 = malloc (16300)) == NULL 13 | || (p3 = malloc (4000)) == NULL 14 | || (p4 = malloc (500)) == NULL 15 | || (p5 = malloc (1023*1024)) == NULL 16 | || (p6 = malloc (8191*1024)) == NULL) 17 | { 18 | printf ("fail\n"); 19 | exit (1); 20 | } 21 | 22 | free (p1); 23 | free (p2); 24 | free (p3); 25 | free (p4); 26 | free (p5); 27 | free (p6); 28 | 29 | p1 = malloc (64000); 30 | if (p1 == NULL) 31 | { 32 | printf ("fail\n"); 33 | exit (1); 34 | } 35 | free (p1); 36 | 37 | printf ("pass\n"); 38 | exit (0); 39 | } 40 | -------------------------------------------------------------------------------- /tests/cris/check_mcp.s: -------------------------------------------------------------------------------- 1 | # mach: crisv32 2 | # output: fffffffe\n1\n1ffff\nfffffffe\ncc463bdc\n4c463bdc\n0\n 3 | 4 | .include "testutils.inc" 5 | start 6 | 7 | ; Set R, clear C. 8 | move 0x100,ccs 9 | moveq -5,r3 10 | move 2,mof 11 | mcp mof,r3 12 | test_cc 1 0 0 0 13 | checkr3 fffffffe 14 | 15 | moveq 2,r3 16 | move -1,srp 17 | mcp srp,r3 18 | test_cc 0 0 0 0 19 | checkr3 1 20 | 21 | move 0xffff,srp 22 | move srp,r3 23 | mcp srp,r3 24 | test_cc 0 0 0 0 25 | checkr3 1ffff 26 | 27 | move -1,mof 28 | move mof,r3 29 | mcp mof,r3 30 | test_cc 1 0 0 0 31 | checkr3 fffffffe 32 | 33 | move 0x5432f789,mof 34 | move.d 0x78134452,r3 35 | mcp mof,r3 36 | test_cc 1 0 1 0 37 | checkr3 cc463bdc 38 | 39 | move 0x80000000,srp 40 | mcp srp,r3 41 | test_cc 0 0 1 0 42 | checkr3 4c463bdc 43 | 44 | move 0xb3b9c423,srp 45 | mcp srp,r3 46 | test_cc 0 1 0 0 47 | checkr3 0 48 | 49 | quit 50 | -------------------------------------------------------------------------------- /tests/cris/check_mmap1.c: -------------------------------------------------------------------------------- 1 | /* 2 | #notarget: cris*-*-elf 3 | */ 4 | 5 | #define _GNU_SOURCE 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | int main (int argc, char *argv[]) 16 | { 17 | int fd = open (argv[0], O_RDONLY); 18 | struct stat sb; 19 | int size; 20 | void *a; 21 | const char *str = "a string you'll only find in the program"; 22 | 23 | if (fd == -1) 24 | { 25 | perror ("open"); 26 | abort (); 27 | } 28 | 29 | if (fstat (fd, &sb) < 0) 30 | { 31 | perror ("fstat"); 32 | abort (); 33 | } 34 | 35 | size = sb.st_size; 36 | 37 | /* We want to test mmapping a size that isn't exactly a page. */ 38 | if ((size & 8191) == 0) 39 | size--; 40 | 41 | a = mmap (NULL, size, PROT_READ, MAP_PRIVATE, fd, 0); 42 | 43 | if (memmem (a, size, str, strlen (str) + 1) == NULL) 44 | abort (); 45 | 46 | printf ("pass\n"); 47 | exit (0); 48 | } 49 | -------------------------------------------------------------------------------- /tests/cris/check_mmap2.c: -------------------------------------------------------------------------------- 1 | /* 2 | #notarget: cris*-*-elf 3 | */ 4 | 5 | #define _GNU_SOURCE 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | int main (int argc, char *argv[]) 16 | { 17 | int fd = open (argv[0], O_RDONLY); 18 | struct stat sb; 19 | int size; 20 | void *a; 21 | const char *str = "a string you'll only find in the program"; 22 | 23 | if (fd == -1) 24 | { 25 | perror ("open"); 26 | abort (); 27 | } 28 | 29 | if (fstat (fd, &sb) < 0) 30 | { 31 | perror ("fstat"); 32 | abort (); 33 | } 34 | 35 | size = sb.st_size; 36 | 37 | /* We want to test mmapping a size that isn't exactly a page. */ 38 | if ((size & 8191) == 0) 39 | size--; 40 | 41 | a = mmap (NULL, size, PROT_READ, MAP_SHARED, fd, 0); 42 | 43 | if (memmem (a, size, str, strlen (str) + 1) == NULL) 44 | abort (); 45 | 46 | printf ("pass\n"); 47 | exit (0); 48 | } 49 | -------------------------------------------------------------------------------- /tests/cris/check_mmap3.c: -------------------------------------------------------------------------------- 1 | /* 2 | #notarget: cris*-*-elf 3 | */ 4 | 5 | #define _GNU_SOURCE 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | int main (int argc, char *argv[]) 15 | { 16 | volatile unsigned char *a; 17 | 18 | /* Check that we can map a non-multiple of a page and still get a full page. */ 19 | a = mmap (NULL, 0x4c, PROT_READ | PROT_WRITE | PROT_EXEC, 20 | MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); 21 | if (a == NULL || a == (unsigned char *) -1) 22 | abort (); 23 | 24 | a[0] = 0xbe; 25 | a[8191] = 0xef; 26 | memset ((char *) a + 1, 0, 8190); 27 | 28 | if (a[0] != 0xbe || a[8191] != 0xef) 29 | abort (); 30 | 31 | printf ("pass\n"); 32 | exit (0); 33 | } 34 | -------------------------------------------------------------------------------- /tests/cris/check_movdelsr1.s: -------------------------------------------------------------------------------- 1 | # mach: crisv0 crisv3 crisv8 crisv10 crisv32 2 | # output: aa117acd\n 3 | # output: eeaabb42\n 4 | 5 | ; Bug with move to special register in delay slot, due to 6 | ; special flush-insn-cache simulator use. Ordinary move worked; 7 | ; special register caused branch to fail. 8 | 9 | .include "testutils.inc" 10 | start 11 | move -1,srp 12 | 13 | move.d 0xaa117acd,r1 14 | moveq 3,r9 15 | cmpq 1,r9 16 | bhi 0f 17 | move.d r1,r3 18 | 19 | fail 20 | 0: 21 | checkr3 aa117acd 22 | 23 | move.d 0xeeaabb42,r1 24 | moveq 3,r9 25 | cmpq 1,r9 26 | bhi 0f 27 | move r1,srp 28 | 29 | fail 30 | 0: 31 | move srp,r3 32 | checkr3 eeaabb42 33 | quit 34 | -------------------------------------------------------------------------------- /tests/cris/check_movecr.s: -------------------------------------------------------------------------------- 1 | # mach: crisv3 crisv8 crisv10 crisv32 2 | # output: ffffff42\n94\nffff4321\n9234\n76543210\n76540000\n 3 | 4 | ; Move constant byte, word, dword to register. Check that no extension is 5 | ; performed, that only part of the register is set. 6 | 7 | .include "testutils.inc" 8 | startnostack 9 | moveq -1,r3 10 | move.b 0x42,r3 11 | test_move_cc 0 0 0 0 12 | checkr3 ffffff42 13 | 14 | moveq 0,r3 15 | move.b 0x94,r3 16 | test_move_cc 1 0 0 0 17 | checkr3 94 18 | 19 | moveq -1,r3 20 | move.w 0x4321,r3 21 | test_move_cc 0 0 0 0 22 | checkr3 ffff4321 23 | 24 | moveq 0,r3 25 | move.w 0x9234,r3 26 | test_move_cc 1 0 0 0 27 | checkr3 9234 28 | 29 | move.d 0x76543210,r3 30 | test_move_cc 0 0 0 0 31 | checkr3 76543210 32 | 33 | move.w 0,r3 34 | test_move_cc 0 1 0 0 35 | checkr3 76540000 36 | 37 | quit 38 | -------------------------------------------------------------------------------- /tests/cris/check_movei.s: -------------------------------------------------------------------------------- 1 | # mach: crisv32 2 | # output: fffffffe\n 3 | # output: fffffffe\n 4 | 5 | ; Check basic integral-write semantics regarding flags. 6 | 7 | .include "testutils.inc" 8 | start 9 | 10 | move.d 0, $r3 11 | ; A write that works. Check that flags are set correspondingly. 12 | move.d d,r4 13 | ;; store to bring it into the tlb with the right prot bits 14 | move.d r3,[r4] 15 | moveq -2,r5 16 | setf c 17 | clearf p 18 | move.d [r4],r3 19 | ax 20 | move.d r5,[r4] 21 | move.d [r4],r3 22 | 23 | bcc 0f 24 | nop 25 | fail 26 | 27 | 0: 28 | checkr3 fffffffe 29 | 30 | ; A write that fails; check flags too. 31 | move.d d,r4 32 | moveq 23,r5 33 | setf p 34 | clearf c 35 | move.d [r4],r3 36 | ax 37 | move.d r5,[r4] 38 | move.d [r4],r3 39 | 40 | bcs 0f 41 | nop 42 | fail 43 | 44 | 0: 45 | checkr3 fffffffe 46 | quit 47 | 48 | .data 49 | d: 50 | .dword 42424242 51 | -------------------------------------------------------------------------------- /tests/cris/check_moveq.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "sys.h" 5 | #include "crisutils.h" 6 | 7 | #define cris_moveq(dst, src) \ 8 | asm volatile ("moveq %1, %0\n" : "=r" (dst) : "i" (src)); 9 | 10 | 11 | 12 | int main(void) 13 | { 14 | int t; 15 | 16 | cris_tst_cc_init(); 17 | asm volatile ("setf\tzvnc\n"); 18 | cris_moveq(t, 10); 19 | cris_tst_cc(1, 1, 1, 1); 20 | if (t != 10) 21 | err(); 22 | 23 | /* make sure moveq doesnt clobber the zflag. */ 24 | cris_tst_cc_init(); 25 | asm volatile ("setf vnc\n"); 26 | asm volatile ("clearf z\n"); 27 | cris_moveq(t, 0); 28 | cris_tst_cc(1, 0, 1, 1); 29 | if (t != 0) 30 | err(); 31 | 32 | /* make sure moveq doesnt clobber the nflag. 33 | Also check large immediates */ 34 | cris_tst_cc_init(); 35 | asm volatile ("setf zvc\n"); 36 | asm volatile ("clearf n\n"); 37 | cris_moveq(t, -31); 38 | cris_tst_cc(0, 1, 1, 1); 39 | if (t != -31) 40 | err(); 41 | 42 | cris_tst_cc_init(); 43 | asm volatile ("setf nzvc\n"); 44 | cris_moveq(t, 31); 45 | cris_tst_cc(1, 1, 1, 1); 46 | if (t != 31) 47 | err(); 48 | 49 | pass(); 50 | return 0; 51 | } 52 | -------------------------------------------------------------------------------- /tests/cris/check_mover.s: -------------------------------------------------------------------------------- 1 | # mach: crisv3 crisv8 crisv10 crisv32 2 | # output: ffffff05\nffff0005\n5\nffffff00\n 3 | 4 | ; Move between registers. Check that just the subreg is copied. 5 | 6 | .include "testutils.inc" 7 | startnostack 8 | moveq -30,r3 9 | moveq 5,r4 10 | move.b r4,r3 11 | test_move_cc 0 0 0 0 ; FIXME 12 | checkr3 ffffff05 13 | 14 | move.w r4,r3 15 | test_move_cc 0 0 0 0 16 | checkr3 ffff0005 17 | 18 | move.d r4,r3 19 | test_move_cc 0 0 0 0 20 | checkr3 5 21 | 22 | moveq -1,r3 23 | moveq 0,r4 24 | move.b r4,r3 25 | test_move_cc 0 1 0 0 26 | checkr3 ffffff00 27 | 28 | quit 29 | -------------------------------------------------------------------------------- /tests/cris/check_moverm.s: -------------------------------------------------------------------------------- 1 | # mach: crisv3 crisv8 crisv10 crisv32 2 | # output: 7823fec2\n10231879\n102318fe\n 3 | 4 | .include "testutils.inc" 5 | start 6 | 7 | .data 8 | mem1: 9 | .dword 0x12345678 10 | mem2: 11 | .word 0x4567 12 | mem3: 13 | .byte 0x23 14 | .dword 0x76543210 15 | .byte 0xaa,0x11,0x99 16 | 17 | .text 18 | move.d mem1,r2 19 | move.d 0x7823fec2,r4 20 | setf nzvc 21 | move.d r4,[r2+] 22 | test_cc 1 1 1 1 23 | subq 4,r2 24 | move.d [r2],r3 25 | checkr3 7823fec2 26 | 27 | move.d mem2,r3 28 | move.d 0x45231879,r4 29 | clearf nzvc 30 | move.w r4,[r3] 31 | test_cc 0 0 0 0 32 | move.d [r3],r3 33 | checkr3 10231879 34 | 35 | move.d mem2,r2 36 | moveq -2,r4 37 | clearf nc 38 | setf zv 39 | move.b r4,[r2+] 40 | test_cc 0 1 1 0 41 | subq 1,r2 42 | move.d [r2],r3 43 | checkr3 102318fe 44 | 45 | quit 46 | -------------------------------------------------------------------------------- /tests/cris/check_movpmv32.s: -------------------------------------------------------------------------------- 1 | # mach: crisv32 2 | # output: 11223320\nbb113344\naa557711\n 3 | 4 | # Test v32-specific special registers. FIXME: more registers. 5 | 6 | .include "testutils.inc" 7 | start 8 | .data 9 | store: 10 | .dword 0x11223344 11 | .dword 0x77665544 12 | 13 | .text 14 | moveq -1,r3 15 | move.d store,r4 16 | move vr,[r4] 17 | move [r4+],mof 18 | move mof,r3 19 | checkr3 11223320 20 | 21 | moveq -1,r3 22 | clearf zcvn 23 | move 0xbb113344,mof 24 | test_cc 0 0 0 0 25 | move mof,r3 26 | checkr3 bb113344 27 | 28 | setf zcvn 29 | move 0xaa557711,mof 30 | test_cc 1 1 1 1 31 | move mof,[r4] 32 | move.d [r4],r3 33 | checkr3 aa557711 34 | 35 | quit 36 | -------------------------------------------------------------------------------- /tests/cris/check_movpr.s: -------------------------------------------------------------------------------- 1 | # mach: crisv3 crisv8 crisv10 crisv32 2 | # output: ffffff00\nffff0000\n0\nbb113344\n 3 | 4 | # Test generic "move Ps,Rd" and "move Rs,Pd" insns; the ones with 5 | # functionality common to all models. 6 | 7 | .include "testutils.inc" 8 | start 9 | moveq -1,r3 10 | clear.b r3 11 | checkr3 ffffff00 12 | 13 | moveq -1,r3 14 | clear.w r3 15 | checkr3 ffff0000 16 | 17 | moveq -1,r3 18 | clear.d r3 19 | checkr3 0 20 | 21 | moveq -1,r3 22 | move.d 0xbb113344,r4 23 | setf zcvn 24 | move r4,srp 25 | move srp,r3 26 | test_cc 1 1 1 1 27 | checkr3 bb113344 28 | quit 29 | -------------------------------------------------------------------------------- /tests/cris/check_movprv32.s: -------------------------------------------------------------------------------- 1 | # mach: crisv32 2 | # output: ffffff20\nbb113344\n 3 | 4 | # Test v32-specific special registers. FIXME: more registers. 5 | 6 | .include "testutils.inc" 7 | start 8 | moveq -1,r3 9 | setf zcvn 10 | move vr,r3 11 | test_cc 1 1 1 1 12 | checkr3 ffffff20 13 | 14 | moveq -1,r3 15 | move.d 0xbb113344,r4 16 | clearf cvnz 17 | move r4,mof 18 | test_cc 0 0 0 0 19 | move mof,r3 20 | checkr3 bb113344 21 | quit 22 | -------------------------------------------------------------------------------- /tests/cris/check_movscr.s: -------------------------------------------------------------------------------- 1 | # mach: crisv3 crisv8 crisv10 crisv32 2 | # output: 42\nffffff85\n7685\nffff8765\n0\n 3 | 4 | ; Move constant byte, word, dword to register. Check that sign-extension 5 | ; is performed. 6 | 7 | .include "testutils.inc" 8 | start 9 | moveq -1,r3 10 | movs.b 0x42,r3 11 | checkr3 42 12 | 13 | movs.b 0x85,r3 14 | test_move_cc 1 0 0 0 15 | checkr3 ffffff85 16 | 17 | movs.w 0x7685,r3 18 | test_move_cc 0 0 0 0 19 | checkr3 7685 20 | 21 | movs.w 0x8765,r3 22 | test_move_cc 1 0 0 0 23 | checkr3 ffff8765 24 | 25 | movs.w 0,r3 26 | test_move_cc 0 1 0 0 27 | checkr3 0 28 | 29 | quit 30 | -------------------------------------------------------------------------------- /tests/cris/check_movsm.s: -------------------------------------------------------------------------------- 1 | # mach: crisv3 crisv8 crisv10 crisv32 2 | # output: 5\nfffffff5\n5\nfffffff5\n0\n 3 | 4 | ; Movs between registers. Check that sign-extension is performed and the 5 | ; full register is set. 6 | 7 | .include "testutils.inc" 8 | 9 | .data 10 | x: 11 | .byte 5,-11 12 | .word 5,-11 13 | .word 0 14 | 15 | start 16 | move.d x,r5 17 | 18 | moveq -1,r3 19 | movs.b [r5+],r3 20 | test_move_cc 0 0 0 0 21 | checkr3 5 22 | 23 | moveq 0,r3 24 | movs.b [r5],r3 25 | test_move_cc 1 0 0 0 26 | addq 1,r5 27 | checkr3 fffffff5 28 | 29 | moveq -1,r3 30 | movs.w [r5+],r3 31 | test_move_cc 0 0 0 0 32 | checkr3 5 33 | 34 | moveq 0,r3 35 | movs.w [r5],r3 36 | test_move_cc 1 0 0 0 37 | addq 2,r5 38 | checkr3 fffffff5 39 | 40 | movs.w [r5],r3 41 | test_move_cc 0 1 0 0 42 | checkr3 0 43 | 44 | quit 45 | -------------------------------------------------------------------------------- /tests/cris/check_movsr.s: -------------------------------------------------------------------------------- 1 | # mach: crisv3 crisv8 crisv10 crisv32 2 | # output: 5\nfffffff5\n5\nfffffff5\n0\n 3 | 4 | ; Movs between registers. Check that sign-extension is performed and the 5 | ; full register is set. 6 | 7 | .include "testutils.inc" 8 | start 9 | moveq -1,r5 10 | moveq 5,r4 11 | move.b r4,r5 12 | moveq -1,r3 13 | movs.b r5,r3 14 | test_move_cc 0 0 0 0 15 | checkr3 5 16 | 17 | moveq 0,r5 18 | moveq -11,r4 19 | move.b r4,r5 20 | moveq 0,r3 21 | movs.b r5,r3 22 | test_move_cc 1 0 0 0 23 | checkr3 fffffff5 24 | 25 | moveq -1,r5 26 | moveq 5,r4 27 | move.w r4,r5 28 | moveq -1,r3 29 | movs.w r5,r3 30 | test_move_cc 0 0 0 0 31 | checkr3 5 32 | 33 | moveq 0,r5 34 | moveq -11,r4 35 | move.w r4,r5 36 | moveq 0,r3 37 | movs.w r5,r3 38 | test_move_cc 1 0 0 0 39 | checkr3 fffffff5 40 | 41 | moveq 0,r5 42 | movs.b r5,r3 43 | test_move_cc 0 1 0 0 44 | checkr3 0 45 | 46 | quit 47 | -------------------------------------------------------------------------------- /tests/cris/check_movucr.s: -------------------------------------------------------------------------------- 1 | # mach: crisv3 crisv8 crisv10 crisv32 2 | # output: 42\n85\n7685\n8765\n0\n 3 | 4 | ; Move constant byte, word, dword to register. Check that zero-extension 5 | ; is performed. 6 | 7 | .include "testutils.inc" 8 | start 9 | moveq -1,r3 10 | movu.b 0x42,r3 11 | test_move_cc 0 0 0 0 12 | checkr3 42 13 | 14 | moveq -1,r3 15 | movu.b 0x85,r3 16 | test_move_cc 0 0 0 0 17 | checkr3 85 18 | 19 | moveq -1,r3 20 | movu.w 0x7685,r3 21 | test_move_cc 0 0 0 0 22 | checkr3 7685 23 | 24 | moveq -1,r3 25 | movu.w 0x8765,r3 26 | test_move_cc 0 0 0 0 27 | checkr3 8765 28 | 29 | movu.b 0,r3 30 | test_move_cc 0 1 0 0 31 | checkr3 0 32 | 33 | quit 34 | -------------------------------------------------------------------------------- /tests/cris/check_movum.s: -------------------------------------------------------------------------------- 1 | # mach: crisv3 crisv8 crisv10 crisv32 2 | # output: 5\nf5\n5\nfff5\n0\n 3 | 4 | ; Movu between registers. Check that zero-extension is performed and the 5 | ; full register is set. 6 | 7 | .include "testutils.inc" 8 | 9 | .data 10 | x: 11 | .byte 5,-11 12 | .word 5,-11 13 | .word 0 14 | 15 | start 16 | move.d x,r5 17 | 18 | movu.b [r5+],r3 19 | test_move_cc 0 0 0 0 20 | checkr3 5 21 | 22 | movu.b [r5],r3 23 | test_move_cc 0 0 0 0 24 | addq 1,r5 25 | checkr3 f5 26 | 27 | movu.w [r5+],r3 28 | test_move_cc 0 0 0 0 29 | checkr3 5 30 | 31 | movu.w [r5],r3 32 | test_move_cc 0 0 0 0 33 | addq 2,r5 34 | checkr3 fff5 35 | 36 | movu.w [r5],r3 37 | test_move_cc 0 1 0 0 38 | checkr3 0 39 | 40 | quit 41 | -------------------------------------------------------------------------------- /tests/cris/check_movur.s: -------------------------------------------------------------------------------- 1 | # mach: crisv3 crisv8 crisv10 crisv32 2 | # output: 5\nf5\n5\nfff5\n0\n 3 | 4 | ; Movu between registers. Check that zero-extension is performed and the 5 | ; full register is set. 6 | 7 | .include "testutils.inc" 8 | start 9 | moveq -1,r5 10 | moveq 5,r4 11 | move.b r4,r5 12 | moveq -1,r3 13 | movu.b r5,r3 14 | test_move_cc 0 0 0 0 15 | checkr3 5 16 | 17 | moveq 0,r5 18 | moveq -11,r4 19 | move.b r4,r5 20 | moveq -1,r3 21 | movu.b r5,r3 22 | test_move_cc 0 0 0 0 23 | checkr3 f5 24 | 25 | moveq -1,r5 26 | moveq 5,r4 27 | move.w r4,r5 28 | moveq -1,r3 29 | movu.w r5,r3 30 | test_move_cc 0 0 0 0 31 | checkr3 5 32 | 33 | moveq 0,r5 34 | moveq -11,r4 35 | move.w r4,r5 36 | moveq -1,r3 37 | movu.w r5,r3 38 | test_move_cc 0 0 0 0 39 | checkr3 fff5 40 | 41 | movu.w 0,r3 42 | test_move_cc 0 1 0 0 43 | checkr3 0 44 | 45 | quit 46 | -------------------------------------------------------------------------------- /tests/cris/check_mulv32.s: -------------------------------------------------------------------------------- 1 | # mach: crisv32 2 | # output: fffffffe\n 3 | # output: ffffffff\n 4 | # output: fffffffe\n 5 | # output: 1\n 6 | # output: fffffffe\n 7 | # output: ffffffff\n 8 | # output: fffffffe\n 9 | # output: 1\n 10 | 11 | ; Check that carry is not modified on v32. 12 | 13 | .include "testutils.inc" 14 | start 15 | moveq -1,r3 16 | moveq 2,r4 17 | setf c 18 | muls.d r4,r3 19 | test_cc 1 0 0 1 20 | checkr3 fffffffe 21 | move mof,r3 22 | checkr3 ffffffff 23 | 24 | moveq -1,r3 25 | moveq 2,r4 26 | setf c 27 | mulu.d r4,r3 28 | test_cc 0 0 1 1 29 | checkr3 fffffffe 30 | move mof,r3 31 | checkr3 1 32 | 33 | moveq -1,r3 34 | moveq 2,r4 35 | clearf c 36 | muls.d r4,r3 37 | test_cc 1 0 0 0 38 | checkr3 fffffffe 39 | move mof,r3 40 | checkr3 ffffffff 41 | 42 | moveq -1,r3 43 | moveq 2,r4 44 | clearf c 45 | mulu.d r4,r3 46 | test_cc 0 0 1 0 47 | checkr3 fffffffe 48 | move mof,r3 49 | checkr3 1 50 | 51 | quit 52 | -------------------------------------------------------------------------------- /tests/cris/check_not.s: -------------------------------------------------------------------------------- 1 | # mach: crisv0 crisv3 crisv8 crisv10 crisv32 2 | # output: fffffffe\nfffffffd\nffff0f00\n0\n87ecbbad\n 3 | 4 | .include "testutils.inc" 5 | start 6 | moveq 1,r3 7 | not r3 8 | test_move_cc 1 0 0 0 9 | checkr3 fffffffe 10 | 11 | moveq 2,r3 12 | not r3 13 | test_move_cc 1 0 0 0 14 | checkr3 fffffffd 15 | 16 | move.d 0xf0ff,r3 17 | not r3 18 | test_move_cc 1 0 0 0 19 | checkr3 ffff0f00 20 | 21 | moveq -1,r3 22 | not r3 23 | test_move_cc 0 1 0 0 24 | checkr3 0 25 | 26 | move.d 0x78134452,r3 27 | not r3 28 | test_move_cc 1 0 0 0 29 | checkr3 87ecbbad 30 | 31 | quit 32 | -------------------------------------------------------------------------------- /tests/cris/check_openpf1.c: -------------------------------------------------------------------------------- 1 | /* Check that --sysroot is applied to open(2). 2 | #sim: --sysroot=@exedir@ 3 | 4 | We assume, with EXE being the name of the executable: 5 | - The simulator executes with cwd the same directory where the executable 6 | is located (so argv[0] contains a plain filename without directory 7 | components). 8 | - There's no /EXE on the host file system. */ 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | int main (int argc, char *argv[]) 15 | { 16 | char *fnam = argv[0]; 17 | FILE *f; 18 | if (argv[0][0] != '/') 19 | { 20 | fnam = malloc (strlen (argv[0]) + 2); 21 | if (fnam == NULL) 22 | abort (); 23 | strcpy (fnam, "/"); 24 | strcat (fnam, argv[0]); 25 | } 26 | 27 | f = fopen (fnam, "rb"); 28 | if (f == NULL) 29 | abort (); 30 | close (f); 31 | 32 | /* Cover another execution path. */ 33 | if (fopen ("/nonexistent", "rb") != NULL 34 | || errno != ENOENT) 35 | abort (); 36 | printf ("pass\n"); 37 | return 0; 38 | } 39 | -------------------------------------------------------------------------------- /tests/cris/check_openpf2.c: -------------------------------------------------------------------------------- 1 | /* Check that the simulator has chdir:ed to the --sysroot argument 2 | #sim: --sysroot=@srcdir@ 3 | (or that --sysroot is applied to relative file paths). */ 4 | 5 | #include 6 | #include 7 | #include 8 | int main (int argc, char *argv[]) 9 | { 10 | FILE *f = fopen ("check_openpf2.c", "rb"); 11 | if (f == NULL) 12 | abort (); 13 | close (f); 14 | printf ("pass\n"); 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /tests/cris/check_openpf3.c: -------------------------------------------------------------------------------- 1 | /* Basic file operations (rename, unlink); once without sysroot. We 2 | also test that the simulator has chdir:ed to PREFIX, when defined. */ 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #ifndef PREFIX 12 | #define PREFIX 13 | #endif 14 | 15 | void err (const char *s) 16 | { 17 | perror (s); 18 | abort (); 19 | } 20 | 21 | int main (int argc, char *argv[]) 22 | { 23 | FILE *f; 24 | struct stat buf; 25 | 26 | unlink (PREFIX "testfoo2.tmp"); 27 | 28 | f = fopen ("testfoo1.tmp", "w"); 29 | if (f == NULL) 30 | err ("open"); 31 | fclose (f); 32 | 33 | if (rename (PREFIX "testfoo1.tmp", PREFIX "testfoo2.tmp") != 0) 34 | err ("rename"); 35 | 36 | if (stat (PREFIX "testfoo2.tmp", &buf) != 0 37 | || !S_ISREG (buf.st_mode)) 38 | err ("stat 1"); 39 | 40 | if (stat ("testfoo2.tmp", &buf) != 0 41 | || !S_ISREG (buf.st_mode)) 42 | err ("stat 2"); 43 | 44 | if (unlink (PREFIX "testfoo2.tmp") != 0) 45 | err ("unlink"); 46 | 47 | printf ("pass\n"); 48 | return 0; 49 | } 50 | -------------------------------------------------------------------------------- /tests/cris/check_openpf4.c: -------------------------------------------------------------------------------- 1 | /* Basic file operations, now *with* sysroot. 2 | #sim: --sysroot=@exedir@ 3 | */ 4 | #define PREFIX "/" 5 | #include "check_openpf3.c" 6 | -------------------------------------------------------------------------------- /tests/cris/check_orq.s: -------------------------------------------------------------------------------- 1 | # mach: crisv0 crisv3 crisv8 crisv10 crisv32 2 | # output: 3\n3\nffffffff\nffffffff\n1f\nffffffe0\n7813445e\n 3 | 4 | .include "testutils.inc" 5 | start 6 | moveq 1,r3 7 | orq 2,r3 8 | test_move_cc 0 0 0 0 9 | checkr3 3 10 | 11 | moveq 2,r3 12 | orq 1,r3 13 | test_move_cc 0 0 0 0 14 | checkr3 3 15 | 16 | move.d 0xf0ff,r3 17 | orq -1,r3 18 | test_move_cc 1 0 0 0 19 | checkr3 ffffffff 20 | 21 | moveq 0,r3 22 | orq -1,r3 23 | test_move_cc 1 0 0 0 24 | checkr3 ffffffff 25 | 26 | moveq 0,r3 27 | orq 31,r3 28 | test_move_cc 0 0 0 0 29 | checkr3 1f 30 | 31 | moveq 0,r3 32 | orq -32,r3 33 | test_move_cc 1 0 0 0 34 | checkr3 ffffffe0 35 | 36 | move.d 0x78134452,r3 37 | orq 12,r3 38 | test_move_cc 0 0 0 0 39 | checkr3 7813445e 40 | 41 | quit 42 | -------------------------------------------------------------------------------- /tests/cris/check_ret.s: -------------------------------------------------------------------------------- 1 | # mach: crisv3 crisv8 crisv10 2 | # output: 3\n 3 | 4 | # Test that ret works. 5 | 6 | .include "testutils.inc" 7 | start 8 | x: 9 | moveq 0,r3 10 | jsr z 11 | w: 12 | quit 13 | y: 14 | addq 1,r3 15 | checkr3 3 16 | quit 17 | 18 | z: 19 | addq 1,r3 20 | move srp,r2 21 | add.d y-w,r2 22 | move r2,srp 23 | ret 24 | addq 1,r3 25 | quit 26 | -------------------------------------------------------------------------------- /tests/cris/check_settls1.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #include 7 | 8 | #ifndef SYS_set_thread_area 9 | #define SYS_set_thread_area 243 10 | #endif 11 | 12 | int main (void) 13 | { 14 | unsigned long tp, old_tp; 15 | int ret; 16 | 17 | asm volatile ("move $pid,%0" : "=r" (old_tp)); 18 | old_tp &= ~0xff; 19 | 20 | ret = syscall (SYS_set_thread_area, 0xf0); 21 | if (ret != -1 || errno != EINVAL) { 22 | syscall (SYS_set_thread_area, old_tp); 23 | perror ("Invalid thread area accepted:"); 24 | abort(); 25 | } 26 | 27 | ret = syscall (SYS_set_thread_area, 0xeddeed00); 28 | if (ret != 0) { 29 | perror ("Valid thread area not accepted: "); 30 | abort (); 31 | } 32 | 33 | asm volatile ("move $pid,%0" : "=r" (tp)); 34 | tp &= ~0xff; 35 | syscall (SYS_set_thread_area, old_tp); 36 | 37 | if (tp != 0xeddeed00) { 38 | * (volatile int *) 0 = 0; 39 | perror ("tls2"); 40 | abort (); 41 | } 42 | 43 | printf ("pass\n"); 44 | return EXIT_SUCCESS; 45 | } 46 | -------------------------------------------------------------------------------- /tests/cris/check_sigalrm.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #define MAGIC (0xdeadbeef) 7 | 8 | int s = 0; 9 | void sighandler(int sig) 10 | { 11 | s = MAGIC; 12 | } 13 | 14 | int main(int argc, char **argv) 15 | { 16 | int p; 17 | 18 | p = getpid(); 19 | signal(SIGALRM, sighandler); 20 | kill(p, SIGALRM); 21 | if (s != MAGIC) 22 | return EXIT_FAILURE; 23 | 24 | printf ("passed\n"); 25 | return EXIT_SUCCESS; 26 | } 27 | -------------------------------------------------------------------------------- /tests/cris/check_stat1.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | int main (void) 8 | { 9 | struct stat buf; 10 | 11 | if (stat (".", &buf) != 0 12 | || !S_ISDIR (buf.st_mode)) 13 | abort (); 14 | printf ("pass\n"); 15 | exit (0); 16 | } 17 | -------------------------------------------------------------------------------- /tests/cris/check_stat2.c: -------------------------------------------------------------------------------- 1 | /* 2 | #notarget: cris*-*-elf 3 | */ 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | int main (void) 12 | { 13 | struct stat buf; 14 | 15 | if (lstat (".", &buf) != 0 16 | || !S_ISDIR (buf.st_mode)) 17 | abort (); 18 | printf ("pass\n"); 19 | exit (0); 20 | } 21 | -------------------------------------------------------------------------------- /tests/cris/check_stat3.c: -------------------------------------------------------------------------------- 1 | /* Simulator options: 2 | #sim: --sysroot=@exedir@ 3 | */ 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | int main (int argc, char *argv[]) 12 | { 13 | char path[1024] = "/"; 14 | struct stat buf; 15 | 16 | strcat (path, argv[0]); 17 | if (stat (".", &buf) != 0 18 | || !S_ISDIR (buf.st_mode)) 19 | abort (); 20 | if (stat (path, &buf) != 0 21 | || !S_ISREG (buf.st_mode)) 22 | abort (); 23 | printf ("pass\n"); 24 | exit (0); 25 | } 26 | -------------------------------------------------------------------------------- /tests/cris/check_stat4.c: -------------------------------------------------------------------------------- 1 | /* Simulator options: 2 | #notarget: cris*-*-elf 3 | #sim: --sysroot=@exedir@ 4 | */ 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | int main (int argc, char *argv[]) 14 | { 15 | char path[1024] = "/"; 16 | struct stat buf; 17 | 18 | strcat (path, argv[0]); 19 | if (lstat (".", &buf) != 0 20 | || !S_ISDIR (buf.st_mode)) 21 | abort (); 22 | if (lstat (path, &buf) != 0 23 | || !S_ISREG (buf.st_mode)) 24 | abort (); 25 | printf ("pass\n"); 26 | exit (0); 27 | } 28 | -------------------------------------------------------------------------------- /tests/cris/check_subq.s: -------------------------------------------------------------------------------- 1 | # mach: crisv3 crisv8 crisv10 crisv32 2 | # output: 0\nffffffff\nfffffffe\nffff\nff\n56788f9\n56788d9\n567889a\n0\n7ffffffc\n 3 | 4 | .include "testutils.inc" 5 | start 6 | moveq 1,r3 7 | subq 1,r3 8 | test_cc 0 1 0 0 9 | checkr3 0 10 | 11 | subq 1,r3 12 | test_cc 1 0 0 1 13 | checkr3 ffffffff 14 | 15 | subq 1,r3 16 | test_cc 1 0 0 0 17 | checkr3 fffffffe 18 | 19 | move.d 0x10000,r3 20 | subq 1,r3 21 | test_cc 0 0 0 0 22 | checkr3 ffff 23 | 24 | move.d 0x100,r3 25 | subq 1,r3 26 | test_cc 0 0 0 0 27 | checkr3 ff 28 | 29 | move.d 0x5678900,r3 30 | subq 7,r3 31 | test_cc 0 0 0 0 32 | checkr3 56788f9 33 | 34 | subq 32,r3 35 | test_cc 0 0 0 0 36 | checkr3 56788d9 37 | 38 | subq 63,r3 39 | test_cc 0 0 0 0 40 | checkr3 567889a 41 | 42 | move.d 34,r3 43 | subq 34,r3 44 | test_cc 0 1 0 0 45 | checkr3 0 46 | 47 | move.d 0x80000024,r3 48 | subq 40,r3 49 | test_cc 0 0 1 0 50 | checkr3 7ffffffc 51 | 52 | quit 53 | -------------------------------------------------------------------------------- /tests/cris/check_time1.c: -------------------------------------------------------------------------------- 1 | /* Basic time functionality test: check that milliseconds are 2 | incremented for each syscall (does not work on host). */ 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | void err (const char *s) 10 | { 11 | perror (s); 12 | abort (); 13 | } 14 | 15 | int 16 | main (void) 17 | { 18 | struct timeval t_m = {0, 0}; 19 | struct timezone t_z = {0, 0}; 20 | struct timeval t_m1 = {0, 0}; 21 | int i; 22 | 23 | if (gettimeofday (&t_m, &t_z) != 0) 24 | err ("gettimeofday"); 25 | 26 | for (i = 1; i < 10000; i++) 27 | if (gettimeofday (&t_m1, NULL) != 0) 28 | err ("gettimeofday 1"); 29 | else 30 | if (t_m1.tv_sec * 1000000 + t_m1.tv_usec 31 | != (t_m.tv_sec * 1000000 + t_m.tv_usec + i * 1000)) 32 | { 33 | fprintf (stderr, "t0 (%ld, %ld), i %d, t1 (%ld, %ld)\n", 34 | t_m.tv_sec, t_m.tv_usec, i, t_m1.tv_sec, t_m1.tv_usec); 35 | abort (); 36 | } 37 | 38 | if (time (NULL) != t_m1.tv_sec) 39 | { 40 | fprintf (stderr, "time != gettod\n"); 41 | abort (); 42 | } 43 | 44 | printf ("pass\n"); 45 | exit (0); 46 | } 47 | -------------------------------------------------------------------------------- /tests/cris/check_time2.c: -------------------------------------------------------------------------------- 1 | /* CB_SYS_time doesn't implement the Linux time syscall; the return 2 | value isn't written to the argument. */ 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | int 9 | main (void) 10 | { 11 | time_t x = (time_t) -1; 12 | time_t t = time (&x); 13 | 14 | if (t == (time_t) -1 || t != x) 15 | abort (); 16 | printf ("pass\n"); 17 | exit (0); 18 | } 19 | -------------------------------------------------------------------------------- /tests/cris/check_xarith.s: -------------------------------------------------------------------------------- 1 | 2 | .include "testutils.inc" 3 | 4 | start 5 | 6 | moveq -1, $r0 7 | moveq 0, $r1 8 | addq 1, $r0 9 | ax 10 | addq 0, $r1 11 | 12 | move.d $r0, $r3 13 | checkr3 0 14 | move.d $r1, $r3 15 | checkr3 1 16 | 17 | move.d 0, $r0 18 | moveq -1, $r1 19 | subq 1, $r0 20 | ax 21 | subq 0, $r1 22 | 23 | move.d $r0, $r3 24 | checkr3 ffffffff 25 | move.d $r1, $r3 26 | checkr3 fffffffe 27 | 28 | 29 | moveq -1, $r0 30 | moveq -1, $r1 31 | cmpq -1, $r0 32 | ax 33 | cmpq -1, $r1 34 | beq 1f 35 | nop 36 | fail 37 | 1: 38 | cmpq 0, $r0 39 | ax 40 | cmpq -1, $r1 41 | bne 1f 42 | nop 43 | fail 44 | 1: 45 | 46 | ;; test for broken X sequence, run it several times. 47 | moveq 8, $r0 48 | 1: 49 | moveq 0, $r3 50 | move.d $r0, $r1 51 | andq 1, $r1 52 | lslq 4, $r1 53 | moveq 1, $r2 54 | or.d $r1, $r2 55 | ba 2f 56 | move $r2, $ccs 57 | 2: 58 | addq 0, $r3 59 | move.d $r0, $r4 60 | move.d $r1, $r5 61 | move.d $r2, $r6 62 | move.d $r3, $r7 63 | lsrq 4, $r1 64 | move.d $r1, $r8 65 | xor $r1, $r3 66 | checkr3 0 67 | subq 1, $r0 68 | bne 1b 69 | nop 70 | 71 | pass 72 | quit 73 | -------------------------------------------------------------------------------- /tests/cris/crt.s: -------------------------------------------------------------------------------- 1 | .data 2 | _stack_start: 3 | .space 8192, 0 4 | _stack_end: 5 | .text 6 | .global _start 7 | _start: 8 | move.d _stack_end, $sp 9 | jsr main 10 | nop 11 | moveq 0, $r10 12 | jump exit 13 | nop 14 | -------------------------------------------------------------------------------- /tests/cris/sys.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | static inline int mystrlen(char *s) { 6 | int i = 0; 7 | while (s[i]) 8 | i++; 9 | return i; 10 | } 11 | 12 | void pass(void) { 13 | char s[] = "passed.\n"; 14 | write (1, s, sizeof (s) - 1); 15 | exit (0); 16 | } 17 | 18 | void _fail(char *reason) { 19 | char s[] = "\nfailed: "; 20 | int len = mystrlen(reason); 21 | write (1, s, sizeof (s) - 1); 22 | write (1, reason, len); 23 | write (1, "\n", 1); 24 | // exit (1); 25 | } 26 | 27 | void *memset (void *s, int c, size_t n) { 28 | char *p = s; 29 | int i; 30 | for (i = 0; i < n; i++) 31 | p[i] = c; 32 | return p; 33 | } 34 | 35 | void exit (int status) { 36 | asm volatile ("moveq 1, $r9\n" /* NR_exit. */ 37 | "break 13\n"); 38 | while(1) 39 | ; 40 | } 41 | 42 | ssize_t write (int fd, const void *buf, size_t count) { 43 | int r; 44 | asm ("move.d %0, $r10\n" 45 | "move.d %1, $r11\n" 46 | "move.d %2, $r12\n" 47 | "moveq 4, $r9\n" /* NR_write. */ 48 | "break 13\n" : : "r" (fd), "r" (buf), "r" (count) : "memory"); 49 | asm ("move.d $r10, %0\n" : "=r" (r)); 50 | return r; 51 | } 52 | -------------------------------------------------------------------------------- /tests/cris/sys.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define STRINGIFY(x) #x 4 | #define TOSTRING(x) STRINGIFY(x) 5 | 6 | #define CURRENT_LOCATION __FILE__ ":" TOSTRING(__LINE__) 7 | 8 | #define err() \ 9 | { \ 10 | _fail("at " CURRENT_LOCATION " "); \ 11 | } 12 | 13 | #define mb() asm volatile ("" : : : "memory") 14 | 15 | extern void pass(void); 16 | extern void _fail(char *reason); 17 | -------------------------------------------------------------------------------- /tests/hello-i386.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | extern inline volatile void exit(int status) 4 | { 5 | int __res; 6 | __asm__ volatile ("movl %%ecx,%%ebx\n"\ 7 | "int $0x80" \ 8 | : "=a" (__res) : "0" (__NR_exit),"c" ((long)(status))); 9 | } 10 | 11 | extern inline int write(int fd, const char * buf, int len) 12 | { 13 | int status; 14 | __asm__ volatile ("pushl %%ebx\n"\ 15 | "movl %%esi,%%ebx\n"\ 16 | "int $0x80\n" \ 17 | "popl %%ebx\n"\ 18 | : "=a" (status) \ 19 | : "0" (__NR_write),"S" ((long)(fd)),"c" ((long)(buf)),"d" ((long)(len))); 20 | } 21 | 22 | void _start(void) 23 | { 24 | write(1, "Hello World\n", 12); 25 | exit(0); 26 | } 27 | -------------------------------------------------------------------------------- /tests/pi_10.com: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pleed/pyqemu/a8bfd2186e347c6343ae3564a890e0fdf96a4d51/tests/pi_10.com -------------------------------------------------------------------------------- /tests/test-arm-iwmmxt.s: -------------------------------------------------------------------------------- 1 | @ Checks whether iwMMXt is functional. 2 | .code 32 3 | .globl main 4 | 5 | main: 6 | ldr r0, =data0 7 | ldr r1, =data1 8 | ldr r2, =data2 9 | #ifndef FPA 10 | wldrd wr0, [r0, #0] 11 | wldrd wr1, [r0, #8] 12 | wldrd wr2, [r1, #0] 13 | wldrd wr3, [r1, #8] 14 | wsubb wr2, wr2, wr0 15 | wsubb wr3, wr3, wr1 16 | wldrd wr0, [r2, #0] 17 | wldrd wr1, [r2, #8] 18 | waddb wr0, wr0, wr2 19 | waddb wr1, wr1, wr3 20 | wstrd wr0, [r2, #0] 21 | wstrd wr1, [r2, #8] 22 | #else 23 | ldfe f0, [r0, #0] 24 | ldfe f1, [r0, #8] 25 | ldfe f2, [r1, #0] 26 | ldfe f3, [r1, #8] 27 | adfdp f2, f2, f0 28 | adfdp f3, f3, f1 29 | ldfe f0, [r2, #0] 30 | ldfe f1, [r2, #8] 31 | adfd f0, f0, f2 32 | adfd f1, f1, f3 33 | stfe f0, [r2, #0] 34 | stfe f1, [r2, #8] 35 | #endif 36 | mov r0, #1 37 | mov r1, r2 38 | mov r2, #0x11 39 | swi #0x900004 40 | mov r0, #0 41 | swi #0x900001 42 | 43 | .data 44 | data0: 45 | .string "aaaabbbbccccdddd" 46 | data1: 47 | .string "bbbbccccddddeeee" 48 | data2: 49 | .string "hvLLWs\x1fsdrs9\x1fNJ-\n" 50 | -------------------------------------------------------------------------------- /ui/sdl_zoom.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SDL_zoom - surface scaling 3 | * 4 | * Copyright (c) 2009 Citrix Systems, Inc. 5 | * 6 | * Derived from: SDL_rotozoom, LGPL (c) A. Schiffler from the SDL_gfx library. 7 | * Modifications by Stefano Stabellini. 8 | * 9 | * This work is licensed under the terms of the GNU GPL version 2. 10 | * See the COPYING file in the top-level directory. 11 | * 12 | */ 13 | 14 | #ifndef SDL_zoom_h 15 | #define SDL_zoom_h 16 | 17 | #include 18 | 19 | #define SMOOTHING_OFF 0 20 | #define SMOOTHING_ON 1 21 | 22 | int sdl_zoom_blit(SDL_Surface *src_sfc, SDL_Surface *dst_sfc, 23 | int smooth, SDL_Rect *src_rect); 24 | 25 | #endif /* SDL_zoom_h */ 26 | --------------------------------------------------------------------------------