Repository navigation
8 Userland Programs
Relevant source files
This page provides a high-level overview of ring-0 userland programs in CadenzaOS, their execution environment, and the build/link conventions required to package them for the OS. CadenzaOS supports running lightweight executable applications loaded from disk, receiving command-line arguments via registers, and interacting with the kernel through the software interrupt system call gateway (int $0x80).
For detailed technical explanations, source code breakdowns, and packaging mechanics, please refer to the child pages:
CadenzaOS includes sample userland applications—specifically hello, prog1, and kbecho—located under the userland/ directory. These programs demonstrate how user-level tasks interface with kernel services using inline assembly wrappers around the int $0x80 system call vector, handling operations such as string printing, scratch page manipulation, non-blocking keyboard input, and CPU yielding userland/hello/hello.zig36-76userland/prog1/prog1.zig36-76.
Programs define an entry point _start matching a C-style calling convention that receives argument counts (argc) in register rdi and argument vectors (argv) in register rsiuserland/hello/hello.zig103-115userland/prog1/prog1.zig103-130.

Sources: userland/hello/hello.zig36-115userland/prog1/prog1.zig36-130
For details on syscall numbering, argument passing conventions, scratch page memory manipulation, and complete source breakdowns, see hello, prog1 and kbecho Programs.
Userland programs require strict adherence to layout and header conventions so the kernel binary loader can parse and execute them correctly. Each binary embeds a custom 16-byte CDZP header identified by the magic number 0x505A4443 placed at image offset zero (_header_start = 0x0) userland/hello/hello.zig84-95userland/hello/linker.ld5-30.
The custom linker script (linker.ld) enforces this layout by placing the .header section first, followed by .text, .rodata, and .data sections up to _image_end, while discarding unnecessary debugging frames [userland/hello/linker.ld:7-27]. Once compiled, these binaries are bundled for storage staging and integrated into the filesystem image.

Sources: userland/hello/linker.ld1-32userland/hello/hello.zig84-95
For details on linker scripts, header validation assertions, and packaging utilities, see Userland Linking and Packaging.
- Overview
- Getting Started and Build System
- Kernel Configuration and Global State
- Project Governance and Contributing
- Boot and Early Kernel Initialization
- Bootloader Stages and Linking
- kmain Boot Sequence
- Splash Screen and Branding
- Interrupts, Scheduling, and Syscalls
- IDT, PIC, APIC and IRQ Stubs
- Scheduler and Task Lifecycle
- System Call Interface
- Demonstration Tasks
- CodaFS Filesystem and Storage
- On-Disk Format and Operations
- Space Manager and Block Devices
- Binary Format and Program Loading
- Shell, Terminal, and Display
- Shell Command Pipeline
- Terminal, Input Devices and Prompts
- Display: VGA, Framebuffer, Console and Serial