Crate cpu

source ·
Expand description

An abstraction for querying about CPUs (cores) in an SMP multicore system.

This crate contains no extra functionality. Currently it consists of:

  • re-exports of items from [apic] on x86_64
  • canonical definitions on aarch64

Note: This crate currently assumes there is only one available CPU core in the system on Arm, as secondary cores are currently unused in Theseus on Arm.

Structs

  • A unique identifier for a CPU core.
  • A wrapper around Option<CpuId> with a forced type alignment of 8 bytes, which guarantees that it compiles down to lock-free native atomic instructions when using it inside of an atomic type like [AtomicCell].

Functions

  • Returns the ID of the bootstrap CPU (if known), which is the first CPU to run after system power-on.
  • Returns the number of CPUs (SMP cores) that exist and are currently initialized on this system.
  • Returns the ID of the currently executing CPU.
  • Returns true if the currently executing CPU is the bootstrap CPU, i.e., the first CPU to run after system power-on.