blob: a9aef929209ad707eb6c73bf722c9d7129b77757 (
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
42
43
44
45
46
47
48
49
50
51
52
|
#ifndef MELVIX_PAGING_H
#define MELVIX_PAGING_H
#include <stdint.h>
struct page {
u32 present : 1;
u32 rw : 1;
u32 user : 1;
u32 accessed : 1;
u32 dirty : 1;
u32 unused : 7;
u32 frame : 20;
};
struct page_table {
struct page pages[1024];
};
struct page_directory {
struct page_table *tables[1024];
};
struct page_directory *paging_root_directory;
struct page_table *get_cr3();
u32 get_cr0();
void set_cr3(struct page_directory *dir);
void set_cr0(u32 new_cr0);
void paging_disable();
void paging_enable();
void paging_switch_directory(struct page_directory *dir);
struct page_directory *paging_make_directory();
struct page_table *paging_make_table();
u32 paging_get_phys(u32 virt);
void paging_install();
void paging_map(struct page_directory *cr3, u32 virt, u32 phys);
void paging_map_user(struct page_directory *cr3, u32 virt, u32 phys);
void paging_convert_page(struct page_directory *kdir);
struct page_directory *paging_copy_user_directory(struct page_directory *dir);
#define EMPTY_TAB ((struct page_table *)0x00000002)
#define PAGE_S 0x400000
#endif
|