1 use crate::include::bindings::bindings::{mm_struct, process_control_block, PAGE_OFFSET}; 2 3 pub mod allocator; 4 pub mod gfp; 5 pub mod mmio_buddy; 6 pub mod syscall; 7 8 /// @brief 将内核空间的虚拟地址转换为物理地址 9 #[inline(always)] 10 pub fn virt_2_phys(addr: usize) -> usize { 11 addr - PAGE_OFFSET as usize 12 } 13 14 /// @brief 将物理地址转换为内核空间的虚拟地址 15 #[inline(always)] 16 pub fn phys_2_virt(addr: usize) -> usize { 17 addr + PAGE_OFFSET as usize 18 } 19 20 // ====== 重构内存管理后,请删除18-24行 ====== 21 //BUG pcb问题 22 unsafe impl Send for process_control_block {} 23 unsafe impl Sync for process_control_block {} 24 25 unsafe impl Send for mm_struct {} 26 unsafe impl Sync for mm_struct {} 27