misc.h File Reference

Back to the index.

Macros | Typedefs | Enumerations | Functions
misc.h File Reference
#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-2019 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 *)
 

Macro Definition Documentation

◆ BE16_TO_HOST

#define BE16_TO_HOST (   x)    (SWAP16(x))

Definition at line 174 of file misc.h.

◆ BE32_TO_HOST

#define BE32_TO_HOST (   x)    (SWAP32(x))

Definition at line 182 of file misc.h.

◆ BE64_TO_HOST

#define BE64_TO_HOST (   x)
Value:
( (((x) >> 56) & 0xff) + \
((((x) >> 48) & 0xff) << 8) + \
((((x) >> 40) & 0xff) << 16) + \
((((x) >> 32) & 0xff) << 24) + \
((((x) >> 24) & 0xff) << 32) + \
((((x) >> 16) & 0xff) << 40) + \
((((x) >> 8) & 0xff) << 48) + \
(((x) & 0xff) << 56) )

Definition at line 190 of file misc.h.

◆ CHECK_ALLOCATION

#define CHECK_ALLOCATION (   ptr)
Value:
{ \
if ((ptr) == NULL) \
FAILURE("Out of memory"); \
}

Definition at line 240 of file misc.h.

◆ COPYRIGHT_MSG

#define COPYRIGHT_MSG   "Copyright (C) 2003-2019 Anders Gavare"

Definition at line 47 of file misc.h.

◆ DEBUG_BUFSIZE

#define DEBUG_BUFSIZE   1024

Definition at line 212 of file misc.h.

◆ DEBUG_INDENTATION

#define DEBUG_INDENTATION   4

Definition at line 213 of file misc.h.

◆ DEFAULT_TMP_DIR

#define DEFAULT_TMP_DIR   "/tmp"

Definition at line 149 of file misc.h.

◆ EMUL_BIG_ENDIAN

#define EMUL_BIG_ENDIAN   2

Definition at line 166 of file misc.h.

◆ EMUL_LITTLE_ENDIAN

#define EMUL_LITTLE_ENDIAN   1

Definition at line 165 of file misc.h.

◆ EMUL_UNDEFINED_ENDIAN

#define EMUL_UNDEFINED_ENDIAN   0

Definition at line 164 of file misc.h.

◆ FAILURE

#define FAILURE (   error_msg)
Value:
{ \
char where_msg[400]; \
snprintf(where_msg, sizeof(where_msg), \
"%s, line %i, function %s().\n", \
__FILE__, __LINE__, __FUNCTION__); \
fprintf(stderr, "\n%s, in %s\n", error_msg, where_msg); \
exit(1); \
}

Definition at line 218 of file misc.h.

◆ LE16_TO_HOST

#define LE16_TO_HOST (   x)    (x)

Definition at line 173 of file misc.h.

◆ LE32_TO_HOST

#define LE32_TO_HOST (   x)    (x)

Definition at line 181 of file misc.h.

◆ LE64_TO_HOST

#define LE64_TO_HOST (   x)    (x)

Definition at line 189 of file misc.h.

◆ NO_BYTE_ORDER_OVERRIDE

#define NO_BYTE_ORDER_OVERRIDE   -1

Definition at line 163 of file misc.h.

◆ SECONDARY_MSG

#define SECONDARY_MSG   ""

Definition at line 55 of file misc.h.

◆ SWAP16

#define SWAP16 (   x)    ((((x) & 0xff00) >> 8) | (((x)&0xff) << 8))

Definition at line 170 of file misc.h.

◆ SWAP32

#define SWAP32 (   x)
Value:
((((x) & 0xff000000) >> 24) | (((x)&0xff) << 24) | \
(((x) & 0xff0000) >> 8) | (((x) & 0xff00) << 8))

Definition at line 168 of file misc.h.

Typedef Documentation

◆ stringchar

typedef char stringchar

Definition at line 59 of file misc.h.

Enumeration Type Documentation

◆ Endianness

enum Endianness
Enumerator
BigEndian 
LittleEndian 

Definition at line 156 of file misc.h.

Function Documentation

◆ apple_load_bootblock()

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().

◆ debug()

void debug ( const char *  fmt,
  ... 
)

Definition at line 133 of file main.cc.

References quiet_mode.

◆ debug_indentation()

void debug_indentation ( int  diff)

◆ decstation_prom_emul()

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().

◆ dreamcast_descramble()

void dreamcast_descramble ( char *  from,
char *  to 
)

Definition at line 190 of file dreamcast_scramble.cc.

References read_file().

◆ dreamcast_emul()

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().

◆ dreamcast_machine_setup()

void dreamcast_machine_setup ( struct machine )

◆ fatal()

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_cpu_interpret_thumb_SLOW(), arm_exception(), arm_load_register_bank(), arm_mcr_mrc(), arm_pop(), arm_save_register_bank(), bus_isa_init(), bus_pci_add(), bus_pci_data_access(), bus_pci_decompose_1(), bus_pci_setaddr(), 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(), crime_update_crime_time(), 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(), do_mte_transfer(), draw_primitive(), dreamcast_emul(), emul_machine_setup(), framebuffer_blockcopyfill(), get_rgb(), horrible_getputpixel(), 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_exception(), TRANSLATE_ADDRESS(), X(), Y(), and yamon_emul().

◆ file_load()

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 
)

◆ file_n_executables_loaded()

int file_n_executables_loaded ( void  )

Definition at line 104 of file file.cc.

◆ iso_load_bootblock()

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 
)

◆ load_bootblock()

int load_bootblock ( struct machine m,
struct cpu cpu,
int *  n_loadp,
char ***  load_namesp 
)

◆ luna88kprom_emul()

int luna88kprom_emul ( struct cpu cpu)

◆ luna88kprom_init()

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().

◆ mvmeprom_emul()

int mvmeprom_emul ( struct cpu cpu)

◆ mvmeprom_init()

void mvmeprom_init ( struct machine machine)

◆ mymkstemp()

int mymkstemp ( char *  templ)

Definition at line 114 of file misc.cc.

◆ mystrlcat()

size_t mystrlcat ( char *  dst,
const char *  src,
size_t  size 
)

◆ mystrlcpy()

size_t mystrlcpy ( char *  dst,
const char *  src,
size_t  size 
)

◆ mystrtoull()

unsigned long long mystrtoull ( const char *  s,
char **  endp,
int  base 
)

Definition at line 46 of file misc.cc.

◆ playstation2_sifbios_emul()

int playstation2_sifbios_emul ( struct cpu cpu)

◆ print_separator_line()

void print_separator_line ( void  )

Definition at line 164 of file misc.cc.

References debug.

◆ sh_ipl_g_emul()

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().

◆ sh_ipl_g_emul_init()

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().

◆ yamon_emul()

int yamon_emul ( struct cpu )

◆ yamon_machine_setup()

void yamon_machine_setup ( struct machine machine,
uint64_t  env 
)

Generated on Tue Aug 25 2020 19:25:06 for GXemul by doxygen 1.8.18