blob: 104e5abbc8a98e09a7baf7ffdc15aab6ed99d721 (
plain)
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
|
//! i86 architecture defines 1024 entries per table--do not change
#define PAGES_PER_TABLE 1024
#define PAGES_PER_DIR 1024
#define PAGE_DIRECTORY_INDEX(x) (((x) >> 22) & 0x3ff)
#define PAGE_TABLE_INDEX(x) (((x) >> 12) & 0x3ff)
#define PAGE_GET_PHYSICAL_ADDRESS(x) (*x & ~0xfff)
//! page table represents 4mb address space
#define PTABLE_ADDR_SPACE_SIZE 0x400000
//! directory table represents 4gb address space
#define DTABLE_ADDR_SPACE_SIZE 0x100000000
//! page sizes are 4k
#define PAGE_SIZE 4096
//! page table entry
typedef uint32_t pt_entry;
//! a page directery entry
typedef uint32_t pd_entry;
//! page table
typedef struct ptable_struct {
pt_entry m_entries[PAGES_PER_TABLE];
}ptable ;
//! page directory
typedef struct pdirectory_struct {
pd_entry m_entries[PAGES_PER_DIR];
}pdirectory;
pdirectory* vmem_init(uint32_t kernel_blocks,uint32_t fb_addr);
|