From f2bb044e9e715f05db8df5950ca704976b98174a Mon Sep 17 00:00:00 2001 From: manuel Date: Wed, 20 Jun 2012 23:33:23 +0200 Subject: add stub for mmap/munmap + fix build errors in subdirectories --- filesys/Make.vars | 2 +- intro/Make.vars | 2 +- userprog/Make.vars | 2 +- userprog/exception.c | 2 +- userprog/process.h | 2 +- userprog/syscall.c | 19 ++++++++++++++++++- 6 files changed, 23 insertions(+), 6 deletions(-) diff --git a/filesys/Make.vars b/filesys/Make.vars index b3aa005..68d66b8 100644 --- a/filesys/Make.vars +++ b/filesys/Make.vars @@ -1,7 +1,7 @@ # -*- makefile -*- kernel.bin: DEFINES = -DUSERPROG -DFILESYS -KERNEL_SUBDIRS = threads devices lib lib/kernel userprog filesys +KERNEL_SUBDIRS = threads devices lib lib/kernel userprog filesys vm TEST_SUBDIRS = tests/userprog tests/filesys/base tests/filesys/extended GRADING_FILE = $(SRCDIR)/tests/filesys/Grading.no-vm SIMULATOR = --qemu diff --git a/intro/Make.vars b/intro/Make.vars index c612275..43faa3b 100644 --- a/intro/Make.vars +++ b/intro/Make.vars @@ -1,7 +1,7 @@ # -*- makefile -*- kernel.bin: DEFINES = -DUSERPROG -DFILESYS -KERNEL_SUBDIRS = threads devices lib lib/kernel userprog filesys $(KERNEL_TESTS) +KERNEL_SUBDIRS = threads devices lib lib/kernel userprog filesys vm $(KERNEL_TESTS) KERNEL_TESTS = tests/intro/alarm-clock TEST_SUBDIRS = tests/intro/alarm-clock tests/intro/userprog-args GRADING_FILE = $(SRCDIR)/tests/intro/Grading diff --git a/userprog/Make.vars b/userprog/Make.vars index e4dbb08..3541b02 100644 --- a/userprog/Make.vars +++ b/userprog/Make.vars @@ -1,7 +1,7 @@ # -*- makefile -*- kernel.bin: DEFINES = -DUSERPROG -DFILESYS -KERNEL_SUBDIRS = threads devices lib lib/kernel userprog filesys +KERNEL_SUBDIRS = threads devices lib lib/kernel userprog filesys vm TEST_SUBDIRS = tests/userprog tests/userprog/no-vm tests/filesys/base GRADING_FILE = $(SRCDIR)/tests/userprog/Grading SIMULATOR = --qemu diff --git a/userprog/exception.c b/userprog/exception.c index debe7f0..a2873d5 100644 --- a/userprog/exception.c +++ b/userprog/exception.c @@ -175,7 +175,7 @@ page_fault (struct intr_frame *f) printf ("Unable to load page at %p in %s context.\n", fault_addr, user ? "user" : "kernel"); } - /* there's no page in our page table but we might still have an valid + /* there's no page in our page table but we might still have a valid stack access and need to expand our stack. so just check for that. the maxium offset we consider as a valid access is caused by the PUSHA instruction. it's 32 bytes below the current stack pointer */ diff --git a/userprog/process.h b/userprog/process.h index ccb94cb..5fcd80e 100644 --- a/userprog/process.h +++ b/userprog/process.h @@ -3,7 +3,7 @@ #include "threads/thread.h" -#define STACK_SIZE (1 << 23) /* 8MB maxiumum stack size */ +#define STACK_SIZE (1 << 23) /* 8MB maximum stack size */ /* In the current implementation, the capacity is fixed to 1024 (PGSIZE/4) */ struct fd_table { diff --git a/userprog/syscall.c b/userprog/syscall.c index 541668d..71aba5c 100644 --- a/userprog/syscall.c +++ b/userprog/syscall.c @@ -14,6 +14,7 @@ #include "userprog/pagedir.h" #include "userprog/process.h" #include "userprog/syscall.h" +#include "lib/user/syscall.h" #define STACK_SLOT_SIZE sizeof(int) @@ -181,7 +182,9 @@ static handler syscall_read, syscall_seek, syscall_tell, - syscall_close; + syscall_close, + syscall_mmap, + syscall_munmap; /* Register syscall_handler for interrupt 0x30 */ void @@ -217,6 +220,8 @@ syscall_handler (struct intr_frame *f) case SYS_SEEK: fp = syscall_seek; break; case SYS_TELL: fp = syscall_tell; break; case SYS_CLOSE: fp = syscall_close; break; + case SYS_MMAP: fp = syscall_mmap; break; + case SYS_MUNMAP: fp = syscall_munmap; break; default: goto fail; } @@ -564,3 +569,15 @@ syscall_close (void *sp, bool *segfault) (void) process_close_file (fd); return 0; } + +static int +syscall_mmap (void *sp, bool *segfault) +{ + return 0; +} + +static int +syscall_munmap (void *sp, bool *segfault) +{ + return 0; +} -- cgit v1.2.3