AquilaOS documentation
How it works, and its code
Toggle main menu visibility
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
11
MALLOC_DEFINE
(M_VM_ENTRY,
"vm-entry"
,
"virtual memory map entry"
);
12
18
struct
vm_entry
*
vm_entry_new
(
void
)
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
32
void
vm_entry_destroy
(
struct
vm_entry
*
vm_entry
)
33
{
34
if
(!
vm_entry
)
35
return
;
36
37
if
(
vm_entry
->
vm_anon
)
38
vm_anon_decref
(
vm_entry
->
vm_anon
);
39
40
if
(
vm_entry
->
vm_object
)
41
vm_object_decref
(
vm_entry
->
vm_object
);
42
}
system.h
MALLOC_DEFINE
#define MALLOC_DEFINE(type, _name, _desc)
Definition
kvmem.h:30
kmalloc
void * kmalloc(size_t size, struct malloc_type *type, int flags)
Allocates memory for one of the kernel's structures.
Definition
kvmem.c:123
M_ZERO
#define M_ZERO
Definition
kvmem.h:26
NULL
#define NULL
Definition
stddef.h:27
vm_entry
A mapping (map entry): a range of an address space, its permissions, and where its pages come from.
Definition
vm.h:66
vm_entry::vm_anon
struct vm_anon * vm_anon
its anon: the pages the process wrote to
Definition
vm.h:81
vm_entry::vm_object
struct vm_object * vm_object
its object: what its other pages come from (a file)
Definition
vm.h:84
vm.h
vm_object_decref
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
vm_entry_destroy
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
vm_entry_new
struct vm_entry * vm_entry_new(void)
Makes a new, empty map entry.
Definition
vm_entry.c:18
vm_anon_decref
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
kernel
mm
vm_entry.c
Generated by
1.18.0