From 5516ccbe10ab2f35506e83afca43aeb1185795c8 Mon Sep 17 00:00:00 2001 From: Braiden Vasco Date: Thu, 9 Nov 2017 06:26:24 +0000 Subject: [PATCH] Add macro "PAGE_DIR_ADDR" --- arch/x86/pagedir.h | 2 ++ arch/x86/paging.c | 6 ++---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/x86/pagedir.h b/arch/x86/pagedir.h index 8235482..11959d9 100644 --- a/arch/x86/pagedir.h +++ b/arch/x86/pagedir.h @@ -5,6 +5,8 @@ #define PAGE_DIR_ALIGN 4096 +#define PAGE_DIR_ADDR(base) ((base) >> 12) + struct PageDir_Entry { unsigned int present : 1; unsigned int writable : 1; diff --git a/arch/x86/paging.c b/arch/x86/paging.c index 4b1d59d..688bea4 100644 --- a/arch/x86/paging.c +++ b/arch/x86/paging.c @@ -24,8 +24,6 @@ #define I386_CR4_MCE 0x00000040 // Machine check enable #define I386_CR4_PGE 0x00000080 // Global page flag enable -#define BIG_PAGE_BASE_TO_ADDR(base) ((base) >> 12) - unsigned long read_cr0(); unsigned long read_cr4(); @@ -73,7 +71,7 @@ void paging_clear() void paging_identity() { for (int i = 0; i < PAGE_DIR_LENGTH; ++i) { - pagedir[i].addr = BIG_PAGE_BASE_TO_ADDR(i * PAGE_BIG_SIZE); + pagedir[i].addr = PAGE_DIR_ADDR(i * PAGE_BIG_SIZE); pagedir[i].unused = 0; pagedir[i].ignored = 0; @@ -99,7 +97,7 @@ int paging_mapkernel(const struct KernelMQ_Info *const kinfo) unsigned long kern_phys = kinfo->kernel_phys_base; while (mapped < kinfo->kernel_size) { - pagedir[pde].addr = BIG_PAGE_BASE_TO_ADDR(kern_phys); + pagedir[pde].addr = PAGE_DIR_ADDR(kern_phys); pagedir[pde].unused = 0; pagedir[pde].ignored = 0;