1// SPDX-License-Identifier: GPL-3.0-or-later
2
3#pragma once
4
5#include "mos/mm/mm.hpp"
6#include "mos/mm/paging/paging.hpp"
7
8/**
9 * @brief Copy-on-write a page range
10 *
11 * @param target_mmctx The mm context to copy to
12 * @param source_vmap The vmap to copy from
13 * @return vmap_t* The new vmap, with the lock held
14 */
15PtrResult<vmap_t> cow_clone_vmap_locked(MMContext *target_mmctx, vmap_t *source_vmap);
16
17/**
18 * @brief Allocate zero-on-demand pages at a specific address
19 *
20 * @param handle The paging handle to use
21 * @param npages The number of pages to allocate
22 * @param vaddr The virtual address to allocate at
23 * @param hints Allocation hints, see valloc_flags
24 * @param flags VM flags to use
25 * @return vmblock_t The allocated block
26 */
27PtrResult<vmap_t> cow_allocate_zeroed_pages(MMContext *handle, size_t npages, ptr_t vaddr, valloc_flags hints, vm_flags flags);
28