map apic
This commit is contained in:
@@ -11,22 +11,22 @@ void create_basic_page_table(uintptr_t base){
|
||||
//pagetable_entry_t *l1 = (pagetable_entry_t *) (base + (7 * 4096));
|
||||
four_lvl_paging_t* table = (four_lvl_paging_t*)base;
|
||||
|
||||
table->l4 = {
|
||||
.present = 0,
|
||||
.write = 0,
|
||||
.user = 0,
|
||||
.address = 0, //(uintptr_t)&(table->l3) >> 12,
|
||||
table->l4.entries[0] = {
|
||||
.present = 1,
|
||||
.write = 1,
|
||||
.user = 1,
|
||||
.address = (uintptr_t)&(table->l3) >> 12,
|
||||
};
|
||||
|
||||
table->l3 = {
|
||||
table->l3.entries[0] = {
|
||||
.present = 1,
|
||||
.write = 1,
|
||||
.user = 1,
|
||||
.address = (uintptr_t)&(table->l2) >> 12,
|
||||
};
|
||||
|
||||
for(uint32_t i=0; i<sizeof(table->l2)/sizeof(table->l2[0]); i++){
|
||||
table->l2[i] = {
|
||||
for(uint32_t i=0; i<sizeof(table->l1)/sizeof(table->l1[0]); i++){
|
||||
table->l2.entries[i] = {
|
||||
.present = 1,
|
||||
.write = 1,
|
||||
.user = 1,
|
||||
@@ -35,7 +35,7 @@ void create_basic_page_table(uintptr_t base){
|
||||
}
|
||||
|
||||
//kernel memory
|
||||
for(uintptr_t i=0; i<0x40000000/4096; i++){
|
||||
for(uintptr_t i=0; i<0x4000000/4096; i++){
|
||||
table->l1[i/512].entries[i%512] = {
|
||||
.present = 1,
|
||||
.write = 1,
|
||||
@@ -44,4 +44,47 @@ void create_basic_page_table(uintptr_t base){
|
||||
};
|
||||
}
|
||||
|
||||
//add ioapic address to pagetable
|
||||
table->l3.entries[3] = {
|
||||
.present = 1,
|
||||
.write = 1,
|
||||
.user = 1,
|
||||
.address = (uintptr_t)&(table->l2_apic) >> 12,
|
||||
};
|
||||
table->l2_apic.entries[502] = {
|
||||
.present = 1,
|
||||
.write = 1,
|
||||
.user = 1,
|
||||
.address = (uintptr_t)&(table->ioapic) >> 12,
|
||||
};
|
||||
table->ioapic.entries[0] = {
|
||||
.present = 1,
|
||||
.write = 1,
|
||||
.user = 0,
|
||||
.address = 0xFEC00,
|
||||
};
|
||||
|
||||
//lapic
|
||||
table->l2_apic.entries[503] = {
|
||||
.present = 1,
|
||||
.write = 1,
|
||||
.user = 1,
|
||||
.address = (uintptr_t)&(table->lapic) >> 12,
|
||||
};
|
||||
table->lapic.entries[0] = {
|
||||
.present = 1,
|
||||
.write = 1,
|
||||
.user = 0,
|
||||
.address = 0xFEE00,
|
||||
};
|
||||
|
||||
|
||||
//unmap 0 page
|
||||
table->l1[0].entries[0].present = 0;
|
||||
|
||||
////map ioapic
|
||||
//uintptr_t ioapic_page = 0xfec00000 >> 12;
|
||||
//table->l1[ioapic_page/512].entries[ioapic_page%512].address = ioapic_page;
|
||||
//table->l1[ioapic_page/512].entries[ioapic_page%512].present = 1;
|
||||
//table->l1[ioapic_page/512].entries[ioapic_page%512].write = 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user