Expand description
Per-CPU data (x86_64)
Minimal per-CPU tracking for SMP bring-up. This keeps CPU identity, online state, and per-CPU kernel stack top pointers.
Structs§
- PerCpu
- Per-CPU state.
- PerCpu
Arch - Minimal per-CPU block accessed from assembly via GS base.
Constants§
- KERNEL_
RSP_ OFFSET - MAX_
CPUS - Maximum number of CPUs supported for now.
- USER_
RSP_ OFFSET - Offsets used by the SYSCALL entry (must match
PerCpuArchlayout). Note: cpu_index is at offset 0 (8 bytes).
Functions§
- apic_
id_ by_ cpu_ index - Get the APIC ID for a given CPU index, or
Noneif not present. - cpu_
count - Get the total number of CPUs that have been registered.
- cpu_
index_ by_ apic - Find a CPU index by APIC ID.
- cpu_
index_ from_ gs - Resolve current CPU index from GS base (compatibility).
- current_
cpu_ index - Resolve current CPU index via a GS-relative load from offset 0.
- current_
cpu_ index_ fast - Alias for current_cpu_index.
- get_
cpu_ count - Get the total number of CPUs (public alias for OSTD compatibility).
- init_
boot_ cpu - Initialize the boot CPU (BSP) entry.
- init_
gs_ base - Initialize GS base for this CPU to point at its per-CPU block.
- is_
preemptible - Returns
trueif preemption is currently allowed on this CPU (preempt_count == 0). - kernel_
stack_ top - Get the per-CPU kernel stack top for the given CPU index.
- mark_
online_ by_ apic - Mark a CPU as online by APIC ID.
- mark_
tlb_ ready_ current - Mark current CPU as ready to handle TLB shootdown IPIs.
- percpu
- Access the per-CPU array (read-only).
- preempt_
disable - Increment the preemption-disable depth for the current CPU. When depth > 0, the scheduler will not preempt this CPU.
- preempt_
enable - Decrement the preemption-disable depth for the current CPU.
Must be paired with exactly one prior call to
preempt_disable. - register_
cpu - Register a new CPU by APIC ID, returning its CPU index.
- set_
kernel_ rsp_ current - Set the per-CPU SYSCALL kernel RSP for the current CPU.
- set_
kernel_ rsp_ for_ cpu - Set the per-CPU SYSCALL kernel RSP (used by syscall entry).
- set_
kernel_ stack_ top - Set the per-CPU kernel stack top for the given CPU index.
- tlb_
ready - Returns true iff CPU
indexis online and ready for TLB shootdown.