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 3830
Line 118... Line 118...
118
#define SET_FRAME_FLAGS_ARCH(ptl3, i, x) \
118
#define SET_FRAME_FLAGS_ARCH(ptl3, i, x) \
119
    set_pt_flags((pte_t *) (ptl3), (index_t) (i), (x))
119
    set_pt_flags((pte_t *) (ptl3), (index_t) (i), (x))
120
 
120
 
121
/* Macros for querying the last-level PTEs. */
121
/* Macros for querying the last-level PTEs. */
122
#define PTE_VALID_ARCH(pte)         (*((uint32_t *) (pte)) != 0)
122
#define PTE_VALID_ARCH(pte)         (*((uint32_t *) (pte)) != 0)
123
#define PTE_PRESENT_ARCH(pte)           ((pte)->p != 0)
123
#define PTE_PRESENT_ARCH(pte)           ((pte)->present != 0)
124
#define PTE_GET_FRAME_ARCH(pte)         ((pte)->pfn << 12)
124
#define PTE_GET_FRAME_ARCH(pte)         ((pte)->pfn << 12)
125
#define PTE_WRITABLE_ARCH(pte)          1
125
#define PTE_WRITABLE_ARCH(pte)          1
126
#define PTE_EXECUTABLE_ARCH(pte)        1
126
#define PTE_EXECUTABLE_ARCH(pte)        1
127
 
127
 
128
#ifndef __ASM__
128
#ifndef __ASM__
Line 132... Line 132...
132
 
132
 
133
static inline int get_pt_flags(pte_t *pt, index_t i)
133
static inline int get_pt_flags(pte_t *pt, index_t i)
134
{
134
{
135
    pte_t *p = &pt[i];
135
    pte_t *p = &pt[i];
136
   
136
   
137
    return ((1 << PAGE_CACHEABLE_SHIFT) |
137
    return (((!p->page_cache_disable) << PAGE_CACHEABLE_SHIFT) |
138
        ((!p->p) << PAGE_PRESENT_SHIFT) |
138
        ((!p->present) << PAGE_PRESENT_SHIFT) |
139
        (1 << PAGE_USER_SHIFT) |
139
        (1 << PAGE_USER_SHIFT) |
140
        (1 << PAGE_READ_SHIFT) |
140
        (1 << PAGE_READ_SHIFT) |
141
        (1 << PAGE_WRITE_SHIFT) |
141
        (1 << PAGE_WRITE_SHIFT) |
142
        (1 << PAGE_EXEC_SHIFT) |
142
        (1 << PAGE_EXEC_SHIFT) |
143
        (p->g << PAGE_GLOBAL_SHIFT));
143
        (p->global << PAGE_GLOBAL_SHIFT));
144
}
144
}
145
 
145
 
146
static inline void set_pt_flags(pte_t *pt, index_t i, int flags)
146
static inline void set_pt_flags(pte_t *pt, index_t i, int flags)
147
{
147
{
148
    pte_t *p = &pt[i];
148
    pte_t *p = &pt[i];
149
   
149
   
-
 
150
    p->page_cache_disable = !(flags & PAGE_CACHEABLE);
150
    p->p = !(flags & PAGE_NOT_PRESENT);
151
    p->present = !(flags & PAGE_NOT_PRESENT);
151
    p->g = (flags & PAGE_GLOBAL) != 0;
152
    p->global = (flags & PAGE_GLOBAL) != 0;
152
    p->valid = 1;
153
    p->valid = 1;
153
}
154
}
154
 
155
 
155
extern void page_arch_init(void);
156
extern void page_arch_init(void);
156
 
157