fix: obtain correct page table entry when performing eviction
This commit is contained in:
@@ -47,7 +47,7 @@ struct page_entry *
|
||||
page_insert_swapped (void *upage, void *kpage, struct thread *owner)
|
||||
{
|
||||
/* 1. Initialize swapped page entry. */
|
||||
struct page_entry *page = page_get (upage);
|
||||
struct page_entry *page = page_get (thread_current (), upage);
|
||||
if (page == NULL)
|
||||
{
|
||||
page = malloc (sizeof (struct page_entry));
|
||||
@@ -103,13 +103,13 @@ page_insert_file (struct file *file, off_t ofs, void *upage,
|
||||
/* Gets a page_entry from the starting address of the page. Returns NULL if no
|
||||
such page_entry exists in the hash map.*/
|
||||
struct page_entry *
|
||||
page_get (void *upage)
|
||||
page_get (struct thread *thread, void *upage)
|
||||
{
|
||||
struct page_entry fake_page_entry;
|
||||
fake_page_entry.upage = upage;
|
||||
|
||||
struct hash_elem *e
|
||||
= hash_find (&thread_current ()->pages, &fake_page_entry.elem);
|
||||
= hash_find (&thread->pages, &fake_page_entry.elem);
|
||||
if (e == NULL)
|
||||
return NULL;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user