The cause code of a trap changes when qemu is nested in another qemu
Host environment
-
Operating system: Ubuntu
-
OS/kernel version: 6.5.0-15-generic #15~22.04.1-Ubuntu
-
Architecture: x86
-
QEMU flavor: qemu-system-riscv64
-
QEMU version: 7.2
-
QEMU command line:
qemu-system-riscv64 -machine virt -m 4096 -smp 4 -nographic -bios /usr/lib/riscv64-linux-gnu/opensbi/generic/fw_jump.bin -kernel /usr/lib/u-boot/qemu-riscv64_smode/uboot.elf -drive file=ubuntu-22.04.4-preinstalled-server-riscv64+unmatched.img,format=raw,if=virtio -netdev user,id=mynet0 -device virtio-net-pci,netdev=mynet0
Emulated/Virtualized environment
- Operating system: Ubuntu
- OS/kernel version: 22.04.3
- Architecture: RiscV64
Description of problem
I am studying the feasibility of doing some practical work on RISCV plates. Since I don't have these boards yet, I'm emulating it with qemu. The practice in turn consists of launching with qemu a very small operating system with two tasks that make a series of system calls.
When I run this practice on my host it works correctly, but when I run it on an Ubuntu emulated in riscv with qemu, the cause code for the trap changes (the first bit of the code).
The demo can be found in this repository: https://github.com/Sft570/qemu-bug-report
Steps to reproduce
- Clone the repository on the host and run the demo with "make qemu"
- Emulate with qemu ubuntu in riscv, clone the repository and run the demo with "make qemu".
The error displayed shows the change of the cause code bit. You can analyze its behavior in the trap.c file in the src folder.