Skip to content

Repository files navigation

TOS

A hobby x86_64 operating system: long-mode kernel, SMP bring-up, FAT32 root filesystem with support FAT16. preemptive scheduler, syscall ABI, framebuffer window manager, and a small prebuilt userspace including a ported version of DOOM

Layout

kernel/              Kernel. Headers live next to the sources that implement them.
  main.c             Boot entry after the asm stubs hand off.
  acpi/              ACPI table + MCFG parsing
  arch/              CPU state: GDT, TSS, per-CPU, syscall dispatch
  arch/x86_64/       Assembly: boot stubs, ISR stubs, context switch, SYSCALL entry
  boot/              Multiboot2 tag walk
  devices/           LAPIC, PIT, serial, port I/O
  display/           Framebuffer, graphics, TTY, text print
  drivers/           Driver registry; drivers/video/ holds the NVIDIA GSP driver
  firmware/          Firmware blob loading
  fs/                FAT16 driver + kernel stdio
  input/             Keyboard, mouse
  interrupts/        IDT, PIC
  loader/            ELF loader, process creation
  memory/            PMM, VMM, heap, HHDM
  msg/               Per-task message rings
  pci/               PCI enumeration
  sched/             Scheduler, SMP bring-up
  sync/              Spinlocks
  utilities/         string, printf, stdlib, logging
  virtio/            virtio-pci transport + virtio-gpu

userspace/
  bin/<name>/        One directory per binary, built to <name>.elf
  lib/               libc subset, crt0, syscall stubs, window-manager client
  include/           Userspace headers
  games/doom/        doomgeneric port + platform glue

boot/x86_64/         Linker script and GRUB ISO staging tree
rootfs/              Files copied into the FAT16 disk image
tools/               Build and run scripts
tests/               Host-side unit tests
build/  dist/        Generated. Both are gitignored; `make clean` removes them.

Kernel includes are written relative to kernel/, e.g. #include "fs/fat.h". Userspace gets the same root via -I ../kernel so it can share the syscall ABI header.

Root filesystem

The generated FAT32 image uses a Unix-style executable hierarchy:

  • /bin contains the shell and core system utilities.
  • /usr/bin contains regular applications and development tools.
  • /usr/local/bin is reserved for locally installed programs.

The shell's default PATH is /bin:/usr/bin:/usr/local/bin. Bare commands are searched in that order; paths containing / are used directly. PATH=... and export PATH=... can change the search list for the running shell.

Build

Requires an x86_64-elf cross toolchain, nasm, and WSL with grub-mkimage, xorriso, mtools, and dosfstools for the disk image and ISO.

mingw32-make -j12 build-x86_64

Faster inner loop — compile and link the kernel only, no disk image or ISO:

mingw32-make -j12 kernel

Then run it:

tools/run.bat

tools/build.bat and tools/run.sh are the same steps for cmd and bash. All scripts cd to the repository root themselves, so they work from any directory.

Tests

Run the host suite for fast PMM, VMM, process-page-table, FAT, stdio, framebuffer-damage, BMP, gfx, and UI coverage:

mingw32-make test-host

Run the heavy suite to rebuild the ISO and add SMP, VM, filesystem, IPC/shared memory, Winman lifecycle, process churn, framebuffer lifetime/resize, Deskelf, PATH, and panic-screen checks under QEMU:

mingw32-make test-heavy

The in-guest stress binary can also be run manually as stress, or as stress windows to isolate 64 Winman surface create/destroy cycles.

About

A hobby x86_64 operating system written from scratch in C. Long-mode kernel with SMP bring-up, a preemptive scheduler, a custom syscall ABI, FAT16/FAT32 support, a framebuffer window manager

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages