Changes in kernel/arch/arm32/include/mm/page.h [c09adc10:7a0359b] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/arm32/include/mm/page.h
rc09adc10 r7a0359b 27 27 */ 28 28 29 /** @addtogroup arm32mm 29 /** @addtogroup arm32mm 30 30 * @{ 31 31 */ … … 40 40 #include <mm/mm.h> 41 41 #include <arch/exception.h> 42 #include <trace.h> 42 43 43 44 #define PAGE_WIDTH FRAME_WIDTH … … 192 193 /** Sets the address of level 0 page table. 193 194 * 194 * @param pt Pointer to the page table to set. 195 */ 196 static inline void set_ptl0_addr(pte_t *pt) 195 * @param pt Pointer to the page table to set. 196 * 197 */ 198 NO_TRACE static inline void set_ptl0_addr(pte_t *pt) 197 199 { 198 200 asm volatile ( … … 205 207 /** Returns level 0 page table entry flags. 206 208 * 207 * @param pt Level 0 page table. 208 * @param i Index of the entry to return. 209 */ 210 static inline int get_pt_level0_flags(pte_t *pt, size_t i) 209 * @param pt Level 0 page table. 210 * @param i Index of the entry to return. 211 * 212 */ 213 NO_TRACE static inline int get_pt_level0_flags(pte_t *pt, size_t i) 211 214 { 212 215 pte_level0_t *p = &pt[i].l0; 213 216 int np = (p->descriptor_type == PTE_DESCRIPTOR_NOT_PRESENT); 214 217 215 218 return (np << PAGE_PRESENT_SHIFT) | (1 << PAGE_USER_SHIFT) | 216 219 (1 << PAGE_READ_SHIFT) | (1 << PAGE_WRITE_SHIFT) | … … 220 223 /** Returns level 1 page table entry flags. 221 224 * 222 * @param pt Level 1 page table. 223 * @param i Index of the entry to return. 224 */ 225 static inline int get_pt_level1_flags(pte_t *pt, size_t i) 225 * @param pt Level 1 page table. 226 * @param i Index of the entry to return. 227 * 228 */ 229 NO_TRACE static inline int get_pt_level1_flags(pte_t *pt, size_t i) 226 230 { 227 231 pte_level1_t *p = &pt[i].l1; 228 232 229 233 int dt = p->descriptor_type; 230 234 int ap = p->access_permission_0; 231 235 232 236 return ((dt == PTE_DESCRIPTOR_NOT_PRESENT) << PAGE_PRESENT_SHIFT) | 233 237 ((ap == PTE_AP_USER_RO_KERNEL_RW) << PAGE_READ_SHIFT) | … … 241 245 } 242 246 243 244 247 /** Sets flags of level 0 page table entry. 245 248 * 246 * @param pt level 0 page table 247 * @param i index of the entry to be changed 248 * @param flags new flags 249 */ 250 static inline void set_pt_level0_flags(pte_t *pt, size_t i, int flags) 249 * @param pt level 0 page table 250 * @param i index of the entry to be changed 251 * @param flags new flags 252 * 253 */ 254 NO_TRACE static inline void set_pt_level0_flags(pte_t *pt, size_t i, int flags) 251 255 { 252 256 pte_level0_t *p = &pt[i].l0; 253 257 254 258 if (flags & PAGE_NOT_PRESENT) { 255 259 p->descriptor_type = PTE_DESCRIPTOR_NOT_PRESENT; … … 262 266 p->descriptor_type = PTE_DESCRIPTOR_COARSE_TABLE; 263 267 p->should_be_zero = 0; 264 268 } 265 269 } 266 270 … … 268 272 /** Sets flags of level 1 page table entry. 269 273 * 270 * We use same access rights for the whole page. When page is not preset we 271 * store 1 in acess_rigts_3 so that at least one bit is 1 (to mark correct 272 * page entry, see #PAGE_VALID_ARCH). 273 * 274 * @param pt Level 1 page table. 275 * @param i Index of the entry to be changed. 276 * @param flags New flags. 277 */ 278 static inline void set_pt_level1_flags(pte_t *pt, size_t i, int flags) 274 * We use same access rights for the whole page. When page 275 * is not preset we store 1 in acess_rigts_3 so that at least 276 * one bit is 1 (to mark correct page entry, see #PAGE_VALID_ARCH). 277 * 278 * @param pt Level 1 page table. 279 * @param i Index of the entry to be changed. 280 * @param flags New flags. 281 * 282 */ 283 NO_TRACE static inline void set_pt_level1_flags(pte_t *pt, size_t i, int flags) 279 284 { 280 285 pte_level1_t *p = &pt[i].l1; … … 287 292 p->access_permission_3 = p->access_permission_0; 288 293 } 289 294 290 295 p->cacheable = p->bufferable = (flags & PAGE_CACHEABLE) != 0; 291 296 292 297 /* default access permission */ 293 298 p->access_permission_0 = p->access_permission_1 = 294 299 p->access_permission_2 = p->access_permission_3 = 295 300 PTE_AP_USER_NO_KERNEL_RW; 296 301 297 302 if (flags & PAGE_USER) { 298 303 if (flags & PAGE_READ) {
Note:
See TracChangeset
for help on using the changeset viewer.