cpu.h File Reference

Back to the index.

Classes | Macros | Functions
cpu.h File Reference
#include <sys/types.h>
#include <inttypes.h>
#include <sys/time.h>
#include "../../config.h"
#include "timer.h"
#include "cpu_alpha.h"
#include "cpu_arm.h"
#include "cpu_m88k.h"
#include "cpu_mips.h"
#include "cpu_ppc.h"
#include "cpu_sh.h"

Go to the source code of this file.

Classes

struct  physpage_ranges
 
struct  cpu_family
 
struct  cpu
 

Macros

#define DYNTRANS_MISC_DECLARATIONS(arch, ARCH, addrtype)
 
#define DYNTRANS_MISC64_DECLARATIONS(arch, ARCH, tlbindextype)
 
#define PHYSPAGE_RANGES_ENTRIES_PER_LIST   20
 
#define DYNTRANS_ITC(arch)
 
#define VPH_TLBS(arch, ARCH)
 
#define N_VPH32_ENTRIES   1048576
 
#define VPH32(arch, ARCH)
 
#define VPH32_16BITVPHENTRIES(arch, ARCH)
 
#define VPH32EXTENDED(arch, ARCH, ex)
 
#define DYNTRANS_L1N   17
 
#define VPH64(arch, ARCH)
 
#define NOT_DELAYED   0
 
#define DELAYED   1
 
#define TO_BE_DELAYED   2
 
#define EXCEPTION_IN_DELAY_SLOT   8
 
#define N_SAFE_DYNTRANS_LIMIT_SHIFT   14
 
#define N_SAFE_DYNTRANS_LIMIT   ((1 << (N_SAFE_DYNTRANS_LIMIT_SHIFT - 1)) - 1)
 
#define MAX_DYNTRANS_READAHEAD   128
 
#define DEFAULT_DYNTRANS_CACHE_SIZE   (96*1048576)
 
#define DYNTRANS_CACHE_MARGIN   200000
 
#define N_BASE_TABLE_ENTRIES   65536
 
#define PAGENR_TO_TABLE_INDEX(a)   ((a) & (N_BASE_TABLE_ENTRIES-1))
 
#define JUST_MARK_AS_NON_WRITABLE   1
 
#define INVALIDATE_ALL   2
 
#define INVALIDATE_PADDR   4
 
#define INVALIDATE_VADDR   8
 
#define INVALIDATE_VADDR_UPPER4   16 /* useful for PPC emulation */
 
#define CPU_SETTINGS_ADD_REGISTER64(name, var)
 
#define CPU_SETTINGS_ADD_REGISTER32(name, var)
 
#define CPU_SETTINGS_ADD_REGISTER16(name, var)
 
#define CPU_SETTINGS_ADD_REGISTER8(name, var)
 
#define CPU_FAMILY_INIT(n, s)
 

Functions

struct cpucpu_new (struct memory *mem, struct machine *machine, int cpu_id, char *cpu_type_name)
 
void cpu_destroy (struct cpu *cpu)
 
void cpu_tlbdump (struct machine *m, int x, int rawflag)
 
void cpu_register_dump (struct machine *m, struct cpu *cpu, int gprs, int coprocs)
 
int cpu_disassemble_instr (struct machine *m, struct cpu *cpu, unsigned char *instr, int running, uint64_t addr)
 
void cpu_functioncall_trace (struct cpu *cpu, uint64_t f)
 
void cpu_functioncall_trace_return (struct cpu *cpu)
 
void cpu_create_or_reset_tc (struct cpu *cpu)
 
void cpu_run_init (struct machine *machine)
 
void cpu_run_deinit (struct machine *machine)
 
void cpu_dumpinfo (struct machine *m, struct cpu *cpu)
 
void cpu_list_available_types (void)
 
void cpu_show_cycles (struct machine *machine, int forced)
 
struct cpu_familycpu_family_ptr_by_number (int arch)
 
void cpu_init (void)
 

Macro Definition Documentation

◆ CPU_FAMILY_INIT

#define CPU_FAMILY_INIT (   n,
 
)
Value:
int n ## _cpu_family_init( \
struct cpu_family *fp) { \
/* Fill in the cpu_family struct with valid data for this arch. */ \
fp->name = strdup(s); \
fp->cpu_new = n ## _cpu_new; \
fp->list_available_types = n ## _cpu_list_available_types; \
fp->disassemble_instr = n ## _cpu_disassemble_instr; \
fp->register_dump = n ## _cpu_register_dump; \
fp->dumpinfo = n ## _cpu_dumpinfo; \
fp->functioncall_trace = n ## _cpu_functioncall_trace; \
fp->tlbdump = n ## _cpu_tlbdump; \
fp->init_tables = n ## _cpu_init_tables; \
return 1; \
}

Definition at line 501 of file cpu.h.

◆ CPU_SETTINGS_ADD_REGISTER16

#define CPU_SETTINGS_ADD_REGISTER16 (   name,
  var 
)
Value:
SETTINGS_FORMAT_HEX16, (void *) &(var));
struct settings * settings
Definition: cpu.h:331
#define SETTINGS_FORMAT_HEX16
Definition: settings.h:54
Definition: cpu.h:326
void settings_add(struct settings *settings, const char *name, int writable, int type, int format, void *ptr)
Definition: settings.cc:334
#define SETTINGS_TYPE_UINT16
Definition: settings.h:47

Definition at line 493 of file cpu.h.

◆ CPU_SETTINGS_ADD_REGISTER32

#define CPU_SETTINGS_ADD_REGISTER32 (   name,
  var 
)
Value:
SETTINGS_FORMAT_HEX32, (void *) &(var));
struct settings * settings
Definition: cpu.h:331
#define SETTINGS_FORMAT_HEX32
Definition: settings.h:55
Definition: cpu.h:326
void settings_add(struct settings *settings, const char *name, int writable, int type, int format, void *ptr)
Definition: settings.cc:334
#define SETTINGS_TYPE_UINT32
Definition: settings.h:48

Definition at line 490 of file cpu.h.

Referenced by arm_cpu_new(), m88k_cpu_new(), ppc_cpu_new(), and sh_cpu_new().

◆ CPU_SETTINGS_ADD_REGISTER64

#define CPU_SETTINGS_ADD_REGISTER64 (   name,
  var 
)
Value:
(void *) &(var));
uint8_t is_32bit
Definition: cpu.h:350
struct settings * settings
Definition: cpu.h:331
#define SETTINGS_TYPE_UINT64
Definition: settings.h:49
#define SETTINGS_FORMAT_HEX64
Definition: settings.h:56
#define SETTINGS_FORMAT_HEX32
Definition: settings.h:55
Definition: cpu.h:326
void settings_add(struct settings *settings, const char *name, int writable, int type, int format, void *ptr)
Definition: settings.cc:334

Definition at line 486 of file cpu.h.

Referenced by alpha_cpu_new(), arm_cpu_new(), m88k_cpu_new(), mips_cpu_new(), ppc_cpu_new(), and sh_cpu_new().

◆ CPU_SETTINGS_ADD_REGISTER8

#define CPU_SETTINGS_ADD_REGISTER8 (   name,
  var 
)
Value:
SETTINGS_FORMAT_HEX8, (void *) &(var));
#define SETTINGS_TYPE_UINT8
Definition: settings.h:46
#define SETTINGS_FORMAT_HEX8
Definition: settings.h:53
struct settings * settings
Definition: cpu.h:331
Definition: cpu.h:326
void settings_add(struct settings *settings, const char *name, int writable, int type, int format, void *ptr)
Definition: settings.cc:334

Definition at line 496 of file cpu.h.

◆ DEFAULT_DYNTRANS_CACHE_SIZE

#define DEFAULT_DYNTRANS_CACHE_SIZE   (96*1048576)

Definition at line 315 of file cpu.h.

◆ DELAYED

#define DELAYED   1

Definition at line 306 of file cpu.h.

◆ DYNTRANS_CACHE_MARGIN

#define DYNTRANS_CACHE_MARGIN   200000

Definition at line 316 of file cpu.h.

Referenced by cpu_create_or_reset_tc().

◆ DYNTRANS_ITC

#define DYNTRANS_ITC (   arch)
Value:
struct arch ## _tc_physpage *cur_physpage; \
struct arch ## _instr_call *cur_ic_page; \
struct arch ## _instr_call *next_ic; \
struct arch ## _tc_physpage *physpage_template;\
void (*combination_check)(struct cpu *, \
struct arch ## _instr_call *, int low_addr);
Definition: cpu.h:326

Definition at line 143 of file cpu.h.

◆ DYNTRANS_L1N

#define DYNTRANS_L1N   17

Definition at line 222 of file cpu.h.

Referenced by LS_N(), and X().

◆ DYNTRANS_MISC64_DECLARATIONS

#define DYNTRANS_MISC64_DECLARATIONS (   arch,
  ARCH,
  tlbindextype 
)
Value:
struct arch ## _l3_64_table { \
unsigned char *host_load[1 << ARCH ## _L3N]; \
unsigned char *host_store[1 << ARCH ## _L3N]; \
uint64_t phys_addr[1 << ARCH ## _L3N]; \
tlbindextype vaddr_to_tlbindex[1 << ARCH ## _L3N]; \
struct arch ## _tc_physpage *phys_page[1 << ARCH ## _L3N]; \
struct arch ## _l3_64_table *next; \
int refcount; \
}; \
struct arch ## _l2_64_table { \
struct arch ## _l3_64_table *l3[1 << ARCH ## _L2N]; \
struct arch ## _l2_64_table *next; \
int refcount; \
};

Definition at line 95 of file cpu.h.

◆ DYNTRANS_MISC_DECLARATIONS

#define DYNTRANS_MISC_DECLARATIONS (   arch,
  ARCH,
  addrtype 
)
Value:
struct \
arch ## _instr_call { \
void (*f)(struct cpu *, struct arch ## _instr_call *); \
size_t arg[ARCH ## _N_IC_ARGS]; \
}; \
\
/* Translation cache struct for each physical page: */ \
struct arch ## _tc_physpage { \
struct arch ## _instr_call ics[ARCH ## _IC_ENTRIES_PER_PAGE+2];\
uint32_t next_ofs; /* (0 for end of chain) */ \
uint32_t translations_bitmap; \
uint32_t translation_ranges_ofs; \
addrtype physaddr; \
}; \
\
struct arch ## _vpg_tlb_entry { \
uint8_t valid; \
uint8_t writeflag; \
addrtype vaddr_page; \
addrtype paddr_page; \
unsigned char *host_page; \
};
void f(int s, int func, int only_name)
Definition: cpu.h:326

Definition at line 72 of file cpu.h.

◆ EXCEPTION_IN_DELAY_SLOT

#define EXCEPTION_IN_DELAY_SLOT   8

Definition at line 308 of file cpu.h.

Referenced by m88k_exception(), sh_exception(), and X().

◆ INVALIDATE_ALL

#define INVALIDATE_ALL   2

◆ INVALIDATE_PADDR

#define INVALIDATE_PADDR   4

Definition at line 479 of file cpu.h.

Referenced by coproc_tlbwri(), DEVICE_ACCESS(), memory_device_dyntrans_access(), and MEMORY_RW().

◆ INVALIDATE_VADDR

#define INVALIDATE_VADDR   8

Definition at line 480 of file cpu.h.

Referenced by alpha_palcode(), arm_coproc_15(), coproc_tlbwri(), DEVICE_ACCESS(), m88k_translate_v2p(), and X().

◆ INVALIDATE_VADDR_UPPER4

#define INVALIDATE_VADDR_UPPER4   16 /* useful for PPC emulation */

Definition at line 481 of file cpu.h.

Referenced by X().

◆ JUST_MARK_AS_NON_WRITABLE

#define JUST_MARK_AS_NON_WRITABLE   1

Definition at line 477 of file cpu.h.

Referenced by memory_device_dyntrans_access().

◆ MAX_DYNTRANS_READAHEAD

#define MAX_DYNTRANS_READAHEAD   128

Definition at line 313 of file cpu.h.

◆ N_BASE_TABLE_ENTRIES

#define N_BASE_TABLE_ENTRIES   65536

Definition at line 318 of file cpu.h.

Referenced by cpu_create_or_reset_tc().

◆ N_SAFE_DYNTRANS_LIMIT

#define N_SAFE_DYNTRANS_LIMIT   ((1 << (N_SAFE_DYNTRANS_LIMIT_SHIFT - 1)) - 1)

Definition at line 311 of file cpu.h.

Referenced by X().

◆ N_SAFE_DYNTRANS_LIMIT_SHIFT

#define N_SAFE_DYNTRANS_LIMIT_SHIFT   14

Definition at line 310 of file cpu.h.

Referenced by machine_add_tickfunction().

◆ N_VPH32_ENTRIES

#define N_VPH32_ENTRIES   1048576

Definition at line 188 of file cpu.h.

◆ NOT_DELAYED

#define NOT_DELAYED   0

Definition at line 305 of file cpu.h.

Referenced by m88k_exception(), and X().

◆ PAGENR_TO_TABLE_INDEX

#define PAGENR_TO_TABLE_INDEX (   a)    ((a) & (N_BASE_TABLE_ENTRIES-1))

Definition at line 319 of file cpu.h.

◆ PHYSPAGE_RANGES_ENTRIES_PER_LIST

#define PHYSPAGE_RANGES_ENTRIES_PER_LIST   20

Definition at line 116 of file cpu.h.

◆ TO_BE_DELAYED

#define TO_BE_DELAYED   2

Definition at line 307 of file cpu.h.

Referenced by X().

◆ VPH32

#define VPH32 (   arch,
  ARCH 
)
Value:
unsigned char *host_load[N_VPH32_ENTRIES]; \
unsigned char *host_store[N_VPH32_ENTRIES]; \
uint32_t phys_addr[N_VPH32_ENTRIES]; \
struct arch ## _tc_physpage *phys_page[N_VPH32_ENTRIES]; \
uint8_t vaddr_to_tlbindex[N_VPH32_ENTRIES];
#define N_VPH32_ENTRIES
Definition: cpu.h:188

Definition at line 189 of file cpu.h.

◆ VPH32_16BITVPHENTRIES

#define VPH32_16BITVPHENTRIES (   arch,
  ARCH 
)
Value:
unsigned char *host_load[N_VPH32_ENTRIES]; \
unsigned char *host_store[N_VPH32_ENTRIES]; \
uint32_t phys_addr[N_VPH32_ENTRIES]; \
struct arch ## _tc_physpage *phys_page[N_VPH32_ENTRIES]; \
uint16_t vaddr_to_tlbindex[N_VPH32_ENTRIES];
#define N_VPH32_ENTRIES
Definition: cpu.h:188

Definition at line 195 of file cpu.h.

◆ VPH32EXTENDED

#define VPH32EXTENDED (   arch,
  ARCH,
  ex 
)
Value:
unsigned char *host_load_ ## ex[N_VPH32_ENTRIES]; \
unsigned char *host_store_ ## ex[N_VPH32_ENTRIES]; \
uint32_t phys_addr_ ## ex[N_VPH32_ENTRIES]; \
struct arch ## _tc_physpage *phys_page_ ## ex[N_VPH32_ENTRIES];\
uint8_t vaddr_to_tlbindex_ ## ex[N_VPH32_ENTRIES];
#define N_VPH32_ENTRIES
Definition: cpu.h:188

Definition at line 201 of file cpu.h.

◆ VPH64

#define VPH64 (   arch,
  ARCH 
)
Value:
struct arch ## _l3_64_table *l3_64_dummy; \
struct arch ## _l3_64_table *next_free_l3; \
struct arch ## _l2_64_table *l2_64_dummy; \
struct arch ## _l2_64_table *next_free_l2; \
struct arch ## _l2_64_table *l1_64[1 << DYNTRANS_L1N];
#define DYNTRANS_L1N
Definition: cpu.h:222

Definition at line 223 of file cpu.h.

◆ VPH_TLBS

#define VPH_TLBS (   arch,
  ARCH 
)
Value:
struct arch ## _vpg_tlb_entry \
vph_tlb_entry[ARCH ## _MAX_VPH_TLB_ENTRIES];

Definition at line 157 of file cpu.h.

Function Documentation

◆ cpu_create_or_reset_tc()

void cpu_create_or_reset_tc ( struct cpu cpu)

◆ cpu_destroy()

void cpu_destroy ( struct cpu cpu)

Definition at line 140 of file cpu.cc.

References cpu::path, cpu::settings, settings_destroy(), settings_remove(), and settings_remove_all().

Referenced by machine_destroy().

◆ cpu_disassemble_instr()

int cpu_disassemble_instr ( struct machine m,
struct cpu cpu,
unsigned char *  instr,
int  running,
uint64_t  addr 
)

Definition at line 183 of file cpu.cc.

References machine::cpu_family, cpu_family::disassemble_instr, and fatal().

◆ cpu_dumpinfo()

void cpu_dumpinfo ( struct machine m,
struct cpu cpu 
)

Definition at line 318 of file cpu.cc.

References machine::cpu_family, cpu::cpu_id, debug, cpu_family::dumpinfo, fatal(), cpu::name, and cpu::running.

Referenced by machine_dumpinfo().

◆ cpu_family_ptr_by_number()

struct cpu_family* cpu_family_ptr_by_number ( int  arch)

◆ cpu_functioncall_trace()

void cpu_functioncall_trace ( struct cpu cpu,
uint64_t  f 
)

◆ cpu_functioncall_trace_return()

void cpu_functioncall_trace_return ( struct cpu cpu)

Definition at line 275 of file cpu.cc.

References cpu::trace_tree_depth.

Referenced by arm_cpu_interpret_thumb_SLOW(), arm_pop(), X(), and Y().

◆ cpu_init()

void cpu_init ( void  )

Definition at line 567 of file cpu.cc.

Referenced by main().

◆ cpu_list_available_types()

void cpu_list_available_types ( void  )

Definition at line 335 of file cpu.cc.

References DEBUG_INDENTATION.

Referenced by machine_list_available_types_and_cpus().

◆ cpu_new()

struct cpu* cpu_new ( struct memory mem,
struct machine machine,
int  cpu_id,
char *  cpu_type_name 
)

◆ cpu_register_dump()

void cpu_register_dump ( struct machine m,
struct cpu cpu,
int  gprs,
int  coprocs 
)

◆ cpu_run_deinit()

void cpu_run_deinit ( struct machine machine)

◆ cpu_run_init()

void cpu_run_init ( struct machine machine)

◆ cpu_show_cycles()

void cpu_show_cycles ( struct machine machine,
int  forced 
)

◆ cpu_tlbdump()

void cpu_tlbdump ( struct machine m,
int  x,
int  rawflag 
)

Definition at line 168 of file cpu.cc.

References machine::cpu_family, fatal(), and cpu_family::tlbdump.


Generated on Fri Dec 7 2018 19:52:23 for GXemul by doxygen 1.8.13