Added some Page Table stuff :3
This commit is contained in:
parent
9fd57e7e34
commit
64f29facc5
|
@ -15,13 +15,36 @@ struct x86_Page_Directory {
|
||||||
bool available_2: 1;
|
bool available_2: 1;
|
||||||
bool page_size: 1;
|
bool page_size: 1;
|
||||||
uint8_t available_1 : 4;
|
uint8_t available_1 : 4;
|
||||||
uint32_t address : 20;
|
uint32_t address : 20; // Multiply by 0x1000
|
||||||
} __attribute__((packed));
|
} __attribute__((packed));
|
||||||
|
|
||||||
extern uint32_t boot_page_directory[1024] __attribute__((aligned(4096)));
|
struct x86_Page_Table {
|
||||||
|
bool present: 1;
|
||||||
|
bool read_write: 1;
|
||||||
|
bool user_supervisor: 1;
|
||||||
|
bool write_through: 1;
|
||||||
|
bool cache_disable: 1;
|
||||||
|
bool accesed: 1;
|
||||||
|
bool dirty: 1;
|
||||||
|
bool page_attribute_table: 1;
|
||||||
|
bool global: 1;
|
||||||
|
uint8_t available_1 : 3;
|
||||||
|
uint32_t address : 20; // Multiply by 0x1000
|
||||||
|
} __attribute__((packed));
|
||||||
|
|
||||||
|
extern struct x86_Page_Directory boot_page_directory[1024] __attribute__((aligned(4096)));
|
||||||
|
|
||||||
|
static struct x86_Page_Table* get_table(uint16_t index) {
|
||||||
|
struct x86_Page_Table* table = (struct x86_Page_Table*)(boot_page_directory[index].address * 0x1000 + 0xC0000000);
|
||||||
|
return table;
|
||||||
|
}
|
||||||
|
|
||||||
void setup_paging() {
|
void setup_paging() {
|
||||||
size_t size = sizeof(boot_page_directory[0]);
|
struct x86_Page_Table* kernel = get_table(768);
|
||||||
struct x86_Page_Directory *directory = (struct x86_Page_Directory*) boot_page_directory;
|
for (int i = 0; i < 1024; i++) {
|
||||||
uint32_t table_1 = boot_page_directory[768];
|
if (kernel[i].address != 0) {
|
||||||
|
struct x86_Page_Table test = kernel[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue