18 releases (11 breaking)
Uses new Rust 2024
| 0.12.1 | Apr 2, 2026 |
|---|---|
| 0.12.0 | Mar 10, 2026 |
| 0.11.0 | Dec 16, 2025 |
| 0.10.0 | Jul 10, 2025 |
| 0.2.1 | Jun 29, 2022 |
#402 in Embedded development
11,866 downloads per month
Used in 2 crates
195KB
3.5K
SLoC
A library to manipulate AArch64 VMSA page tables.
Currently it supports:
- stage 1 and stage 2 page tables
- 4 KiB pages
- EL3, NS-EL2, NS-EL2&0 and NS-EL1&0 translation regimes
- 64-bit descriptors
Full support is provided for identity mapping (IdMap) and linear mapping
(LinearMap). If you want to use a different mapping scheme, you must
provide an implementation of the Translation trait and then use Mapping directly.
Example
use aarch64_paging::{
idmap::IdMap,
descriptor::El1Attributes,
paging::{MemoryRegion, El1And0},
};
const ASID: usize = 1;
const ROOT_LEVEL: usize = 1;
const NORMAL_CACHEABLE: El1Attributes = El1Attributes::ATTRIBUTE_INDEX_1.union(El1Attributes::INNER_SHAREABLE);
// Create a new EL1 page table with identity mapping.
let mut idmap = IdMap::with_asid(ASID, ROOT_LEVEL, El1And0);
// Map a 2 MiB region of memory as read-write.
idmap.map_range(
&MemoryRegion::new(0x80200000, 0x80400000),
NORMAL_CACHEABLE | El1Attributes::NON_GLOBAL | El1Attributes::VALID | El1Attributes::ACCESSED,
).unwrap();
// SAFETY: Everything the program uses is within the 2 MiB region mapped above.
unsafe {
// Set `TTBR0_EL1` to activate the page table.
idmap.activate();
}
aarch64 page table manipulation
This crate provides a library to manipulate page tables conforming to the AArch64 Virtual Memory System Architecture.
Currently it supports:
- stage 1 and stage 2 page tables
- 4 KiB pages
- EL3, NS-EL2, NS-EL2&0 and NS-EL1&0 translation regimes
- 64-bit descriptors
This is not an officially supported Google product.
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contributing
If you want to contribute to the project, see details of how we accept contributions.
Dependencies
~190–620KB
~14K SLoC