fix: invalidate PTEs of evicted pages before eviction occurs to prevent modificationof pages mid-eviction
This commit is contained in:
@@ -6,8 +6,8 @@
|
||||
#define ADDR_START_BIT 12
|
||||
|
||||
/* Updates the 'owner' thread's page table entry for virtual address 'upage'
|
||||
to have a present bit of 0 and stores the specified swap slot value in the
|
||||
entry for later retrieval from disk. */
|
||||
to flag the page as being stored in swap, and stores the specified swap slot
|
||||
value in the entry at the address bits for later retrieval from disk. */
|
||||
void
|
||||
page_set_swap (struct thread *owner, void *upage, size_t swap_slot)
|
||||
{
|
||||
@@ -19,9 +19,7 @@ page_set_swap (struct thread *owner, void *upage, size_t swap_slot)
|
||||
uint32_t swap_slot_bits = (swap_slot << ADDR_START_BIT) & PTE_ADDR;
|
||||
*pte = (*pte & PTE_FLAGS) | swap_slot_bits;
|
||||
|
||||
/* Mark page as 'not present' and flag the page directory as having
|
||||
been modified. */
|
||||
pagedir_clear_page (owner->pagedir, upage);
|
||||
invalidate_pagedir (owner->pagedir);
|
||||
}
|
||||
|
||||
/* Returns true iff the page with user address 'upage' owned by 'owner'
|
||||
|
||||
Reference in New Issue
Block a user