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
66
67
|
#ifndef __KERNEL_VMMMGR_H
#define __KERNEL_VMMMGR_H
#include <limits.h>
#include <kernel/types.h>
#include <kernel/spinlock.H>
class VmmManager
{
public:
enum VMM_CONSTS
{
ONE_MEG = 1 * 1024 * 1024,
THREE_MEG = 3 * ONE_MEG,
EIGHT_MEG = 8 * ONE_MEG,
FULL_MEM_SIZE = THREE_MEG,
// put the Page Table at the end of our memory space
PTSIZE = (1 << 18),
HTABORG = (FULL_MEM_SIZE - PTSIZE),
};
enum ACCESS_TYPES
{
NO_USER_ACCESS,
READ_O_ACCESS,
NORMAL_ACCESS,
CI_ACCESS,
RO_EXE_ACCESS,
};
static void init();
static void init_slb();
/**
* @brief Responsible for handling PTE misses.
*
* @param[in] t - Task causing the page fault.
* @param[in] effAddr - Effective address accessed to cause fault.
*
* @return true - PTE miss was successfully handled.
*
* If the PTE miss is not successfully handled, the exception
* handler should collect debug information and kill the task.
*/
static bool pteMiss(task_t* t, uint64_t effAddr);
static void* mmioMap(void*, size_t);
static int mmioUnmap(void*, size_t);
protected:
VmmManager();
~VmmManager() {};
private:
Spinlock lock;
void initPTEs();
void initSDR1();
bool _pteMiss(task_t*, uint64_t);
};
#endif
|