Merge lazy loading with page swapping #56

Merged
td1223 merged 9 commits from vm/lazy-loading into vm/page-swap-synch 2024-12-04 18:48:19 +00:00
141 changed files with 15320 additions and 64 deletions
Showing only changes of commit c8b93c57ee - Show all commits

View File

@@ -179,18 +179,23 @@ try_fetch_page (void *upage, bool write)
if (page == NULL)
return false;
/* An attempt to write to a non-writeable should fail. */
if (write && !page->writable)
{
pagedir_set_writable(thread_current()->pagedir, upage, write);
page->writable = true;
return true;
}
return false;
/* Load the page into memory based on the type of data it is expecting. */
bool success = false;
switch (page->type) {
case PAGE_EXECUTABLE:
return page_load (page, write);
success = page_load (page, page->writable);
break;
default:
return false;
}
}
if (success && page->writable &&
!pagedir_is_writable(thread_current()->pagedir, upage))
pagedir_set_writable(thread_current()->pagedir, upage, true);
return success;
}