summaryrefslogtreecommitdiff
path: root/Source/Kernel/MemoryManager/PageDirectory.class.h
blob: e93524b41d00858e1b2e4a1ce07015111e641f6c (plain) (blame)
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
#ifndef DEF_PAGEDIRECTORY_CLASS_H
#define DEF_PAGEDIRECTORY_CLASS_H

#include <common.h>

struct page_t {
	u32int present		: 1;
	u32int rw			: 1;
	u32int user			: 1;
	u32int accessed		: 1;
	u32int dirty		: 1;
	u32int unused		: 7;
	u32int frame		: 20;
};

struct page_table_t {
	page_t pages[1024];
};

struct PageDirectory {
	page_table_t *tables[1024];	
	u32int *tablesPhysical;
	u32int physicalAddr;

	PageDirectory();
	PageDirectory(PageDirectory* other);	//Clones the other pagedir
	~PageDirectory();
	page_t *getPage(u32int address, bool make);
	void map(page_t *p, u32int frame, bool is_user, bool is_writable);
	void allocFrame(u32int address, bool is_user, bool is_writable);
	void freeFrame(u32int address);
	void switchTo();

	private:
	PageDirectory(const PageDirectory& other);
	void operator=(const PageDirectory& other);
};



#endif