diff options
| author | Gustav Sörnäs <gustav@sornas.net> | 2021-02-19 12:14:36 +0100 |
|---|---|---|
| committer | Gustav Sörnäs <gustav@sornas.net> | 2021-02-19 12:15:29 +0100 |
| commit | 495d3cf2bdf5e1ce0654f37a3d983d55e098964d (patch) | |
| tree | d150e97c258e079eccd3fef4b5a92f622974550d /src/userprog/syscall.c | |
| parent | 3ed3ba31adb9c84bcca000a5f31c5278211bd3ae (diff) | |
| download | pintos-495d3cf2bdf5e1ce0654f37a3d983d55e098964d.tar.gz | |
prepare for lab 3
Diffstat (limited to 'src/userprog/syscall.c')
| -rw-r--r-- | src/userprog/syscall.c | 13 |
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)); |
