Cleaner include paths + some paging definitions
This commit is contained in:
@@ -1,16 +1,29 @@
|
||||
#ifndef PAGING_PMM_H
|
||||
#define PAGING_PMM_H
|
||||
|
||||
/*
|
||||
We are going to use a bitmap, consisting of an array of uint64_t
|
||||
to represent pages for the PMM (physical memory manager).
|
||||
|
||||
Bit set (1) = page used
|
||||
Bit clear (0) = page free
|
||||
|
||||
*/
|
||||
#ifndef PAGING_H
|
||||
#define PAGING_H
|
||||
|
||||
#define PAGE_SIZE 4096
|
||||
#define BITS_PER_ROW 64
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
void paging_init();
|
||||
|
||||
extern uint64_t hhdm_off;
|
||||
|
||||
#define PHYS_TO_VIRT(x) ((void*)((uintptr_t)(x) + hhdm_off))
|
||||
#define VIRT_TO_PHYS(x) ((uintptr_t)(x) - hhdm_off)
|
||||
|
||||
// Stole it
|
||||
#define ALIGN_UP(x, align) (((x) + ((align) - 1)) & ~((align) - 1))
|
||||
#define ALIGN_DOWN(x, align) ((x) & ~((align) - 1))
|
||||
|
||||
// Page entry special bits
|
||||
// Bits set on a parent (directory, table) fall back to their children
|
||||
#define PTE_PRESENT (1ULL << 0)
|
||||
#define PTE_WRITE (1ULL << 1)
|
||||
#define PTE_USER (1ULL << 2)
|
||||
#define PTE_HUGE (1ULL << 7)
|
||||
#define PTE_NOEXEC (1ULL << 63)
|
||||
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user