Skip to content

Commit

Permalink
Merge pull request #443 from ChinYikMing/sret-can-branch
Browse files Browse the repository at this point in the history
Specify can_branch and decode the sret instruction
  • Loading branch information
jserv authored May 27, 2024
2 parents 69fae57 + 6f8864b commit a968310
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/decode.c
Original file line number Diff line number Diff line change
Expand Up @@ -826,10 +826,12 @@ static inline bool op_system(rv_insn_t *ir, const uint32_t insn)
break;
case 0x105: /* WFI: Wait for Interrupt */
case 0x002: /* URET: return from traps in U-mode */
case 0x102: /* SRET: return from traps in S-mode */
case 0x202: /* HRET: return from traps in H-mode */
/* illegal instruciton */
/* illegal instruction */
return false;
case 0x102: /* SRET: return from traps in S-mode */
ir->opcode = rv_insn_sret;
break;
case 0x302: /* MRET */
ir->opcode = rv_insn_mret;
break;
Expand Down
2 changes: 1 addition & 1 deletion src/decode.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ enum op_field {
/* RISC-V Privileged Instruction */ \
_(wfi, 0, 4, 0, ENC(rs1, rd)) \
_(uret, 0, 4, 0, ENC(rs1, rd)) \
_(sret, 0, 4, 0, ENC(rs1, rd)) \
_(sret, 1, 4, 0, ENC(rs1, rd)) \
_(hret, 0, 4, 0, ENC(rs1, rd)) \
_(mret, 1, 4, 0, ENC(rs1, rd)) \
/* RV32 Zifencei Standard Extension */ \
Expand Down

0 comments on commit a968310

Please sign in to comment.