create all page tables for the kernel space

This commit is contained in:
Stefan Lankes 2011-03-04 21:34:04 +01:00
parent 08b0207dc9
commit 08dd1852b6

View file

@ -556,7 +556,7 @@ int arch_paging_init(void)
irq_install_handler(14, pagefault_handler);
// Create a page table to reference to the other page tables
pgt = (page_table_t*) get_pages(1);
pgt = (page_table_t*) get_page();
if (!pgt) {
kputs("arch_paging_init: Not enough memory!\n");
return -ENOMEM;
@ -572,6 +572,16 @@ int arch_paging_init(void)
per_core(current_task)->pgd->entries[index1] = (((size_t) pgt) & 0xFFFFF000)|KERN_TABLE;
pgt->entries[index2] = ((size_t) pgt & 0xFFFFF000)|KERN_PAGE;
// create the other PGTs for the kernel space
for(i=0; i<KERNEL_SPACE/(1024*PAGE_SIZE)-1; i++) {
size_t phyaddr = get_page();
if (!phyaddr)
continue;
memset((void*) phyaddr, 0, PAGE_SIZE);
pgt->entries[i] = (phyaddr & 0xFFFFF000)|KERN_PAGE;
}
/*
* Set the page table and page directory entries for the kernel. We map the kernel's physical address
* to the same virtual address.