//! Stage 22: the code that depends on the CPU family ("architecture"). //! //! Rustbelt grew up on the PC (x86_64), so almost everything in src/ still //! assumes it. Stage 22 starts a second family, 64-bit ARM (aarch64, or //! "arm64"), and puts the CPU-specific parts behind one small interface. //! Every architecture module provides the same six things: //! //! | Part | What it is | x86_64 | aarch64 | //! |------|------------|--------|---------| //! | entry | where the CPU first jumps into our code | bootloader 0.9's `entry_point!` (src/main.rs) | `_start` in `aarch64/boot.rs` (EL2 -> EL1, stack, .bss) | //! | `console` | text out, for the very first messages | COM1 (src/serial.rs) | the board's PL011 UART | //! | `interrupts` | exception table + interrupt controller | IDT + 8259 PIC / APIC | vector table (VBAR_EL1) + GICv2 | //! | `timer` | a regular tick | PIT / local APIC timer | the generic timer (virtual, CNTV) | //! | `paging` | turning on virtual memory | src/memory.rs (the bootloader already did it) | `aarch64/paging.rs`: identity + higher half | //! | `exit` | ending a QEMU run with a status | `isa-debug-exit` port 0xf4 | semihosting `SYS_EXIT` | //! //! `arch::current` is the module for the family being built. The PC kernel //! doesn't go through this interface yet (src/main.rs is unchanged); the //! x86_64 module just names the existing pieces so the two can be compared //! and, later, shared code can call `arch::current::...` instead. #[cfg(target_arch = "x86_64")] pub mod x86_64; #[cfg(target_arch = "x86_64")] pub use self::x86_64 as current; #[cfg(target_arch = "aarch64")] pub mod aarch64; #[cfg(target_arch = "aarch64")] pub use self::aarch64 as current;