Closed mndstrmr closed 1 month ago
From my reading of the privileged spec, TW also applies in user mode:
If you agree this issue should be opened on the Sail repository.
@rmn30 , do you know whether we differ with the upstream sail over how to handle WFI and TW bit?
Looks like upstream sail-riscv
is exactly the same so should probably file an issue there. Of course doesn't make any difference to CHERIoT since there is no User mode. Do we make mstatus.TW
read only?
Since I am now using a modified version of the specification which fixes this issue, this proves, so I will close this for now.
According to the Sail, WFI should be illegal when invoked in user mode:
https://github.com/CHERIoT-Platform/sail-riscv/blob/cf541bea6be2d612c9bc91af032ab277a3756512/model/riscv_insts_base.sail#L764-L771
Currently the controller has this: https://github.com/microsoft/cheriot-ibex/blob/4a739b4f4bcf0324633ba4d7a0286fa6dfd9a04f/rtl/ibex_controller.sv#L235-L237
The
csr_mstatus_tw_i
would be necessary for supervisor mode (which is not implemented), but is not for user mode.