summaryrefslogtreecommitdiffstats
path: root/vm/page.h
diff options
context:
space:
mode:
authormanuel <manuel@mausz.at>2012-06-19 01:44:56 +0200
committermanuel <manuel@mausz.at>2012-06-19 01:44:56 +0200
commite88a8c4c379d721e9901752d440a05295087da11 (patch)
treeb89070c525614267811a10b77a4dbc49ffd96b03 /vm/page.h
parentd9e0c55d118d0a3923b440b7811f8d1d6db9e1d7 (diff)
downloadprogos-e88a8c4c379d721e9901752d440a05295087da11.tar.gz
progos-e88a8c4c379d721e9901752d440a05295087da11.tar.bz2
progos-e88a8c4c379d721e9901752d440a05295087da11.zip
implement page table and use it for lazy loading of segments
Diffstat (limited to 'vm/page.h')
-rw-r--r--vm/page.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/vm/page.h b/vm/page.h
new file mode 100644
index 0000000..29159fb
--- /dev/null
+++ b/vm/page.h
@@ -0,0 +1,41 @@
1#ifndef VM_PAGE_H
2#define VM_PAGE_H
3
4#include <debug.h>
5#include "hash.h"
6#include "filesys/off_t.h"
7
8/* supplemental page table entry */
9struct page_table_entry
10{
11 void *uvaddr;
12 bool loaded;
13 enum
14 {
15 PAGE_SEGMENT,
16 PAGE_MEMORY_MAPPED_FILE,
17 } type;
18
19 union
20 {
21 struct segment
22 {
23 struct file *file;
24 off_t ofs;
25 uint32_t read_bytes;
26 uint32_t zero_bytes;
27 bool writable;
28 } segment;
29 };
30
31 struct hash_elem elem;
32};
33
34void page_table_init (struct hash *ht);
35void page_table_free (struct hash *ht);
36struct page_table_entry *page_table_fetch (struct hash *ht, void *uvaddr);
37bool page_table_insert_segment (struct file *file, off_t ofs, uint8_t *upage,
38 uint32_t read_bytes, uint32_t zero_bytes, bool writable);
39bool page_load (struct page_table_entry *pte);
40
41#endif