diff options
| author | manuel <manuel@mausz.at> | 2012-06-21 16:47:23 +0200 |
|---|---|---|
| committer | manuel <manuel@mausz.at> | 2012-06-21 16:47:23 +0200 |
| commit | e11b2ef0c606ab516a4344aeea1dbba22cb1fe5d (patch) | |
| tree | b4973f4dca916113c82a4a172f6f729d41cf4430 /vm/page.h | |
| parent | e9e69def589375c3d0e51b532268b27d3d403bbf (diff) | |
| download | progos-e11b2ef0c606ab516a4344aeea1dbba22cb1fe5d.tar.gz progos-e11b2ef0c606ab516a4344aeea1dbba22cb1fe5d.tar.bz2 progos-e11b2ef0c606ab516a4344aeea1dbba22cb1fe5d.zip | |
initial implementation of memory mapped files
Diffstat (limited to 'vm/page.h')
| -rw-r--r-- | vm/page.h | 27 |
1 files changed, 9 insertions, 18 deletions
| @@ -10,24 +10,15 @@ struct page_table_entry | |||
| 10 | { | 10 | { |
| 11 | void *upage; /* virtual address of page */ | 11 | void *upage; /* virtual address of page */ |
| 12 | bool loaded; /* indicates if page is loaded */ | 12 | bool loaded; /* indicates if page is loaded */ |
| 13 | enum | ||
| 14 | { | ||
| 15 | PAGE_SEGMENT, | ||
| 16 | PAGE_MEMORY_MAPPED_FILE, | ||
| 17 | } type; /* type of page */ | ||
| 18 | 13 | ||
| 19 | union | 14 | /* structure needed for lazy loading of data segments and mmapped files */ |
| 15 | struct segment | ||
| 20 | { | 16 | { |
| 21 | /* structure needed for lazy loading of data segments */ | 17 | struct file *file; |
| 22 | struct segment | 18 | off_t ofs; |
| 23 | { | 19 | uint32_t read_bytes; |
| 24 | struct file *file; | 20 | bool writable; |
| 25 | off_t ofs; | 21 | } segment; |
| 26 | uint32_t read_bytes; | ||
| 27 | uint32_t zero_bytes; | ||
| 28 | bool writable; | ||
| 29 | } segment; | ||
| 30 | }; | ||
| 31 | 22 | ||
| 32 | struct hash_elem elem; /* Hash element. */ | 23 | struct hash_elem elem; /* Hash element. */ |
| 33 | }; | 24 | }; |
| @@ -35,8 +26,8 @@ struct page_table_entry | |||
| 35 | void page_table_init (struct hash *ht); | 26 | void page_table_init (struct hash *ht); |
| 36 | void page_table_free (struct hash *ht); | 27 | void page_table_free (struct hash *ht); |
| 37 | struct page_table_entry *page_table_fetch (struct hash *ht, void *upage); | 28 | struct page_table_entry *page_table_fetch (struct hash *ht, void *upage); |
| 38 | bool page_table_insert_segment (struct file *file, off_t ofs, uint8_t *upage, | 29 | bool page_table_insert_segment (struct hash *ht, struct file *file, off_t ofs, |
| 39 | uint32_t read_bytes, uint32_t zero_bytes, bool writable); | 30 | uint8_t *upage, uint32_t read_bytes, bool writable); |
| 40 | bool page_load (struct page_table_entry *pte); | 31 | bool page_load (struct page_table_entry *pte); |
| 41 | 32 | ||
| 42 | #endif | 33 | #endif |
