kernel/src/paging.h

31 lines
736 B
C
Raw Normal View History

2021-12-12 14:00:17 +00:00
#ifndef KERNEL_INCLUDED_PAGING
#define KERNEL_INCLUDED_PAGING 1
2020-12-01 19:11:28 +00:00
#include "config.h"
2017-11-09 16:00:36 +00:00
#include "info.h"
#include <kernaux/arch/i386.h>
2020-12-01 19:11:28 +00:00
#define PAGE_DIR_ALIGN 4096
#define PAGE_DIR_ADDR(base) ((base) >> 12)
2021-12-18 05:19:44 +00:00
struct Paging {
struct KernAux_Arch_I386_PageDir page_dir;
// FIXME: use PFA to allocate page tables dynamically.
2021-12-21 05:19:17 +00:00
struct KernAux_Arch_I386_PageTable page_tables[KERNAUX_ARCH_I386_PAGE_DIR_ENTRIES_COUNT];
2021-12-18 05:19:44 +00:00
}
__attribute__((packed))
__attribute__((aligned((PAGE_DIR_ALIGN))))
;
2020-12-01 19:11:28 +00:00
2021-12-18 20:05:42 +00:00
void paging_load(struct Paging *paging);
2021-12-18 20:26:49 +00:00
void paging_enable();
2017-11-04 14:59:01 +00:00
2021-12-18 05:19:44 +00:00
void paging_clear(struct Paging *paging);
2021-12-18 20:33:18 +00:00
2021-12-19 02:13:51 +00:00
void paging_identity(struct Paging *paging);
void paging_mapkernel(struct Paging *paging, const struct Kernel_Info *kinfo);
#endif