Add support for some basic system calls and args handling correctly. #29

Merged
sb3923 merged 49 commits from system-calls into master 2024-11-07 19:36:30 +00:00
2 changed files with 58 additions and 16 deletions
Showing only changes of commit 87126237ad - Show all commits

View File

@@ -1,5 +1,6 @@
#include "userprog/syscall.h" #include "userprog/syscall.h"
#include "devices/shutdown.h" #include "devices/shutdown.h"
#include "threads/vaddr.h"
#include <stdio.h> #include <stdio.h>
#include <syscall-nr.h> #include <syscall-nr.h>
#include "threads/interrupt.h" #include "threads/interrupt.h"
@@ -52,3 +53,14 @@ exit (int status)
{ {
//TODO //TODO
} }
/* A function to validate if a block of memory starting at PTR and of
size SIZE bytes is fully contained within user virtual memory. */
static void *
validate_user_pointer (void *ptr, size_t size)
{
if (ptr == NULL || !is_user_vaddr (ptr) || !is_user_vaddr (ptr + size - 1))
thread_exit ();
return ptr;
}