kernel/
environment.rs

1// Architecture-aware environment constants.
2//
3// This module is intentionally split by arch, but re-exported here so callers can keep using
4// `crate::environment::FOO` without being aware of the split.
5
6#[path = "environment/common.rs"]
7mod common;
8
9#[cfg(target_arch = "aarch64")]
10#[path = "environment/aarch64.rs"]
11mod arch;
12
13#[cfg(target_arch = "riscv64")]
14#[path = "environment/riscv64.rs"]
15mod arch;
16
17pub use arch::*;
18pub use common::*;
19
20// Derived constants (depend on arch-specific end addresses)
21pub const KERNEL_VM_STACK_START: usize = KERNEL_VM_STACK_END - KERNEL_VM_STACK_SIZE + 1;
22
23// Kernel high-VA stack window region (per-task windows in shared kernel PT)
24// One guard page + task kernel stack per slot
25pub const KERNEL_KSTACK_SLOT_SIZE: usize = TASK_KERNEL_STACK_SIZE + PAGE_SIZE;
26// Reserve the top-most page(s) for trampoline; place window region below KERNEL_VM_STACK
27pub const KERNEL_KSTACK_REGION_END: usize = KERNEL_VM_STACK_START - 1;
28pub const KERNEL_KSTACK_REGION_START: usize =
29    KERNEL_KSTACK_REGION_END + 1 - (KERNEL_KSTACK_SLOTS * KERNEL_KSTACK_SLOT_SIZE);