178bf93f0SYJwu2023 use crate::include::bindings::bindings::{mm_struct, process_control_block, PAGE_OFFSET}; 2004e86ffSlogin 382d2e446Slogin pub mod allocator; 46cb769c4Slogin pub mod gfp; 5c2481452Shoumkh pub mod mmio_buddy; 6*ab5c8ca4Slogin pub mod syscall; 7004e86ffSlogin 8004e86ffSlogin /// @brief 将内核空间的虚拟地址转换为物理地址 9004e86ffSlogin #[inline(always)] 10004e86ffSlogin pub fn virt_2_phys(addr: usize) -> usize { 11004e86ffSlogin addr - PAGE_OFFSET as usize 12004e86ffSlogin } 13004e86ffSlogin 14004e86ffSlogin /// @brief 将物理地址转换为内核空间的虚拟地址 15004e86ffSlogin #[inline(always)] 16004e86ffSlogin pub fn phys_2_virt(addr: usize) -> usize { 17004e86ffSlogin addr + PAGE_OFFSET as usize 18004e86ffSlogin } 19bacd691cSlogin 20bacd691cSlogin // ====== 重构内存管理后,请删除18-24行 ====== 21bacd691cSlogin //BUG pcb问题 22bacd691cSlogin unsafe impl Send for process_control_block {} 23bacd691cSlogin unsafe impl Sync for process_control_block {} 24bacd691cSlogin 25bacd691cSlogin unsafe impl Send for mm_struct {} 26bacd691cSlogin unsafe impl Sync for mm_struct {} 27