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