![]() |
MOS Source Code
|
A platform-independent interface to map/unmap virtual memory to physical memory. More...
Functions | |
PtrResult< vmap_t > | mm_get_free_vaddr_locked (MMContext *mmctx, size_t n_pages, ptr_t base_vaddr, bool exact) |
Gets npages unmapped free pages from a page table. | |
void | mm_map_kernel_pages (MMContext *mmctx, ptr_t vaddr, pfn_t pfn, size_t npages, VMFlags flags) |
Map a block of virtual memory to a block of physical memory. | |
PtrResult< vmap_t > | mm_map_user_pages (MMContext *mmctx, ptr_t vaddr, pfn_t pfn, size_t npages, VMFlags flags, vmap_type_t type, vmap_content_t content, bool exact=false) |
void | mm_replace_page_locked (MMContext *mmctx, ptr_t vaddr, pfn_t pfn, VMFlags flags) |
Replace the mappings of a page with a new physical frame. | |
PtrResult< vmap_t > | mm_clone_vmap_locked (const vmap_t *src_vmap, MMContext *dst_ctx) |
Remap a block of virtual memory from one page table to another, i.e. copy the mappings. | |
bool | mm_get_is_mapped_locked (MMContext *mmctx, ptr_t vaddr) |
Get if a virtual address is mapped in a page table. | |
void | mm_flag_pages_locked (MMContext *mmctx, ptr_t vaddr, size_t npages, VMFlags flags) |
Update the flags of a block of virtual memory. | |
ptr_t | mm_get_phys_addr (MMContext *ctx, ptr_t vaddr) |
A platform-independent interface to map/unmap virtual memory to physical memory.
PtrResult< vmap_t > mm_get_free_vaddr_locked | ( | MMContext * | mmctx, |
size_t | n_pages, | ||
ptr_t | base_vaddr, | ||
bool | exact ) |
Gets npages unmapped free pages from a page table.
mmctx | The memory management context to allocate from. |
n_pages | The number of pages to allocate. |
base_vaddr | The base virtual address to allocate at. |
exact | If the address must be exact. |
Definition at line 18 of file paging.cpp.
Referenced by cow_allocate_zeroed_pages(), mm_clone_vmap_locked(), mm_map_user_pages(), and mmap_file().
void mm_map_kernel_pages | ( | MMContext * | mmctx, |
ptr_t | vaddr, | ||
pfn_t | pfn, | ||
size_t | npages, | ||
VMFlags | flags ) |
Map a block of virtual memory to a block of physical memory.
mmctx | The memory management context to map to. |
vaddr | The virtual address to map to. |
pfn | The physical frame to map from. |
npages | The number of pages to map. |
flags | Flags to set on the pages, see VMFlags. |
exact | If the address must be exact. |
This function maps the pages in the block, their reference count will NOT be incremented.
Definition at line 82 of file paging.cpp.
Referenced by setup_sane_environment().
PtrResult< vmap_t > mm_map_user_pages | ( | MMContext * | mmctx, |
ptr_t | vaddr, | ||
pfn_t | pfn, | ||
size_t | npages, | ||
VMFlags | flags, | ||
vmap_type_t | type, | ||
vmap_content_t | content, | ||
bool | exact = false ) |
Definition at line 92 of file paging.cpp.
Referenced by dmabuf_allocate(), and mos_start_kernel().
Replace the mappings of a page with a new physical frame.
mmctx | The memory management context to replace in. |
vaddr | The virtual address to replace. |
pfn | The physical frame to replace to. |
flags | The new flags to set on the pages. |
Definition at line 112 of file paging.cpp.
Referenced by mm_handle_fault(), and mm_resolve_cow_fault().
Remap a block of virtual memory from one page table to another, i.e. copy the mappings.
src_vmap | The source vmap |
dst_ctx | The destination paging context |
This function firstly unmaps the pages in the destination page table, then copies the pages mappings, including the flags and physical addresses, the physical page reference count is updated accordingly.
Definition at line 132 of file paging.cpp.
Referenced by cow_clone_vmap_locked(), and process_do_fork().
Get if a virtual address is mapped in a page table.
mmctx | The memory management context to check in. |
vaddr | The virtual address to get the physical address of. |
Definition at line 159 of file paging.cpp.
Update the flags of a block of virtual memory.
mmctx | The memory management context to update the flags in. |
vaddr | The virtual address to update the flags of. |
npages | The number of pages to update the flags of. |
flags | The flags to set on the pages, see VMFlags. |
Definition at line 171 of file paging.cpp.
Referenced by cow_clone_vmap_locked().
Definition at line 179 of file paging.cpp.
Referenced by futex_get_key(), and x86_dump_stack_at().