now, the page fault handler determines the PGT's address correctly

This commit is contained in:
Stefan Lankes 2011-08-18 07:08:25 -07:00
parent 01a4573b36
commit 1f178b99cc

View file

@ -623,20 +623,18 @@ static void pagefault_handler(struct state *s)
put_page(phyaddr);
}
// does our SVM system need to handle this page fault?
index1 = viraddr >> 22;
index2 = (viraddr >> 12) & 0x3FF;
kprintf("page fault: pgd 0x%p\n", pgd);
if (pgd)
pgt = (page_table_t*) (pgd->entries[index1] & 0xFFFFF000);
kprintf("page fault: pgt 0x%p\n", pgt);
if (!pgt)
if (!pgd || !(pgd->entries[index1] & 0xFFFFF000))
goto default_handler;
pgt = (page_table_t*) ((KERNEL_SPACE - 1024*PAGE_SIZE + index1*PAGE_SIZE) & 0xFFFFF000);
if (!pgt || !(pgt->entries[index2]))
goto default_handler;
if (pgt->entries[index2] & PG_SVM)
if (!svm_access_request(viraddr))
return;
kprintf("pgt->entries[%d] = 0x%x\n", index2, pgt->entries[index2]);
default_handler:
kprintf("PAGE FAULT: Task %u got page fault at %p (irq %d, cs:eip 0x%x:0x%x)\n", task->id, viraddr, s->int_no, s->cs, s->eip);