1
0
Fork 0
mirror of https://github.com/tailix/kernel.git synced 2024-12-04 11:34:42 -05:00

Add file "arch/paging.c"

This commit is contained in:
Braiden Vasco 2017-11-04 04:19:32 +00:00
parent 874bc8498c
commit ef1012f3b7
2 changed files with 23 additions and 0 deletions

View file

@ -10,6 +10,7 @@ OBJS += main.c.o
OBJS += logger.c.o console.c.o kprintf.c.o
OBJS += multiboot.c.o
OBJS += memory.c.o
OBJS += paging.c.o
OBJS += protected.c.o protected.asm.cpp.o
OBJS += exception.c.o exception.asm.cpp.o

22
arch/paging.c Normal file
View file

@ -0,0 +1,22 @@
#define PAGES_PER_TABLE 1024
#define TABLES_PER_DIR 1024
struct page {
unsigned int present : 1;
unsigned int rw : 1;
unsigned int user : 1;
unsigned int accessed : 1;
unsigned int dirty : 1;
unsigned int unused : 7;
unsigned int frame : 20;
};
struct page_table {
struct page pages[PAGES_PER_TABLE];
};
struct page_dir {
struct page_table *tables[TABLES_PER_DIR];
unsigned int tables_phys[TABLES_PER_DIR];
unsigned int phys;
};