AquilaOS documentation
How it works, and its code
Loading...
Searching...
No Matches
pmap.h
Go to the documentation of this file.
1#ifndef _MM_PMAP_H
2#define _MM_PMAP_H
3
4/*
5 * The page tables, which each architecture implements (arch/ARCH/mm/). A
6 * pmap is an address space's page tables. `pmap_add()` maps a page,
7 * `pmap_remove()` unmaps a range, and `pmap_protect()` changes a range's
8 * permissions. The `pmap_page_*()` functions reach a physical page
9 * through the kernel's mapping.
10 */
11
14void pmap_init(void);
15
22struct pmap *pmap_switch(struct pmap *pmap);
23
30struct pmap *pmap_create(void);
31
37void pmap_incref(struct pmap *pmap);
38
45void pmap_decref(struct pmap *pmap);
46
59int pmap_add(struct pmap *pmap, vaddr_t va, paddr_t pa, uint32_t flags);
60
69void pmap_remove(struct pmap *pmap, vaddr_t sva, vaddr_t eva);
70
80void pmap_protect(struct pmap *pmap, vaddr_t sva, vaddr_t eva, uint32_t prot);
81
88void pmap_page_copy(paddr_t src, paddr_t dst);
89
97void pmap_remove_all(struct pmap *pmap);
98
108int pmap_page_read(paddr_t paddr, off_t off, size_t size, void *buf);
109
119int pmap_page_write(paddr_t paddr, off_t off, size_t size, void *buf);
120
121#endif /* _MM_PMAP_H */
uint64_t paddr_t
Definition mm.h:39
uint64_t vaddr_t
Definition mm.h:40
int pmap_add(struct pmap *pmap, vaddr_t va, paddr_t pa, uint32_t flags)
Maps a page in an address space, replacing what was mapped there.
Definition pmap.c:307
void pmap_page_copy(paddr_t src, paddr_t dst)
Copies a page of physical memory to another.
Definition pmap.c:423
void pmap_protect(struct pmap *pmap, vaddr_t sva, vaddr_t eva, uint32_t prot)
Changes the permissions of the mapped pages of a range of an address space.
Definition pmap.c:399
int pmap_page_read(paddr_t paddr, off_t off, size_t size, void *buf)
Reads from a page of physical memory, through the kernel's mapping.
Definition pmap.c:440
void pmap_init(void)
Takes over the boot page tables as the kernel's, at boot, and makes the page tables of the kernel's h...
Definition pmap.c:195
void pmap_decref(struct pmap *pmap)
Drops a reference to an address space's page tables, freeing them with the last one.
Definition pmap.c:271
struct pmap * pmap_switch(struct pmap *pmap)
Switches this CPU to an address space's page tables.
Definition pmap.c:164
int pmap_page_write(paddr_t paddr, off_t off, size_t size, void *buf)
Writes to a page of physical memory, through the kernel's mapping.
Definition pmap.c:452
void pmap_incref(struct pmap *pmap)
Adds a reference to an address space's page tables.
Definition pmap.c:263
void pmap_remove(struct pmap *pmap, vaddr_t sva, vaddr_t eva)
Unmaps the pages of a range of an address space, and flushes them from the TLBs that may have them.
Definition pmap.c:337
struct pmap * pmap_create(void)
Makes the page tables of a new address space: an empty user half, and the kernel's half,...
Definition pmap.c:242
void pmap_remove_all(struct pmap *pmap)
Unmaps the whole user half of an address space, and frees its page tables.
Definition pmap.c:382
unsigned int uint32_t
Definition stddef.h:22
An address space's page tables, on x86.
Definition pmap.h:9
long int off_t
Definition types.h:10