summaryrefslogtreecommitdiffstats
path: root/vm/page.h
diff options
context:
space:
mode:
Diffstat (limited to 'vm/page.h')
-rw-r--r--vm/page.h35
1 files changed, 18 insertions, 17 deletions
diff --git a/vm/page.h b/vm/page.h
index 29159fb..9cea048 100644
--- a/vm/page.h
+++ b/vm/page.h
@@ -8,32 +8,33 @@
8/* supplemental page table entry */ 8/* supplemental page table entry */
9struct page_table_entry 9struct page_table_entry
10{ 10{
11 void *uvaddr; 11 void *upage; /* virtual address of page */
12 bool loaded; 12 bool loaded; /* indicates if page is loaded */
13 enum 13 enum
14 { 14 {
15 PAGE_SEGMENT, 15 PAGE_SEGMENT,
16 PAGE_MEMORY_MAPPED_FILE, 16 PAGE_MEMORY_MAPPED_FILE,
17 } type; 17 } type; /* type of page */
18 18
19 union 19 union
20 {
21 struct segment
22 { 20 {
23 struct file *file; 21 /* structure needed for lazy loading of data segments */
24 off_t ofs; 22 struct segment
25 uint32_t read_bytes; 23 {
26 uint32_t zero_bytes; 24 struct file *file;
27 bool writable; 25 off_t ofs;
28 } segment; 26 uint32_t read_bytes;
29 }; 27 uint32_t zero_bytes;
28 bool writable;
29 } segment;
30 };
30 31
31 struct hash_elem elem; 32 struct hash_elem elem; /* Hash element. */
32}; 33};
33 34
34void page_table_init (struct hash *ht); 35void page_table_init (struct hash *ht);
35void page_table_free (struct hash *ht); 36void page_table_free (struct hash *ht);
36struct page_table_entry *page_table_fetch (struct hash *ht, void *uvaddr); 37struct page_table_entry *page_table_fetch (struct hash *ht, void *upage);
37bool page_table_insert_segment (struct file *file, off_t ofs, uint8_t *upage, 38bool page_table_insert_segment (struct file *file, off_t ofs, uint8_t *upage,
38 uint32_t read_bytes, uint32_t zero_bytes, bool writable); 39 uint32_t read_bytes, uint32_t zero_bytes, bool writable);
39bool page_load (struct page_table_entry *pte); 40bool page_load (struct page_table_entry *pte);