Implement VM #63

Merged
td1223 merged 94 commits from vm/merged/themis into master 2024-12-06 05:07:14 +00:00
16 changed files with 484 additions and 74 deletions
Showing only changes of commit 60faf995ea - Show all commits

View File

@@ -158,6 +158,16 @@ page_fault (struct intr_frame *f)
#ifdef VM
struct thread *t = thread_current ();
void *upage = pg_round_down (fault_addr);
/* If the fault address is in a user page that is not present, then it might
be an executable file page that needs to be lazily loaded. So, we check the
SPT to determine if this is the case, and if so load the page from disk. */
if (not_present && is_user_vaddr (upage))
{
if (try_fetch_page (upage, write))
return;
}
if (user)
{
if (not_present)
@@ -193,15 +203,6 @@ page_fault (struct intr_frame *f)
f->eax = 0xffffffff;
return;
}
/* If the fault address is in a user page that is not present, then it might
just need to be lazily loaded. So, we check our SPT to see if the page
is expected to have data loaded in memory. */
if (not_present && is_user_vaddr (upage) && upage != NULL)
{
if (try_fetch_page (upage, write))
return;
}
#endif
/* To implement virtual memory, delete the rest of the function