1 use crate::include::bindings::bindings::PAGE_OFFSET; 2 3 pub mod allocator; 4 pub mod gfp; 5 pub mod mmio_buddy; 6 7 /// @brief 将内核空间的虚拟地址转换为物理地址 8 #[inline(always)] virt_2_phys(addr: usize) -> usize9pub fn virt_2_phys(addr: usize) -> usize { 10 addr - PAGE_OFFSET as usize 11 } 12 13 /// @brief 将物理地址转换为内核空间的虚拟地址 14 #[inline(always)] phys_2_virt(addr: usize) -> usize15pub fn phys_2_virt(addr: usize) -> usize { 16 addr + PAGE_OFFSET as usize 17 } 18