The manual
ginnOS
The reference: libc, the libraries and the kernel
Loading...
Searching...
No Matches
mm.h
Go to the documentation of this file.
1#pragma once
2
3/**
4 * changing a process's user mappings: unmap and protect ranges, keeping the
5 * process's areas (vma.h) and its page tables in step.
6 */
7
8#include "common/stdint.h"
9#include "common/error.h"
11
12/**
13 * unmap [start, end) from a process: every mapped page is removed (frames
14 * from RAM are freed; device frames are not) and the areas are trimmed.
15 * unmapped parts of the range are not an error.
16 * @param proc the process.
17 * @param start first byte (page-aligned, user space).
18 * @param end first byte past the range (page-aligned).
19 * @return KERR_OK, KERR_INVAL for a bad range, KERR_NOSPC if splitting an
20 * area needs a slot and the table is full (nothing is unmapped then).
21 */
23
24/**
25 * change the protection of [start, end) in a process. pages already backed
26 * get the new permissions now; the rest are backed with them on first touch.
27 * PROT_NONE keeps the pages but makes them inaccessible to user code.
28 * @param proc the process.
29 * @param start first byte (page-aligned, user space).
30 * @param end first byte past the range (page-aligned).
31 * @param prot the new PROT_* bits.
32 * @return KERR_OK, KERR_INVAL for a bad range, KERR_NOENT if part of the
33 * range is not mapped, KERR_NOSPC if the areas cannot be split.
34 */
35kerr_t mm_protect(process_t *proc, uintptr_t start, uintptr_t end, uint32_t prot);
kerr_t
unified kernel error codes.
Definition error.h:14
unsigned int uint32_t
Definition fb.h:17
__UINTPTR_TYPE__ uintptr_t
Definition stdint.h:19
kerr_t mm_protect(process_t *proc, uintptr_t start, uintptr_t end, uint32_t prot)
change the protection of [start, end) in a process.
Definition mm.c:112
kerr_t mm_unmap(process_t *proc, uintptr_t start, uintptr_t end)
changing a process's user mappings: unmap and protect ranges, keeping the process's areas (vma....
Definition mm.c:96
struct process process_t
process control block.