feat: incorporate lazy-loading data & helpers into supplemental page table
This commit is contained in:
@@ -2,7 +2,36 @@
|
||||
#define VM_PAGE_H
|
||||
|
||||
#include "threads/thread.h"
|
||||
#include "filesys/off_t.h"
|
||||
|
||||
enum page_type {
|
||||
PAGE_EXECUTABLE,
|
||||
PAGE_EMPTY
|
||||
};
|
||||
|
||||
struct page_entry {
|
||||
enum page_type type; /* Type of Data that should go into the page */
|
||||
void *upage; /* Start Address of the User Page (Key of hash table). */
|
||||
|
||||
/* File Data */
|
||||
struct file *file; /* Pointer to the file for executables. */
|
||||
off_t offset; /* Offset of the page content within the file. */
|
||||
uint32_t read_bytes; /* Number of bytes to read within the page. */
|
||||
uint32_t zero_bytes; /* Number of bytes to zero within the page. */
|
||||
bool writable; /* Flag for whether this page is writable or not. */
|
||||
|
||||
struct hash_elem elem; /* An elem for the hash table. */
|
||||
};
|
||||
|
||||
unsigned page_hash (const struct hash_elem *e, void *aux);
|
||||
bool page_less (const struct hash_elem *a_, const struct hash_elem *b_,
|
||||
void *aux);
|
||||
struct page_entry *page_insert (struct file *file, off_t ofs, void *upage,
|
||||
uint32_t read_bytes, uint32_t zero_bytes,
|
||||
bool writable, enum page_type type);
|
||||
struct page_entry *page_get (void *upage);
|
||||
bool page_load (struct page_entry *page, bool writable);
|
||||
void page_cleanup (struct hash_elem *e, void *aux);
|
||||
void page_set_swap (struct thread *, void *, size_t);
|
||||
bool page_in_swap (struct thread *, void *);
|
||||
size_t page_get_swap (struct thread *, void *);
|
||||
|
||||
Reference in New Issue
Block a user