rust-kernel
Rustbelt: a hobby x86_64 kernel written in Rust
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | //! Just enough ACPI to find the CPUs.
//!
//! The firmware describes the machine in ACPI tables. We follow the chain:
//!
//! RSDP ("RSD PTR ", found by scanning the BIOS area)
//! -> RSDT (Root System Description Table: a list of table addresses)
//! -> MADT (signature "APIC": one entry per interrupt controller)
//!
//! Each MADT entry of type 0 is a CPU's local APIC; we collect the APIC IDs
//! of the enabled ones. That's the list of CPUs smp.rs will start.
use cratephys_to_virt;
use Vec;
use PhysAddr;
/// Read a value of type T at physical address `addr`.
/// ACPI tables are valid if all their bytes add up to 0 (mod 256).
/// Find the RSDP: in the first KiB of the EBDA (Extended BIOS Data Area)
/// or in the BIOS ROM area 0xE0000-0xFFFFF, on a 16-byte boundary.
/// The APIC IDs of all enabled CPUs, or None if there's no usable MADT.
|