diff options
| -rw-r--r-- | filesys/Make.vars | 2 | ||||
| -rw-r--r-- | intro/Make.vars | 2 | ||||
| -rw-r--r-- | userprog/Make.vars | 2 | ||||
| -rw-r--r-- | userprog/exception.c | 2 | ||||
| -rw-r--r-- | userprog/process.h | 2 | ||||
| -rw-r--r-- | 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 @@ | |||
| 1 | # -*- makefile -*- | 1 | # -*- makefile -*- |
| 2 | 2 | ||
| 3 | kernel.bin: DEFINES = -DUSERPROG -DFILESYS | 3 | kernel.bin: DEFINES = -DUSERPROG -DFILESYS |
| 4 | KERNEL_SUBDIRS = threads devices lib lib/kernel userprog filesys | 4 | KERNEL_SUBDIRS = threads devices lib lib/kernel userprog filesys vm |
| 5 | TEST_SUBDIRS = tests/userprog tests/filesys/base tests/filesys/extended | 5 | TEST_SUBDIRS = tests/userprog tests/filesys/base tests/filesys/extended |
| 6 | GRADING_FILE = $(SRCDIR)/tests/filesys/Grading.no-vm | 6 | GRADING_FILE = $(SRCDIR)/tests/filesys/Grading.no-vm |
| 7 | SIMULATOR = --qemu | 7 | 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 @@ | |||
| 1 | # -*- makefile -*- | 1 | # -*- makefile -*- |
| 2 | 2 | ||
| 3 | kernel.bin: DEFINES = -DUSERPROG -DFILESYS | 3 | kernel.bin: DEFINES = -DUSERPROG -DFILESYS |
| 4 | KERNEL_SUBDIRS = threads devices lib lib/kernel userprog filesys $(KERNEL_TESTS) | 4 | KERNEL_SUBDIRS = threads devices lib lib/kernel userprog filesys vm $(KERNEL_TESTS) |
| 5 | KERNEL_TESTS = tests/intro/alarm-clock | 5 | KERNEL_TESTS = tests/intro/alarm-clock |
| 6 | TEST_SUBDIRS = tests/intro/alarm-clock tests/intro/userprog-args | 6 | TEST_SUBDIRS = tests/intro/alarm-clock tests/intro/userprog-args |
| 7 | GRADING_FILE = $(SRCDIR)/tests/intro/Grading | 7 | 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 @@ | |||
| 1 | # -*- makefile -*- | 1 | # -*- makefile -*- |
| 2 | 2 | ||
| 3 | kernel.bin: DEFINES = -DUSERPROG -DFILESYS | 3 | kernel.bin: DEFINES = -DUSERPROG -DFILESYS |
| 4 | KERNEL_SUBDIRS = threads devices lib lib/kernel userprog filesys | 4 | KERNEL_SUBDIRS = threads devices lib lib/kernel userprog filesys vm |
| 5 | TEST_SUBDIRS = tests/userprog tests/userprog/no-vm tests/filesys/base | 5 | TEST_SUBDIRS = tests/userprog tests/userprog/no-vm tests/filesys/base |
| 6 | GRADING_FILE = $(SRCDIR)/tests/userprog/Grading | 6 | GRADING_FILE = $(SRCDIR)/tests/userprog/Grading |
| 7 | SIMULATOR = --qemu | 7 | 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) | |||
| 175 | printf ("Unable to load page at %p in %s context.\n", | 175 | printf ("Unable to load page at %p in %s context.\n", |
| 176 | fault_addr, user ? "user" : "kernel"); | 176 | fault_addr, user ? "user" : "kernel"); |
| 177 | } | 177 | } |
| 178 | /* there's no page in our page table but we might still have an valid | 178 | /* there's no page in our page table but we might still have a valid |
| 179 | stack access and need to expand our stack. so just check for that. | 179 | stack access and need to expand our stack. so just check for that. |
| 180 | the maxium offset we consider as a valid access is caused by the PUSHA | 180 | the maxium offset we consider as a valid access is caused by the PUSHA |
| 181 | instruction. it's 32 bytes below the current stack pointer */ | 181 | 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 @@ | |||
| 3 | 3 | ||
| 4 | #include "threads/thread.h" | 4 | #include "threads/thread.h" |
| 5 | 5 | ||
| 6 | #define STACK_SIZE (1 << 23) /* 8MB maxiumum stack size */ | 6 | #define STACK_SIZE (1 << 23) /* 8MB maximum stack size */ |
| 7 | 7 | ||
| 8 | /* In the current implementation, the capacity is fixed to 1024 (PGSIZE/4) */ | 8 | /* In the current implementation, the capacity is fixed to 1024 (PGSIZE/4) */ |
| 9 | struct fd_table { | 9 | 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 @@ | |||
| 14 | #include "userprog/pagedir.h" | 14 | #include "userprog/pagedir.h" |
| 15 | #include "userprog/process.h" | 15 | #include "userprog/process.h" |
| 16 | #include "userprog/syscall.h" | 16 | #include "userprog/syscall.h" |
| 17 | #include "lib/user/syscall.h" | ||
| 17 | 18 | ||
| 18 | #define STACK_SLOT_SIZE sizeof(int) | 19 | #define STACK_SLOT_SIZE sizeof(int) |
| 19 | 20 | ||
| @@ -181,7 +182,9 @@ static handler | |||
| 181 | syscall_read, | 182 | syscall_read, |
| 182 | syscall_seek, | 183 | syscall_seek, |
| 183 | syscall_tell, | 184 | syscall_tell, |
| 184 | syscall_close; | 185 | syscall_close, |
| 186 | syscall_mmap, | ||
| 187 | syscall_munmap; | ||
| 185 | 188 | ||
| 186 | /* Register syscall_handler for interrupt 0x30 */ | 189 | /* Register syscall_handler for interrupt 0x30 */ |
| 187 | void | 190 | void |
| @@ -217,6 +220,8 @@ syscall_handler (struct intr_frame *f) | |||
| 217 | case SYS_SEEK: fp = syscall_seek; break; | 220 | case SYS_SEEK: fp = syscall_seek; break; |
| 218 | case SYS_TELL: fp = syscall_tell; break; | 221 | case SYS_TELL: fp = syscall_tell; break; |
| 219 | case SYS_CLOSE: fp = syscall_close; break; | 222 | case SYS_CLOSE: fp = syscall_close; break; |
| 223 | case SYS_MMAP: fp = syscall_mmap; break; | ||
| 224 | case SYS_MUNMAP: fp = syscall_munmap; break; | ||
| 220 | default: | 225 | default: |
| 221 | goto fail; | 226 | goto fail; |
| 222 | } | 227 | } |
| @@ -564,3 +569,15 @@ syscall_close (void *sp, bool *segfault) | |||
| 564 | (void) process_close_file (fd); | 569 | (void) process_close_file (fd); |
| 565 | return 0; | 570 | return 0; |
| 566 | } | 571 | } |
| 572 | |||
| 573 | static int | ||
| 574 | syscall_mmap (void *sp, bool *segfault) | ||
| 575 | { | ||
| 576 | return 0; | ||
| 577 | } | ||
| 578 | |||
| 579 | static int | ||
| 580 | syscall_munmap (void *sp, bool *segfault) | ||
| 581 | { | ||
| 582 | return 0; | ||
| 583 | } | ||
