The manual
ginnOS
The reference: libc, the libraries and the kernel
Toggle main menu visibility
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
"
10
#include "
kernel/process/process.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
*/
22
kerr_t
mm_unmap
(
process_t
*proc,
uintptr_t
start,
uintptr_t
end);
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
*/
35
kerr_t
mm_protect
(
process_t
*proc,
uintptr_t
start,
uintptr_t
end,
uint32_t
prot);
stdint.h
error.h
kerr_t
kerr_t
unified kernel error codes.
Definition
error.h:14
uint32_t
unsigned int uint32_t
Definition
fb.h:17
uintptr_t
__UINTPTR_TYPE__ uintptr_t
Definition
stdint.h:19
mm_protect
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
mm_unmap
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
process.h
process_t
struct process process_t
process control block.
src
kernel
memory
mm.h
Generated by
1.18.0