page_table_multiarch
This crate provides generic, unified, architecture-independent, and OS-free page table structures for various hardware architectures.
The core struct is PageTable64<M, PTE, H>
. OS-functions and architecture-dependent types are provided by generic parameters:
M
: The architecture-dependent metadata, requires to implement thePagingMetaData
trait.PTE
: The architecture-dependent page table entry, requires to implement theGenericPTE
trait.H
: OS-functions such as physical memory allocation, requires to implement thePagingHandler
trait.
Currently supported architectures and page table structures:
- x86:
x86_64::X64PageTable
- ARM:
aarch64::A64PageTable
- RISC-V:
riscv::Sv39PageTable
,riscv::Sv48PageTable
- LoongArch64:
loongarch64:LA64PageTable
Examples (x86_64)
use ;
use ;
use ;
use Layout;
extern crate alloc;
;
let vaddr = from;
let paddr = from;
let flags = READ | WRITE;
let mut pt = try_new.unwrap;
assert!;
assert!;
assert_eq!;