stands for
Oh Shit Plus Plus, stylised asOS++
OSPP is a 32-bit x86 hobby kernel written in freestanding C++17. The tree currently contains:
kernel/: the kernel image, bootstrap code, MM, interrupts, SMP, scheduler, ACPI/APIC, and the in-kernel self-test layerklibcpp/: the freestanding support library used by both the kernel and loadable modulesmodules/: relocatable kernel modules linked as.koobjects and loaded by the kernel at boot
The project targets i386, boots through Multiboot + GRUB, runs under QEMU/Bochs, and is primarily developed against the q35 machine model.
The kernel currently brings up:
- GDT and IDT
- PMM, recursive-paging VMM, and kernel heap
- ACPI table discovery
- LAPIC and IOAPIC setup
- BSP/AP SMP bring-up
- a simple scheduler driven by PIT callbacks
- loadable module linking and entry dispatch
- optional built-in runtime and compile-time self-tests
This is still a bring-up kernel, not a stable OS. A lot of subsystems are real, but many policies are intentionally minimal.
.
├── kernel/ # kernel image, linker script, low-level architecture code
├── klibcpp/ # freestanding C++ support layer
├── modules/ # sample/test modules linked as relocatable objects
├── output/ # build artifacts copied here by the build scripts
├── build/ # CMake build directory
└── utils.sh # image/build/run helper script
You need a 32-bit capable GCC/binutils toolchain and the host tools used by utils.sh.
Typical Linux requirements:
gcc,g++,binutils,make,cmakeqemu-system-i386orqemu-system-x86grub-installparted,losetup,kpartxmkfs.ext2objcopy,stripsudo
Optional:
bochsfor Bochs runsgdbfor remote debugging with./utils.sh runduncrustifyfor repository formatting
Manual build:
cmake -B build . -DCMAKE_BUILD_TYPE=Debug
cmake --build build -j$(nproc)Artifacts are written to output/:
output/kerneloutput/kernel.debugoutput/modules/*.ko
The helper script manages the disk image and GRUB installation.
Initialize a fresh disk image once:
./utils.sh initBuild and pack the kernel plus modules into disk.img:
./utils.sh pack Debuginit and pack require sudo because they create loop devices, filesystems, and install GRUB.
Available run modes:
./utils.sh run- QEMU, serial on stdio./utils.sh runk- QEMU with KVM enabled./utils.sh rund- QEMU paused with GDB stub (-s -S)./utils.sh runb- Bochs
The kernel logs to the serial port. Current successful runs reach:
[boot] Terminated
Kernel self-tests are enabled by default through:
OPTION(KERNEL_SELF_TESTS "Enable built-in kernel self tests" ON)They cover:
- freestanding runtime helpers
- static containers and allocators
- PMM/VMM/heap invariants
- scheduler smoke tests
- shutdown-time checks
- compile-time layout and ABI assertions
To disable them:
cmake -B build . -DCMAKE_BUILD_TYPE=Debug -DKERNEL_SELF_TESTS=OFFModules are linked as relocatable ELF objects and packed into /modules inside the disk image. At boot the kernel iterates over the Multiboot module list, links each module into the module address window, and looks up:
module_entermodule_exit
The sample module lives in:
modules/test/src/main.cpp
The repository uses uncrustify:
./utils.sh formatThe formatting profile is stored in:
.uncrustify.cfg
- The kernel is low-linked and identity-maps the early bootstrap window.
- Virtual layout constants are centralized in
kernel/include/mm/layout.hpp. - Some early boot and MM assumptions are specific to the current x86 bring-up path.