summaryrefslogtreecommitdiffstats
path: root/src/userprog
diff options
context:
space:
mode:
Diffstat (limited to 'src/userprog')
-rw-r--r--src/userprog/syscall.c13
1 files changed, 12 insertions, 1 deletions
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));