organization
This commit is contained in:
+16
-1
@@ -4,12 +4,27 @@
|
||||
#include "../include/stdio.h"
|
||||
#include <stdint.h>
|
||||
|
||||
#define PAGE_OFFSET 0xC0000000
|
||||
#define PAGE_SIZE 4096
|
||||
#define PAGE_SHIFT 0x0C
|
||||
|
||||
#define PAGE_MASK ~(PAGE_SIZE - 1) /* 0xFFFFF000 */
|
||||
#define PAGE_ALIGN(addr) (((addr) + (PAGE_SIZE - 1)) & PAGE_MASK)
|
||||
|
||||
#define PAGE_PRESENT 0x1
|
||||
#define PAGE_RW 0x002 /* Read/Write */
|
||||
#define PAGE_USER 0x004 /* User */
|
||||
#define PAGE_NOALLOC 0x200 /* No Page Allocated (OS managed) */
|
||||
|
||||
#define GDT_BASE (0xFFFFFFFF - (PAGE_OFFSET - 1))
|
||||
|
||||
#define GET_PGDIR(address) ((uint32_t)((address) >> 22) & 0x3FF)
|
||||
#define GET_PGTBL(address) ((uint32_t)((address) >> 12) & 0x3FF)
|
||||
|
||||
extern uint32_t kernel_page_directory[1024] __attribute__((aligned(4096)));
|
||||
extern uint32_t kernel_page_table[1024] __attribute__((aligned(4096)));
|
||||
extern uint32_t user_page_table[1024] __attribute__((aligned(4096)));
|
||||
|
||||
|
||||
//paging.c
|
||||
void enablePaging();
|
||||
void loadPageDirectory(uint32_t* page_directory);
|
||||
|
||||
Reference in New Issue
Block a user