46
#define KA2PA(x) (((uintptr_t) (x)) - 0x80000000)
47
#define PA2KA(x) (((uintptr_t) (x)) + 0x80000000)
49
#define KA2PA(x) ((x) - 0x80000000)
50
#define PA2KA(x) ((x) + 0x80000000)
45
#define KA2PA(x) (((uintptr_t) (x)) - 0x80000000)
46
#define PA2KA(x) (((uintptr_t) (x)) + 0x80000000)
54
49
* This is an example of 2-level page tables (PTL1 and PTL2 are left out)
121
116
((p)->writeable != 0)
122
117
#define PTE_EXECUTABLE_ARCH(p) 1
126
119
#include <mm/mm.h>
127
120
#include <arch/interrupt.h>
128
121
#include <arch/types.h>
129
122
#include <typedefs.h>
131
/* Page fault error codes. */
133
/** When bit on this position is 0, the page fault was caused by a not-present
136
#define PFERR_CODE_P (1 << 0)
138
/** When bit on this position is 1, the page fault was caused by a write. */
139
#define PFERR_CODE_RW (1 << 1)
141
/** When bit on this position is 1, the page fault was caused in user mode. */
142
#define PFERR_CODE_US (1 << 2)
144
/** When bit on this position is 1, a reserved bit was set in page directory. */
145
#define PFERR_CODE_RSVD (1 << 3)
147
124
/** Page Table Entry. */
149
unsigned present : 1;
150
unsigned writeable : 1;
151
unsigned uaccessible : 1;
152
unsigned page_write_through : 1;
153
unsigned page_cache_disable : 1;
154
unsigned accessed : 1;
158
unsigned soft_valid : 1; /**< Valid content even if the present bit is not set. */
160
unsigned frame_address : 20;
161
} __attribute__ ((packed)) pte_t;
126
unsigned int present : 1;
127
unsigned int writeable : 1;
128
unsigned int uaccessible : 1;
129
unsigned int page_write_through : 1;
130
unsigned int page_cache_disable : 1;
131
unsigned int accessed : 1;
132
unsigned int dirty : 1;
133
unsigned int pat : 1;
134
unsigned int global : 1;
136
/** Valid content even if the present bit is not set. */
137
unsigned int soft_valid : 1;
138
unsigned int avl : 2;
139
unsigned int frame_address : 20;
140
} __attribute__((packed)) pte_t;
163
142
static inline unsigned int get_pt_flags(pte_t *pt, size_t i)