feat: allow stack to grow for process up to 8MB in size
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#include "userprog/gdt.h"
|
||||
#include "threads/interrupt.h"
|
||||
#include "threads/thread.h"
|
||||
#include "vm/stackgrowth.h"
|
||||
|
||||
/* Number of page faults processed. */
|
||||
static long long page_fault_cnt;
|
||||
@@ -145,6 +146,12 @@ page_fault (struct intr_frame *f)
|
||||
write = (f->error_code & PF_W) != 0;
|
||||
user = (f->error_code & PF_U) != 0;
|
||||
|
||||
if (user && needs_new_page (fault_addr, f->esp))
|
||||
{
|
||||
if (grow_stack (fault_addr))
|
||||
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. */
|
||||
|
||||
Reference in New Issue
Block a user