-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPageTable.cpp
More file actions
65 lines (52 loc) · 1.02 KB
/
PageTable.cpp
File metadata and controls
65 lines (52 loc) · 1.02 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// author Janik und Patrick Tinz
#include "PageTable.h"
#include "Constants.h"
#include "VirtualMemoryManager.h"
#include <cstdlib>
using namespace std;
PageTable::PageTable()
{
for(int i = 0; i < pageTableSize; i++)
{
table.push_back(rand()%ramSize); // init Pageframes
presentBit.push_back(0);
dirtyBit.push_back(0);
rBit.push_back(0);
}
}
PageTable::~PageTable()
{
}
int PageTable::getPageFrame(int pageNumber)
{
int pageFrame = table[pageNumber];
return pageFrame;
}
void PageTable::setPresentBit(int index)
{
presentBit[index] = 1;
}
int PageTable::getPresentBit(int index)
{
return presentBit[index];
}
void PageTable::removePresentBit(int index)
{
presentBit[index] = 0;
}
void PageTable::setReferenceBit(int index)
{
rBit[index] = 1;
}
void PageTable::removeReferenceBit(int index)
{
rBit[index] = 0;
}
void PageTable::setDirtyBit(int index)
{
dirtyBit[index] = 1;
}
void PageTable::removeDirtyBit(int index)
{
dirtyBit[index] = 0;
}