Implement Supplemental Page Table (SPT) per thread along with structure for its entries, w/ G
This commit is contained in:
@@ -1,5 +1,25 @@
|
||||
#include "page.h"
|
||||
|
||||
/* Hashing function needed for the SPT table. Returns a hash for an entry,
|
||||
based on its upage. */
|
||||
unsigned
|
||||
page_hash (const struct hash_elem *e, UNUSED void *aux)
|
||||
{
|
||||
struct page_entry *page = hash_entry (e, struct page_entry, elem);
|
||||
return hash_ptr(page->upage);
|
||||
}
|
||||
|
||||
/* Comparator function for the SPT table. Compares two entries based on their
|
||||
upages. */
|
||||
bool
|
||||
page_less (const struct hash_elem *a_, const struct hash_elem *b_, UNUSED void *aux)
|
||||
{
|
||||
const struct page_entry *a = hash_entry (a_, struct page_entry, elem);
|
||||
const struct page_entry *b = hash_entry (b_, struct page_entry, elem);
|
||||
return a->upage < b->upage;
|
||||
}
|
||||
|
||||
|
||||
/* 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. */
|
||||
@@ -16,5 +36,4 @@ size_t
|
||||
page_get_swap (struct thread *owner, void *upage)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user