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

how to understand bit 63 in mstateen0 is defined to control access to the matching sstateen and hstateen CSRs? #1528

Open
ZeyueShen opened this issue Jul 13, 2024 · 2 comments

Comments

@ZeyueShen
Copy link

In spec:
https://github.com/riscvarchive/riscv-state-enable/blob/main/content.adoc
clipbord_1720835480865

It describes that access to hstateen0 csr is controlled by mstateen0[63], but does not specify whether failure to access will result in an exception. Similarly, access to sstateen0 csr is controlled by hstateen0[63], and there is no mention of non-access handling.

But in spike:
clipbord_1720836727929

It means that when mstateen0[63] is zero, access to hstateen0 in privileged mode less than m mode will cause an illegal instruction exception.
clipbord_1720836857257

It means that when mstateen0[63] & hstateen0[63] is zero, accessing sstateen0 in virtualization mode causes a virtual instruction exception.

So can you describe in detail the controlled access of hstateen0 and sstateen0? I am looking forward to your answer!

@gfavor
Copy link
Collaborator

gfavor commented Jul 16, 2024

The spec (section 4.1) says:

"when a stateen CSR prevents access to state by less privileged levels, an attempt in one of those privilege modes to execute an instruction that would read or write the protected state raises an illegal instruction exception, or, if executing in VS or VU mode
and the circumstances for a virtual instruction exception apply, raises a virtual instruction exception
instead of an illegal instruction exception."

@ZeyueShen
Copy link
Author

ok, Thanks for your reply!

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