QEMU not writting to mtval for cbo illegal instructions
## Host environment - Operating system: AlmaLinux 9.7 - Architecture: x86_64 - QEMU flavor: qemu-system-riscv64 - QEMU version: QEMU emulator version 10.2.0 (v10.2.0) - QEMU command line: ``` qemu-system-riscv64 -S -M virt -nographic -bios none -kernel ExceptionsZicboU-00.elf -gdb tcp::1234 ``` ## Emulated/Virtualized environment - Operating system: bare-metal test - OS/kernel version: N/A - Architecture: riscv64 ## Description of problem I am writing a test to exercise the cbo instructions that will cause various exceptions for the Zicbo extension. I reproduced this under GDB with a minimal test case. In GDB, the value remains `0x0 `for `cbo.inval` that trapped, but is set to `0x1502573 `for a trapping `csrrs x10, seed, x0` ## Steps to reproduce The following are for an illegal cbo instruction: 1. Start QEMU and wait for GDB to attach: `qemu-system-riscv64 -S -M virt -nographic -bios none -kernel ExceptionsZicboU-00.elf -gdb tcp::1234` 2. In another terminal, attach GDB: `riscv64-unknown-elf-gdb -ex "target remote :1234" -iex "file ExceptionsZicboU-00.elf"` 3. In GDB, display the current instruction and continue to the `cbo.inval` instruction `display /i $pc` `b ExceptionsZicboU_cg_cp_cbie_cbo_inval_mode0_menvcfg_cbie00` `c` 4. Single-step the `cbo.inval` and observe that execution transfers to the trap handler: `stepi` 5. Check the value of mtval: `p/x $mtval` The following are for another illegal instruction (as an example of expected behavior): 1. Start QEMU and wait for GDB to attach: `qemu-system-riscv64 -S -M virt -nographic -bios none -kernel ExceptionsSm-00.elf -gdb tcp::1234` 2. In another terminal, attach GDB: `riscv64-unknown-elf-gdb -ex "target remote :1234" -iex "file ExceptionsSm-00.elf"` 3. In GDB, display the current instruction and continue to the `csrrs` instruction `display /i $pc` `b ExceptionsSm_cg_cp_illegal_instruction_seed_seed_csrrs` `c` 4. Single-step the `csrrs` and observe that execution transfers to the trap handler: `stepi` 5. Check the value of mtval `p/x $mtval` Expected result: * the mtval value should be set to appropriate values based on the cause of the trap for both instructions Observed Result: * mtval value remains to be `0x0` for a trapping `cbo.inval` but is set appropriately for `csrrs x10, seed, x0` <!--The line below ensures that proper tags are added to the issue. Please do not remove it.-->
issue