Skip to content
Home-made almost operating system
Branch: master
Clone or download

SOS (Stephen's OS)

This is a toy operating system for ARM processors. It doesn't have many features, and the code is pretty bad. It has never actually run on a real processor (just a virtual machine). The list of limitations is too long to write here. But it's all homemade, and so I love it.

Here are some of the things it does:

  • Kernel may use the UART to print messages to the console
  • Basic printf support for writing to the console
  • MMU is fully configured and managed
  • Memory allocation code (which also allows you to free addresses, usually that's at least half the battle)
  • Interrupt handling (reporting faults, handling syscalls)
  • Context switching!
  • Processes support
    • separate address spaces
    • user mode
    • system calls
    • cooperative multiprocessing
  • Scheduling using a round-robin scheduler

If you want to work with the code, you can install qemu, the arm eabi toolchain, and then use the commands below:

# run the code
make run

# do debug mode
make debug
# (in another terminal)
make gdb

If you want to run the tests (yes there are tests for some things), run the following: (no need for qemu or special toolchains)

make test


These are a bunch of things I've looked at while making this, but it's not exhaustive. The primary resource, of course, is the ARMv7-A architecture reference manual.

The following links do similar things, but with different machines (i.e. not the "virt" board from qemu), which means different memory layouts, etc:

This one does similar things, but with ARM 64 bit.

ARM assembly reference card:

Baking Pi

This is an interesting alternative which uses qemu without a "system", just to run some ARM code. Interesting stuff:

This course website is a useful reference as well:

You can’t perform that action at this time.