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