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

Smcsrind exception fixex #1896

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

JJ-Gaisler
Copy link

Fixes for: #1893
I have implemented smcdeleg in another branch and tested this implementation with smcdeleg and from the way I interpret the spec this should fix the issues I was seeing before. Let me know if something is poorly explained or incorrect.

@aswaterman
Copy link
Collaborator

Haven't had the chance to review yet, but please clean up the commit history to get rid of the merge commit and the commits with debug prints. In this case, squashing everything into a single commit is probably appropriate.

@JJ-Gaisler JJ-Gaisler force-pushed the smcsrind_fix branch 2 times, most recently from 44a4f87 to c9b298b Compare January 21, 2025 08:02
@JJ-Gaisler
Copy link
Author

I was just extending my testing and I noticed that checks for the s/hcontext bits is also missing, I'll be adding these soon. Should I also add hedelegh as a read-only zero CSR and incorporate the check for p1p13 while at it?

@aswaterman
Copy link
Collaborator

May as well, thank you!

@aswaterman
Copy link
Collaborator

You can add them to this PR if you prefer. Up to you.

missing proxy csr and check for csr privilege in sscsring_reg_csr_t
since mireg uses the same class.
Add stateen checks for scontext/hcontext
Fix for issue: 1893
@JJ-Gaisler
Copy link
Author

I couldn't find mstateen0_priv113 nor csr_hedelegh in the encoding.h file. I have added these constants in the code inline for now, I am waiting for riscv/riscv-opcodes#333

I have a test case which loops over CSRs that are affected by stateen, it checks that the correct trap is raised in all privilege modes. The test can be run with:
spike -m0x80000000:0x10000000,0x20000000:0x1000,0x4000:0x1000,0xB000:0x1000 --isa rv64gh_svinval_zba_zbb_zbc_zbs_zfh_zfa_zbkb_zbkx_zicsr_zifencei_sscofpmf_smstateen_smepmp_zicbom_zicntr_zihpm_svadu_sstc_zicond_smcsrind_sscsrind -p1 csr_test.txt

csr_test.txt

@aswaterman
Copy link
Collaborator

riscv-opcodes PR has been merged.

nibrunieAtSi5 and others added 6 commits February 7, 2025 11:58
Ensuring No negation on -2^63(int64_t) is performed during mulh/mulhsu

Signed-off-by: Nicolas Brunie <82109999+nibrunieAtSi5@users.noreply.github.com>

Update riscv/arith.h

Signed-off-by: Nicolas Brunie <82109999+nibrunieAtSi5@users.noreply.github.com>
Pointer masking needs to be reapplied after computing the address of the
tail of a misaligned access in case there's a carry-out into the MSBs.

Resolves riscv-software-src#1895
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.

6 participants