AquilaOS documentation
How it works, and its code
Toggle main menu visibility
Loading...
Searching...
No Matches
vmm.c
Go to the documentation of this file.
1
5
6
#include <
core/system.h
>
7
#include <
core/arch.h
>
8
#include <
core/panic.h
>
9
#include <
mm/mm.h
>
10
#include <
mm/vm.h
>
11
#include <
ds/queue.h
>
12
#include <
ds/hashmap.h
>
13
14
MALLOC_DEFINE
(M_VM_AREF,
"vm-aref"
,
"anonymous virtual memory object reference"
);
15
16
/* The kernel's address space. */
17
struct
vm_space
kvm_space
;
18
29
int
vm_map
(
struct
vm_space
*
vm_space
,
struct
vm_entry
*
vm_entry
)
30
{
31
return
mm_map
(
vm_space
->
pmap
,
vm_entry
->
paddr
,
vm_entry
->
base
,
vm_entry
->
size
,
vm_entry
->
flags
);
32
}
33
42
void
vm_unmap_full
(
struct
vm_space
*
vm_space
,
struct
vm_entry
*
vm_entry
)
43
{
44
mm_unmap_full
(
vm_space
->
pmap
,
vm_entry
->
base
,
vm_entry
->
size
);
45
}
46
hashmap.h
arch.h
panic.h
system.h
mm.h
mm_map
int mm_map(struct pmap *pmap, paddr_t paddr, vaddr_t vaddr, size_t size, int flags)
Maps a range of an address space, page by page.
Definition
mm.c:161
mm_unmap_full
void mm_unmap_full(struct pmap *pmap, vaddr_t vaddr, size_t size)
Unmaps every page of a range of an address space.
Definition
mm.c:208
MALLOC_DEFINE
#define MALLOC_DEFINE(type, _name, _desc)
Definition
kvmem.h:30
queue.h
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::flags
uint32_t flags
its permissions and flags (VM_*)
Definition
vm.h:78
vm_entry::paddr
paddr_t paddr
physical memory to map all at once (vm_map()), or 0 for pages that come in on page faults
Definition
vm.h:69
vm_entry::base
vaddr_t base
where the mapping starts in its address space
Definition
vm.h:72
vm_entry::size
size_t size
its size
Definition
vm.h:75
vm_space
An address space: its mappings, and its page tables.
Definition
vm.h:25
vm_space::pmap
struct pmap * pmap
its page tables (the architecture's)
Definition
vm.h:27
vm.h
vm_unmap_full
void vm_unmap_full(struct vm_space *vm_space, struct vm_entry *vm_entry)
Unmaps every page of a map entry's range.
Definition
vmm.c:42
vm_map
int vm_map(struct vm_space *vm_space, struct vm_entry *vm_entry)
Maps a map entry's whole range at once: its physical memory (paddr), or new pages of memory if it has...
Definition
vmm.c:29
kvm_space
struct vm_space kvm_space
Definition
vmm.c:17
kernel
mm
vmm.c
Generated by
1.18.0