Port-RISCV archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Introduction and partially bootable RISC-V64 kernel with QEMU

Hi all!  This is my first message to a NetBSD mailing list.  I've been
lurking for a while.

I've been getting more into NetBSD in the last couple years, and I
also have been pretty excited about RISC-V.  Given its reputation for
being ultra-portable, I was surprised that it didn't already have a
mature port.  I've been poking at it off and on for about a year now,
and this spring, I decided to make a big push.

So, as of now, I wrote a dedicated pmap module and spent a lot of time
running GDB against the kernel in QEMU.  I've gotten it to the point
where it will start a test init from an md root device that can print
to the sbi console, run syscalls and run through the basic process
life cycle.  The big things that are missing are any kind of clock
driver, so it's cooperative multitasking only right now, and a lot of
other driver infrastructure.  Particularly devicetree support.

I'm really impressed with the code that was already there.  Much of
the trap code worked with minimal modification (there were a handful
of typos of the sort that everyone makes, but I didn't have to figure
out the structure of it).  Having the basic stubs for everything in a
form that built made this much more approachable.  The only thing that
really needed a major overhaul was the page table handling, and even
there, a bunch of good decisions had been made and outlined in the
code about things like memory map layout.  Thank you to everyone who
touched this code ahead of me.

I have a bunch more to write up (like: what my exact build and run
commands were), and I should have time to get that out this weekend,
but I wanted to get this email out now (I'm pretty excited to finally
have something worth showing the list).  I put the code up on


Feel free to take a look and if you run into trouble building it, let
me know.  I've been working from an older -current snapshot.  My next
two projects are to try it with an up-to-date source tree and to get
it running on Real Hardware (I have a SiFive HiFive Unmatched sitting
on my desk).  After that, a bunch of driver work, devicetree support
and getting a full build of userland.


Home | Main Index | Thread Index | Old Index