Subversion Repositories HelenOS

Rev

Rev 3233 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3233 Rev 4490
Line 93... Line 93...
93
#define SET_FRAME_ADDRESS_ARCH(ptl3, i, a) \
93
#define SET_FRAME_ADDRESS_ARCH(ptl3, i, a) \
94
    (((pte_t *) (ptl3))[(i)].frame_address = (a) >> 12)
94
    (((pte_t *) (ptl3))[(i)].frame_address = (a) >> 12)
95
 
95
 
96
/* Get PTE flags accessors for each level. */
96
/* Get PTE flags accessors for each level. */
97
#define GET_PTL1_FLAGS_ARCH(ptl0, i) \
97
#define GET_PTL1_FLAGS_ARCH(ptl0, i) \
98
    get_pt_flags((pte_t *) (ptl0), (index_t) (i))
98
    get_pt_flags((pte_t *) (ptl0), (size_t) (i))
99
#define GET_PTL2_FLAGS_ARCH(ptl1, i) \
99
#define GET_PTL2_FLAGS_ARCH(ptl1, i) \
100
    PAGE_PRESENT
100
    PAGE_PRESENT
101
#define GET_PTL3_FLAGS_ARCH(ptl2, i) \
101
#define GET_PTL3_FLAGS_ARCH(ptl2, i) \
102
    PAGE_PRESENT
102
    PAGE_PRESENT
103
#define GET_FRAME_FLAGS_ARCH(ptl3, i) \
103
#define GET_FRAME_FLAGS_ARCH(ptl3, i) \
104
    get_pt_flags((pte_t *) (ptl3), (index_t) (i))
104
    get_pt_flags((pte_t *) (ptl3), (size_t) (i))
105
 
105
 
106
/* Set PTE flags accessors for each level. */
106
/* Set PTE flags accessors for each level. */
107
#define SET_PTL1_FLAGS_ARCH(ptl0, i, x) \
107
#define SET_PTL1_FLAGS_ARCH(ptl0, i, x) \
108
    set_pt_flags((pte_t *) (ptl0), (index_t) (i), (x))
108
    set_pt_flags((pte_t *) (ptl0), (size_t) (i), (x))
109
#define SET_PTL2_FLAGS_ARCH(ptl1, i, x)
109
#define SET_PTL2_FLAGS_ARCH(ptl1, i, x)
110
#define SET_PTL3_FLAGS_ARCH(ptl2, i, x)
110
#define SET_PTL3_FLAGS_ARCH(ptl2, i, x)
111
#define SET_FRAME_FLAGS_ARCH(ptl3, i, x) \
111
#define SET_FRAME_FLAGS_ARCH(ptl3, i, x) \
112
    set_pt_flags((pte_t *) (ptl3), (index_t) (i), (x))
112
    set_pt_flags((pte_t *) (ptl3), (size_t) (i), (x))
113
 
113
 
114
/* Macros for querying the last level entries. */
114
/* Macros for querying the last level entries. */
115
#define PTE_VALID_ARCH(p) \
115
#define PTE_VALID_ARCH(p) \
116
    (*((uint32_t *) (p)) != 0)
116
    (*((uint32_t *) (p)) != 0)
117
#define PTE_PRESENT_ARCH(p) \
117
#define PTE_PRESENT_ARCH(p) \
Line 143... Line 143...
143
#define PFERR_CODE_US       (1 << 2)
143
#define PFERR_CODE_US       (1 << 2)
144
 
144
 
145
/** When bit on this position is 1, a reserved bit was set in page directory. */
145
/** When bit on this position is 1, a reserved bit was set in page directory. */
146
#define PFERR_CODE_RSVD     (1 << 3)    
146
#define PFERR_CODE_RSVD     (1 << 3)    
147
 
147
 
148
static inline int get_pt_flags(pte_t *pt, index_t i)
148
static inline int get_pt_flags(pte_t *pt, size_t i)
149
{
149
{
150
    pte_t *p = &pt[i];
150
    pte_t *p = &pt[i];
151
   
151
   
152
    return ((!p->page_cache_disable) << PAGE_CACHEABLE_SHIFT |
152
    return ((!p->page_cache_disable) << PAGE_CACHEABLE_SHIFT |
153
        (!p->present) << PAGE_PRESENT_SHIFT |
153
        (!p->present) << PAGE_PRESENT_SHIFT |
Line 156... Line 156...
156
        p->writeable << PAGE_WRITE_SHIFT |
156
        p->writeable << PAGE_WRITE_SHIFT |
157
        1 << PAGE_EXEC_SHIFT |
157
        1 << PAGE_EXEC_SHIFT |
158
        p->global << PAGE_GLOBAL_SHIFT);
158
        p->global << PAGE_GLOBAL_SHIFT);
159
}
159
}
160
 
160
 
161
static inline void set_pt_flags(pte_t *pt, index_t i, int flags)
161
static inline void set_pt_flags(pte_t *pt, size_t i, int flags)
162
{
162
{
163
    pte_t *p = &pt[i];
163
    pte_t *p = &pt[i];
164
   
164
   
165
    p->page_cache_disable = !(flags & PAGE_CACHEABLE);
165
    p->page_cache_disable = !(flags & PAGE_CACHEABLE);
166
    p->present = !(flags & PAGE_NOT_PRESENT);
166
    p->present = !(flags & PAGE_NOT_PRESENT);