fix: disable dynamic stack growth when VM flag is disabled

This commit is contained in:
Themis Demetriades
2024-12-02 20:44:54 +00:00
parent 6adf2e743b
commit 6190d1bee6
2 changed files with 3 additions and 1 deletions

View File

@@ -1,7 +1,7 @@
# -*- makefile -*- # -*- makefile -*-
kernel.bin: DEFINES = -DUSERPROG -DFILESYS 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 TEST_SUBDIRS = tests/userprog tests/userprog/no-vm tests/filesys/base
GRADING_FILE = $(SRCDIR)/tests/userprog/Grading GRADING_FILE = $(SRCDIR)/tests/userprog/Grading
SIMULATOR = --qemu SIMULATOR = --qemu

View File

@@ -146,6 +146,7 @@ page_fault (struct intr_frame *f)
write = (f->error_code & PF_W) != 0; write = (f->error_code & PF_W) != 0;
user = (f->error_code & PF_U) != 0; user = (f->error_code & PF_U) != 0;
#ifdef VM
if (user && not_present) if (user && not_present)
{ {
if (handle_stack_fault (fault_addr, f->esp)) if (handle_stack_fault (fault_addr, f->esp))
@@ -160,6 +161,7 @@ page_fault (struct intr_frame *f)
f->eax = 0xffffffff; f->eax = 0xffffffff;
return; return;
} }
#endif
/* To implement virtual memory, delete the rest of the function /* To implement virtual memory, delete the rest of the function
body, and replace it with code that brings in the page to body, and replace it with code that brings in the page to