diff --git a/src/userprog/syscall.c b/src/userprog/syscall.c index c6d4259..e85f194 100644 --- a/src/userprog/syscall.c +++ b/src/userprog/syscall.c @@ -11,11 +11,13 @@ #include "threads/synch.h" #include "userprog/process.h" #include "userprog/pagedir.h" +#include "vm/mmap.h" #include #include #define MAX_SYSCALL_ARGS 3 #define EXIT_FAILURE -1 +#define MMAP_FAILURE -1 struct open_file { @@ -45,6 +47,8 @@ static int syscall_write (int fd, const void *buffer, unsigned size); static void syscall_seek (int fd, unsigned position); static unsigned syscall_tell (int fd); static void syscall_close (int fd); +static mapid_t syscall_mmap (int fd, void *addr); +static void syscall_munmap (mapid_t mapping); static struct open_file *fd_get_file (int fd); static void validate_user_pointer (const void *start, size_t size, bool write); @@ -74,6 +78,8 @@ static const struct syscall_arguments syscall_lookup[] = [SYS_SEEK] = {(syscall_function) syscall_seek, 2}, [SYS_TELL] = {(syscall_function) syscall_tell, 1}, [SYS_CLOSE] = {(syscall_function) syscall_close, 1}, + [SYS_MMAP] = {(syscall_function) syscall_mmap, 2}, + [SYS_MUNMAP] = {(syscall_function) syscall_munmap, 1} }; /* The number of syscall functions (i.e, number of elements) within the @@ -394,6 +400,20 @@ syscall_close (int fd) } } +/* Handles the syscall for memory mapping a file. */ +static mapid_t +syscall_mmap (int fd, void *addr) +{ + return MMAP_FAILURE; +} + +/* Handles the syscall for unmapping a memory mapped file. */ +static void +syscall_munmap (mapid_t mapping UNUSED) +{ + +} + /* Hashing function needed for the open_file table. Returns a hash for an entry, based on its FD. */ unsigned