#include <sys/types.h>
#include <inttypes.h>
#include "../../config.h"
#include <string>
#include <map>
#include <list>
#include <vector>
#include <sstream>
#include <ostream>
#include <iostream>
#include "thirdparty/debug_new.h"
#include "refcount_ptr.h"
Go to the source code of this file.
Macros | |
#define | COPYRIGHT_MSG "Copyright (C) 2003-2018 Anders Gavare" |
#define | SECONDARY_MSG "" |
#define | DEFAULT_TMP_DIR "/tmp" |
#define | NO_BYTE_ORDER_OVERRIDE -1 |
#define | EMUL_UNDEFINED_ENDIAN 0 |
#define | EMUL_LITTLE_ENDIAN 1 |
#define | EMUL_BIG_ENDIAN 2 |
#define | SWAP32(x) |
#define | SWAP16(x) ((((x) & 0xff00) >> 8) | (((x)&0xff) << 8)) |
#define | LE16_TO_HOST(x) (x) |
#define | BE16_TO_HOST(x) (SWAP16(x)) |
#define | LE32_TO_HOST(x) (x) |
#define | BE32_TO_HOST(x) (SWAP32(x)) |
#define | LE64_TO_HOST(x) (x) |
#define | BE64_TO_HOST(x) |
#define | DEBUG_BUFSIZE 1024 |
#define | DEBUG_INDENTATION 4 |
#define | FAILURE(error_msg) |
#define | CHECK_ALLOCATION(ptr) |
Typedefs | |
typedef char | stringchar |
Enumerations | |
enum | Endianness { BigEndian = 0, LittleEndian } |
Functions | |
int | load_bootblock (struct machine *m, struct cpu *cpu, int *n_loadp, char ***load_namesp) |
int | apple_load_bootblock (struct machine *m, struct cpu *cpu, int disk_id, int disk_type, int *n_loadp, char ***load_namesp) |
int | iso_load_bootblock (struct machine *m, struct cpu *cpu, int disk_id, int disk_type, int iso_type, unsigned char *buf, int *n_loadp, char ***load_namesp) |
int | decstation_prom_emul (struct cpu *cpu) |
void | dreamcast_machine_setup (struct machine *) |
void | dreamcast_emul (struct cpu *cpu) |
void | dreamcast_descramble (char *from, char *to) |
int | file_n_executables_loaded (void) |
void | file_load (struct machine *machine, struct memory *mem, char *filename, uint64_t *entrypointp, int arch, uint64_t *gpp, int *byte_order, uint64_t *tocp) |
void | luna88kprom_init (struct machine *machine) |
int | luna88kprom_emul (struct cpu *cpu) |
void | debug_indentation (int diff) |
void | debug (const char *fmt,...) |
void | fatal (const char *fmt,...) |
unsigned long long | mystrtoull (const char *s, char **endp, int base) |
int | mymkstemp (char *templ) |
size_t | mystrlcpy (char *dst, const char *src, size_t size) |
size_t | mystrlcat (char *dst, const char *src, size_t size) |
void | print_separator_line (void) |
void | mvmeprom_init (struct machine *machine) |
int | mvmeprom_emul (struct cpu *cpu) |
int | playstation2_sifbios_emul (struct cpu *cpu) |
void | sh_ipl_g_emul_init (struct machine *machine) |
int | sh_ipl_g_emul (struct cpu *) |
void | yamon_machine_setup (struct machine *machine, uint64_t env) |
int | yamon_emul (struct cpu *) |
#define BE16_TO_HOST | ( | x | ) | (SWAP16(x)) |
Definition at line 173 of file misc.h.
Referenced by MIPS_CPUComponent::PCtoInstructionAddress(), CacheComponent::ReadData(), RAMComponent::ReadData(), sh_cpu_instruction_has_delayslot(), CacheComponent::WriteData(), RAMComponent::WriteData(), and X().
#define BE32_TO_HOST | ( | x | ) | (SWAP32(x)) |
Definition at line 181 of file misc.h.
Referenced by I960_CPUComponent::DisassembleInstruction(), MIPS_CPUComponent::DisassembleInstruction(), M88K_CPUComponent::DisassembleInstruction(), m8820x_mark_page_as_modified(), m88k_cpu_instruction_has_delayslot(), m88k_translate_v2p(), mips_cpu_instruction_has_delayslot(), CacheComponent::ReadData(), RAMComponent::ReadData(), CacheComponent::WriteData(), RAMComponent::WriteData(), X(), and yamon_emul().
#define BE64_TO_HOST | ( | x | ) |
Definition at line 189 of file misc.h.
Referenced by CacheComponent::ReadData(), RAMComponent::ReadData(), CacheComponent::WriteData(), and RAMComponent::WriteData().
#define CHECK_ALLOCATION | ( | ptr | ) |
Definition at line 239 of file misc.h.
Referenced by add_cmmu_for_cpu(), add_symbol_name(), arcbios_add_string_to_component(), arcbios_console_init(), arcbios_emul(), arcbios_init(), bus_isa_init(), bus_pci_add(), bus_pci_init(), cpu_new(), debugger_assignment(), debugger_init(), debugger_parse_expression(), dec21143_rx(), dec21143_tx(), dec_jumptable_func(), dev_asc_init(), dev_bt431_init(), dev_bt455_init(), dev_bt459_init(), dev_colorplanemask_init(), dev_crime_init(), dev_dc7085_init(), dev_dec5500_ioboard_init(), dev_dec_ioasic_init(), dev_deccca_init(), dev_decxmi_init(), dev_fb_init(), dev_fb_resize(), dev_gt_init(), dev_kn01_init(), dev_le_init(), dev_macepci_init(), dev_mc146818_init(), dev_pckbc_init(), dev_pmagja_init(), dev_px_init(), dev_ram_init(), dev_scc_init(), dev_sfb_init(), dev_sgec_init(), dev_sgi_gbe_init(), dev_sgi_ip20_init(), dev_sgi_ip22_init(), dev_sgi_mec_init(), dev_sgi_mte_init(), dev_sgi_ust_init(), dev_sii_init(), dev_ssc_init(), dev_turbochannel_init(), dev_uninorth_init(), dev_vdac_init(), dev_vga_init(), dev_vr41xx_init(), DEVICE_ACCESS(), device_add(), device_register(), DEVINIT(), diskimage_add(), diskimage_add_overlay(), emul_add_machine(), emul_machine_setup(), emul_new(), get_cmd_args(), iso_load_bootblock(), load_bootblock(), machine_add_breakpoint_string(), machine_add_tickfunction(), MACHINE_DEFAULT_CPU(), machine_entry_add_alias(), machine_entry_add_subtype(), machine_entry_new(), machine_new(), MACHINE_SETUP(), machine_statistics_init(), memory_device_register(), memory_new(), memory_paddr_to_hostaddr(), mips_coproc_new(), mips_cpu_new(), net_add_nic(), net_allocate_ethernet_packet_link(), net_init(), net_tcp_rx_avail(), of_emul_init(), of_emul_init_adb(), of_emul_init_zs(), pci_register(), PCIINIT(), settings_add(), settings_debugdump(), settings_new(), symbol_recalc_sizes(), test_triangle(), timer_add(), x11_check_event(), and zeroed_alloc().
#define COPYRIGHT_MSG "Copyright (C) 2003-2018 Anders Gavare" |
Definition at line 46 of file misc.h.
Referenced by GXemul::Version().
#define DEBUG_INDENTATION 4 |
Definition at line 212 of file misc.h.
Referenced by console_debug_dump(), cpu_list_available_types(), diskimage_dump_info(), emul_create_from_configfile(), emul_dumpinfo(), emul_machine_setup(), emul_simple_init(), file_load(), iso_load_bootblock(), machine_list_available_types_and_cpus(), mips_cpu_dumpinfo(), and net_dumpinfo().
#define DEFAULT_TMP_DIR "/tmp" |
Definition at line 148 of file misc.h.
Referenced by emul_machine_setup(), file_load(), and iso_load_bootblock().
#define EMUL_BIG_ENDIAN 2 |
Definition at line 165 of file misc.h.
Referenced by arcbios_emul(), arm_coproc_15(), arm_translate_v2p_mmu(), dev_jazz_dma_controller(), DEVICE_ACCESS(), m88k_cpu_dumpinfo(), m88k_cpu_new(), m88k_stcr(), MACHINE_SETUP(), memory_readmax64(), mips_cpu_disassemble_instr(), mips_cpu_dumpinfo(), ppc_cpu_new(), reg_access_msr(), sh_cpu_disassemble_instr(), sh_cpu_dumpinfo(), sh_cpu_instruction_has_delayslot(), X(), and Y().
#define EMUL_LITTLE_ENDIAN 1 |
Definition at line 164 of file misc.h.
Referenced by alpha_cpu_new(), arm_cpu_disassemble_instr(), arm_cpu_disassemble_instr_thumb(), arm_cpu_new(), arm_setup_initial_translation_table(), arm_translate_v2p_mmu(), arm_translation_table_set_l1(), arm_translation_table_set_l1_b(), dev_px_dma(), DEVICE_ACCESS(), load_16bit_word(), load_32bit_word(), load_64bit_word(), m8820x_mark_page_as_modified(), m88k_cpu_disassemble_instr(), m88k_cpu_instruction_has_delayslot(), m88k_stcr(), m88k_translate_v2p(), MACHINE_SETUP(), memory_readmax64(), memory_writemax64(), mips_cpu_instruction_has_delayslot(), mips_cpu_new(), mips_unaligned_loadstore(), px_readword(), sh_cpu_new(), store_16bit_word(), store_16bit_word_in_host(), store_32bit_word(), store_32bit_word_in_host(), store_64bit_word(), store_64bit_word_in_host(), sw_loop(), X(), Y(), and yamon_emul().
#define FAILURE | ( | error_msg | ) |
#define LE16_TO_HOST | ( | x | ) | (x) |
Definition at line 172 of file misc.h.
Referenced by MIPS_CPUComponent::PCtoInstructionAddress(), CacheComponent::ReadData(), RAMComponent::ReadData(), sh_cpu_instruction_has_delayslot(), CacheComponent::WriteData(), RAMComponent::WriteData(), and X().
#define LE32_TO_HOST | ( | x | ) | (x) |
Definition at line 180 of file misc.h.
Referenced by I960_CPUComponent::DisassembleInstruction(), MIPS_CPUComponent::DisassembleInstruction(), M88K_CPUComponent::DisassembleInstruction(), m8820x_mark_page_as_modified(), m88k_cpu_instruction_has_delayslot(), m88k_translate_v2p(), maple_do_dma_xfer(), mips_cpu_instruction_has_delayslot(), CacheComponent::ReadData(), RAMComponent::ReadData(), CacheComponent::WriteData(), RAMComponent::WriteData(), X(), and yamon_emul().
#define LE64_TO_HOST | ( | x | ) | (x) |
Definition at line 188 of file misc.h.
Referenced by alpha_translate_v2p(), CacheComponent::ReadData(), RAMComponent::ReadData(), CacheComponent::WriteData(), and RAMComponent::WriteData().
#define NO_BYTE_ORDER_OVERRIDE -1 |
Definition at line 162 of file misc.h.
Referenced by emul_machine_setup(), and machine_new().
#define SECONDARY_MSG "" |
Definition at line 54 of file misc.h.
Referenced by GXemul::Version().
#define SWAP16 | ( | x | ) | ((((x) & 0xff00) >> 8) | (((x)&0xff) << 8)) |
#define SWAP32 | ( | x | ) |
typedef char stringchar |
enum Endianness |
int apple_load_bootblock | ( | struct machine * | m, |
struct cpu * | cpu, | ||
int | disk_id, | ||
int | disk_type, | ||
int * | n_loadp, | ||
char *** | load_namesp | ||
) |
Definition at line 53 of file bootblock_apple.cc.
References debug, diskimage_access(), and fatal().
void debug | ( | const char * | fmt, |
... | |||
) |
Definition at line 133 of file main.cc.
References quiet_mode.
void debug_indentation | ( | int | diff | ) |
Definition at line 120 of file main.cc.
Referenced by diskimage_dump_info(), emul_create_from_configfile(), emul_dumpinfo(), emul_machine_setup(), emul_simple_init(), file_load(), iso_load_bootblock(), machine_list_available_types_and_cpus(), mips_cpu_dumpinfo(), and net_dumpinfo().
int decstation_prom_emul | ( | struct cpu * | cpu | ) |
Definition at line 229 of file dec_prom.cc.
References dec_jumptable_func(), and cpu::pc.
Referenced by X().
void dreamcast_descramble | ( | char * | from, |
char * | to | ||
) |
Definition at line 190 of file dreamcast_scramble.cc.
References read_file().
Referenced by scramble().
void dreamcast_emul | ( | struct cpu * | cpu | ) |
Definition at line 239 of file dreamcast.cc.
References cpu::cd, DREAMCAST_MACHINE_ID_ADDRESS, DREAMCAST_ROMFONT_BASE, fatal(), cpu::pc, sh_cpu::r, cpu::running, and cpu::sh.
Referenced by X().
void dreamcast_machine_setup | ( | struct machine * | ) |
Definition at line 200 of file dreamcast.cc.
References machine::cpus, DREAMCAST_MACHINE_ID_ADDRESS, SH_INVALID_INSTR, store_16bit_word(), store_32bit_word(), and store_64bit_word().
Referenced by MACHINE_SETUP().
void fatal | ( | const char * | fmt, |
... | |||
) |
Definition at line 152 of file main.cc.
Referenced by add_to_rx_queue(), alpha_palcode(), alpha_prom_call(), alpha_translate_v2p(), apple_load_bootblock(), arcbios_emul(), arcbios_private_emul(), arm_cdp(), arm_coproc_15(), arm_coproc_i80321_6(), arm_coproc_xscale_14(), arm_exception(), arm_load_register_bank(), arm_mcr_mrc(), arm_save_register_bank(), bus_isa_init(), bus_pci_add(), bus_pci_data_access(), bus_pci_decompose_1(), bus_pci_setaddr(), console_makeavail(), coproc_function(), coproc_register_read(), coproc_register_write(), coproc_tlbpr(), coproc_tlbwri(), cpu_disassemble_instr(), cpu_dumpinfo(), cpu_functioncall_trace(), cpu_register_dump(), cpu_tlbdump(), dec21143_rx(), dec21143_tx(), dec_jumptable_func(), dev_fb_resize(), dev_gt_init(), dev_jazz_dma_controller(), dev_px_init(), dev_ram_init(), dev_scc_add_to_rx_queue(), dev_turbochannel_init(), DEVICE_ACCESS(), device_add(), DEVICE_TICK(), device_unregister(), DEVINIT(), diskimage_access(), diskimage_add(), diskimage_getchs(), diskimage_scsicommand(), diskimage_set_baseoffset(), dreamcast_emul(), emul_machine_setup(), framebuffer_blockcopyfill(), ieee_interpret_float_value(), ieee_store_float_value(), lca_interrupt_assert(), lca_interrupt_deassert(), le_register_write(), load_bootblock(), LS_GENERIC_N(), luna88kprom_emul(), m88k_exception(), m88k_fstcr(), m88k_ldcr(), m88k_stcr(), m88k_translate_v2p(), machine_add_tickfunction(), MACHINE_DEFAULT_CPU(), machine_default_cputype(), machine_init(), machine_list_available_types_and_cpus(), machine_memsize_fix(), machine_name_to_type(), MACHINE_SETUP(), machine_setup(), maple_do_dma_xfer(), memory_device_register(), memory_device_remove(), memory_warn_about_unimplemented_addr(), mvmeprom_emul(), net_debugaddr(), net_ethernet_tx(), net_generate_unique_mac(), net_ip_broadcast(), net_ip_tcp_connectionreply(), net_tcp_rx_avail(), net_udp_rx_avail(), of_emul(), OF_SERVICE(), osiop_execute_scripts_instr(), osiop_get_next_scripts_word(), pcctwo_interrupt_common(), PCIINIT(), pckbc_add_code(), pckbc_get_code(), playstation2_sifbios_emul(), ppc_bat(), ppc_exception(), ppc_translate_v2p(), pvr_dma_transfer(), pvr_render(), reg_access_msr(), sh4_dmac_transfer(), sh_cpu_interrupt_assert(), sh_cpu_new(), sh_exception(), TRANSLATE_ADDRESS(), X(), x11_check_event(), Y(), and yamon_emul().
void file_load | ( | struct machine * | machine, |
struct memory * | mem, | ||
char * | filename, | ||
uint64_t * | entrypointp, | ||
int | arch, | ||
uint64_t * | gpp, | ||
int * | byte_order, | ||
uint64_t * | tocp | ||
) |
Definition at line 118 of file file.cc.
References ARCH_NOARCH, debug, DEBUG_INDENTATION, debug_indentation(), DEFAULT_TMP_DIR, f(), old_quiet_mode, quiet_mode, and verbose.
Referenced by emul_machine_setup().
int iso_load_bootblock | ( | struct machine * | m, |
struct cpu * | cpu, | ||
int | disk_id, | ||
int | disk_type, | ||
int | iso_type, | ||
unsigned char * | buf, | ||
int * | n_loadp, | ||
char *** | load_namesp | ||
) |
Definition at line 99 of file bootblock_iso9660.cc.
References machine::boot_kernel_filename, CHECK_ALLOCATION, debug, DEBUG_INDENTATION, debug_indentation(), DEFAULT_TMP_DIR, and cpu::machine.
Definition at line 65 of file bootblock.cc.
References CHECK_ALLOCATION, debug, diskimage_bootdev(), diskimage_get_baseoffset(), diskimage_is_a_cdrom(), fatal(), cpu::machine, MACHINE_DREAMCAST, and machine::machine_type.
Referenced by emul_machine_setup().
int luna88kprom_emul | ( | struct cpu * | cpu | ) |
Definition at line 90 of file luna88kprom.cc.
References cpu::cd, console_putchar(), cpu_register_dump(), fatal(), cpu::m88k, cpu::machine, machine::main_console_handle, cpu::pc, m88k_cpu::r, and cpu::running.
Referenced by X().
void luna88kprom_init | ( | struct machine * | machine | ) |
Definition at line 50 of file luna88kprom.cc.
References machine::cpus, x11_md::in_use, M88K_PROM_INSTR, store_32bit_word(), and machine::x11_md.
Referenced by MACHINE_SETUP().
int mvmeprom_emul | ( | struct cpu * | cpu | ) |
Definition at line 99 of file mvmeprom.cc.
References cpu::cd, console_putchar(), cpu_register_dump(), fatal(), cpu::m88k, cpu::machine, machine::main_console_handle, MVMEPROM_BRDID_ADDR, MVMEPROM_EXIT, MVMEPROM_GETBRDID, MVMEPROM_OUTCHR, MVMEPROM_OUTCRLF, m88k_cpu::r, and cpu::running.
Referenced by X().
void mvmeprom_init | ( | struct machine * | machine | ) |
Definition at line 55 of file mvmeprom.cc.
References cpu::cd, machine::cpus, m88k_cpu::cr, cpu::m88k, M88K_CR_VBR, M88K_PROM_INSTR, MACHINE_MVME88K_187, MACHINE_MVME88K_188, MACHINE_MVME88K_197, machine::machine_subtype, mvmeprom_brdid::model, MVMEPROM_BRDID_ADDR, MVMEPROM_VECTOR, mvmeprom_brdid::speed, store_16bit_word_in_host(), store_32bit_word(), and store_buf().
Referenced by MACHINE_SETUP().
int mymkstemp | ( | char * | templ | ) |
Definition at line 114 of file misc.cc.
References mystrlcat(), mystrlcpy(), and strlen().
size_t mystrlcat | ( | char * | dst, |
const char * | src, | ||
size_t | size | ||
) |
Referenced by mymkstemp().
size_t mystrlcpy | ( | char * | dst, |
const char * | src, | ||
size_t | size | ||
) |
Referenced by mymkstemp().
unsigned long long mystrtoull | ( | const char * | s, |
char ** | endp, | ||
int | base | ||
) |
int playstation2_sifbios_emul | ( | struct cpu * | cpu | ) |
Definition at line 51 of file ps2_bios.cc.
References cpu::cd, console_charavail(), console_putchar(), console_readchar(), cpu_register_dump(), debug, fatal(), mips_cpu::gpr, load_32bit_word(), cpu::machine, machine::main_console_handle, cpu::mips, MIPS_GPR_A0, MIPS_GPR_A1, MIPS_GPR_A2, MIPS_GPR_A3, MIPS_GPR_V0, quiet_mode, cpu::running, and store_32bit_word().
Referenced by X().
int sh_ipl_g_emul | ( | struct cpu * | ) |
Definition at line 98 of file sh_ipl_g.cc.
References cpu::cd, sh_cpu::expevt, EXPEVT_TRAPA, cpu::sh, and sh_cpu::tra.
Referenced by X().
void sh_ipl_g_emul_init | ( | struct machine * | machine | ) |
Definition at line 51 of file sh_ipl_g.cc.
References cpu::cd, machine::cpus, cpu::sh, SH_INVALID_INSTR, store_16bit_word(), and sh_cpu::vbr.
Referenced by MACHINE_SETUP().
int yamon_emul | ( | struct cpu * | ) |
Definition at line 139 of file yamon.cc.
References BE32_TO_HOST, cpu::byte_order, CACHE_DATA, cpu::cd, console_putchar(), console_readchar(), cpu_register_dump(), debug, EMUL_LITTLE_ENDIAN, machine::emulated_hz, fatal(), mips_cpu::gpr, LE32_TO_HOST, cpu::machine, machine::main_console_handle, cpu::mem, MEM_READ, MEM_WRITE, cpu::memory_rw, cpu::mips, MIPS_GPR_A0, MIPS_GPR_A1, MIPS_GPR_A2, MIPS_GPR_V0, NO_EXCEPTIONS, cpu::pc, cpu::running, SYSCON_BOARD_CPU_CLOCK_FREQ_ID, YAMON_EXIT_OFS, YAMON_FUNCTION_BASE, YAMON_GETCHAR_OFS, YAMON_PRINT_COUNT_OFS, and YAMON_SYSCON_READ_OFS.
Referenced by X().
void yamon_machine_setup | ( | struct machine * | machine, |
uint64_t | env | ||
) |
Definition at line 52 of file yamon.cc.
References add_environment_string_dual(), machine::cpus, machine::emulated_hz, net_generate_unique_mac(), and machine::physical_ram_in_mb.
Referenced by MACHINE_SETUP().