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

target/riscv: check misa value before reporting #1112

Merged
merged 1 commit into from
Sep 6, 2024

Conversation

en-sc
Copy link
Collaborator

@en-sc en-sc commented Aug 9, 2024

Currently, during register file examination:

  1. A read of an XPR is attempted via 64-bit abstract access.
  2. If such a read fails (e.g. connection unstable) XLEN is assumed to be
    32.
  3. Then misa is read. Since misa is a CSR and it may be only
    readable via program buffer, s0 should be readable beforehand (at
    least some assumption about xlen should be made).
  4. Before the commit, the misa.mxl field was not checked against
    xlen, therefore erroneous info may have been reported to the user.
    Moreover, the examine() would pass indicating no error at all.
  5. After the commit, misa.mxl is checked against xlen value.

@en-sc
Copy link
Collaborator Author

en-sc commented Aug 9, 2024

Depends on #1101

Copy link
Collaborator

@JanMatCodasip JanMatCodasip left a comment

Choose a reason for hiding this comment

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

Overall, this looks fine to me, thank you. I have only posted few minor comments.

src/target/riscv/riscv-013_reg.c Outdated Show resolved Hide resolved
src/target/riscv/riscv-013_reg.c Outdated Show resolved Hide resolved
src/target/riscv/riscv-013_reg.c Outdated Show resolved Hide resolved
Currently, during register file examination:
1. A read of an XPR is attempted via 64-bit abstract access.
2. If such a read fails (e.g. connection unstable) XLEN is assumed to be
   32.
3. Then `misa` is read. Since `misa` is a CSR and it may be only
   readable via program buffer, `s0` should be readable beforehand (at
   least some assumption about `xlen` should be made).
4. Before the commit, the `misa.mxl` field was not checked against
   `xlen`, therefore erroneous info may have been reported to the user.
   Moreover, the `examine()` would pass indicating no error at all.
5. After the commit, `misa.mxl` is checked against `xlen` value.

Change-Id: I3fe5bd6742e564e6de782aad9ed10e65c0728923
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
@en-sc en-sc merged commit 3cd99c0 into riscv-collab:riscv Sep 6, 2024
4 checks passed
@en-sc en-sc deleted the en-sc/misa-xlen branch September 6, 2024 12:58
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