From 495d3cf2bdf5e1ce0654f37a3d983d55e098964d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustav=20S=C3=B6rn=C3=A4s?= Date: Fri, 19 Feb 2021 12:14:36 +0100 Subject: prepare for lab 3 --- src/userprog/syscall.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/userprog') diff --git a/src/userprog/syscall.c b/src/userprog/syscall.c index 4ff0340..65ebc7e 100644 --- a/src/userprog/syscall.c +++ b/src/userprog/syscall.c @@ -8,6 +8,7 @@ #include "filesys/file.h" #include "filesys/filesys.h" #include "filesys/off_t.h" +#include "lib/pid_t.h" #include "threads/init.h" #include "threads/malloc.h" @@ -67,7 +68,7 @@ get_fd (struct thread *thread, int fd_i) } static void -exit (int status) +exit (int status UNUSED) { struct thread *thread = thread_current (); @@ -142,6 +143,12 @@ close (int fd_i) } } +static pid_t +exec (const char *file_name UNUSED) +{ + return -1; +} + // cast to TYPE and deref argument N from f->esp #define INTR_ESP(N, TYPE) *(TYPE *)(f->esp+(4*(N))) @@ -158,6 +165,10 @@ syscall_handler (struct intr_frame *f UNUSED) // exit exit (INTR_ESP (1, int)); break; + case 2: + // exec + f->eax = exec (INTR_ESP (1, char *)); + break; case 4: // create f->eax = create (INTR_ESP (1, char *), INTR_ESP (2, off_t)); -- cgit v1.2.1