pub trait CpuArch {
// Required methods
fn current_core_id() -> usize;
fn max_cores() -> usize;
fn spinlock_acquire(lock: &LockWord);
fn spinlock_release(lock: &LockWord);
fn send_ipi(target_core: usize);
fn supports_smp() -> bool;
}Expand description
The per-architecture primitives a multi-core kernel needs — and nothing else.
Implemented for RISC-V, ARM (A/R profile), Xtensa, the hosted backends, and a single-core fallback for targets that cannot support SMP.
Required Methods§
Sourcefn current_core_id() -> usize
fn current_core_id() -> usize
Which physical core is executing this code, 0-based.
Sourcefn max_cores() -> usize
fn max_cores() -> usize
How many cores the chip has. Validates KernelConfig::active_cores before
anything is brought up.
Sourcefn spinlock_acquire(lock: &LockWord)
fn spinlock_acquire(lock: &LockWord)
Take the interlock. Local interrupts are already masked by SpinLock.
Sourcefn spinlock_release(lock: &LockWord)
fn spinlock_release(lock: &LockWord)
Release the interlock.
Sourcefn send_ipi(target_core: usize)
fn send_ipi(target_core: usize)
Ask another core to reschedule (target_core is a core id, not a mask).
Sourcefn supports_smp() -> bool
fn supports_smp() -> bool
Whether more than one core can run concurrently on this target.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".