1 unstable release

0.1.0 May 9, 2023

#543 in Operating systems

Download history 9/week @ 2024-02-25 17/week @ 2024-03-31 1/week @ 2024-04-07 25/week @ 2024-04-21 181/week @ 2024-04-28

210 downloads per month

GPL-3.0-or-later OR Apache-2.0

12KB
267 lines

memory_addr

Crates.io

Wrappers and helper functions for physical and virtual memory addresses.

Examples

use memory_addr::{PhysAddr, VirtAddr};

let phys_addr = PhysAddr::from(0x12345678);
let virt_addr = VirtAddr::from(0x87654321);

assert_eq!(phys_addr.align_down(0x1000usize), PhysAddr::from(0x12345000));
assert_eq!(phys_addr.align_offset_4k(), 0x678);
assert_eq!(virt_addr.align_up_4k(), VirtAddr::from(0x87655000));
assert!(!virt_addr.is_aligned_4k());
assert!(VirtAddr::from(0xabcedf0).is_aligned(16usize));

No runtime deps