Karg  v0.2.0
The kernel of CargOS
vm.c File Reference
#include <mm/vm.h>
#include <errno.h>
#include <mm/page_alloc.h>
#include <utils/mem.h>

Classes

struct  pte_t
 

Macros

#define PTE_FLAG_V   0x01
 
#define PTE_FLAG_R   0x02
 
#define PTE_FLAG_W   0x04
 
#define PTE_FLAG_X   0x08
 
#define PTE_FLAG_U   0x10
 
#define PTE_FLAG_G   0x20
 
#define PTE_FLAG_A   0x40
 
#define PTE_FLAG_D   0x80
 

Functions

void * vm_create_page_table (void)
 
i32 vm_map_page (void *page_table, usize virt, void *phys, u32 flags)
 
i32 vm_virt_to_phys (void *page_table, usize virt, usize *phys)
 

Macro Definition Documentation

◆ PTE_FLAG_A

#define PTE_FLAG_A   0x40

◆ PTE_FLAG_D

#define PTE_FLAG_D   0x80

◆ PTE_FLAG_G

#define PTE_FLAG_G   0x20

◆ PTE_FLAG_R

#define PTE_FLAG_R   0x02

◆ PTE_FLAG_U

#define PTE_FLAG_U   0x10

◆ PTE_FLAG_V

#define PTE_FLAG_V   0x01

◆ PTE_FLAG_W

#define PTE_FLAG_W   0x04

◆ PTE_FLAG_X

#define PTE_FLAG_X   0x08

Function Documentation

◆ vm_create_page_table()

void* vm_create_page_table ( void  )

◆ vm_map_page()

i32 vm_map_page ( void *  page_table,
usize  virt,
void *  phys,
u32  flags 
)

◆ vm_virt_to_phys()

i32 vm_virt_to_phys ( void *  page_table,
usize  virt,
usize phys 
)