Features
- Capability-based access control
- Processes, address spaces, and scheduling
- IPC, notifications, faults, and interrupts
- Hardware abstraction through the HAL
A capability-oriented design
A9N is a third-generation Capability-based Microkernel. Processes, address spaces, and communication ports are objects accessed through capabilities, which combine a reference with authority. A process must hold a reachable capability to operate on an object; knowing a descriptor’s numeric value alone grants no access.
A9N adopts the Take-Grant Model for authority delegation. User space distributes capabilities, while the kernel checks object types and the rights required by each operation. The regular kernel interface consists of Capability Call and YIELD, giving different objects a common invocation format. Resource allocation and service composition remain decisions for the user-space OS.
High-performance IPC
IPC transfers messages and capabilities between processes. Short payloads use registers; additional words use the IPC buffer. CALL combines a request with a reply wait, while REPLY_RECEIVE combines a reply with the next receive, supporting request/reply service loops.
When a server is waiting and no higher-priority process is ready, CALL switches directly to that server. This fastpath bypasses the normal scheduler invocation and ready-queue search, shortening the path from a client request to server execution.
The common internal IPC logic is written in C++20. Result types carry success values and errors through higher-order function chains, exposing the normal execution path to compiler optimization. Conditionally trivial copy and destruction operations reduce value-passing overhead while limiting dependence on hand-written, architecture-specific optimization.
Explicit memory ownership
Generic capabilities represent physical memory from which processes, ports, page tables, and frames are created. A Frame represents a physical range; an Address Space represents a virtual address space. Making object backing explicit lets the user-space OS control how much memory each service receives.
Mappings specify read, write, and execute permissions together with Normal, Buffered, or Uncached memory attributes. This gives ordinary memory, framebuffer writes, and device registers a common mapping interface. User space manages attribute consistency across aliases and the lifetime of references before backing memory is reused.
User-space events and fault handling
Notification Ports accumulate event flags from multiple sources and support both waiting and polling. They can also be bound to processes receiving IPC. Hardware interrupts are delivered through notifications, allowing a user-space driver to handle a device and acknowledge the interrupt afterward.
Faults such as memory violations and unknown kernel calls can be delivered by IPC to a registered user-space handler. The process-management service decides how to respond. This supports drivers and foreign-OS ABI handling outside the kernel; Nanami’s Alter/ uses this fault-delivery mechanism.
Multicore execution and scheduling
SMP is implemented for x86_64 and AArch64, allowing user processes to run concurrently on different cores. Each core has a priority-based scheduler with round-robin selection within a priority level. CPU affinity controls placement, and IPC and notifications can wake processes on another core.
SMP is selected at build time. Four-core boot has been verified on QEMU virt and Raspberry Pi 4 Model B. Kernel entry is currently serialized by a giant lock; automatic load balancing and CPU hotplug are not implemented.
Portability through the HAL
The hardware-independent kernel is separated from the HAL, which implements CPU context, memory mapping, interrupts, timers, and I/O. Architecture and board implementations are selected at build time behind common interfaces. Hardware-specific changes can therefore preserve the shared object model and IPC logic.
Implemented platforms are x86_64/pc99, AArch64/QEMU virt, and Raspberry Pi 4 Model B. AArch64 boots through U-Boot; secondary cores use PSCI on QEMU and spin tables on Raspberry Pi 4.
Technical details
- Implementation
- C++, C, and assembly
- Architectures
- x86_64 Long Mode, AArch64
- AArch64 configuration
- ARMv8-A, GICv2
- Platforms
- pc99 (x86_64), QEMU (x86_64/AArch64), Raspberry Pi 4 Model B (rpi4b)
- Source components
- kernel, hal, liba9n
- License
- MIT
- Source reference
- develop ·
02951a4↗