valheim icon indicating copy to clipboard operation
valheim copied to clipboard

Just for fun riscv64 emulator, which boots the Linux.

valheim

Learning purpose riscv64 (RV64GC) emulator. This project is built for 一生一芯 as a reference implementation.

Highlights

  • Type-safe instructions which makes the decoding less error-prone.
  • Full emulation trace (registers, memory, etc.) like persistent data structures, which is useful for debugging the real hardware.
  • MISA = RV64ACDFIMSU
    • RV64G (IMAFD_Zicsr_Zifencei) instruction set
    • RVC extension
    • Supervisor mode extension
    • User mode extension

Amazing Moments

Running openEuler Linux for RISC-V

Currently, the init program cannot use serial device as console (I am trying hard to find the cause). But the kernel was indeed successfully booted and initialized.

I was thinking that should I just give up trying to fix the console problem, instead, go and implement a virtio-net device and start the sshd service when booted? It's not that hard comparingly, and it's closer to the real-world use case.

asciicast

Running RustSBI-QEMU with its test kernel

With the following command:

cargo run --release -- --kernel tests/test-kernel.bin --bios tests/rustsbi-qemu.bin

rustsbi-booting

Running xv6 for RISC-V

With the following command:

$(CROSS)objcopy -O binary xv6/kernel xv6/kernel.bin
cargo run --release -- --kernel xv6/kernel.bin --disk xv6/fs.img

xv6-booting