From e11b2ef0c606ab516a4344aeea1dbba22cb1fe5d Mon Sep 17 00:00:00 2001 From: manuel Date: Thu, 21 Jun 2012 16:47:23 +0200 Subject: initial implementation of memory mapped files --- vm/page.h | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) (limited to 'vm/page.h') diff --git a/vm/page.h b/vm/page.h index 9cea048..da1398c 100644 --- a/vm/page.h +++ b/vm/page.h @@ -10,24 +10,15 @@ struct page_table_entry { void *upage; /* virtual address of page */ bool loaded; /* indicates if page is loaded */ - enum - { - PAGE_SEGMENT, - PAGE_MEMORY_MAPPED_FILE, - } type; /* type of page */ - union + /* structure needed for lazy loading of data segments and mmapped files */ + struct segment { - /* structure needed for lazy loading of data segments */ - struct segment - { - struct file *file; - off_t ofs; - uint32_t read_bytes; - uint32_t zero_bytes; - bool writable; - } segment; - }; + struct file *file; + off_t ofs; + uint32_t read_bytes; + bool writable; + } segment; struct hash_elem elem; /* Hash element. */ }; @@ -35,8 +26,8 @@ struct page_table_entry 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); -bool page_table_insert_segment (struct file *file, off_t ofs, uint8_t *upage, - uint32_t read_bytes, uint32_t zero_bytes, bool writable); +bool page_table_insert_segment (struct hash *ht, struct file *file, off_t ofs, + uint8_t *upage, uint32_t read_bytes, bool writable); bool page_load (struct page_table_entry *pte); #endif -- cgit v1.2.3