Custom Operating System

Written December 17, 2023 • Last edited March 20, 2024


DISCLAIMER: This was a five-person group project, and it certainly would not have gotten done without the respectable efforts of most of my teammates. However, I would like to take credit for a majority of the work aside from the starred bullet points below. :-)

This operating system runs in QEMU and targets the RISC-V architecture. It is mostly written in C (some assembly required) and boasts the following features:

  • page-grained physical memory allocation
  • RISC-V Sv39 MMU (39-bit virtual addresses, 56-bit physical addresses)
    • separate address spaces for the kernel heap and each process' stack and heap
  • PCIe memory-mapped I/O
  • drivers for the following VirtIO devices:
    • random number generator*
    • keyboard input*
    • tablet input
    • block devices (to mount .dsk files to)
    • GPU (for drawing rectangles, circles, and strings from a bitmap font)
  • Minix 3 file system*
  • processes and round-robin scheduling*
  • runnable ELF files loadable from the file system
  • support for user space applications, including system calls
    • currently runs a primitive version of MS Paint that allows for drawing with a fixed set of colors and sizes, saving a selection of the screen as a PPM image, and pasting an existing PPM image from the file system

Now, this is hardly cutting-edge technology, but I think it is still an accomplishment to be proud of, and I've gained a high level of respect for those who work on actual operating systems. To take a step back and look at the final result (albeit imperfect) knowing just how much learning, planning, and debugging went into it is a really good feeling—a satisfying payoff.

The README.md file included in the repository is a journal of the project's progress and highlights most of the major bugs and challenges we overcame. I don't have access to the original commit history, so unfortunately that is gone forever.


Here's a small showcase of the user space application in action:

Input device events captured for drawing.
Various colors and brush size combinations selectable via the keyboard.
Loading a PPM image from disk—Dr. Marz has never looked better!
Copying a selection, saving it to disk as a PPM image, and pasting it.

Admittedly not a very professional theme (so I've avoided marketing it such), but we were having a lot of fun with it and did a play on words with the game Among Us and arrived at...

Splash screen upon booting the OS (plus a use of the random number generator).