diff options
| author | Gustav Sörnäs <gustav@sornas.net> | 2021-02-05 13:00:30 +0100 |
|---|---|---|
| committer | Gustav Sörnäs <gustav@sornas.net> | 2021-02-05 13:04:44 +0100 |
| commit | be3915299c4d7106ac4482570ae8661e9c8da8d8 (patch) | |
| tree | 827d18cd9ba33607fd105be10de5f37cbd35d4ad /src/userprog | |
| parent | b9e1e4c18c379d0cc53a38329edcabd5dfc61785 (diff) | |
| download | pintos-be3915299c4d7106ac4482570ae8661e9c8da8d8.tar.gz | |
implement create()
Diffstat (limited to 'src/userprog')
| -rw-r--r-- | src/userprog/syscall.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/userprog/syscall.c b/src/userprog/syscall.c index d53c1bd..5e5a6f1 100644 --- a/src/userprog/syscall.c +++ b/src/userprog/syscall.c @@ -1,10 +1,13 @@ #include "userprog/syscall.h" #include <stdio.h> #include <syscall-nr.h> -#include "threads/init.h" #include "threads/interrupt.h" #include "threads/thread.h" +#include "threads/init.h" +#include "filesys/filesys.h" +#include "filesys/off_t.h" + static void syscall_handler (struct intr_frame *); void @@ -30,6 +33,14 @@ syscall_handler (struct intr_frame *f UNUSED) break; case 4: // create + ; // empty statement because c-grammar doesn't allow declarations following labels + printf("kernel: create\n"); + char *filename = INTR_ESP(1, char *); + printf("create: read filename '%s'\n", filename); + off_t initial_size = INTR_ESP(2, off_t); + printf("create: read initial_size '%d'\n", initial_size); + f->eax = filesys_create(filename, initial_size); + printf("create: result (%d) put in f->eax\n", f->eax); break; case 6: // open @@ -48,5 +59,4 @@ syscall_handler (struct intr_frame *f UNUSED) printf ("kernel: unknown syscall '%d'\n", syscall_number); break; } - thread_exit (); } |
