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 | //! 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.
pub use x86_64 as current;
pub use aarch64 as current;
|