Refactor: abstract new page allocation to one general function and make helper functions static

This commit is contained in:
EDiasAlberto
2024-11-27 19:41:22 +00:00
parent c74a8c55aa
commit 4f84a83611
4 changed files with 34 additions and 28 deletions

View File

@@ -146,9 +146,9 @@ page_fault (struct intr_frame *f)
write = (f->error_code & PF_W) != 0;
user = (f->error_code & PF_U) != 0;
if (user && needs_new_page (fault_addr, f->esp))
if (user)
{
if (grow_stack (fault_addr))
if (try_alloc_new_page (fault_addr, f->esp))
return;
}