Feat: pointer validation checks string across multiple pages and handle kernel page faults

This commit is contained in:
EDiasAlberto
2024-11-29 23:49:49 +00:00
parent 5f40d83e66
commit 5c661c2e24
4 changed files with 37 additions and 27 deletions

View File

@@ -146,19 +146,19 @@ page_fault (struct intr_frame *f)
write = (f->error_code & PF_W) != 0;
user = (f->error_code & PF_U) != 0;
/* Kernel page fault is further handled by the kernel itself. */
if (kernel)
if (user && not_present)
{
f->eip = (void *)f->eax;
if (try_alloc_new_page (fault_addr, f->esp))
return;
}
else
{
if (try_alloc_new_page (fault_addr, thread_current ()->curr_esp))
return;
f->eip = (void *)f->eax;
f->eax = 0xffffffff;
return;
}
if (user)
{
if (try_alloc_new_page (fault_addr, f->esp))
return;
}
}
/* To implement virtual memory, delete the rest of the function
body, and replace it with code that brings in the page to