Skip to main content

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
14use address::VPNRange;
15pub use address::{PhysAddr, PhysPageNum, StepByOne, VirtAddr, VirtPageNum};
16pub use frame_allocator::{FrameTracker, frame_alloc, frame_dealloc};
17pub use memory_set::remap_test;
18pub use memory_set::{KERNEL_SPACE, MapPermission, MemorySet, kernel_token};
19use page_table::PTEFlags;
20pub use page_table::{
21    PageTable, PageTableEntry, UserBuffer, UserBufferIterator, translated_byte_buffer,
22    translated_ref, translated_refmut, translated_str,
23};
24/// initiate heap allocator, frame allocator and kernel space
25pub fn init() {
26    heap_allocator::init_heap();
27    frame_allocator::init_frame_allocator();
28    KERNEL_SPACE.exclusive_access().activate();
29}