Go to the source code of this file.
◆ alloc_pages()
void* alloc_pages |
( |
int |
num_pages | ) |
|
Allocate virtual pages & map them to physical memory.
- Parameters
-
num_pages | The number of pages to allocate. |
- Returns
- a pointer to the allocated pages.
◆ alloc_pages_virt()
void alloc_pages_virt |
( |
int |
num_pages, |
|
|
void * |
addr |
|
) |
| |
Allocate virtual pages at a specific address & map them to physical memory.
- Parameters
-
num_pages | The number of pages to allocate. |
addr | The adress to start allocation at. |
◆ find_free_pages()
void* find_free_pages |
( |
int |
num_pages | ) |
|
Finds free virtual pages and returns the start address
- Parameters
-
num_pages | The minimum size of the free area |
- Returns
- the start of the free area
◆ get_cr3()
Get the current address space
- Returns
- a pointer to the current address space in physical memory.
◆ load_address_space()
void load_address_space |
( |
void * |
cr3 | ) |
|
Load an address space
- Parameters
-
cr3 | The address space to load |
◆ map_pages()
void map_pages |
( |
void * |
virt_addr_ptr, |
|
|
void * |
phys_addr_ptr, |
|
|
int |
num_pages, |
|
|
char |
usr, |
|
|
char |
wr |
|
) |
| |
Map virtual pages to physical frames.
- Parameters
-
virt_addr_ptr | The start of the virtual range to map. |
phys_addr_ptr | The start of the physical range to map. |
num_pages | The number of pages to map. |
usr | Are the pages acessible by user mode code |
wr | Are the pages writable by user mode code (kernel always has write permissions) |
◆ paging_init()
◆ paging_new_address_space()
void* paging_new_address_space |
( |
| ) |
|
Create a new address space
- Returns
- a pointer to the new address space in physical memory.
◆ unmap_pages()
void unmap_pages |
( |
void * |
start_virt, |
|
|
int |
num_pages |
|
) |
| |
Unmap virtual pages,
- Parameters
-
start_virt | The start of the virtual range to unmap. |
num_pages | The number of pages to map. |
◆ virt_to_phys()
void* virt_to_phys |
( |
void * |
virt_addr | ) |
|
Convert a virtual address to a physical one.
- Parameters
-
virt_addr | The virtual address to convert |
- Returns
- the physical adress it maps to, or NULL if it is not mapped.