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 
7 /// @brief 将内核空间的虚拟地址转换为物理地址
8 #[inline(always)]
virt_2_phys(addr: usize) -> usize9 pub 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) -> usize15 pub fn phys_2_virt(addr: usize) -> usize {
16     addr + PAGE_OFFSET as usize
17 }
18 
19 // ====== 重构内存管理后,请删除18-24行 ======
20 //BUG pcb问题
21 unsafe impl Send for process_control_block {}
22 unsafe impl Sync for process_control_block {}
23 
24 unsafe impl Send for mm_struct {}
25 unsafe impl Sync for mm_struct {}
26