summaryrefslogtreecommitdiffstats
path: root/src/userprog
diff options
context:
space:
mode:
Diffstat (limited to 'src/userprog')
-rw-r--r--src/userprog/syscall.c14
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 ();
}