Skip to content

Commit

Permalink
Add sfence.vma in the disable_pmp function
Browse files Browse the repository at this point in the history
Signed-off-by: liangzhen <[email protected]>
Change-Id: Ief659c0e68618f5b08a1eee98bc7df92817b8b51
  • Loading branch information
lz-bro committed Mar 2, 2024
1 parent 67e7759 commit 4407a9c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions debug/targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@ class Target:
# Instruction count limit
icount_limit = 4

# Implements page-based virtual memory. So when PMP changes execute an
# SFENCE.VMA
implements_page_virtual_memory = True

# Internal variables:
directory = None
temporary_files = []
Expand Down
3 changes: 3 additions & 0 deletions debug/testlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -1453,6 +1453,9 @@ def disable_pmp(self):
# pmcfg0 readback matches write, so TOR is supported.
self.gdb.p("$pmpaddr0="
f"0x{(self.hart.ram + self.hart.ram_size) >> 2:x}")
if self.target.implements_page_virtual_memory:
# PMP changes require an sfence.vma, 0x12000073 is sfence.vma
self.gdb.command("monitor riscv exec_progbuf 0x12000073")
except CouldNotFetch:
# PMP registers are optional
pass
Expand Down

0 comments on commit 4407a9c

Please sign in to comment.