Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

AI Kernel API Map

Use this before docs/api/kernel.md.

Rule: cross-crate kernel calls should go through kernel_*::api.

NeedImportRead
GDT/IDT/ACPI/PIC/RTC/SIMD/hookskernel_hal::api as hal_apikernel/hal/src/api.rs
Heap/paging/frames/higher-halfkernel_mm::api as mm_apikernel/mm/src/api.rs
Handles/rights/session idskernel_object::api as object_apikernel/object/src/api.rs
Shared memory regionskernel_ipc_runtime::api as ipc_apikernel/ipc-runtime/src/api.rs
Scheduler/process/user statekernel_ps::api as ps_apikernel/ps/src/api.rs
VFS/devices/console/drivers/input/USBkernel_io_manager::api as io_apikernel/io-manager/src/api.rs
Linux/Windows compat/syscallskernel_compat::api as compat_apikernel/compat/src/api.rs
Boot orchestration/hookskernel_executive::bootkernel/executive/src/boot.rs, kernel/executive/src/lib.rs
Logging/panic/boot tracenucleus_core::debugkernel/nucleus-core/src/debug/mod.rs

Boot order from kernel/src/main.rs:

  1. hal_api::disable_interrupts
  2. debug::boot_trace::init
  3. hal_api::init_gdt
  4. hal_api::init_idt
  5. mm_api::init_paging
  6. hal_api::enter_higher_half
  7. hal_api::call_with_stack
  8. boot::kernel_main_bootstrap

Do not reorder without reading kernel/src/main.rs and kernel/executive/src/boot.rs.

High-risk APIs:

  • unsafe boot transfer helpers: enter_higher_half, call_with_stack.
  • user-memory IO: read_to_current_user, read_to_user, ioctl_from_user.
  • process state mutation: with_current_user_process_state_mut, with_process_state_by_pid_mut.
  • scheduler wait primitives: use current_task_id, block_current_task, and wake_task for kernel-capable wait queues; use *_user_* wrappers only for userspace-task waits.
  • scheduler preemption: use cond_resched/reschedule_if_requested only at Linux-style safe points outside spinlocked or IRQ-off regions; timer IRQs should request reschedule for user-task kernel frames, not blindly switch away from arbitrary kernel code.
  • Linux .ko init preemption: module init executes as a user-service syscall kernel frame, so long lock-free Linux compat callbacks must call cond_resched at safe points. Do not hold RustOS spinlocks or IRQ-off sections across those calls.
  • scheduler fairness: keep the hardware timer tick fixed and route service weights into scheduler vruntime/load accounting only. Root slot 0 is a fair task during bootstrap finalize, then becomes the idle fallback after mark_root_idle().
  • VFS mount/unmount/open path helpers: require current process context.

Docs:

  • Human reference: docs/api/kernel.md.
  • AI contract: docs/ai/contracts.md.