MOS Source Code
|
A platform-independent interface to map/unmap virtual memory to physical memory. More...
Enumerations | |
enum | valloc_flags { VALLOC_DEFAULT = 0 , VALLOC_EXACT = MMAP_EXACT } |
Functions | |
vmap_t * | mm_get_free_vaddr_locked (mm_context_t *mmctx, size_t n_pages, ptr_t base_vaddr, valloc_flags flags) |
Gets npages unmapped free pages from a page table. | |
void | mm_map_kernel_pages (mm_context_t *mmctx, ptr_t vaddr, pfn_t pfn, size_t npages, vm_flags flags) |
Map a block of virtual memory to a block of physical memory. | |
vmap_t * | mm_map_user_pages (mm_context_t *mmctx, ptr_t vaddr, pfn_t pfn, size_t npages, vm_flags flags, valloc_flags vaflags, vmap_type_t type, vmap_content_t content) |
void | mm_replace_page_locked (mm_context_t *mmctx, ptr_t vaddr, pfn_t pfn, vm_flags flags) |
Replace the mappings of a page with a new physical frame. | |
vmap_t * | mm_clone_vmap_locked (vmap_t *src_vmap, mm_context_t *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 (mm_context_t *mmctx, ptr_t vaddr) |
Get if a virtual address is mapped in a page table. | |
void | mm_flag_pages_locked (mm_context_t *mmctx, ptr_t vaddr, size_t npages, vm_flags flags) |
Update the flags of a block of virtual memory. | |
ptr_t | mm_get_phys_addr (mm_context_t *ctx, ptr_t vaddr) |
A platform-independent interface to map/unmap virtual memory to physical memory.
enum valloc_flags |
vmap_t * mm_get_free_vaddr_locked | ( | mm_context_t * | mmctx, |
size_t | n_pages, | ||
ptr_t | base_vaddr, | ||
valloc_flags | flags ) |
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. |
flags | Flags to set on the pages, see valloc_flags. |
Definition at line 18 of file paging.c.
Referenced by cow_allocate_zeroed_pages(), mm_clone_vmap_locked(), mm_map_user_pages(), and mmap_file().
void mm_map_kernel_pages | ( | mm_context_t * | mmctx, |
ptr_t | vaddr, | ||
pfn_t | pfn, | ||
size_t | npages, | ||
vm_flags | 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 vm_flags. |
This function maps the pages in the block, their reference count will NOT be incremented.
Definition at line 82 of file paging.c.
Referenced by mos_start_kernel().
vmap_t * mm_map_user_pages | ( | mm_context_t * | mmctx, |
ptr_t | vaddr, | ||
pfn_t | pfn, | ||
size_t | npages, | ||
vm_flags | flags, | ||
valloc_flags | vaflags, | ||
vmap_type_t | type, | ||
vmap_content_t | content ) |
Definition at line 92 of file paging.c.
Referenced by dmabuf_allocate(), and mos_start_kernel().
void mm_replace_page_locked | ( | mm_context_t * | mmctx, |
ptr_t | vaddr, | ||
pfn_t | pfn, | ||
vm_flags | flags ) |
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.c.
Referenced by mm_handle_fault(), and mm_resolve_cow_fault().
vmap_t * mm_clone_vmap_locked | ( | vmap_t * | src_vmap, |
mm_context_t * | dst_ctx ) |
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.c.
Referenced by cow_clone_vmap_locked(), and process_do_fork().
bool mm_get_is_mapped_locked | ( | mm_context_t * | mmctx, |
ptr_t | vaddr ) |
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.c.
void mm_flag_pages_locked | ( | mm_context_t * | mmctx, |
ptr_t | vaddr, | ||
size_t | npages, | ||
vm_flags | flags ) |
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 vm_flags. |
Definition at line 171 of file paging.c.
Referenced by cow_clone_vmap_locked().
ptr_t mm_get_phys_addr | ( | mm_context_t * | ctx, |
ptr_t | vaddr ) |
Definition at line 179 of file paging.c.
Referenced by futex_get_key(), and x86_dump_stack_at().