pub struct MemorySet {
    page_table: PageTable,
    areas: Vec<MapArea>,
    heap_area_idx: Option<usize>,
}
Expand description

The memory “space” as in user space or kernel space

Fields

page_table: PageTableareas: Vec<MapArea>

The mapped area. Segments are implemented using this mechanism. In other words, they may be considered a subset of MapArea. Yet, other purposes may exist in this struct, such as file mapping.

heap_area_idx: Option<usize>

The pointer to store the heap area in order to ease the heap lookup and allocation/CoW.

Implementations

Create a new struct with no information at all.

Getter to the token of current memory space, or “this” page table.

Insert an anonymous segment containing the space between start_va.floor() to end_va.ceil() The space is allocated and added to the current MemorySet.

Prerequisite

Assuming no conflicts. In other words, the space is NOT checked for space validity or overlap. It is merely mapped, pushed into the current memory set. Since CoW is implemented, the space is NOT allocated until a page fault is triggered.

Insert an anonymous segment containing the space between start_va.floor() to end_va.ceil() The space is allocated and added to the current MemorySet.

Prerequisite

Assuming no conflicts. In other words, the space is NOT checked for space validity or overlap. It is merely mapped, pushed into the current memory set. Since CoW is implemented, the space is NOT allocated until a page fault is triggered.

Warning

if the start_vpn does not match any area’s start_vpn, then nothing is done and return Ok(())

Push a not-yet-mapped map_area into current MemorySet and copy the data into it if any, allocating the needed memory for the map.

Push the map area into the memory set without copying or allocation.

The REAL handler to page fault. Handles all types of page fault:(In regex:) “(Store|Load|Instruction)(Page)?Fault” Checks the permission to decide whether to copy.

Mention that trampoline is not collected by areas.

Can be accessed in user mode.

Create an empty kernel space. Without kernel stacks. (Is it done with .bss?)

Include sections in elf and trampoline and TrapContext and user stack, also returns user_sp and entry point.

Translate the vpn into its corresponding Some(PageTableEntry) in the current memory set if exists None is returned if nothing is found.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.