xref: /DragonOS/kernel/src/mm/mod.rs (revision bacd691c9ef0502b5cc618aad50517f9e59df5e0)
1 use crate::include::bindings::bindings::{PAGE_OFFSET, process_control_block, mm_struct};
2 
3 pub mod allocator;
4 pub mod gfp;
5 pub mod mmio_buddy;
6 
7 /// @brief 将内核空间的虚拟地址转换为物理地址
8 #[inline(always)]
9 pub fn virt_2_phys(addr: usize) -> usize {
10     addr - PAGE_OFFSET as usize
11 }
12 
13 /// @brief 将物理地址转换为内核空间的虚拟地址
14 #[inline(always)]
15 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 {}