A rv32i virtual machine, implemented in Bash.
Bash and coreutils. I did this mess on Alpine Linux edge with busybox and bash 5.2.26 and everything worked well.
$ barv.sh BINARY
The binary specified as argument will be loaded into memory, starting from 0x00000000. PC is set to 0 when the virtual machine starts.
Some functionalities are provided through ecall
. a0
contains ecall number.
0
: system shutdown (exit the VM)1
: register dump (dump outa1
)2
: ASCII putchar (character is stored ina1
)
ebreak
could be used to print a snapshot of registers.
barv has passed a port of riscv-tests. But there are still bugs I think.