cpu.cc Source File
Back to the index.
Go to the documentation of this file.
33 #include <sys/types.h>
46 static struct cpu_family *first_cpu_family = NULL;
67 fprintf(stderr,
"cpu_new(): cpu name = NULL?\n");
89 snprintf(tmpstr,
sizeof(tmpstr),
"cpu[%i]",
cpu_id);
100 fp = first_cpu_family;
108 fatal(
"\ncpu_new(): memory_rw == "
120 fatal(
"\ncpu_new(): unknown cpu type '%s'\n", cpu_type_name);
127 fatal(
"\ncpu_new(): Internal bug: Endianness not set.\n");
155 munmap((
void *)
cpu,
sizeof(
struct cpu));
171 fatal(
"cpu_tlbdump(): NULL\n");
187 fatal(
"cpu_disassemble_instr(): NULL\n");
204 int gprs,
int coprocs)
207 fatal(
"cpu_register_dump(): NULL\n");
221 int show_symbolic_function_name = 1;
229 show_symbolic_function_name = 0;
243 f, &offset, &n_args);
244 if (
symbol != NULL && show_symbolic_function_name && offset == 0)
248 fatal(
"0x%" PRIx32, (uint32_t)
f);
250 fatal(
"0x%" PRIx64, (uint64_t)
f);
259 #ifdef PRINT_MEMORY_CHECKSUM
324 fatal(
"cpu_dumpinfo(): NULL\n");
340 fp = first_cpu_family;
343 debug(
"No CPUs defined!\n");
353 debug(
"(internal error: list_available_types"
403 int64_t mseconds, ninstrs, is, avg;
407 static int64_t mseconds_last = 0;
408 static int64_t ninstrs_last = -1;
412 gettimeofday(&tv, NULL);
419 if (mseconds - mseconds_last == 0)
428 printf(
"[ %" PRIi64
" instrs", (int64_t)
cpu->
ninstrs);
431 is = 1000 * (
ninstrs-ninstrs_last) / (mseconds-mseconds_last);
432 avg = (
long long)1000 *
ninstrs / mseconds;
442 printf(
"; i/s=%" PRIi64
" avg=%" PRIi64, is, avg);
448 printf(
"; pc=0x%08" PRIx32, (uint32_t)
pc);
450 printf(
"; pc=0x%016" PRIx64, (uint64_t)
pc);
464 mseconds_last = mseconds;
479 printf(
"Machine with no CPUs? TODO.\n");
503 static void add_cpu_family(
int (*family_init)(
struct cpu_family *),
int arch)
516 res = family_init(fp);
525 tmp = first_cpu_family;
527 first_cpu_family = fp;
529 while (tmp->
next != NULL)
544 fp = first_cpu_family;
569 ADD_ALL_CPU_FAMILIES;
void(* list_available_types)(void)
struct cpu_family * cpu_family_ptr_by_number(int arch)
void cpu_register_dump(struct machine *m, struct cpu *cpu, int gprs, int coprocs)
void f(int s, int func, int only_name)
struct cpu_family * cpu_family
void(* init_tables)(struct cpu *cpu)
void cpu_run_deinit(struct machine *machine)
unsigned char * translation_cache
struct symbol_context symbol_context
struct cpu * cpu_new(struct memory *mem, struct machine *machine, int cpu_id, char *name)
#define N_BASE_TABLE_ENTRIES
void settings_remove(struct settings *settings, const char *name)
size_t dyntrans_cache_size
#define SETTINGS_FORMAT_STRING
int cpu_disassemble_instr(struct machine *m, struct cpu *cpu, unsigned char *instr, int running, uint64_t addr)
int show_nr_of_instructions
char * get_symbol_name(struct symbol_context *, uint64_t addr, uint64_t *offset)
void settings_add(struct settings *settings, const char *name, int writable, int type, int format, void *ptr)
void cpu_functioncall_trace_return(struct cpu *cpu)
uint64_t memory_checksum(struct memory *mem)
#define SETTINGS_TYPE_STRING
void cpu_functioncall_trace(struct cpu *cpu, uint64_t f)
void cpu_show_cycles(struct machine *machine, int forced)
int64_t ninstrs_since_gettimeofday
#define DYNTRANS_CACHE_MARGIN
struct tick_functions tick_functions
void(* invalidate_code_translation)(struct cpu *, uint64_t paddr, int flags)
void COMBINE() strlen(struct cpu *cpu, struct arm_instr_call *ic, int low_addr)
int(* cpu_new)(struct cpu *cpu, struct memory *mem, struct machine *machine, int cpu_id, char *cpu_type_name)
void fatal(const char *fmt,...)
void cpu_tlbdump(struct machine *m, int x, int rawflag)
void settings_remove_all(struct settings *settings)
struct settings * settings
void(* dumpinfo)(struct cpu *cpu)
uint32_t cr[N_M88K_CONTROL_REGS]
#define SETTINGS_TYPE_SUBSETTINGS
void * zeroed_alloc(size_t s)
struct settings * settings
void settings_destroy(struct settings *settings)
void(* functioncall_trace)(struct cpu *, int n_args)
#define SETTINGS_TYPE_UINT8
#define EMUL_UNDEFINED_ENDIAN
void cpu_create_or_reset_tc(struct cpu *cpu)
#define DEBUG_INDENTATION
char * get_symbol_name_and_n_args(struct symbol_context *, uint64_t addr, uint64_t *offset, int *n_argsp)
struct settings * settings_new(void)
void(* tlbdump)(struct machine *m, int x, int rawflag)
int(* memory_rw)(struct cpu *cpu, struct memory *mem, uint64_t vaddr, unsigned char *data, size_t len, int writeflag, int cache_flags)
void(* register_dump)(struct cpu *cpu, int gprs, int coprocs)
int(* disassemble_instr)(struct cpu *cpu, unsigned char *instr, int running, uint64_t dumpaddr)
void(** f)(struct cpu *, void *)
void cpu_run_init(struct machine *machine)
size_t translation_cache_cur_ofs
void cpu_destroy(struct cpu *cpu)
void cpu_dumpinfo(struct machine *m, struct cpu *cpu)
void debug_indentation(int diff)
#define SETTINGS_FORMAT_YESNO
void cpu_list_available_types(void)
#define CHECK_ALLOCATION(ptr)
Generated on Tue Mar 24 2020 14:04:48 for GXemul by
1.8.17