14 releases (4 breaking)

0.5.1 Jan 19, 2025
0.5.0 Dec 17, 2024
0.4.3 Jan 19, 2025
0.4.2 Dec 17, 2024
0.3.1 Jul 31, 2024

#179 in Hardware support

Download history 1142/week @ 2024-10-21 452/week @ 2024-10-28 120/week @ 2024-11-04 409/week @ 2024-11-11 853/week @ 2024-11-18 503/week @ 2024-11-25 518/week @ 2024-12-02 511/week @ 2024-12-09 990/week @ 2024-12-16 767/week @ 2024-12-23 741/week @ 2024-12-30 704/week @ 2025-01-06 362/week @ 2025-01-13 335/week @ 2025-01-20 90/week @ 2025-01-27 414/week @ 2025-02-03

1,236 downloads per month
Used in 3 crates

GPL-3.0-or-later OR Apache-2…

30KB
599 lines

page_table_entry

Crates.io Docs.rs CI

This crate provides the definition of page table entry for various hardware architectures.

Currently supported architectures and page table entry types:

All these types implement the GenericPTE trait, which provides unified methods for manipulating various page table entries.

Examples (x86_64)

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)
);

Dependencies

~730KB
~13K SLoC