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

Set PMP to create invalid address #535

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lz-bro
Copy link
Contributor

@lz-bro lz-bro commented Feb 2, 2024

Some hardware has full address coverage, so set PMP to create invalid address

Change-Id: I707281626521d321aadb6cee5aea457fc5c0424d

debug/testlib.py Outdated

def reset_pmp_deny(self):
try:
import math
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you really need this import here?

debug/testlib.py Outdated
self.gdb.p("$pmpcfg0=0x98") # L, NAPOT, !R, !W, !X
self.gdb.p("$pmpaddr0="
f"0x{((address >> 2) | ((size - 1) >> 3)):x}")
self.gdb.command("monitor riscv exec_progbuf 0x12000073") # 0x12000073 is sfence.vma
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would double-check if we need to flush register cache after modification of pmp* stuff

self.gdb.command("monitor riscv exec_progbuf 0x12000073") # 0x12000073 is sfence.vma
except CouldNotFetch:
# PMP registers are optional
pass
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. can you add some indication in the log that an attempt resulted in a some kind of exception?
  2. do you really need this try block since you've introduced this support_set_pmp_deny property for the target?

Signed-off-by: liangzhen <zhen.liang@spacemit.com>
Change-Id: I707281626521d321aadb6cee5aea457fc5c0424d
@en-sc en-sc requested a review from aap-sc July 1, 2024 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants