23#define PTSPAN (1 << PTBITS << PGBITS)
24#define PTMASK BITMASK(PTSHIFT, PTBITS)
27#define PDSHIFT (PTSHIFT + PTBITS)
29#define PDMASK BITMASK(PDSHIFT, PDBITS)
32static inline unsigned pt_no (
const void *va) {
61#define PTE_FLAGS 0x00000fff
62#define PTE_ADDR 0xfffff000
63#define PTE_AVL 0x00000e00
#define ASSERT(CONDITION)
This is outside the header guard so that debug.h may be included multiple times with different settin...
#define PTE_W
1=read/write, 0=read-only.
static uint32_t pte_create_user(void *page, bool writable)
Returns a PTE that points to PAGE.
#define PDSHIFT
Page directory index (bits 22:31).
#define PTSHIFT
Functions and macros for working with x86 hardware page tables.
static unsigned pt_no(const void *va)
Obtains page table index from a virtual address.
static void * pte_get_page(uint32_t pte)
Returns a pointer to the page that page table entry PTE points to.
#define PTE_P
1=present, 0=not present.
static uint32_t pde_create(uint32_t *pt)
Returns a PDE that points to page table PT.
#define PTE_ADDR
Address bits.
static uintptr_t pd_no(const void *va)
Obtains page directory index from a virtual address.
static uint32_t pte_create_kernel(void *page, bool writable)
Returns a PTE that points to PAGE.
#define PTE_U
1=user/kernel, 0=kernel only.
#define PTMASK
Page table bits (12:21).
static uint32_t * pde_get_pt(uint32_t pde)
Returns a pointer to the page table that page directory entry PDE, which must "present",...
static uintptr_t vtop(const void *vaddr)
Returns physical address at which kernel virtual address VADDR is mapped.
static unsigned pg_ofs(const void *va)
Offset within a page.
static void * ptov(uintptr_t paddr)
Returns kernel virtual address at which physical address PADDR is mapped.