#ifndef VM_PAGE_H #define VM_PAGE_H #include #include "hash.h" #include "filesys/off_t.h" /* supplemental page table entry */ struct page_table_entry { void *upage; /* virtual address of page */ bool loaded; /* indicates if page is loaded */ /* structure needed for lazy loading of data segments and mmapped files */ struct segment { struct file *file; off_t ofs; uint32_t read_bytes; bool writable; } segment; struct hash_elem elem; /* Hash element. */ }; void page_table_init (struct hash *ht); void page_table_free (struct hash *ht); struct page_table_entry *page_table_fetch (struct hash *ht, void *upage); struct page_table_entry *page_table_remove (struct hash *ht, void *upage); bool page_table_insert_segment (struct hash *ht, struct file *file, off_t ofs, void *upage, uint32_t read_bytes, bool writable); bool page_load (struct page_table_entry *pte); #endif