-
Notifications
You must be signed in to change notification settings - Fork 520
[debug] Misc debug fixes #632
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
Open
hirooih
wants to merge
9
commits into
riscv-software-src:master
Choose a base branch
from
hirooih:misc-debug-fixes
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+27
−19
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
300c38d
debug: test S and U are supported for tdata1
hirooih d55e525
debug: test S is supported in TranslateTest
hirooih 68257fb
debug: test implements_page_virtual_memory before executing sfence.vm…
hirooih f355fc3
debug: set size arguments of set_pmp_deny() to 8
hirooih ccda9c9
debug: rename honors_tdata1_hmode to honors_tdata1_dmode
hirooih fa13464
debug: fixed obsoleted openocd-command names
hirooih 9e92de6
debug: not to throw exception on an expected error
hirooih 0488fae
debug: call create() instead of target()
hirooih dd719cd
debug: VcsSim: make server start string configurable
hirooih File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -247,7 +247,8 @@ class VcsSim: | |
| logname = logfile.name | ||
| lognames = [logname] | ||
|
|
||
| def __init__(self, sim_cmd=None, debug=False, timeout=300): | ||
| def __init__(self, sim_cmd=None, debug=False, timeout=300, | ||
| server_started=r"^Listening on port (\d+)$"): | ||
| if sim_cmd: | ||
| cmd = shlex.split(sim_cmd) | ||
| else: | ||
|
|
@@ -281,7 +282,7 @@ def __init__(self, sim_cmd=None, debug=False, timeout=300): | |
| line = listenfile.readline() | ||
| if not line: | ||
| time.sleep(1) | ||
| match = re.match(r"^Listening on port (\d+)$", line) | ||
| match = re.match(server_started, line) | ||
| if match: | ||
| done = True | ||
| self.port = int(match.group(1)) | ||
|
|
@@ -321,11 +322,11 @@ def __init__(self, server_cmd=None, config=None, debug=False, timeout=60, | |
| # line, since they are executed in order. | ||
| cmd += [ | ||
| # Tell OpenOCD to bind gdb to an unused, ephemeral port. | ||
| "--command", "gdb_port 0", | ||
| "--command", "gdb port 0", | ||
| # We create a socket for OpenOCD command line (TCL-RPC) | ||
| "--command", "tcl_port 0", | ||
| "--command", "tcl port 0", | ||
| # don't use telnet | ||
| "--command", "telnet_port disabled", | ||
| "--command", "telnet port disabled", | ||
| ] | ||
|
|
||
| if config: | ||
|
|
@@ -1137,7 +1138,7 @@ def run_all_tests(module, target, parsed): | |
| return 0 | ||
|
|
||
| try: | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems like this |
||
| os.makedirs(parsed.logs) | ||
| os.makedirs(parsed.logs, exist_ok=True) | ||
| except OSError: | ||
| # There's a race where multiple instances of the test program might | ||
| # decide to create the logs directory at the same time. | ||
|
|
@@ -1492,14 +1493,16 @@ def set_pmp_deny(self, address, size=4 * 1024): | |
| self.gdb.p("$pmpcfg0=0x98") # L, NAPOT, !R, !W, !X | ||
| self.gdb.p("$pmpaddr0=" | ||
| f"0x{((address >> 2) | ((size - 1) >> 3)):x}") | ||
| # PMP changes require an sfence.vma, 0x12000073 is sfence.vma | ||
| self.gdb.command("monitor riscv exec_progbuf 0x12000073") | ||
| 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") | ||
|
|
||
| def reset_pmp_deny(self): | ||
| self.gdb.p("$pmpcfg0=0") | ||
| self.gdb.p("$pmpaddr0=0") | ||
| # PMP changes require an sfence.vma, 0x12000073 is sfence.vma | ||
| self.gdb.command("monitor riscv exec_progbuf 0x12000073") | ||
| 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") | ||
|
|
||
| def disable_pmp(self): | ||
| # Disable physical memory protection by allowing U mode access to all | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm afraid this will break the targets with insufficient PMP granularity (see [3.7.1.1. Address Matching] of the Priv Spec).
One way to address this is to:
Perhaps there is a better way to address the issue. In any case this needs to be addressed.