feat: allow stack to grow for process up to 8MB in size

This commit is contained in:
EDiasAlberto
2024-11-26 04:43:25 +00:00
parent 605050e38d
commit 3ef5264b6e
4 changed files with 57 additions and 0 deletions

View File

@@ -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. */