Combine syscall code with final stack initialization code #32

Merged
td1223 merged 27 commits from read-only-exec into userprog-merge 2024-11-11 22:23:20 +00:00
Showing only changes of commit a8676f2e09 - Show all commits

View File

@@ -1,14 +1,18 @@
#include "userprog/syscall.h"
#include "devices/shutdown.h"
#include "devices/input.h"
#include "filesys/filesys.h"
#include "threads/vaddr.h"
#include "threads/interrupt.h"
#include "threads/thread.h"
#include "threads/synch.h"
#include "userprog/process.h"
#include "userprog/pagedir.h"
#include <stdio.h>
#include <syscall-nr.h>
static struct lock filesys_lock;
static void syscall_handler (struct intr_frame *);
/* A syscall_function is a function that receives up to 3 arguments, the
@@ -68,6 +72,7 @@ void
syscall_init (void)
{
intr_register_int (0x30, 3, INTR_ON, syscall_handler, "syscall");
lock_init (&filesys_lock);
}
static void
@@ -126,8 +131,13 @@ syscall_wait (pid_t pid)
static bool
syscall_create (const char *file UNUSED, unsigned initial_size UNUSED)
{
//TODO
return 0;
validate_user_pointer (file, 1);
lock_acquire (&filesys_lock);
bool status = filesys_create (file, initial_size);
lock_release (&filesys_lock);
return status;
}
static bool