riscv: preserve fflags when rejecting a reserved frm value - #280
Open
carlosqwqqwq wants to merge 1 commit into
Open
riscv: preserve fflags when rejecting a reserved frm value#280carlosqwqqwq wants to merge 1 commit into
carlosqwqqwq wants to merge 1 commit into
Conversation
purplesyringa
requested changes
Aug 12, 2026
| return; | ||
| // Invalid rounding mode written: keep the old FRM value per | ||
| // WARL semantics, but still apply the other fields of fcsr | ||
| new_fcsr = bit_replace(new_fcsr, 5, 3, old_frm); |
Collaborator
There was a problem hiding this comment.
Maybe reconstruct new_fcsr from the patched new_frm/new_fflags once at writeback so that this isn't a path uncovered by most tests?
Author
There was a problem hiding this comment.
Thanks! Reworked: fcsr is now reconstructed from the patched frm/fflags once at writeback (vm->csr.fcsr = (new_fcsr & ~CSR_FCSR_MASK) | new_fflags | (new_frm << 5)), so the reserved-frm path shares the same writeback as every other path. Rebuilt cleanly and force-pushed.
carlosqwqqwq
force-pushed
the
fix/fcsr-reserved-frm-fflags
branch
from
August 12, 2026 23:53
93b0a47 to
9e96a86
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
riscv: preserve fflags when rejecting a reserved frm value
Fixes #274
Commit message
Description
riscv_update_fcsr()currently returns before committing the writablefflagsfield when the incomingfrmvalue is reserved. Keep the old/WARLfrmvalue and continue applying the independentfflagsbits. The change is limited tosrc/cpu/riscv_csr.c; the probe and research logs are not part of the upstream change.Validation