Subversion Repositories HelenOS

Rev

Rev 4345 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4345 Rev 4691
Line 92... Line 92...
92
#define SET_FRAME_ADDRESS_ARCH(ptl3, i, a) \
92
#define SET_FRAME_ADDRESS_ARCH(ptl3, i, a) \
93
    (((pte_level1_t *) (ptl3))[(i)].frame_base_addr = (a) >> 12)
93
    (((pte_level1_t *) (ptl3))[(i)].frame_base_addr = (a) >> 12)
94
 
94
 
95
/* Get PTE flags accessors for each level. */
95
/* Get PTE flags accessors for each level. */
96
#define GET_PTL1_FLAGS_ARCH(ptl0, i) \
96
#define GET_PTL1_FLAGS_ARCH(ptl0, i) \
97
    get_pt_level0_flags((pte_level0_t *) (ptl0), (index_t) (i))
97
    get_pt_level0_flags((pte_level0_t *) (ptl0), (size_t) (i))
98
#define GET_PTL2_FLAGS_ARCH(ptl1, i) \
98
#define GET_PTL2_FLAGS_ARCH(ptl1, i) \
99
    PAGE_PRESENT
99
    PAGE_PRESENT
100
#define GET_PTL3_FLAGS_ARCH(ptl2, i) \
100
#define GET_PTL3_FLAGS_ARCH(ptl2, i) \
101
    PAGE_PRESENT
101
    PAGE_PRESENT
102
#define GET_FRAME_FLAGS_ARCH(ptl3, i) \
102
#define GET_FRAME_FLAGS_ARCH(ptl3, i) \
103
    get_pt_level1_flags((pte_level1_t *) (ptl3), (index_t) (i))
103
    get_pt_level1_flags((pte_level1_t *) (ptl3), (size_t) (i))
104
 
104
 
105
/* Set PTE flags accessors for each level. */
105
/* Set PTE flags accessors for each level. */
106
#define SET_PTL1_FLAGS_ARCH(ptl0, i, x) \
106
#define SET_PTL1_FLAGS_ARCH(ptl0, i, x) \
107
    set_pt_level0_flags((pte_level0_t *) (ptl0), (index_t) (i), (x))
107
    set_pt_level0_flags((pte_level0_t *) (ptl0), (size_t) (i), (x))
108
#define SET_PTL2_FLAGS_ARCH(ptl1, i, x)
108
#define SET_PTL2_FLAGS_ARCH(ptl1, i, x)
109
#define SET_PTL3_FLAGS_ARCH(ptl2, i, x)
109
#define SET_PTL3_FLAGS_ARCH(ptl2, i, x)
110
#define SET_FRAME_FLAGS_ARCH(ptl3, i, x) \
110
#define SET_FRAME_FLAGS_ARCH(ptl3, i, x) \
111
    set_pt_level1_flags((pte_level1_t *) (ptl3), (index_t) (i), (x))
111
    set_pt_level1_flags((pte_level1_t *) (ptl3), (size_t) (i), (x))
112
 
112
 
113
/* Macros for querying the last-level PTE entries. */
113
/* Macros for querying the last-level PTE entries. */
114
#define PTE_VALID_ARCH(pte) \
114
#define PTE_VALID_ARCH(pte) \
115
    (*((uint32_t *) (pte)) != 0)
115
    (*((uint32_t *) (pte)) != 0)
116
#define PTE_PRESENT_ARCH(pte) \
116
#define PTE_PRESENT_ARCH(pte) \
Line 202... Line 202...
202
/** Returns level 0 page table entry flags.
202
/** Returns level 0 page table entry flags.
203
 *
203
 *
204
 *  @param pt     Level 0 page table.
204
 *  @param pt     Level 0 page table.
205
 *  @param i      Index of the entry to return.
205
 *  @param i      Index of the entry to return.
206
 */
206
 */
207
static inline int get_pt_level0_flags(pte_level0_t *pt, index_t i)
207
static inline int get_pt_level0_flags(pte_level0_t *pt, size_t i)
208
{
208
{
209
    pte_level0_t *p = &pt[i];
209
    pte_level0_t *p = &pt[i];
210
    int np = (p->descriptor_type == PTE_DESCRIPTOR_NOT_PRESENT);
210
    int np = (p->descriptor_type == PTE_DESCRIPTOR_NOT_PRESENT);
211
 
211
 
212
    return (np << PAGE_PRESENT_SHIFT) | (1 << PAGE_USER_SHIFT) |
212
    return (np << PAGE_PRESENT_SHIFT) | (1 << PAGE_USER_SHIFT) |
Line 217... Line 217...
217
/** Returns level 1 page table entry flags.
217
/** Returns level 1 page table entry flags.
218
 *
218
 *
219
 *  @param pt     Level 1 page table.
219
 *  @param pt     Level 1 page table.
220
 *  @param i      Index of the entry to return.
220
 *  @param i      Index of the entry to return.
221
 */
221
 */
222
static inline int get_pt_level1_flags(pte_level1_t *pt, index_t i)
222
static inline int get_pt_level1_flags(pte_level1_t *pt, size_t i)
223
{
223
{
224
    pte_level1_t *p = &pt[i];
224
    pte_level1_t *p = &pt[i];
225
 
225
 
226
    int dt = p->descriptor_type;
226
    int dt = p->descriptor_type;
227
    int ap = p->access_permission_0;
227
    int ap = p->access_permission_0;
Line 242... Line 242...
242
 *
242
 *
243
 *  @param pt     level 0 page table
243
 *  @param pt     level 0 page table
244
 *  @param i      index of the entry to be changed
244
 *  @param i      index of the entry to be changed
245
 *  @param flags  new flags
245
 *  @param flags  new flags
246
 */
246
 */
247
static inline void set_pt_level0_flags(pte_level0_t *pt, index_t i, int flags)
247
static inline void set_pt_level0_flags(pte_level0_t *pt, size_t i, int flags)
248
{
248
{
249
    pte_level0_t *p = &pt[i];
249
    pte_level0_t *p = &pt[i];
250
 
250
 
251
    if (flags & PAGE_NOT_PRESENT) {
251
    if (flags & PAGE_NOT_PRESENT) {
252
        p->descriptor_type = PTE_DESCRIPTOR_NOT_PRESENT;
252
        p->descriptor_type = PTE_DESCRIPTOR_NOT_PRESENT;
Line 270... Line 270...
270
 *
270
 *
271
 *  @param pt     Level 1 page table.
271
 *  @param pt     Level 1 page table.
272
 *  @param i      Index of the entry to be changed.
272
 *  @param i      Index of the entry to be changed.
273
 *  @param flags  New flags.
273
 *  @param flags  New flags.
274
 */  
274
 */  
275
static inline void set_pt_level1_flags(pte_level1_t *pt, index_t i, int flags)
275
static inline void set_pt_level1_flags(pte_level1_t *pt, size_t i, int flags)
276
{
276
{
277
    pte_level1_t *p = &pt[i];
277
    pte_level1_t *p = &pt[i];
278
   
278
   
279
    if (flags & PAGE_NOT_PRESENT) {
279
    if (flags & PAGE_NOT_PRESENT) {
280
        p->descriptor_type = PTE_DESCRIPTOR_NOT_PRESENT;
280
        p->descriptor_type = PTE_DESCRIPTOR_NOT_PRESENT;