From 6190d1bee631f89a4fe33686374f806b85182569 Mon Sep 17 00:00:00 2001 From: Themis Demetriades Date: Mon, 2 Dec 2024 20:44:54 +0000 Subject: [PATCH] fix: disable dynamic stack growth when VM flag is disabled --- src/userprog/Make.vars | 2 +- src/userprog/exception.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/userprog/Make.vars b/src/userprog/Make.vars index 3541b02..e4dbb08 100644 --- a/src/userprog/Make.vars +++ b/src/userprog/Make.vars @@ -1,7 +1,7 @@ # -*- makefile -*- kernel.bin: DEFINES = -DUSERPROG -DFILESYS -KERNEL_SUBDIRS = threads devices lib lib/kernel userprog filesys vm +KERNEL_SUBDIRS = threads devices lib lib/kernel userprog filesys TEST_SUBDIRS = tests/userprog tests/userprog/no-vm tests/filesys/base GRADING_FILE = $(SRCDIR)/tests/userprog/Grading SIMULATOR = --qemu diff --git a/src/userprog/exception.c b/src/userprog/exception.c index 8988c0a..cecd143 100644 --- a/src/userprog/exception.c +++ b/src/userprog/exception.c @@ -146,6 +146,7 @@ page_fault (struct intr_frame *f) write = (f->error_code & PF_W) != 0; user = (f->error_code & PF_U) != 0; +#ifdef VM if (user && not_present) { if (handle_stack_fault (fault_addr, f->esp)) @@ -160,6 +161,7 @@ page_fault (struct intr_frame *f) f->eax = 0xffffffff; return; } +#endif /* To implement virtual memory, delete the rest of the function body, and replace it with code that brings in the page to