- Start the monitor with
Ctrl + AthenC - Exit QEMU by using
qin the monitor - Use
info registersto view CPU regs - Use
stopandcontto control execution
unimp is a "pseudo" instruction.
According to RISC-V Assembly Programmer's Manual, the assembler translates unimp to the following instruction:
csrrw x0, cycle, x0
This reads and writes the cycle register into x0. Since cycle is a read-only register, CPU determines that the instruction is invalid and triggers an illegal instruction exception.
qemu-system-riscv64 -machine virt -bios default -nographic -serial mon:stdio --no-reboot -gdb tcp::1234 -S -kernel kernel.elf