Fix multi-oom #39

Merged
gk1623 merged 23 commits from userprog-oom into master 2024-11-13 22:09:12 +00:00
17 changed files with 241 additions and 81 deletions
Showing only changes of commit 31ea215805 - Show all commits

View File

@@ -446,13 +446,12 @@ validate_user_string (const char *str)
if (str == NULL || !is_user_vaddr (str)) if (str == NULL || !is_user_vaddr (str))
syscall_exit (EXIT_FAILURE); syscall_exit (EXIT_FAILURE);
size_t length = 0;
size_t offset = (uintptr_t) str % PGSIZE; size_t offset = (uintptr_t) str % PGSIZE;
/* We move page by page, checking if the page is mapped to physical memory. */ /* We move page by page, checking if the page is mapped to physical memory. */
for (;;) for (;;)
{ {
void *page = pg_round_down (str + length); void *page = pg_round_down (str);
if (!is_user_vaddr(page) || if (!is_user_vaddr(page) ||
pagedir_get_page (thread_current ()->pagedir, page) == NULL) pagedir_get_page (thread_current ()->pagedir, page) == NULL)