Combine syscall code with final stack initialization code #32

Merged
td1223 merged 27 commits from read-only-exec into userprog-merge 2024-11-11 22:23:20 +00:00
Showing only changes of commit 26e38be761 - Show all commits

View File

@@ -5,6 +5,7 @@
#include "threads/interrupt.h" #include "threads/interrupt.h"
#include "threads/thread.h" #include "threads/thread.h"
#include "userprog/process.h" #include "userprog/process.h"
#include "userprog/pagedir.h"
#include <stdio.h> #include <stdio.h>
#include <syscall-nr.h> #include <syscall-nr.h>
@@ -227,8 +228,9 @@ validate_user_pointer (const void *ptr, size_t size)
{ {
if (size > 0 && (ptr == NULL || if (size > 0 && (ptr == NULL ||
!is_user_vaddr (ptr) || !is_user_vaddr (ptr) ||
!is_user_vaddr (ptr + size - 1))) !is_user_vaddr (ptr + size - 1) ||
pagedir_get_page (thread_current()->pagedir, ptr) == NULL))
thread_exit (); thread_exit ();
return ptr; return (void *) ptr;
} }