os/mm/
mod.rs

1//! Memory management implementation
2//!
3//! SV39 page-based virtual-memory architecture for RV64 systems, and
4//! everything about memory management, like frame allocator, page table,
5//! map area and memory set, is implemented here.
6//!
7//! Every task or process has a memory_set to control its virtual memory.
8mod address;
9mod frame_allocator;
10mod heap_allocator;
11mod memory_set;
12mod page_table;
13
14pub use address::{PhysAddr, PhysPageNum, VirtAddr, VirtPageNum};
15use address::{StepByOne, VPNRange};
16pub use frame_allocator::{FrameTracker, frame_alloc};
17pub use memory_set::remap_test;
18pub use memory_set::{KERNEL_SPACE, MapPermission, MemorySet};
19use page_table::{PTEFlags, PageTable};
20pub use page_table::{PageTableEntry, translated_byte_buffer, translated_refmut, translated_str};
21
22/// initiate heap allocator, frame allocator and kernel space
23pub fn init() {
24    heap_allocator::init_heap();
25    frame_allocator::init_frame_allocator();
26    KERNEL_SPACE.exclusive_access().activate();
27}