Skip to content

Commit

Permalink
Merge pull request riscv-software-src#1632 from YenHaoChen/pr-scontext
Browse files Browse the repository at this point in the history
Narrow scontext.data length to 32
  • Loading branch information
aswaterman committed Mar 25, 2024
2 parents 4f84dd2 + fe5c249 commit 3427b45
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion riscv/processor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ void state_t::reset(processor_t* const proc, reg_t max_isa)
csrmap[CSR_TDATA3] = std::make_shared<const_csr_t>(proc, CSR_TDATA3, 0);
csrmap[CSR_TINFO] = std::make_shared<const_csr_t>(proc, CSR_TINFO, 0);
}
unsigned scontext_length = (xlen == 32 ? 16 : 34); // debug spec suggests 16-bit for RV32 and 34-bit for RV64
unsigned scontext_length = (xlen == 32 ? 16 : 32); // debug spec suggests 16-bit for RV32 and 32-bit for RV64
csrmap[CSR_SCONTEXT] = scontext = std::make_shared<masked_csr_t>(proc, CSR_SCONTEXT, (reg_t(1) << scontext_length) - 1, 0);
unsigned hcontext_length = (xlen == 32 ? 6 : 13) + (proc->extension_enabled('H') ? 1 : 0); // debug spec suggest 7-bit (6-bit) for RV32 and 14-bit (13-bit) for RV64 with (without) H extension
csrmap[CSR_HCONTEXT] = std::make_shared<masked_csr_t>(proc, CSR_HCONTEXT, (reg_t(1) << hcontext_length) - 1, 0);
Expand Down

0 comments on commit 3427b45

Please sign in to comment.