-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvmm.h
50 lines (33 loc) · 1.18 KB
/
vmm.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#ifndef VMM_H
#define VMM_H
#include "interface.h"
// Declare your own data structures and functions here...
typedef struct {
struct v_Page *prev, *next;
int frame_number;
int offset;
int resident;
int protection_bit; //define later
int wb;
int modified; // 1 if write/store to a page
int referenced; // 1 if read/write to a page
int virt_page;
void *v_mem_addr;
} v_Page;
typedef struct {
int maxLength;
int resident_count;
v_Page *head; //head -> tail = resident pages
v_Page *tail; //tail.next -> end = non-resident pages
int page_size;
enum policy_type pt;
void *vm_ptr;
} Table_Stack;
void vmmu_init(int num_frames, Table_Stack *page_table, enum policy_type policy);
v_Page* get_frame(int virt_page, Table_Stack *g_page_map, int f_type, int *existing_rw);
int evict(v_Page *page_buf, int virt_page, Table_Stack *g_page_map, int f_type);
int evict_FIFO(v_Page *page_buf, int virt_page, Table_Stack *g_page_map, int f_type);
int evict_THIRD(v_Page *page_buf, int virt_page, Table_Stack *g_page_map, int f_type);
v_Page* add_frame(int virt_page, Table_Stack *g_page_map, int f_type);
v_Page *create_page_entry(int wb, int frame_number, int v_page_num, int resident);
#endif