Skip to main content

Module mm

Module mm 

Source
Expand description

Memory management implementation

SV39 page-based virtual-memory architecture for RV64 systems, and everything about memory management, like frame allocator, page table, map area and memory set, is implemented here.

Every task or process has a memory_set to control its virtual memory.

Re-exportsยง

pub use memory_set::KERNEL_SPACE;

Modulesยง

address ๐Ÿ”’
Implementation of physical and virtual address and page number.
frame_allocator ๐Ÿ”’
Implementation of FrameAllocator which controls all the frames in the operating system.
heap_allocator ๐Ÿ”’
The global allocator
memory_set ๐Ÿ”’
Implementation of MapArea and MemorySet.
page_table ๐Ÿ”’
Implementation of PageTableEntry and PageTable.

Structsยง

FrameTracker
manage a frame which has the same lifecycle as the tracker
KERNEL_SPACE
a memory set instance through lazy_static! managing kernel space
MapPermission
map permission corresponding to that in pte: R W X U
MemorySet
memory set structure, controls virtual-memory space
PageTable
Record root ppn and has the same lifetime as 1 and 2 level PageTableEntry
PageTableEntry
page table entry structure
PhysAddr
Definitions
PhysPageNum
phiscal page number
UserBuffer
Array of u8 slice that user communicate with os
UserBufferIterator
Iterator of UserBuffer
VirtAddr
virtual address
VirtPageNum
virtual page number

Traitsยง

StepByOne
Add value by one

Functionsยง

frame_alloc
allocate a frame
frame_dealloc
deallocate a frame
init
initiate heap allocator, frame allocator and kernel space
kernel_token
Get kernelspace root ppn
remap_test
Check PageTable running correctly
translated_byte_buffer
Translate a pointer to a mutable u8 Vec through page table
translated_ref
Translate a generic through page table and return a reference
translated_refmut
Translate a generic through page table and return a mutable reference
translated_str
Translate a pointer to a mutable u8 Vec end with \0 through page table to a String