Subversion Repositories HelenOS

Rev

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

Rev 4341 Rev 4691
Line 100... Line 100...
100
#define SET_FRAME_ADDRESS_ARCH(ptl3, i, a) \
100
#define SET_FRAME_ADDRESS_ARCH(ptl3, i, a) \
101
    (((pte_t *) (ptl3))[(i)].pfn = (a) >> 12)
101
    (((pte_t *) (ptl3))[(i)].pfn = (a) >> 12)
102
 
102
 
103
/* Get PTE flags accessors for each level. */
103
/* Get PTE flags accessors for each level. */
104
#define GET_PTL1_FLAGS_ARCH(ptl0, i) \
104
#define GET_PTL1_FLAGS_ARCH(ptl0, i) \
105
    get_pt_flags((pte_t *) (ptl0), (index_t) (i))
105
    get_pt_flags((pte_t *) (ptl0), (size_t) (i))
106
#define GET_PTL2_FLAGS_ARCH(ptl1, i) \
106
#define GET_PTL2_FLAGS_ARCH(ptl1, i) \
107
    PAGE_PRESENT
107
    PAGE_PRESENT
108
#define GET_PTL3_FLAGS_ARCH(ptl2, i) \
108
#define GET_PTL3_FLAGS_ARCH(ptl2, i) \
109
    PAGE_PRESENT
109
    PAGE_PRESENT
110
#define GET_FRAME_FLAGS_ARCH(ptl3, i) \
110
#define GET_FRAME_FLAGS_ARCH(ptl3, i) \
111
    get_pt_flags((pte_t *) (ptl3), (index_t) (i))
111
    get_pt_flags((pte_t *) (ptl3), (size_t) (i))
112
 
112
 
113
/* Set PTE flags accessors for each level. */
113
/* Set PTE flags accessors for each level. */
114
#define SET_PTL1_FLAGS_ARCH(ptl0, i, x) \
114
#define SET_PTL1_FLAGS_ARCH(ptl0, i, x) \
115
    set_pt_flags((pte_t *) (ptl0), (index_t) (i), (x))
115
    set_pt_flags((pte_t *) (ptl0), (size_t) (i), (x))
116
#define SET_PTL2_FLAGS_ARCH(ptl1, i, x)
116
#define SET_PTL2_FLAGS_ARCH(ptl1, i, x)
117
#define SET_PTL3_FLAGS_ARCH(ptl2, i, x)
117
#define SET_PTL3_FLAGS_ARCH(ptl2, i, x)
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), (size_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)->present != 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)
Line 128... Line 128...
128
#ifndef __ASM__
128
#ifndef __ASM__
129
 
129
 
130
#include <mm/mm.h>
130
#include <mm/mm.h>
131
#include <arch/interrupt.h>
131
#include <arch/interrupt.h>
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, size_t i)
134
{
134
{
135
    pte_t *p = &pt[i];
135
    pte_t *p = &pt[i];
136
   
136
   
137
    return (((!p->page_cache_disable) << PAGE_CACHEABLE_SHIFT) |
137
    return (((!p->page_cache_disable) << PAGE_CACHEABLE_SHIFT) |
138
        ((!p->present) << PAGE_PRESENT_SHIFT) |
138
        ((!p->present) << PAGE_PRESENT_SHIFT) |
Line 141... Line 141...
141
        (1 << PAGE_WRITE_SHIFT) |
141
        (1 << PAGE_WRITE_SHIFT) |
142
        (1 << PAGE_EXEC_SHIFT) |
142
        (1 << PAGE_EXEC_SHIFT) |
143
        (p->global << 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, size_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->page_cache_disable = !(flags & PAGE_CACHEABLE);
151
    p->present = !(flags & PAGE_NOT_PRESENT);
151
    p->present = !(flags & PAGE_NOT_PRESENT);