Subversion Repositories HelenOS

Rev

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

Rev 3386 Rev 4581
Line 110... Line 110...
110
#define SET_FRAME_ADDRESS_ARCH(ptl3, i, a) \
110
#define SET_FRAME_ADDRESS_ARCH(ptl3, i, a) \
111
    (((pte_t *) (ptl3))[(i)].pfn = (a) >> 12)
111
    (((pte_t *) (ptl3))[(i)].pfn = (a) >> 12)
112
 
112
 
113
/* Get PTE flags accessors for each level. */
113
/* Get PTE flags accessors for each level. */
114
#define GET_PTL1_FLAGS_ARCH(ptl0, i) \
114
#define GET_PTL1_FLAGS_ARCH(ptl0, i) \
115
    get_pt_flags((pte_t *) (ptl0), (index_t) (i))
115
    get_pt_flags((pte_t *) (ptl0), (size_t) (i))
116
#define GET_PTL2_FLAGS_ARCH(ptl1, i) \
116
#define GET_PTL2_FLAGS_ARCH(ptl1, i) \
117
    PAGE_PRESENT
117
    PAGE_PRESENT
118
#define GET_PTL3_FLAGS_ARCH(ptl2, i) \
118
#define GET_PTL3_FLAGS_ARCH(ptl2, i) \
119
    PAGE_PRESENT
119
    PAGE_PRESENT
120
#define GET_FRAME_FLAGS_ARCH(ptl3, i) \
120
#define GET_FRAME_FLAGS_ARCH(ptl3, i) \
121
    get_pt_flags((pte_t *) (ptl3), (index_t) (i))
121
    get_pt_flags((pte_t *) (ptl3), (size_t) (i))
122
 
122
 
123
/* Set PTE flags accessors for each level. */
123
/* Set PTE flags accessors for each level. */
124
#define SET_PTL1_FLAGS_ARCH(ptl0, i, x) \
124
#define SET_PTL1_FLAGS_ARCH(ptl0, i, x) \
125
    set_pt_flags((pte_t *) (ptl0), (index_t) (i), (x))
125
    set_pt_flags((pte_t *) (ptl0), (size_t) (i), (x))
126
#define SET_PTL2_FLAGS_ARCH(ptl1, i, x)
126
#define SET_PTL2_FLAGS_ARCH(ptl1, i, x)
127
#define SET_PTL3_FLAGS_ARCH(ptl2, i, x)
127
#define SET_PTL3_FLAGS_ARCH(ptl2, i, x)
128
#define SET_FRAME_FLAGS_ARCH(ptl3, i, x) \
128
#define SET_FRAME_FLAGS_ARCH(ptl3, i, x) \
129
    set_pt_flags((pte_t *) (ptl3), (index_t) (i), (x))
129
    set_pt_flags((pte_t *) (ptl3), (size_t) (i), (x))
130
 
130
 
131
/* Last-level info macros. */
131
/* Last-level info macros. */
132
#define PTE_VALID_ARCH(pte)         (*((uint32_t *) (pte)) != 0)
132
#define PTE_VALID_ARCH(pte)         (*((uint32_t *) (pte)) != 0)
133
#define PTE_PRESENT_ARCH(pte)           ((pte)->p != 0)
133
#define PTE_PRESENT_ARCH(pte)           ((pte)->p != 0)
134
#define PTE_GET_FRAME_ARCH(pte)         ((pte)->pfn << 12)
134
#define PTE_GET_FRAME_ARCH(pte)         ((pte)->pfn << 12)
Line 138... Line 138...
138
#ifndef __ASM__
138
#ifndef __ASM__
139
 
139
 
140
#include <mm/mm.h>
140
#include <mm/mm.h>
141
#include <arch/exception.h>
141
#include <arch/exception.h>
142
 
142
 
143
static inline int get_pt_flags(pte_t *pt, index_t i)
143
static inline int get_pt_flags(pte_t *pt, size_t i)
144
{
144
{
145
    pte_t *p = &pt[i];
145
    pte_t *p = &pt[i];
146
   
146
   
147
    return ((p->cacheable << PAGE_CACHEABLE_SHIFT) |
147
    return ((p->cacheable << PAGE_CACHEABLE_SHIFT) |
148
        ((!p->p) << PAGE_PRESENT_SHIFT) |
148
        ((!p->p) << PAGE_PRESENT_SHIFT) |
Line 151... Line 151...
151
        ((p->w) << PAGE_WRITE_SHIFT) |
151
        ((p->w) << PAGE_WRITE_SHIFT) |
152
        (1 << PAGE_EXEC_SHIFT) |
152
        (1 << PAGE_EXEC_SHIFT) |
153
        (p->g << PAGE_GLOBAL_SHIFT));
153
        (p->g << PAGE_GLOBAL_SHIFT));
154
}
154
}
155
 
155
 
156
static inline void set_pt_flags(pte_t *pt, index_t i, int flags)
156
static inline void set_pt_flags(pte_t *pt, size_t i, int flags)
157
{
157
{
158
    pte_t *p = &pt[i];
158
    pte_t *p = &pt[i];
159
   
159
   
160
    p->cacheable = (flags & PAGE_CACHEABLE) != 0;
160
    p->cacheable = (flags & PAGE_CACHEABLE) != 0;
161
    p->p = !(flags & PAGE_NOT_PRESENT);
161
    p->p = !(flags & PAGE_NOT_PRESENT);