feat: initial shared file page management and initialization
This commit is contained in:
@@ -5,13 +5,16 @@
|
||||
#include "threads/synch.h"
|
||||
#include "filesys/off_t.h"
|
||||
|
||||
enum page_type {
|
||||
enum page_type
|
||||
{
|
||||
PAGE_FILE,
|
||||
PAGE_MMAP,
|
||||
PAGE_EMPTY
|
||||
PAGE_EMPTY,
|
||||
PAGE_SHARED
|
||||
};
|
||||
|
||||
struct page_entry {
|
||||
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). */
|
||||
|
||||
@@ -30,6 +33,17 @@ struct page_entry {
|
||||
struct hash_elem elem; /* An elem for the hash table. */
|
||||
};
|
||||
|
||||
struct shared_file_page
|
||||
{
|
||||
struct file *file;
|
||||
void *upage;
|
||||
void *frame;
|
||||
size_t swap_slot;
|
||||
int ref_count;
|
||||
|
||||
struct hash_elem elem;
|
||||
};
|
||||
|
||||
bool init_pages (struct hash *pages);
|
||||
struct page_entry *page_insert_swapped (void *upage, void* kpage,
|
||||
struct thread *owner);
|
||||
@@ -41,6 +55,11 @@ bool page_load_file (struct page_entry *page);
|
||||
void page_cleanup (struct hash_elem *e, void *aux);
|
||||
|
||||
bool page_in_swap (struct thread *, void *);
|
||||
bool page_in_swap_pte (uint32_t *pte);
|
||||
size_t page_get_swap (struct thread *owner, void *upage);
|
||||
size_t page_get_swap_pte (uint32_t *pte);
|
||||
|
||||
#endif /* vm/frame.h */
|
||||
bool page_is_shared_pte (uint32_t *pte);
|
||||
void shared_file_pages_init ();
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user