|
|
@ -28,6 +28,8 @@ const int SHAMT_BITS = 6; |
|
|
const int FUNCT_BITS = 3; |
|
|
const int FUNCT_BITS = 3; |
|
|
const int FFUNCT_BITS = 5; |
|
|
const int FFUNCT_BITS = 5; |
|
|
const int BIGIMM_BITS = 20; |
|
|
const int BIGIMM_BITS = 20; |
|
|
|
|
|
const int BRANCH_ALIGN_BITS = 1; |
|
|
|
|
|
const int JUMP_ALIGN_BITS = 1; |
|
|
|
|
|
|
|
|
#define SR_ET 0x0000000000000001ULL |
|
|
#define SR_ET 0x0000000000000001ULL |
|
|
#define SR_PS 0x0000000000000004ULL |
|
|
#define SR_PS 0x0000000000000004ULL |
|
|
@ -129,8 +131,8 @@ union insn_t |
|
|
#define SIMM ((int32_t)((uint32_t)insn.itype.imm<<(32-IMM_BITS))>>(32-IMM_BITS)) |
|
|
#define SIMM ((int32_t)((uint32_t)insn.itype.imm<<(32-IMM_BITS))>>(32-IMM_BITS)) |
|
|
#define SHAMT insn.rtype.shamt |
|
|
#define SHAMT insn.rtype.shamt |
|
|
#define TARGET insn.jtype.target |
|
|
#define TARGET insn.jtype.target |
|
|
#define BRANCH_TARGET (npc + (SIMM*sizeof(insn_t))) |
|
|
#define BRANCH_TARGET (pc + (SIMM << BRANCH_ALIGN_BITS)) |
|
|
#define JUMP_TARGET ((npc & ~((1<<TARGET_BITS)*sizeof(insn_t)-1)) + TARGET*sizeof(insn_t)) |
|
|
#define JUMP_TARGET ((pc & ~((1<<(TARGET_BITS+JUMP_ALIGN_BITS))-1)) + (TARGET << JUMP_ALIGN_BITS)) |
|
|
|
|
|
|
|
|
#define require_supervisor if(!(sr & SR_S)) throw trap_privileged_instruction |
|
|
#define require_supervisor if(!(sr & SR_S)) throw trap_privileged_instruction |
|
|
#define require64 if(gprlen != 64) throw trap_illegal_instruction |
|
|
#define require64 if(gprlen != 64) throw trap_illegal_instruction |
|
|
|