Implement VM #63

Merged
td1223 merged 94 commits from vm/merged/themis into master 2024-12-06 05:07:14 +00:00
10 changed files with 197 additions and 62 deletions
Showing only changes of commit df7d847978 - Show all commits

View File

@@ -149,14 +149,10 @@ page_fault (struct intr_frame *f)
#ifdef VM #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)) return;
return;
} }
else else
{ {
if (handle_stack_fault (fault_addr, thread_current ()->curr_esp))
return;
f->eip = (void *)f->eax; f->eip = (void *)f->eax;
f->eax = 0xffffffff; f->eax = 0xffffffff;
return; return;

View File

@@ -26,8 +26,7 @@ handle_stack_fault (const void *ptr, const void *esp)
static bool static bool
is_stack_fault (const void *addr, const void *esp) is_stack_fault (const void *addr, const void *esp)
{ {
return (is_user_vaddr (addr) && return ((uint32_t*)addr >= ((uint32_t*)esp - MAX_STACK_ACCESS_DIST) &&
(uint32_t*)addr >= ((uint32_t*)esp - MAX_STACK_ACCESS_DIST) &&
((PHYS_BASE - pg_round_down (addr)) <= MAX_STACK_SIZE)); ((PHYS_BASE - pg_round_down (addr)) <= MAX_STACK_SIZE));
} }