MOS Source Code
Loading...
Searching...
No Matches
mm.cpp File Reference
#include "mos/mm/mm.hpp"
#include "mos/filesystem/sysfs/sysfs.hpp"
#include "mos/interrupt/ipi.hpp"
#include "mos/misc/setup.hpp"
#include "mos/mm/paging/paging.hpp"
#include "mos/mm/paging/pmlx/pml5.hpp"
#include "mos/mm/paging/table_ops.hpp"
#include "mos/mm/physical/pmm.hpp"
#include "mos/platform/platform.hpp"
#include "mos/platform/platform_defs.hpp"
#include "mos/syslog/printk.hpp"
#include "mos/tasks/signal.hpp"
#include <mos/lib/structures/list.hpp>
#include <mos/lib/sync/spinlock.hpp>
#include <mos/mos_global.h>
#include <mos_stdlib.hpp>
#include <mos_string.hpp>
+ Include dependency graph for mm.cpp:

Go to the source code of this file.

Functions

phyframe_tmm_get_free_page_raw (void)
 
phyframe_tmm_get_free_page (void)
 
phyframe_tmm_get_free_pages (size_t npages)
 
MMContextmm_create_context (void)
 Create a user-mode platform-dependent page table.
 
void mm_destroy_context (MMContext *mmctx)
 Destroy a user-mode platform-dependent page table.
 
void mm_lock_ctx_pair (MMContext *ctx1, MMContext *ctx2)
 Lock and unlock a pair of MMContext objects.
 
void mm_unlock_ctx_pair (MMContext *ctx1, MMContext *ctx2)
 
MMContextmm_switch_context (MMContext *new_ctx)
 
static void do_attach_vmap (MMContext *mmctx, vmap_t *vmap)
 
vmap_tvmap_create (MMContext *mmctx, ptr_t vaddr, size_t npages)
 Create a vmap object and insert it into the address space.
 
void vmap_destroy (vmap_t *vmap)
 Destroy a vmap object, and unmmap the region.
 
vmap_tvmap_obtain (MMContext *mmctx, ptr_t vaddr, size_t *out_offset)
 Get the vmap object for a virtual address.
 
vmap_tvmap_split (vmap_t *first, size_t split)
 Split a vmap object into two, at the specified offset.
 
vmap_tvmap_split_for_range (vmap_t *vmap, size_t rstart_pgoff, size_t rend_pgoff)
 Split a vmap to get a vmap object for a range of pages.
 
void vmap_finalise_init (vmap_t *vmap, vmap_content_t content, vmap_type_t type)
 Finalize the initialization of a vmap object.
 
void mm_copy_page (const phyframe_t *src, const phyframe_t *dst)
 
vmfault_result_t mm_resolve_cow_fault (vmap_t *vmap, ptr_t fault_addr, pagefault_t *info)
 Helper function to resolve a copy-on-write fault.
 
static void invalid_page_fault (ptr_t fault_addr, vmap_t *faulting_vmap, vmap_t *ip_vmap, pagefault_t *info, const char *unhandled_reason)
 
void mm_handle_fault (ptr_t fault_addr, pagefault_t *info)
 Handle a page fault.
 
static bool sys_mem_mmap (sysfs_file_t *f, vmap_t *vmap, off_t offset)
 
static bool sys_mem_munmap (sysfs_file_t *f, vmap_t *vmap, bool *unmapped)
 
static void mm_sysfs_init ()
 
 MOS_INIT (SYSFS, mm_sysfs_init)
 

Variables

static sysfs_item_t sys_mem_item = SYSFS_MEM_ITEM("mem", sys_mem_mmap, sys_mem_munmap)
 

Function Documentation

◆ do_attach_vmap()

static void do_attach_vmap ( MMContext * mmctx,
vmap_t * vmap )
static

Definition at line 131 of file mm.cpp.

Referenced by vmap_create(), and vmap_split().

+ Here is the call graph for this function:

◆ mm_copy_page()

void mm_copy_page ( const phyframe_t * src,
const phyframe_t * dst )

Definition at line 261 of file mm.cpp.

Referenced by mm_handle_fault(), and mm_resolve_cow_fault().

+ Here is the call graph for this function:

◆ invalid_page_fault()

static void invalid_page_fault ( ptr_t fault_addr,
vmap_t * faulting_vmap,
vmap_t * ip_vmap,
pagefault_t * info,
const char * unhandled_reason )
static

Definition at line 279 of file mm.cpp.

Referenced by mm_handle_fault().

+ Here is the call graph for this function:

◆ sys_mem_mmap()

static bool sys_mem_mmap ( sysfs_file_t * f,
vmap_t * vmap,
off_t offset )
static

Definition at line 509 of file mm.cpp.

+ Here is the call graph for this function:

◆ sys_mem_munmap()

static bool sys_mem_munmap ( sysfs_file_t * f,
vmap_t * vmap,
bool * unmapped )
static

Definition at line 517 of file mm.cpp.

+ Here is the call graph for this function:

◆ mm_sysfs_init()

static void mm_sysfs_init ( )
static

Definition at line 527 of file mm.cpp.

Referenced by MOS_INIT().

+ Here is the call graph for this function:

◆ MOS_INIT()

MOS_INIT ( SYSFS ,
mm_sysfs_init  )
+ Here is the call graph for this function:

Variable Documentation

◆ sys_mem_item

sysfs_item_t sys_mem_item = SYSFS_MEM_ITEM("mem", sys_mem_mmap, sys_mem_munmap)
static

Definition at line 525 of file mm.cpp.

Referenced by mm_sysfs_init().