zig-kernel
zig-kernel

xor-bits/zig-kernel

-

This repository has no description.

2 2 0 0
2
build.zig.zon  build.zig 
View on Github  
Updated: 1:58:58 AM Wed Nov 20 2024 Size: 88KB Created: 2:19:47 AM Thu Nov 14 2024
Dependencies:
No known dependencies
zig  fetch  --save  git+https://github.com/xor-bits/zig-kernel

hiillos

hiillos is an operating system with its own microkernel all written in pure Zig

The plan is for the kernel to be just a scheduler, an IPC relay, a physical memory manager and a virtual memory manager.

The system design steals borrows ideas from:

  • Zircon: the reference counted capability model
  • seL4: synchronous IPC endpoints and asynchronous signals
  • RedoxOS: optional filesystem schema (URI protocol here) to reference different services, like fs:///etc/hosts, initfs:///sbin/init, tcp://10.0.0.1:80 or https://archlinux.org

Running in QEMU

zig build run # thats it

# read 'Project-Specific Options' from `zig build --help` for more options
zig build run -Dtest=true # include custom unit test runner

# development cli
zig build run --prominent-compile-errors --summary none \
    # one cpu makes debugging more consistent
    -Dcpus=1 \
    # run the GDB server silently, useful for debugging if the system freezes
    -Dgdb=true \
    # compile faster and with debug info
    -Doptimize=Debug \
    # compile root specifically with higher optimization to speed up initfs decompression
    -Doptimize_root=ReleaseSafe \
    # less initfs compression for faster builds
    -Dzst_l=10

Building an ISO

zig build # generates the os.iso in zig-out/os.iso

Stuff included here

Stuff not included here

IPC performance

Approximate synchronous IPC performance in a call + replyRecv loop:

// server
while (true) {
    msg = try rx.replyRecv(msg);
}
// client
while (true) {
    try tx.call(.{});
}
Bare metal QEMU+KVM
Intel i7-8750H ? 481ns (2 078 811Hz)
Ryzen 9 5950X ? 342ns (2 915 712Hz)

Gallery