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

fix(csr): htinst/mtinst are always written 0 when trap in XiangShan #33

Merged
merged 1 commit into from
Sep 10, 2024

Conversation

cebarobot
Copy link
Member

Currently, XiangShan only support writing 0 to htinst & mtinst CSRs when trap occurs. To align with XiangShan, this patch wraps the update of htinst & mtinst CSRs in take_trap function.

Currently, XiangShan only support writing 0 to htinst & mtinst CSRs when trap occurs. To align with XiangShan, this patch wraps the update of htinst & mtinst CSRs in take_trap function.
@huxuan0307 huxuan0307 merged commit 347cd0e into difftest Sep 10, 2024
3 checks passed
@cebarobot cebarobot deleted the fix-tinst branch September 10, 2024 13:02
cebarobot added a commit that referenced this pull request Sep 14, 2024
This reverts commit 347cd0e (#33). 

According to RISC-V priv spec, htinst/mtinst could be zero when traps into HS/M-mode, except the both following conditions are met:
* the fault is caused by an implicit memory access for VS-stage address translation
* a nonzero value (the faulting guest physical address) is written to mtval2 or htval

Actually, XiangShan would write a nonzero value in such trap, so mtinst could not be written 0.

Acctually, spike only implements this nonzero situation for htinst/mtinst, so no more warps are needed.
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.

2 participants