Skip to content

Commit

Permalink
Add support for sfence.vma instruction
Browse files Browse the repository at this point in the history
  • Loading branch information
buildandcrash committed Jun 13, 2024
1 parent cb9eace commit c30d3ce
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions libr/arch/p/riscv/riscv-opc.c
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,7 @@ static const struct riscv_opcode riscv_builtin_opcodes[] = {
{ "hret", "I", "", MATCH_HRET, MASK_HRET, match_opcode, 0 },
{ "mret", "I", "", MATCH_MRET, MASK_MRET, match_opcode, 0 },
{ "dret", "I", "", MATCH_DRET, MASK_DRET, match_opcode, 0 },
{ "sfence.vma","I", "s,t", MATCH_SFENCE_VMA, MASK_SFENCE_VMA, match_opcode, 0 },
{ "sfence.vm", "I", "", MATCH_SFENCE_VM, MASK_SFENCE_VM | MASK_RS1, match_opcode, 0 },
{ "sfence.vm", "I", "s", MATCH_SFENCE_VM, MASK_SFENCE_VM, match_opcode, 0 },
{ "wfi", "I", "", MATCH_WFI, MASK_WFI, match_opcode, 0 },
Expand Down
2 changes: 2 additions & 0 deletions libr/arch/p/riscv/riscv-opc.h
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,8 @@
#define MASK_MRET 0xffffffff
#define MATCH_DRET 0x7b200073
#define MASK_DRET 0xffffffff
#define MATCH_SFENCE_VMA 0x12000073
#define MASK_SFENCE_VMA 0xfe007fff
#define MATCH_SFENCE_VM 0x10400073
#define MASK_SFENCE_VM 0xfff07fff
#define MATCH_WFI 0x10500073
Expand Down
3 changes: 2 additions & 1 deletion libr/asm/d/riscv.sdb.txt
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,8 @@ sd=store double word (64 bits)
seqz=set if equal to zero
sext=two complement
sextw=two complement word
sfence.vm=supervisor-mode fence for virtual memory
sfence.vma=supervisor-mode fence for virtual memory
sfence.vm=supervisor-mode fence for virtual memory (Deprecated)
sgtz=set if greater than zero
sh=store half-word (16 bits)
slli=shift left logically by immediate
Expand Down

0 comments on commit c30d3ce

Please sign in to comment.