16 releases (4 breaking)

Uses new Rust 2024

0.5.3 Mar 3, 2025
0.5.1 Jan 19, 2025
0.5.0 Dec 17, 2024
0.4.1 Oct 10, 2024
0.3.1 Jul 31, 2024

#276 in Operating systems

Download history 753/week @ 2024-12-25 698/week @ 2025-01-01 605/week @ 2025-01-08 368/week @ 2025-01-15 260/week @ 2025-01-22 72/week @ 2025-01-29 475/week @ 2025-02-05 412/week @ 2025-02-12 228/week @ 2025-02-19 715/week @ 2025-02-26 442/week @ 2025-03-05 1087/week @ 2025-03-12 479/week @ 2025-03-19 573/week @ 2025-03-26 621/week @ 2025-04-02 545/week @ 2025-04-09

2,268 downloads per month
Used in 3 crates

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

30KB
608 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

~725KB
~13K SLoC