Module os::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.

Modules

address 🔒

Implementation of physical and virtual address and page number.

Implementation of FrameAllocator which controls all the frames in the operating system.

The global allocator

memory_set 🔒

Implementation of MapArea and MemorySet.

page_table 🔒

Implementation of PageTableEntry and PageTable.

Structs

tracker for physical page frame allocation and deallocation

The kernel’s initial memory mapping(kernel address space)

map permission corresponding to that in pte: R W X U

address space

page table structure

page table entry structure

Definitions

Physical Page Number PPN phiscal page number

An abstraction over a buffer passed from user space to kernel space

An iterator over a UserBuffer

Virtual Address virtual address

Virtual Page Number VPN

Traits

iterator for phy/virt page number

Functions

Allocate a physical page frame in FrameTracker style

Deallocate a physical page frame with a given ppn

initiate heap allocator, frame allocator and kernel space

the kernel token

remap test in kernel space

Translate&Copy a ptru8 array with LENGTH len to a mutable u8 Vec through page table

Translate a ptru8 array through page table and return a reference of T

Translate a ptru8 array through page table and return a mutable reference of T

Translate&Copy a ptru8 array end with \0 to a String Vec through page table