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");
164 munmap((
void *)
cpu,
sizeof(
struct cpu));
180 fatal(
"cpu_tlbdump(): NULL\n");
196 fatal(
"cpu_disassemble_instr(): NULL\n");
213 int gprs,
int coprocs)
216 fatal(
"cpu_register_dump(): NULL\n");
230 int show_symbolic_function_name = 1;
238 show_symbolic_function_name = 0;
252 f, &offset, &n_args);
253 if (
symbol != NULL && show_symbolic_function_name && offset == 0)
257 fatal(
"0x%" PRIx32, (uint32_t)
f);
259 fatal(
"0x%" PRIx64, (uint64_t)
f);
268 #ifdef PRINT_MEMORY_CHECKSUM
333 fatal(
"cpu_dumpinfo(): NULL\n");
349 fp = first_cpu_family;
352 debug(
"No CPUs defined!\n");
362 debug(
"(internal error: list_available_types"
412 int64_t mseconds, ninstrs, is, avg;
416 static int64_t mseconds_last = 0;
417 static int64_t ninstrs_last = -1;
421 gettimeofday(&tv, NULL);
428 if (mseconds - mseconds_last == 0)
437 printf(
"[ %" PRIi64
" instrs", (int64_t)
cpu->
ninstrs);
440 is = 1000 * (
ninstrs-ninstrs_last) / (mseconds-mseconds_last);
441 avg = (
long long)1000 *
ninstrs / mseconds;
451 printf(
"; i/s=%" PRIi64
" avg=%" PRIi64, is, avg);
457 printf(
"; pc=0x%08" PRIx32, (uint32_t)
pc);
459 printf(
"; pc=0x%016" PRIx64, (uint64_t)
pc);
473 mseconds_last = mseconds;
488 printf(
"Machine with no CPUs? TODO.\n");
512 static void add_cpu_family(
int (*family_init)(
struct cpu_family *),
int arch)
525 res = family_init(fp);
534 tmp = first_cpu_family;
536 first_cpu_family = fp;
538 while (tmp->
next != NULL)
553 fp = first_cpu_family;
578 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 Aug 25 2020 19:25:06 for GXemul by
1.8.18