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 FCSR accesses under Zfinx #1848

Merged
merged 2 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions riscv/csrs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1410,8 +1410,9 @@ float_csr_t::float_csr_t(processor_t* const proc, const reg_t addr, const reg_t

void float_csr_t::verify_permissions(insn_t insn, bool write) const {
masked_csr_t::verify_permissions(insn, write);
require_fs;
if (!proc->extension_enabled('F') && !proc->extension_enabled(EXT_ZFINX))

if (!((proc->extension_enabled('F') && STATE.sstatus->enabled(SSTATUS_FS))
|| proc->extension_enabled(EXT_ZFINX)))
throw trap_illegal_instruction(insn.bits());

if (proc->extension_enabled(EXT_SMSTATEEN) && proc->extension_enabled(EXT_ZFINX)) {
Expand All @@ -1431,7 +1432,8 @@ void float_csr_t::verify_permissions(insn_t insn, bool write) const {
}

bool float_csr_t::unlogged_write(const reg_t val) noexcept {
dirty_fp_state;
if (!proc->extension_enabled(EXT_ZFINX))
dirty_fp_state;
return masked_csr_t::unlogged_write(val);
}

Expand Down
1 change: 0 additions & 1 deletion riscv/decode_macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ static inline bool is_aligned(const unsigned val, const unsigned pos)
#define require_extension(s) require(p->extension_enabled(s))
#define require_either_extension(A,B) require(p->extension_enabled(A) || p->extension_enabled(B));
#define require_impl(s) require(p->supports_impl(s))
#define require_fs require(STATE.sstatus->enabled(SSTATUS_FS))
#define require_fp STATE.fflags->verify_permissions(insn, false)
#define require_accelerator require(STATE.sstatus->enabled(SSTATUS_XS))
#define require_vector_vs require(p->any_vector_extensions() && STATE.sstatus->enabled(SSTATUS_VS))
Expand Down
Loading