axhal/lib.rs
1//! [ArceOS] hardware abstraction layer, provides unified APIs for
2//! platform-specific operations.
3//!
4//! It does the bootstrapping and initialization process for the specified
5//! platform, and provides useful operations on the hardware.
6//!
7//! Currently supported platforms (specify by cargo features):
8//!
9//! - `x86-pc`: Standard PC with x86_64 ISA.
10//! - `riscv64-qemu-virt`: QEMU virt machine with RISC-V ISA.
11//! - `aarch64-qemu-virt`: QEMU virt machine with AArch64 ISA.
12//! - `aarch64-raspi`: Raspberry Pi with AArch64 ISA.
13//! - `dummy`: If none of the above platform is selected, the dummy platform
14//! will be used. In this platform, most of the operations are no-op or
15//! `unimplemented!()`. This platform is mainly used for [cargo test].
16//!
17//! # Cargo Features
18//!
19//! - `smp`: Enable SMP (symmetric multiprocessing) support.
20//! - `fp_simd`: Enable floating-point and SIMD support.
21//! - `paging`: Enable page table manipulation.
22//! - `irq`: Enable interrupt handling support.
23//!
24//! [ArceOS]: https://github.com/arceos-org/arceos
25//! [cargo test]: https://doc.rust-lang.org/cargo/guide/tests.html
26
27#![no_std]
28#![feature(doc_auto_cfg)]
29#![feature(sync_unsafe_cell)]
30
31#[allow(unused_imports)]
32#[macro_use]
33extern crate log;
34
35#[allow(unused_imports)]
36#[macro_use]
37extern crate memory_addr;
38
39mod platform;
40
41#[macro_use]
42pub mod trap;
43
44pub mod arch;
45pub mod cpu;
46pub mod mem;
47pub mod time;
48
49#[cfg(feature = "tls")]
50pub mod tls;
51
52#[cfg(feature = "irq")]
53pub mod irq;
54
55#[cfg(feature = "paging")]
56pub mod paging;
57
58/// Console input and output.
59pub mod console {
60 pub use super::platform::console::*;
61}
62
63/// Miscellaneous operation, e.g. terminate the system.
64pub mod misc {
65 pub use super::platform::misc::*;
66}
67
68/// Multi-core operations.
69#[cfg(feature = "smp")]
70pub mod mp {
71 pub use super::platform::mp::*;
72}
73
74pub use self::platform::platform_init;
75
76#[cfg(feature = "smp")]
77pub use self::platform::platform_init_secondary;