Implement VM #63

Merged
td1223 merged 94 commits from vm/merged/themis into master 2024-12-06 05:07:14 +00:00
139 changed files with 15266 additions and 168 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;
}