Add a PAGE_GLOBAL flag for kernel pages

This commit is contained in:
Thomas Lovén 2018-01-04 00:45:01 +01:00
parent 470eb5e9f9
commit 9a479b1132
3 changed files with 7 additions and 6 deletions

View File

@ -9,20 +9,20 @@ BootP4:
.rept ENTRIES_PER_PT - 2
.quad 0
.endr
.quad offset V2P(BootP3) + (PAGE_PRESENT | PAGE_WRITE)
.quad offset V2P(BootP3) + (PAGE_PRESENT | PAGE_WRITE | PAGE_GLOBAL)
BootP3:
.quad offset V2P(BootP2) + (PAGE_PRESENT | PAGE_WRITE)
.quad offset V2P(BootP2) + (PAGE_PRESENT | PAGE_WRITE | PAGE_GLOBAL)
.rept ENTRIES_PER_PT - 1
.quad 0
.endr
BootP2:
.quad offset V2P(BootP1) + (PAGE_PRESENT | PAGE_WRITE)
.quad offset V2P(BootP1) + (PAGE_PRESENT | PAGE_WRITE | PAGE_GLOBAL)
.rept ENTRIES_PER_PT - 1
.quad 0
.endr
BootP1:
.set i, 0
.rept ENTRIES_PER_PT
.quad (i << 12) + (PAGE_PRESENT | PAGE_WRITE)
.quad (i << 12) + (PAGE_PRESENT | PAGE_WRITE | PAGE_GLOBAL)
.set i, (i+1)
.endr

View File

@ -30,8 +30,8 @@ void kmain(uint64_t multiboot_magic, void *multiboot_data)
continue;
if(vmm_get_page(&BootP4, (uintptr_t)P2V(p)) == (uintptr_t)-1)
{
touch_page(&BootP4, (uintptr_t)P2V(p), PAGE_WRITE | PAGE_HUGE);
vmm_set_page(&BootP4, (uintptr_t)P2V(p), p, PAGE_HUGE | PAGE_WRITE | PAGE_PRESENT);
touch_page(&BootP4, (uintptr_t)P2V(p), PAGE_GLOBAL | PAGE_WRITE | PAGE_HUGE);
vmm_set_page(&BootP4, (uintptr_t)P2V(p), p, PAGE_GLOBAL | PAGE_HUGE | PAGE_WRITE | PAGE_PRESENT);
}
if(type == 1)
pmm_free(p);

View File

@ -19,6 +19,7 @@
#define PAGE_PRESENT 0x001
#define PAGE_WRITE 0x002
#define PAGE_HUGE 0x080
#define PAGE_GLOBAL 0x100
#define PAGE_SIZE 0x1000
#define ENTRIES_PER_PT 512