Add structs for page dir and page table

This commit is contained in:
Alex Kotov 2021-12-19 07:56:17 +05:00
parent 9fdee5025d
commit 0804cb451a
Signed by: kotovalexarian
GPG Key ID: 553C0EBBEB5D5F08
1 changed files with 14 additions and 0 deletions

View File

@ -7,6 +7,8 @@ extern "C" {
#include <stdint.h>
#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);