From: Frédéric Pétrot <[email protected]>

Peter reported undefined behaviors in x-rv128 pmp configuration
registers accesses detected by the clang sanitizer.
This series introduces a 128-bit version of these accesses, and
corrects other out-of-bound shifts within the handling of interrupts
that were triggered afterwards.

Changes in v3:
- Extract the "interrupt" bitfield in the different versions of the
  cause register in a separate field of cpu.h and build the cause
  registers value on demand,
- Add these new fields into the machine migration state,
- Check that the pmp registers used in rv128 are only those allowed,
- Add tcg tests for mcause and scause accesses.

Changes in v2:
- I messed up and directly assigned a 0 to an Int128, so v2 corrects
  that.

Frédéric Pétrot (4):
  target/riscv: fix pmp sanitize error for x-rv128
  target/riscv: fix riscv_cpu_do_interrupt sanitize error for x-rv128
  target/riscv: Update machine state
  target/riscv: [ms]cause tcg tests for x-rv128

 target/riscv/cpu.c                    |   1 +
 target/riscv/cpu.h                    |   4 +
 target/riscv/machine.c                |   4 +
 target/riscv/tcg/cpu_helper.c         |  20 +++-
 target/riscv/tcg/csr.c                | 131 +++++++++++++++++++++-----
 target/riscv/tcg/csr.h                |   3 +
 target/riscv/tcg/pmp.c                |  38 ++++++++
 tests/tcg/riscv64/system/meson.build  |  14 +++
 tests/tcg/riscv64/test-rv128-mcause.S | 101 ++++++++++++++++++++
 tests/tcg/riscv64/test-rv128-scause.S |  94 ++++++++++++++++++
 10 files changed, 382 insertions(+), 28 deletions(-)
 create mode 100644 tests/tcg/riscv64/test-rv128-mcause.S
 create mode 100644 tests/tcg/riscv64/test-rv128-scause.S

-- 
2.43.0


Reply via email to