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

PMP backward-compatible defaults could be misleading #1850

Open
caizixian opened this issue Nov 1, 2024 · 2 comments
Open

PMP backward-compatible defaults could be misleading #1850

caizixian opened this issue Nov 1, 2024 · 2 comments

Comments

@caizixian
Copy link

According to the privileged spec (Section 3.7.1.3 of version 20240411)

If at least one PMP entry is implemented, but all PMP entries' A fields are set to OFF, then all S-mode and U-mode memory accesses will fail.

Currently Spike initializes PMP permissively.

put_csr(CSR_PMPADDR0, ~reg_t(0));

This could lead to software developers debugging against Spike ignoring the need to program PMP (I made that mistake today, and the same executable that works on Spike doesn't on Rocket Chip).

@aswaterman
Copy link
Collaborator

As a reminder, Spike's behavior is explicitly legal, because the Reset section in the Machine Mode chapter allows for platform-specific reset values.

I acknowledge that this property caused you to waste some time, but I can assure you that reversing this property will result in quite a bit more friction. Still, we should hear what others have to say. cc @jerryz123

@caizixian
Copy link
Author

Thanks for the clarification @aswaterman . I actually had a similar problem shortly after: Rocket Chip uses Reg for mideleg and medeleg, and I got some nondeterministic U-mode ecall behavior on Verilator, when sometimes user ecall is delegated to uninitialized bogus stvec. You are right that the Reset section permits such behaviors.

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

No branches or pull requests

2 participants