Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sfence.vma in the disable_pmp function #537

Merged
merged 1 commit into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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

# Support set_pmp_deny to create invalid addresses.
support_set_pmp_deny = False

Expand Down
3 changes: 3 additions & 0 deletions debug/testlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -1514,6 +1514,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
Loading