AI Kernel API Map
Use this before docs/api/kernel.md.
Rule: cross-crate kernel calls should go through kernel_*::api.
| Need | Import | Read |
|---|---|---|
| GDT/IDT/ACPI/PIC/RTC/SIMD/hooks | kernel_hal::api as hal_api | kernel/hal/src/api.rs |
| Heap/paging/frames/higher-half | kernel_mm::api as mm_api | kernel/mm/src/api.rs |
| Handles/rights/session ids | kernel_object::api as object_api | kernel/object/src/api.rs |
| Shared memory regions | kernel_ipc_runtime::api as ipc_api | kernel/ipc-runtime/src/api.rs |
| Scheduler/process/user state | kernel_ps::api as ps_api | kernel/ps/src/api.rs |
| VFS/devices/console/drivers/input/USB | kernel_io_manager::api as io_api | kernel/io-manager/src/api.rs |
| Linux/Windows compat/syscalls | kernel_compat::api as compat_api | kernel/compat/src/api.rs |
| Boot orchestration/hooks | kernel_executive::boot | kernel/executive/src/boot.rs, kernel/executive/src/lib.rs |
| Logging/panic/boot trace | nucleus_core::debug | kernel/nucleus-core/src/debug/mod.rs |
Boot order from kernel/src/main.rs:
hal_api::disable_interruptsdebug::boot_trace::inithal_api::init_gdthal_api::init_idtmm_api::init_paginghal_api::enter_higher_halfhal_api::call_with_stackboot::kernel_main_bootstrap
Do not reorder without reading kernel/src/main.rs and kernel/executive/src/boot.rs.
High-risk APIs:
unsafeboot 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, andwake_taskfor kernel-capable wait queues; use*_user_*wrappers only for userspace-task waits. - scheduler preemption: use
cond_resched/reschedule_if_requestedonly 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
.koinit preemption: module init executes as a user-service syscall kernel frame, so long lock-free Linux compat callbacks must callcond_reschedat 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.