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