diff options
Diffstat (limited to 'arch/i386/include/kernel/paging.h')
-rw-r--r-- | arch/i386/include/kernel/paging.h | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/arch/i386/include/kernel/paging.h b/arch/i386/include/kernel/paging.h index 5999986..d8bb8f3 100644 --- a/arch/i386/include/kernel/paging.h +++ b/arch/i386/include/kernel/paging.h @@ -5,6 +5,8 @@ #include <kernel/multiboot.h> #include <stdint.h> +#define PAGE_SIZE 4096 + #define PD_PRES 0x0001 #define PD_RW 0x0002 #define PD_USR 0x0004 @@ -28,14 +30,16 @@ #define GET_PADDR(x) (((uint32_t)(x)) - 0xC0000000) #define GET_VADDR(x) (((uint32_t)(x)) + 0xC0000000) -#define GET_PDX(x) (((uintptr_t)(x) >> 22) & 0x3FF) -#define GET_PTX(x) (((uintptr_t)(x) >> 12) & 0x3FF) +#define GET_PDX(x) ((uintptr_t)(x) >> 22) +#define GET_PTX(x) (((uintptr_t)(x) >> 12) & 0x03FF) + +uintptr_t get_physaddr(void *vaddr); -uintptr_t* init_page_table(void); void paging_init(void); -void map_page(uint32_t *pd, uintptr_t paddr, uintptr_t vaddr, uint32_t flags); -void unmap_page(uint32_t *pd, uintptr_t vaddr); +uintptr_t init_page_directory(void); +void map_page(uintptr_t paddr, uintptr_t vaddr, uint32_t flags); +void unmap_page(uintptr_t vaddr); void page_fault_handler(struct isr_frame *frame); |