Page
include/mem/page.h View source View on GitHubStructs
Section titled “Structs”struct page {
uint64_t meta;
}; page_table
Section titled “page_table”struct page_table {
pte_t entries[512];
}; page_tag
Section titled “page_tag”enum page_tag {
PAGE_TAG_NONE = 0,
PAGE_TAG_BUDDY = 1,
PAGE_TAG_FOLIO = 2,
PAGE_TAG_ARENA = 3,
}; Functions
Section titled “Functions”page_get_tag
Section titled “page_get_tag”enum page_tag page_get_tag(const struct page *p); page_set_tag
Section titled “page_set_tag”void page_set_tag(struct page *p, enum page_tag tag); page_get_payload
Section titled “page_get_payload”uint64_t page_get_payload(const struct page *p); page_set_payload
Section titled “page_set_payload”void page_set_payload(struct page *p, uint64_t payload); page_assert_tag
Section titled “page_assert_tag”void page_assert_tag(const struct page *p, enum page_tag expected); page_for_pfn
Section titled “page_for_pfn”struct page page_for_pfn(pfn_t pfn); page_for_paddr
Section titled “page_for_paddr”struct page page_for_paddr(paddr_t paddr); page_get_pfn
Section titled “page_get_pfn”pfn_t page_get_pfn(const struct page *bp); page_get_paddr
Section titled “page_get_paddr”paddr_t page_get_paddr(const struct page *bp); page_get_vaddr
Section titled “page_get_vaddr”vaddr_t page_get_vaddr(const struct page *bp); Macros
Section titled “Macros”PAGE_SIZE
Section titled “PAGE_SIZE”#define PAGE_SIZE KB(4) PAGE_2MB
Section titled “PAGE_2MB”#define PAGE_2MB MB(2) PAGE_1GB
Section titled “PAGE_1GB”#define PAGE_1GB GB(1) PAGE_PRESENT_SHIFT
Section titled “PAGE_PRESENT_SHIFT”#define PAGE_PRESENT_SHIFT (0) PAGE_PRESENT
Section titled “PAGE_PRESENT”#define PAGE_PRESENT (0x1UL) PAGE_WRITE
Section titled “PAGE_WRITE”#define PAGE_WRITE (0x2UL) PAGE_USER_ALLOWED
Section titled “PAGE_USER_ALLOWED”#define PAGE_USER_ALLOWED (0x4UL) PAGE_ALL
Section titled “PAGE_ALL”#define PAGE_ALL 0xFFFUL PAGE_XD
Section titled “PAGE_XD”#define PAGE_XD (1UL << 63) // E(x)ecute (D)isable PAGE_PHYS_MASK
Section titled “PAGE_PHYS_MASK”#define PAGE_PHYS_MASK (0x00FFFFFFF000UL) PAGE_PAGE_SIZE
Section titled “PAGE_PAGE_SIZE”#define PAGE_PAGE_SIZE (1UL << 7) PAGE_UNCACHABLE
Section titled “PAGE_UNCACHABLE”#define PAGE_UNCACHABLE ((1UL << 4) | PAGE_WRITE) PAGE_NO_FLAGS
Section titled “PAGE_NO_FLAGS”#define PAGE_NO_FLAGS (0) PAGE_WRITETHROUGH
Section titled “PAGE_WRITETHROUGH”#define PAGE_WRITETHROUGH (1UL << 3) PAGE_2MB_page
Section titled “PAGE_2MB_page”#define PAGE_2MB_page (1ULL << 7) PAGE_PAGEABLE
Section titled “PAGE_PAGEABLE”#define PAGE_PAGEABLE (0) PAGE_MOVABLE
Section titled “PAGE_MOVABLE”#define PAGE_MOVABLE (0) PAGE_2MB_PHYS_MASK
Section titled “PAGE_2MB_PHYS_MASK”#define PAGE_2MB_PHYS_MASK (~((uintptr_t) PAGE_2MB - 1)) PAGE_ALIGN_DOWN
Section titled “PAGE_ALIGN_DOWN”#define PAGE_ALIGN_DOWN(x) ALIGN_DOWN((uintptr_t) (x), PAGE_SIZE) PAGE_ALIGN_UP
Section titled “PAGE_ALIGN_UP”#define PAGE_ALIGN_UP(x) ALIGN_UP((uintptr_t) (x), PAGE_SIZE) IS_PAGE_ALIGNED
Section titled “IS_PAGE_ALIGNED”#define IS_PAGE_ALIGNED(x) IS_ALIGNED((uintptr_t) (x), PAGE_SIZE) PAGE_2MB_ALIGN_DOWN
Section titled “PAGE_2MB_ALIGN_DOWN”#define PAGE_2MB_ALIGN_DOWN(x) ALIGN_DOWN((uintptr_t) (x), PAGE_2MB) PAGE_2MB_ALIGN_UP
Section titled “PAGE_2MB_ALIGN_UP”#define PAGE_2MB_ALIGN_UP(x) ALIGN_UP((uintptr_t) (x), PAGE_2MB) PAGE_1GB_ALIGN_DOWN
Section titled “PAGE_1GB_ALIGN_DOWN”#define PAGE_1GB_ALIGN_DOWN(x) ALIGN_DOWN((uintptr_t) (x), PAGE_1GB) PAGE_1GB_ALIGN_UP
Section titled “PAGE_1GB_ALIGN_UP”#define PAGE_1GB_ALIGN_UP(x) ALIGN_UP((uintptr_t) (x), PAGE_1GB) PAGE_TO_PFN
Section titled “PAGE_TO_PFN”#define PAGE_TO_PFN(addr) ((addr) / PAGE_SIZE) PFN_TO_PAGE
Section titled “PFN_TO_PAGE”#define PFN_TO_PAGE(pfn) ((pfn) * PAGE_SIZE) PAGES_NEEDED_FOR
Section titled “PAGES_NEEDED_FOR”#define PAGES_NEEDED_FOR(bytes) (((bytes) + PAGE_SIZE - 1ULL) / PAGE_SIZE) VMM_MAP_BASE
Section titled “VMM_MAP_BASE”#define VMM_MAP_BASE 0xFFFFA00000200000 VMM_MAP_LIMIT
Section titled “VMM_MAP_LIMIT”#define VMM_MAP_LIMIT 0xFFFFA00010000000 PT_ENTRIES
Section titled “PT_ENTRIES”#define PT_ENTRIES 512 PT_INDEX_MASK
Section titled “PT_INDEX_MASK”#define PT_INDEX_MASK 0x1FFULL PAGE_4K_SHIFT
Section titled “PAGE_4K_SHIFT”#define PAGE_4K_SHIFT 12 PAGE_2M_SHIFT
Section titled “PAGE_2M_SHIFT”#define PAGE_2M_SHIFT 21 PAGE_1G_SHIFT
Section titled “PAGE_1G_SHIFT”#define PAGE_1G_SHIFT 30 PAGE_4K_MASK
Section titled “PAGE_4K_MASK”#define PAGE_4K_MASK ((1ULL << PAGE_4K_SHIFT) - 1) PAGE_2M_MASK
Section titled “PAGE_2M_MASK”#define PAGE_2M_MASK ((1ULL << PAGE_2M_SHIFT) - 1) PAGE_TAG_MASK
Section titled “PAGE_TAG_MASK”#define PAGE_TAG_MASK 0x7ULL PAGE_PAYLOAD_ALIGNMENT
Section titled “PAGE_PAYLOAD_ALIGNMENT”#define PAGE_PAYLOAD_ALIGNMENT 8