diff --git a/src/userprog/exception.c b/src/userprog/exception.c index 0a20b53..8a800b7 100644 --- a/src/userprog/exception.c +++ b/src/userprog/exception.c @@ -145,6 +145,14 @@ page_fault (struct intr_frame *f) write = (f->error_code & PF_W) != 0; user = (f->error_code & PF_U) != 0; + /* Kernel page fault is further handled by the kernel itself. */ + if (!user) + { + f->eip = (void *)f->eax; + f->eax = 0xffffffff; + return; + } + /* To implement virtual memory, delete the rest of the function body, and replace it with code that brings in the page to which fault_addr refers. */