Wade32 is a home-grown 32-bit x86 kernel and tooling stack for experimenting with operating-system internals on bare hardware. The project ships with its own bootloader, runtime, RAM-backed file system, cooperative scheduler, and an interactive shell implemented entirely in C and NASM.
- Custom two-stage BIOS boot path that drops the system straight into 32-bit protected mode before transferring control to
kernel_main. - Kernel services cover VGA text output, interrupt dispatching, programmable interval timer management, keyboard input, stack-canary checking, pseudorandom seeding, and a cooperative scheduler.
- All dynamic memory comes from an in-kernel page allocator feeding a debug-wrapped heap allocator (built on the bundled
xstdsupport library). - The WFS32 RAM file system provides hierarchical directories, file CRUD, streaming reads/writes, and boots through a validation suite at start-up.
- A shell-centric user environment hosts 15 compiled-in "kapps" for system inspection, file-system management, and utilities.
- Everything executes in ring 0; there is no reliance on libc or firmware aside from BIOS/RTC calls during initialization.
- Boot flow:
boot/boot.asmloads the linked kernel image, switches to protected mode using a handcrafted GDT, and jumps to the C entry point defined inboot/kernel_entry.asm. - Memory and safety:
kernel/allocators/kernel_page_allocator.hmanages page frames starting at 0x0010_0000, whilekernel_init.hlayers a debug heap allocator with allocation tracking;kernel_stack_canary.hinstalls a periodic stack-canary checker. - Scheduling and timing: the PIT runs at 100 Hz;
kernel/scheduler/scheduler.henqueues one-shot or periodic callbacks that the main loop drains alongside keyboard events withinkernel_process_loop.h. - File system:
kernel/filesystem/filesystem_wfs32.himplements the WFS32 RAM-only hierarchy and exposes POSIX-style operations (open/close/read/write/list/create/remove); boot-time tests inkernel/filesystem/fs_tests.hverify correctness. - Shell and kapps: the primary shell (
kernel/kernel_apps/shell/shell_main.h) multiplexes input listeners and stdout buffers, dispatching to kapps registered inkernel/kernel_apps/kapps_reg.h. - Diagnostics: VGA banner updates and uptime counters originate from scheduled routines; panics and fatal errors render descriptive outputs through
kernel/kernel_utils.
boot/- stage-1 boot sector, protected-mode switch code, and glue for embedding the linked kernel image.kernel/- core kernel sources, subsystems, kapps, and shared types.xstd/- Wade32's self-contained standard-library replacement (allocators, containers, string utilities, writers).
| Command | Description |
|---|---|
| shell | Launch a nested shell session inside the current TTY. |
| help | List all registered kapps with their descriptions. |
| sysinfo | Display ASCII art banner and kernel metadata. |
| utc | Show RTC time (-d/-t/-h flags supported). |
| args | Echo parsed arguments (debug utility for parser). |
| echo | Print the provided arguments verbatim. |
| cd | Change the current working directory (supports ..). |
| ls | List entries in the current directory. |
| mkdir | Create a directory under the current path. |
| rmdir | Remove a directory subtree. |
| mkfile | Create an empty file. |
| rmfile | Delete a file. |
| write | Overwrite a file with provided content. |
| read | Dump the contents of a file. |
| shutdown | Trigger an ACPI shutdown via the I/O port path. |
Shell built-ins clear (reset screen) and quit (exit the current session) are handled before dispatch.
- Install NASM,
i386-elf-gcc,i386-elf-ld, and QEMU in your WSL toolchain (the batch script expects them under~/opt/cross/bin). - From Windows, run
build.bat; it clearsout/, assembles the bootloader and interrupt stubs, compiles the kernel with-ffreestanding, links viakernel/kernel_linker.ld, and packages a 1.44 MB floppy image. - On success the script launches
qemu-system-i386 -fda out/Wade32.bin. Adjust the executable path at the bottom ofbuild.batif QEMU is installed elsewhere. - To skip auto-launching QEMU, comment out the last command and run your preferred emulator manually.
- Global state lives in
kernel/kernel_globals.h; subsystems register themselves duringkernel_init()and share thekGlobalstruct for coordination. - The cooperative scheduler only runs while
kernel_process()drains event queues, so contributors should schedule periodic work instead of spinning in kapps. - File-system helpers expect absolute paths starting with
rootor relative paths resolved againstkGlobal.file_system.cwd. - Kapps interact with the display through buffered screen regions (
kapp_request_screen_buffer) or stdout writers (kapp_request_stdout) to avoid tearing. - The bundled
xstdlibrary provides allocators, containers, string processing, and buffered writers tailored for freestanding kernels.
- Single-core, ring-0 execution only; no task isolation, paging, or privilege separation.
- The WFS32 file system is RAM-backed and non-persistent between boots.
- No block-device driver beyond BIOS int 13h loading; storage beyond the RAM disk is unimplemented.
- Multitasking is cooperative via the scheduler; there is no context switching between independent processes yet.
- VGA text mode (80x25) is the sole display target.
Ideas under consideration include hardware-backed file systems, real process scheduling, user-space privilege levels, module loading, and richer shell tooling.
