static vmfault_result_t cow_zod_fault_handler(vmap_t *vmap, ptr_t fault_addr, pagefault_t *info)
static phyframe_t * zero_page(void)
static phyframe_t * _zero_page
vmap_t * cow_allocate_zeroed_pages(mm_context_t *mmctx, size_t npages, ptr_t vaddr, valloc_flags allocflags, vm_flags flags)
Allocate zero-on-demand pages at a specific address.
vmap_t * cow_clone_vmap_locked(mm_context_t *target_mmctx, vmap_t *src_vmap)
Copy-on-write a page range.
__BEGIN_DECLS phyframe_t * mm_get_free_page(void)
#define phyframe_va(frame)
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.
@ VMFAULT_MAP_BACKING_PAGE
the caller should map the backing page into the faulting address
@ VMFAULT_MAP_BACKING_PAGE_RO
the caller should map the backing page into the faulting address, and mark it non-writable
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.
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.
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.
#define pmm_ref_one(thing)
#define vmap_stat_inc(vmap, type)
#define vmap_stat_dec(vmap, type)
#define memzero(ptr, size)
#define spinlock_acquire(lock)
#define spinlock_release(lock)
spinlock_t mm_lock
protects [pgd] and the [mmaps] list (the list itself, not the vmap_t objects)
const phyframe_t * backing_page
the frame that contains the data for this page, the on_fault handler should set this
size_t cow
pages that are copy-on-write
size_t regular
regular pages with no special flags being set or unset
vmfault_handler_t on_fault