with one click
kernel-development
// Guide for modifying and debugging the Nanvix kernel architecture and kernel-call paths. Use this when asked about kernel internals or kernel implementation changes.
// Guide for modifying and debugging the Nanvix kernel architecture and kernel-call paths. Use this when asked about kernel internals or kernel implementation changes.
Guide for Nanvix CI and GitHub Actions workflow behavior, including local pipeline execution and matrix coverage. Use this when asked about CI checks, workflow failures, or release flow.
Guide for developing, building, and running Nanvix user-space applications across supported runtimes and languages. Use this when asked about guest app implementation or execution.
Guide for creating and modifying Nanvix libraries under src/libs, including guest no_std and host std crates. Use this when asked about library architecture or crate changes.
Guide for developing and debugging Nanvix daemons, including guest daemons and host linuxd behavior. Use this when asked about daemon architecture or daemon changes.
Guide for writing, running, and debugging Nanvix unit, integration, and system tests in Rust and C/C++. Use this when asked about test implementation or failures.
Guide for running Nanvix tests with z. Use this when asked to run unit tests, integration tests, or the full test suite.
| name | kernel-development |
| description | Guide for modifying and debugging the Nanvix kernel architecture and kernel-call paths. Use this when asked about kernel internals or kernel implementation changes. |
Use this skill when the user asks about developing, modifying, or debugging the Nanvix microkernel.
The kernel is a #![no_std] Rust binary targeting x86 (32-bit) and lives in src/kernel/.
The kernel is a freestanding binary (#![no_std],
#![no_main]) that runs in ring 0 on x86. Entry point is
src/kernel/src/kmain.rs.
| Module | Path | Purpose |
|---|---|---|
hal | src/kernel/src/hal/ | Hardware Abstraction. |
mm | src/kernel/src/mm/ | Memory Management. |
pm | src/kernel/src/pm/ | Process Management. |
ipc | src/kernel/src/ipc/ | IPC (mailboxes). |
event | src/kernel/src/event/ | Event subsystem. |
io | src/kernel/src/io/ | I/O subsystem. |
kcall | src/kernel/src/kcall/ | Kernel call dispatch. |
kargs | src/kernel/src/kargs.rs | Boot args parsing. |
kimage | src/kernel/src/kimage.rs | Kernel image mgmt. |
klog | src/kernel/src/klog.rs | Kernel logging. |
kpanic | src/kernel/src/kpanic.rs | Panic handler. |
uart | src/kernel/src/uart.rs | UART serial driver. |
The kernel supports multiple machine types via Cargo feature flags:
microvm (default) — Lightweight VM for KVM.KERNEL_BASE_RAW to KPOOL_BASE_RAW — Kernel binary.KPOOL_BASE_RAW to USER_BASE_RAW — Kernel pool.USER_BASE_RAW to USER_MMAP_BASE_RAW — User binary.USER_MMAP_BASE_RAW to USER_LIBS_BASE_RAW — Mapped.USER_LIBS_BASE_RAW to USER_HEAP_BASE_RAW — Libs.USER_HEAP_BASE_RAW to USER_HEAP_END_RAW — Heap.USER_STACK_TOP_RAW to USER_STACK_BASE_RAW — Stack../z build -- kernel
The kernel uses a custom Cargo target
(build/targets/x86-kernel.json) and custom linker scripts
(build/kernel/). Kernel builds disable sccache to avoid
issues with compiler_builtins.
The kernel depends on workspace libraries:
arch — Architecture abstractions.bitmap — Bitmap data structure.config — Compile-time configuration.type-safe — Type-safe wrappers.raw-array — Fixed-size arrays.slab — Slab allocator.sys — System-level types (kcall, IPC, MM, PM).#![no_std] — only core and alloc
are available.panic!, unwrap(), or expect() in production
kernel code.::.unsafe blocks and document safety invariants.error! macro before returning Err.KERNEL_CARGO_BUILD_CMD.build/kernel_config.toml.Kernel calls are dispatched through
src/kernel/src/kcall/dispatcher.rs. Each subsystem (PM,
MM, IPC, Event, IO) registers its own kernel call handlers
in its respective kcall/ subdirectory.