Crates.io | page_table_entry |
lib.rs | page_table_entry |
version | 0.4.1 |
source | src |
created_at | 2024-07-16 06:13:53.06227 |
updated_at | 2024-10-10 11:11:56.272956 |
description | Page table entry definition for various hardware architectures |
homepage | https://github.com/arceos-org/arceos |
repository | https://github.com/arceos-org/page_table_multiarch |
max_upload_size | |
id | 1304682 |
size | 23,252 |
This crate provides the definition of page table entry for various hardware architectures.
Currently supported architectures and page table entry types:
x86_64::X64PTE
aarch64::A64PTE
riscv::Rv64PTE
All these types implement the GenericPTE
trait, which provides unified
methods for manipulating various page table entries.
use memory_addr::PhysAddr;
use x86_64::structures::paging::page_table::PageTableFlags;
use page_table_entry::{GenericPTE, MappingFlags, x86_64::X64PTE};
let paddr = PhysAddr::from(0x233000);
let pte = X64PTE::new_page(
paddr,
/* flags: */ MappingFlags::READ | MappingFlags::WRITE,
/* is_huge: */ false,
);
assert!(!pte.is_unused());
assert!(pte.is_present());
assert_eq!(pte.paddr(), paddr);
assert_eq!(
pte.bits(),
0x800_0000000233_003, // PRESENT | WRITE | NO_EXECUTE | paddr(0x233000)
);