Closed JJ-Gaisler closed 3 months ago
cc @i2h2, who contributed Sstc extension support
I believe xcounteren
is checked by state->time_proxy->verify_permissions
. Please let me know if that's not the case. The spec says the privilege mode needs to be S or VS, e.g., "when the TM bit in the mcounteren register is clear, attempts to access the stimecmp register while executing in S-mode will cause an illegal instruction exception."
Tanks for the clarification, it looks like my test had a bug, closing the issue.
Hi, I am having issues with the exception behavior of read/writes of the stimecmp/vstimecmp CSRs. The priv spec clearly states that m/hcounteren.tm has relevance for the exception behavior of these CSRs.
I checked the implementation of the stimecmp_csr_t class and this one doesn't consider the counteren CSRs at all. Below you can find a patch for what I think is the correct behavior, for now keeping the debug prints in there.
I have a test which loops through all state which can affect the exception behavior of the sstc extension, i.e. misa.h m/hcounteren, m/henvcfg, privilege mode, virtualization mode. If the test runs successfully it should only fail on an assert for current_checksum. The test can be ran with:
spike -m0x80000000:0x10000000,0x20000000:0x1000,0x4000:0x1000,0xB000:0x1000 --isa rv64gvh_svinval_zba_zbb_zbc_zbs_zfh_zbkb_zicsr_zifencei_sscofpmf_smepmp_zicbom_zicntr_zihpm_svadu_sstc -p1 hypervisor_tests.txt
hypervisor_tests.txt