Merge basic system calls with stack set-up infrastructure #27

Merged
td1223 merged 31 commits from user-programs into user-programs-stdout 2024-11-06 22:21:28 +00:00
2 changed files with 50 additions and 122 deletions
Showing only changes of commit 87126237ad - Show all commits

View File

@@ -1,5 +1,6 @@
#include "userprog/syscall.h"
#include "devices/shutdown.h"
#include "threads/vaddr.h"
#include <stdio.h>
#include <syscall-nr.h>
#include "threads/interrupt.h"
@@ -51,4 +52,15 @@ static void
exit (int status)
{
//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;
}