pgtable.h (664b0bae0b87f69bc9deb098f5e0158b9cf18e04) | pgtable.h (e3613bb8afc2a9474c9214d65c8326c5ac02135e) |
---|---|
1/* 2 * Copyright (C) 2012 Regents of the University of California 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU General Public License 6 * as published by the Free Software Foundation, version 2. 7 * 8 * This program is distributed in the hope that it will be useful, --- 30 unchanged lines hidden (view full) --- 39 40/* Number of PGD entries that a user-mode program can use */ 41#define USER_PTRS_PER_PGD (TASK_SIZE / PGDIR_SIZE) 42#define FIRST_USER_ADDRESS 0 43 44/* Page protection bits */ 45#define _PAGE_BASE (_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_USER) 46 | 1/* 2 * Copyright (C) 2012 Regents of the University of California 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU General Public License 6 * as published by the Free Software Foundation, version 2. 7 * 8 * This program is distributed in the hope that it will be useful, --- 30 unchanged lines hidden (view full) --- 39 40/* Number of PGD entries that a user-mode program can use */ 41#define USER_PTRS_PER_PGD (TASK_SIZE / PGDIR_SIZE) 42#define FIRST_USER_ADDRESS 0 43 44/* Page protection bits */ 45#define _PAGE_BASE (_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_USER) 46 |
47#define PAGE_NONE __pgprot(0) | 47#define PAGE_NONE __pgprot(_PAGE_PROT_NONE) |
48#define PAGE_READ __pgprot(_PAGE_BASE | _PAGE_READ) 49#define PAGE_WRITE __pgprot(_PAGE_BASE | _PAGE_READ | _PAGE_WRITE) 50#define PAGE_EXEC __pgprot(_PAGE_BASE | _PAGE_EXEC) 51#define PAGE_READ_EXEC __pgprot(_PAGE_BASE | _PAGE_READ | _PAGE_EXEC) 52#define PAGE_WRITE_EXEC __pgprot(_PAGE_BASE | _PAGE_READ | \ 53 _PAGE_EXEC | _PAGE_WRITE) 54 55#define PAGE_COPY PAGE_READ --- 37 unchanged lines hidden (view full) --- 93 * ZERO_PAGE is a global shared page that is always zero, 94 * used for zero-mapped memory areas, etc. 95 */ 96extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)]; 97#define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page)) 98 99static inline int pmd_present(pmd_t pmd) 100{ | 48#define PAGE_READ __pgprot(_PAGE_BASE | _PAGE_READ) 49#define PAGE_WRITE __pgprot(_PAGE_BASE | _PAGE_READ | _PAGE_WRITE) 50#define PAGE_EXEC __pgprot(_PAGE_BASE | _PAGE_EXEC) 51#define PAGE_READ_EXEC __pgprot(_PAGE_BASE | _PAGE_READ | _PAGE_EXEC) 52#define PAGE_WRITE_EXEC __pgprot(_PAGE_BASE | _PAGE_READ | \ 53 _PAGE_EXEC | _PAGE_WRITE) 54 55#define PAGE_COPY PAGE_READ --- 37 unchanged lines hidden (view full) --- 93 * ZERO_PAGE is a global shared page that is always zero, 94 * used for zero-mapped memory areas, etc. 95 */ 96extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)]; 97#define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page)) 98 99static inline int pmd_present(pmd_t pmd) 100{ |
101 return (pmd_val(pmd) & _PAGE_PRESENT); | 101 return (pmd_val(pmd) & (_PAGE_PRESENT | _PAGE_PROT_NONE)); |
102} 103 104static inline int pmd_none(pmd_t pmd) 105{ 106 return (pmd_val(pmd) == 0); 107} 108 109static inline int pmd_bad(pmd_t pmd) --- 63 unchanged lines hidden (view full) --- 173 return (pte_t *)pmd_page_vaddr(*pmd) + pte_index(addr); 174} 175 176#define pte_offset_map(dir, addr) pte_offset_kernel((dir), (addr)) 177#define pte_unmap(pte) ((void)(pte)) 178 179static inline int pte_present(pte_t pte) 180{ | 102} 103 104static inline int pmd_none(pmd_t pmd) 105{ 106 return (pmd_val(pmd) == 0); 107} 108 109static inline int pmd_bad(pmd_t pmd) --- 63 unchanged lines hidden (view full) --- 173 return (pte_t *)pmd_page_vaddr(*pmd) + pte_index(addr); 174} 175 176#define pte_offset_map(dir, addr) pte_offset_kernel((dir), (addr)) 177#define pte_unmap(pte) ((void)(pte)) 178 179static inline int pte_present(pte_t pte) 180{ |
181 return (pte_val(pte) & _PAGE_PRESENT); | 181 return (pte_val(pte) & (_PAGE_PRESENT | _PAGE_PROT_NONE)); |
182} 183 184static inline int pte_none(pte_t pte) 185{ 186 return (pte_val(pte) == 0); 187} 188 189static inline int pte_write(pte_t pte) --- 185 unchanged lines hidden (view full) --- 375 return ptep_test_and_clear_young(vma, address, ptep); 376} 377 378/* 379 * Encode and decode a swap entry 380 * 381 * Format of swap PTE: 382 * bit 0: _PAGE_PRESENT (zero) | 182} 183 184static inline int pte_none(pte_t pte) 185{ 186 return (pte_val(pte) == 0); 187} 188 189static inline int pte_write(pte_t pte) --- 185 unchanged lines hidden (view full) --- 375 return ptep_test_and_clear_young(vma, address, ptep); 376} 377 378/* 379 * Encode and decode a swap entry 380 * 381 * Format of swap PTE: 382 * bit 0: _PAGE_PRESENT (zero) |
383 * bit 1: reserved for future use (zero) | 383 * bit 1: _PAGE_PROT_NONE (zero) |
384 * bits 2 to 6: swap type 385 * bits 7 to XLEN-1: swap offset 386 */ 387#define __SWP_TYPE_SHIFT 2 388#define __SWP_TYPE_BITS 5 389#define __SWP_TYPE_MASK ((1UL << __SWP_TYPE_BITS) - 1) 390#define __SWP_OFFSET_SHIFT (__SWP_TYPE_BITS + __SWP_TYPE_SHIFT) 391 --- 41 unchanged lines hidden --- | 384 * bits 2 to 6: swap type 385 * bits 7 to XLEN-1: swap offset 386 */ 387#define __SWP_TYPE_SHIFT 2 388#define __SWP_TYPE_BITS 5 389#define __SWP_TYPE_MASK ((1UL << __SWP_TYPE_BITS) - 1) 390#define __SWP_OFFSET_SHIFT (__SWP_TYPE_BITS + __SWP_TYPE_SHIFT) 391 --- 41 unchanged lines hidden --- |