From 0804cb451a497f54d78ec94138d32457e742330f Mon Sep 17 00:00:00 2001 From: Alex Kotov Date: Sun, 19 Dec 2021 07:56:17 +0500 Subject: [PATCH] Add structs for page dir and page table --- include/kernaux/arch/i386.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/include/kernaux/arch/i386.h b/include/kernaux/arch/i386.h index 853f595..2f360b8 100644 --- a/include/kernaux/arch/i386.h +++ b/include/kernaux/arch/i386.h @@ -7,6 +7,8 @@ extern "C" { #include +#define KERNAUX_ARCH_I386_PAGE_DIR_TABLE_LENGTH 1024 + // CR0 bits #define KERNAUX_ARCH_I386_CR0_PE ((uint32_t)0x00000001) // 0: Protected Mode Enable #define KERNAUX_ARCH_I386_CR0_MP ((uint32_t)0x00000002) // 1: Monitor co-processor @@ -85,6 +87,18 @@ struct KernAux_Arch_I386_PTE { } __attribute__((packed)); +// Page directory +struct KernAux_Arch_I386_PageDir { + struct KernAux_Arch_I386_PDE pdes[KERNAUX_ARCH_I386_PAGE_DIR_TABLE_LENGTH]; +} +__attribute__((packed)); + +// Page table +struct KernAux_Arch_I386_PageTable { + struct KernAux_Arch_I386_PTE ptes[KERNAUX_ARCH_I386_PAGE_DIR_TABLE_LENGTH]; +} +__attribute__((packed)); + inline static uint8_t kernaux_arch_i386_inportb(uint16_t port); inline static uint16_t kernaux_arch_i386_inportw(uint16_t port); inline static uint32_t kernaux_arch_i386_inportd(uint16_t port);