AquilaOS documentation
How it works, and its code
Loading...
Searching...
No Matches
vm_entry.c
Go to the documentation of this file.
1
7
8#include <core/system.h>
9#include <mm/vm.h>
10
11MALLOC_DEFINE(M_VM_ENTRY, "vm-entry", "virtual memory map entry");
12
19{
20 struct vm_entry *vm_entry = kmalloc(sizeof(struct vm_entry), &M_VM_ENTRY, M_ZERO);
21 if (!vm_entry) return NULL;
22
23 return vm_entry;
24}
25
33{
34 if (!vm_entry)
35 return;
36
37 if (vm_entry->vm_anon)
39
42}
#define MALLOC_DEFINE(type, _name, _desc)
Definition kvmem.h:30
void * kmalloc(size_t size, struct malloc_type *type, int flags)
Allocates memory for one of the kernel's structures.
Definition kvmem.c:123
#define M_ZERO
Definition kvmem.h:26
#define NULL
Definition stddef.h:27
A mapping (map entry): a range of an address space, its permissions, and where its pages come from.
Definition vm.h:66
struct vm_anon * vm_anon
its anon: the pages the process wrote to
Definition vm.h:81
struct vm_object * vm_object
its object: what its other pages come from (a file)
Definition vm.h:84
void vm_object_decref(struct vm_object *vm_object)
Drops a reference to a vm object: one mapping of it less.
Definition vm_object.c:38
void vm_entry_destroy(struct vm_entry *vm_entry)
Releases what a map entry holds: its references to its anon and its object.
Definition vm_entry.c:32
struct vm_entry * vm_entry_new(void)
Makes a new, empty map entry.
Definition vm_entry.c:18
void vm_anon_decref(struct vm_anon *vm_anon)
Drops a reference to an anon, and frees it with the last one.
Definition vm_anon.c:130