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
kernel locking rules:
Definition spinlock.h:67
one area of user memory.
Definition vma.h:47
vma_kind_t kind
Definition vma.h:51
uintptr_t start
Definition vma.h:48
uint32_t prot
Definition vma.h:50
uintptr_t end
Definition vma.h:49
a process's areas, sorted by start.
Definition vma.h:58
spinlock_t lock
Definition vma.h:61
uint32_t count
Definition vma.h:60
vma_t areas[VMA_MAX]
Definition vma.h:59
uintptr_t vma_find_free(const vma_table_t *table, size_t length, uintptr_t low, uintptr_t high)
find the lowest free gap of a given size inside [low, high).
Definition vma.c:133
vma_t * vma_find_kind(vma_table_t *table, vma_kind_t kind)
find the first area of a kind.
Definition vma.c:115
void vma_table_init(vma_table_t *table)
empty a table.
Definition vma.c:50
kerr_t vma_remove_locked(vma_table_t *table, uintptr_t start, uintptr_t end)
vma_remove() for a caller that holds the table's lock.
Definition vma.c:220
kerr_t vma_insert_locked(vma_table_t *table, uintptr_t start, uintptr_t end, uint32_t prot, vma_kind_t kind)
vma_insert() for a caller that holds the table's lock.
Definition vma.c:99
void vma_table_copy(vma_table_t *dst, const vma_table_t *src)
copy the areas of one table into another (fork).
Definition vma.c:56
vma_t * vma_find(vma_table_t *table, uintptr_t addr)
find the area containing an address.
Definition vma.c:105
kerr_t vma_protect(vma_table_t *table, uintptr_t start, uintptr_t end, uint32_t prot)
change the protection of [start, end).
Definition vma.c:283
kerr_t vma_remove(vma_table_t *table, uintptr_t start, uintptr_t end)
unmap [start, end) from the table: areas inside it are removed, areas crossing its edges are trimmed,...
Definition vma.c:212
kerr_t vma_protect_locked(vma_table_t *table, uintptr_t start, uintptr_t end, uint32_t prot)
vma_protect() for a caller that holds the table's lock.
Definition vma.c:291
kerr_t vma_insert(vma_table_t *table, uintptr_t start, uintptr_t end, uint32_t prot, vma_kind_t kind)
add an area.
Definition vma.c:90
bool vma_range_free(const vma_table_t *table, uintptr_t start, uintptr_t end)
check that no area overlaps a range.
Definition vma.c:127
vma_kind_t
what backs an area.
Definition vma.h:34
@ VMA_ANON
Definition vma.h:38
@ VMA_STACK
Definition vma.h:37
@ VMA_HEAP
Definition vma.h:36
@ VMA_ELF
Definition vma.h:35
@ VMA_DEVICE
Definition vma.h:39
@ VMA_SHARED
Definition vma.h:40
#define VMA_MAX
virtual memory areas: what a process has mapped in its user half.
Definition vma.h:28