From ca9564b8c5b2d5223f317e9573e947dbf6332da8 Mon Sep 17 00:00:00 2001 From: Alex Kotov Date: Wed, 25 Nov 2020 17:27:40 +0500 Subject: [PATCH] Rename pagedir to page_dir --- kernelmq/Makefile | 2 +- kernelmq/page_dir.c | 1 + kernelmq/{pagedir.h => page_dir.h} | 4 +-- kernelmq/pagedir.c | 1 - kernelmq/paging.c | 56 +++++++++++++++--------------- 5 files changed, 32 insertions(+), 32 deletions(-) create mode 100644 kernelmq/page_dir.c rename kernelmq/{pagedir.h => page_dir.h} (90%) delete mode 100644 kernelmq/pagedir.c diff --git a/kernelmq/Makefile b/kernelmq/Makefile index 4666384..d6207eb 100644 --- a/kernelmq/Makefile +++ b/kernelmq/Makefile @@ -15,7 +15,7 @@ OBJS += init.c.o OBJS += multiboot.c.o OBJS += panic.c.o panic.asm.cpp.o OBJS += paging.c.o paging.asm.cpp.o -OBJS += pagedir.c.o +OBJS += page_dir.c.o # Architecture-independent OBJS += info.c.o diff --git a/kernelmq/page_dir.c b/kernelmq/page_dir.c new file mode 100644 index 0000000..3532012 --- /dev/null +++ b/kernelmq/page_dir.c @@ -0,0 +1 @@ +#include "page_dir.h" diff --git a/kernelmq/pagedir.h b/kernelmq/page_dir.h similarity index 90% rename from kernelmq/pagedir.h rename to kernelmq/page_dir.h index 11959d9..2268835 100644 --- a/kernelmq/pagedir.h +++ b/kernelmq/page_dir.h @@ -1,5 +1,5 @@ -#ifndef KERNELMQ_INCLUDED_PAGEDIR -#define KERNELMQ_INCLUDED_PAGEDIR 1 +#ifndef KERNELMQ_INCLUDED_PAGE_DIR +#define KERNELMQ_INCLUDED_PAGE_DIR 1 #include "config.h" diff --git a/kernelmq/pagedir.c b/kernelmq/pagedir.c deleted file mode 100644 index 9867672..0000000 --- a/kernelmq/pagedir.c +++ /dev/null @@ -1 +0,0 @@ -#include "pagedir.h" diff --git a/kernelmq/paging.c b/kernelmq/paging.c index 60b6777..1a84a8d 100644 --- a/kernelmq/paging.c +++ b/kernelmq/paging.c @@ -1,6 +1,6 @@ #include "paging.h" -#include "pagedir.h" +#include "page_dir.h" #include "panic.h" #include "stdlib.h" @@ -31,7 +31,7 @@ void write_cr0(volatile unsigned long); void write_cr3(volatile unsigned long); void write_cr4(volatile unsigned long); -static PageDir pagedir; +static PageDir page_dir; void paging_enable() { @@ -65,24 +65,24 @@ void paging_enable() void paging_clear() { - kmemset(pagedir, 0, sizeof(pagedir)); + kmemset(page_dir, 0, sizeof(page_dir)); } void paging_identity() { for (int i = 0; i < PAGE_DIR_LENGTH; ++i) { - pagedir[i].addr = PAGE_DIR_ADDR(i * PAGE_BIG_SIZE); + page_dir[i].addr = PAGE_DIR_ADDR(i * PAGE_BIG_SIZE); - pagedir[i].unused = 0; - pagedir[i].ignored = 0; - pagedir[i].page_size = 1; - pagedir[i].always_0 = 0; - pagedir[i].accessed = 0; - pagedir[i].cache_disabled = 1; - pagedir[i].write_through = 1; - pagedir[i].user = 1; - pagedir[i].writable = 1; - pagedir[i].present = 1; + page_dir[i].unused = 0; + page_dir[i].ignored = 0; + page_dir[i].page_size = 1; + page_dir[i].always_0 = 0; + page_dir[i].accessed = 0; + page_dir[i].cache_disabled = 1; + page_dir[i].write_through = 1; + page_dir[i].user = 1; + page_dir[i].writable = 1; + page_dir[i].present = 1; } } @@ -97,18 +97,18 @@ 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 = PAGE_DIR_ADDR(kern_phys); + page_dir[pde].addr = PAGE_DIR_ADDR(kern_phys); - pagedir[pde].unused = 0; - pagedir[pde].ignored = 0; - pagedir[pde].page_size = 1; - pagedir[pde].always_0 = 0; - pagedir[pde].accessed = 0; - pagedir[pde].cache_disabled = 0; - pagedir[pde].write_through = 0; - pagedir[pde].user = 0; - pagedir[pde].writable = 1; - pagedir[pde].present = 1; + page_dir[pde].unused = 0; + page_dir[pde].ignored = 0; + page_dir[pde].page_size = 1; + page_dir[pde].always_0 = 0; + page_dir[pde].accessed = 0; + page_dir[pde].cache_disabled = 0; + page_dir[pde].write_through = 0; + page_dir[pde].user = 0; + page_dir[pde].writable = 1; + page_dir[pde].present = 1; mapped += PAGE_BIG_SIZE; kern_phys += PAGE_BIG_SIZE; @@ -121,7 +121,7 @@ int paging_mapkernel(const struct KernelMQ_Info *const kinfo) unsigned long paging_load() { - unsigned long pagedir_phys = (unsigned long)pagedir; - write_cr3(pagedir_phys); - return pagedir_phys; + unsigned long page_dir_phys = (unsigned long)page_dir; + write_cr3(page_dir_phys); + return page_dir_phys; }