[PATCH v1 0/2] target/riscv: Write zero into mtinst/htinst for Zicfiss instructions

Alvin Chang via qemu development posted 2 patches 5 days, 14 hours ago
target/riscv/instmap.h        | 17 ++++++++++++++++-
target/riscv/tcg/cpu_helper.c | 23 +++++++++++++++++++----
2 files changed, 35 insertions(+), 5 deletions(-)
[PATCH v1 0/2] target/riscv: Write zero into mtinst/htinst for Zicfiss instructions
Posted by Alvin Chang via qemu development 5 days, 14 hours ago
On any trap into M-mode or HS-mode, a zero, or a transformed instruction may be
written automatically into the appropriate trap instruction CSR, mtinst or
htinst. The privileged spec section "Transformed Instruction or
Pseudoinstruction for mtinst or htinst" lists the instructions that may
automatically write a value into mtinst/htinst CSR, and the section also says:
"If a synchronous trap occurs for a standard instruction for which no
transformation has been defined, the trap instruction register shall be written
with zero".

The instructions (SSAMOSWAP, SSPUSH and SSPOPCHK) defined in the Zicfiss
extension are not listed in that section of the privileged spec. Thus, the
mtinst/htinst shall be written with zero for these three instructions.

Alvin Chang (2):
  target/riscv: Write zero into mtinst/htinst for SSAMOSWAP faults
  target/riscv: Write zero into mtinst/htinst for SSPUSH/SSPOPCHK faults

 target/riscv/instmap.h        | 17 ++++++++++++++++-
 target/riscv/tcg/cpu_helper.c | 23 +++++++++++++++++++----
 2 files changed, 35 insertions(+), 5 deletions(-)


base-commit: e9fa1f66f0d47c74b6766e1b8b87ad7c2a9394d5
-- 
2.43.0