📄 cpu.h
字号:
#define CP0St_IM 8#define CP0St_KX 7#define CP0St_SX 6#define CP0St_UX 5#define CP0St_KSU 3#define CP0St_ERL 2#define CP0St_EXL 1#define CP0St_IE 0 int32_t CP0_IntCtl;#define CP0IntCtl_IPTI 29#define CP0IntCtl_IPPC1 26#define CP0IntCtl_VS 5 int32_t CP0_SRSCtl;#define CP0SRSCtl_HSS 26#define CP0SRSCtl_EICSS 18#define CP0SRSCtl_ESS 12#define CP0SRSCtl_PSS 6#define CP0SRSCtl_CSS 0 int32_t CP0_SRSMap;#define CP0SRSMap_SSV7 28#define CP0SRSMap_SSV6 24#define CP0SRSMap_SSV5 20#define CP0SRSMap_SSV4 16#define CP0SRSMap_SSV3 12#define CP0SRSMap_SSV2 8#define CP0SRSMap_SSV1 4#define CP0SRSMap_SSV0 0 int32_t CP0_Cause;#define CP0Ca_BD 31#define CP0Ca_TI 30#define CP0Ca_CE 28#define CP0Ca_DC 27#define CP0Ca_PCI 26#define CP0Ca_IV 23#define CP0Ca_WP 22#define CP0Ca_IP 8#define CP0Ca_IP_mask 0x0000FF00#define CP0Ca_EC 2 target_ulong CP0_EPC; int32_t CP0_PRid; int32_t CP0_EBase; int32_t CP0_Config0;#define CP0C0_M 31#define CP0C0_K23 28#define CP0C0_KU 25#define CP0C0_MDU 20#define CP0C0_MM 17#define CP0C0_BM 16#define CP0C0_BE 15#define CP0C0_AT 13#define CP0C0_AR 10#define CP0C0_MT 7#define CP0C0_VI 3#define CP0C0_K0 0 int32_t CP0_Config1;#define CP0C1_M 31#define CP0C1_MMU 25#define CP0C1_IS 22#define CP0C1_IL 19#define CP0C1_IA 16#define CP0C1_DS 13#define CP0C1_DL 10#define CP0C1_DA 7#define CP0C1_C2 6#define CP0C1_MD 5#define CP0C1_PC 4#define CP0C1_WR 3#define CP0C1_CA 2#define CP0C1_EP 1#define CP0C1_FP 0 int32_t CP0_Config2;#define CP0C2_M 31#define CP0C2_TU 28#define CP0C2_TS 24#define CP0C2_TL 20#define CP0C2_TA 16#define CP0C2_SU 12#define CP0C2_SS 8#define CP0C2_SL 4#define CP0C2_SA 0 int32_t CP0_Config3;#define CP0C3_M 31#define CP0C3_DSPP 10#define CP0C3_LPA 7#define CP0C3_VEIC 6#define CP0C3_VInt 5#define CP0C3_SP 4#define CP0C3_MT 2#define CP0C3_SM 1#define CP0C3_TL 0 int32_t CP0_Config6; int32_t CP0_Config7; /* XXX: Maybe make LLAddr per-TC? */ target_ulong CP0_LLAddr; target_ulong CP0_WatchLo[8]; int32_t CP0_WatchHi[8]; target_ulong CP0_XContext; int32_t CP0_Framemask; int32_t CP0_Debug;#define CP0DB_DBD 31#define CP0DB_DM 30#define CP0DB_LSNM 28#define CP0DB_Doze 27#define CP0DB_Halt 26#define CP0DB_CNT 25#define CP0DB_IBEP 24#define CP0DB_DBEP 21#define CP0DB_IEXI 20#define CP0DB_VER 15#define CP0DB_DEC 10#define CP0DB_SSt 8#define CP0DB_DINT 5#define CP0DB_DIB 4#define CP0DB_DDBS 3#define CP0DB_DDBL 2#define CP0DB_DBp 1#define CP0DB_DSS 0 int32_t CP0_Debug_tcstatus[MIPS_TC_MAX]; target_ulong CP0_DEPC; int32_t CP0_Performance0; int32_t CP0_TagLo; int32_t CP0_DataLo; int32_t CP0_TagHi; int32_t CP0_DataHi; target_ulong CP0_ErrorEPC; int32_t CP0_DESAVE; /* Qemu */ int interrupt_request; jmp_buf jmp_env; int exception_index; int error_code; int user_mode_only; /* user mode only simulation */ uint32_t hflags; /* CPU State */ /* TMASK defines different execution modes */#define MIPS_HFLAG_TMASK 0x01FF#define MIPS_HFLAG_MODE 0x0007 /* execution modes */ /* The KSU flags must be the lowest bits in hflags. The flag order must be the same as defined for CP0 Status. This allows to use the bits as the value of mmu_idx. */#define MIPS_HFLAG_KSU 0x0003 /* kernel/supervisor/user mode mask */#define MIPS_HFLAG_UM 0x0002 /* user mode flag */#define MIPS_HFLAG_SM 0x0001 /* supervisor mode flag */#define MIPS_HFLAG_KM 0x0000 /* kernel mode flag */#define MIPS_HFLAG_DM 0x0004 /* Debug mode */#define MIPS_HFLAG_64 0x0008 /* 64-bit instructions enabled */#define MIPS_HFLAG_CP0 0x0010 /* CP0 enabled */#define MIPS_HFLAG_FPU 0x0020 /* FPU enabled */#define MIPS_HFLAG_F64 0x0040 /* 64-bit FPU enabled */ /* True if the MIPS IV COP1X instructions can be used. This also controls the non-COP1X instructions RECIP.S, RECIP.D, RSQRT.S and RSQRT.D. */#define MIPS_HFLAG_COP1X 0x0080 /* COP1X instructions enabled */#define MIPS_HFLAG_RE 0x0100 /* Reversed endianness */ /* If translation is interrupted between the branch instruction and * the delay slot, record what type of branch it is so that we can * resume translation properly. It might be possible to reduce * this from three bits to two. */#define MIPS_HFLAG_BMASK 0x0e00#define MIPS_HFLAG_B 0x0200 /* Unconditional branch */#define MIPS_HFLAG_BC 0x0400 /* Conditional branch */#define MIPS_HFLAG_BL 0x0600 /* Likely branch */#define MIPS_HFLAG_BR 0x0800 /* branch to register (can't link TB) */ target_ulong btarget; /* Jump / branch target */ int bcond; /* Branch condition (if needed) */ int halted; /* TRUE if the CPU is in suspend state */ int SYNCI_Step; /* Address step size for SYNCI */ int CCRes; /* Cycle count resolution/divisor */ uint32_t CP0_Status_rw_bitmask; /* Read/write bits in CP0_Status */ uint32_t CP0_TCStatus_rw_bitmask; /* Read/write bits in CP0_TCStatus */ int insn_flags; /* Supported instruction set */#ifdef CONFIG_USER_ONLY target_ulong tls_value;#endif CPU_COMMON const mips_def_t *cpu_model;#ifndef CONFIG_USER_ONLY void *irq[8];#endif struct QEMUTimer *timer; /* Internal timer */};int no_mmu_map_address (CPUMIPSState *env, target_ulong *physical, int *prot, target_ulong address, int rw, int access_type);int fixed_mmu_map_address (CPUMIPSState *env, target_ulong *physical, int *prot, target_ulong address, int rw, int access_type);int r4k_map_address (CPUMIPSState *env, target_ulong *physical, int *prot, target_ulong address, int rw, int access_type);void r4k_do_tlbwi (void);void r4k_do_tlbwr (void);void r4k_do_tlbp (void);void r4k_do_tlbr (void);void mips_cpu_list (FILE *f, int (*cpu_fprintf)(FILE *f, const char *fmt, ...));void do_unassigned_access(target_phys_addr_t addr, int is_write, int is_exec, int unused);#define CPUState CPUMIPSState#define cpu_init cpu_mips_init#define cpu_exec cpu_mips_exec#define cpu_gen_code cpu_mips_gen_code#define cpu_signal_handler cpu_mips_signal_handler#define cpu_list mips_cpu_list/* MMU modes definitions. We carefully match the indices with our hflags layout. */#define MMU_MODE0_SUFFIX _kernel#define MMU_MODE1_SUFFIX _super#define MMU_MODE2_SUFFIX _user#define MMU_USER_IDX 2static inline int cpu_mmu_index (CPUState *env){ return env->hflags & MIPS_HFLAG_KSU;}#include "cpu-all.h"/* Memory access type : * may be needed for precise access rights control and precise exceptions. */enum { /* 1 bit to define user level / supervisor access */ ACCESS_USER = 0x00, ACCESS_SUPER = 0x01, /* 1 bit to indicate direction */ ACCESS_STORE = 0x02, /* Type of instruction that generated the access */ ACCESS_CODE = 0x10, /* Code fetch access */ ACCESS_INT = 0x20, /* Integer load/store access */ ACCESS_FLOAT = 0x30, /* floating point load/store access */};/* Exceptions */enum { EXCP_NONE = -1, EXCP_RESET = 0, EXCP_SRESET, EXCP_DSS, EXCP_DINT, EXCP_DDBL, EXCP_DDBS, EXCP_NMI, EXCP_MCHECK, EXCP_EXT_INTERRUPT, /* 8 */ EXCP_DFWATCH, EXCP_DIB, EXCP_IWATCH, EXCP_AdEL, EXCP_AdES, EXCP_TLBF, EXCP_IBE, EXCP_DBp, /* 16 */ EXCP_SYSCALL, EXCP_BREAK, EXCP_CpU, EXCP_RI, EXCP_OVERFLOW, EXCP_TRAP, EXCP_FPE, EXCP_DWATCH, /* 24 */ EXCP_LTLBL, EXCP_TLBL, EXCP_TLBS, EXCP_DBE, EXCP_THREAD, EXCP_MDMX, EXCP_C2E, EXCP_CACHE, /* 32 */ EXCP_LAST = EXCP_CACHE,};int cpu_mips_exec(CPUMIPSState *s);CPUMIPSState *cpu_mips_init(const char *cpu_model);uint32_t cpu_mips_get_clock (void);int cpu_mips_signal_handler(int host_signum, void *pinfo, void *puc);#endif /* !defined (__MIPS_CPU_H__) */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -