|
81 | 81 | */ |
82 | 82 | #include <asm/pte-hash64.h> |
83 | 83 |
|
84 | | -/* To make some generic powerpc code happy */ |
85 | | -#ifndef _PAGE_HWEXEC |
86 | | -#define _PAGE_HWEXEC 0 |
87 | | -#endif |
88 | | - |
89 | 84 | /* Some other useful definitions */ |
90 | 85 | #define PTE_RPN_MAX (1UL << (64 - PTE_RPN_SHIFT)) |
91 | 86 | #define PTE_RPN_MASK (~((1UL<<PTE_RPN_SHIFT)-1)) |
|
96 | 91 | #define _PAGE_CHG_MASK (PTE_RPN_MASK | _PAGE_HPTEFLAGS | _PAGE_DIRTY | \ |
97 | 92 | _PAGE_ACCESSED | _PAGE_SPECIAL) |
98 | 93 |
|
| 94 | +#define _PAGE_BASE_NC (_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_PSIZE) |
| 95 | +#define _PAGE_BASE (_PAGE_BASE_NC | _PAGE_COHERENT) |
99 | 96 |
|
100 | 97 |
|
101 | | -/* __pgprot defined in arch/powerpc/include/asm/page.h */ |
102 | | -#define PAGE_NONE __pgprot(_PAGE_PRESENT | _PAGE_ACCESSED) |
103 | | - |
104 | | -#define PAGE_SHARED __pgprot(_PAGE_BASE | _PAGE_RW | _PAGE_USER) |
105 | | -#define PAGE_SHARED_X __pgprot(_PAGE_BASE | _PAGE_RW | _PAGE_USER | _PAGE_EXEC) |
| 98 | +/* Permission masks used to generate the __P and __S table, |
| 99 | + * |
| 100 | + * Note:__pgprot is defined in arch/powerpc/include/asm/page.h |
| 101 | + */ |
| 102 | +#define PAGE_NONE __pgprot(_PAGE_BASE) |
| 103 | +#define PAGE_SHARED __pgprot(_PAGE_BASE | _PAGE_USER | _PAGE_RW) |
| 104 | +#define PAGE_SHARED_X __pgprot(_PAGE_BASE | _PAGE_USER | _PAGE_RW | _PAGE_EXEC) |
106 | 105 | #define PAGE_COPY __pgprot(_PAGE_BASE | _PAGE_USER) |
107 | 106 | #define PAGE_COPY_X __pgprot(_PAGE_BASE | _PAGE_USER | _PAGE_EXEC) |
108 | 107 | #define PAGE_READONLY __pgprot(_PAGE_BASE | _PAGE_USER) |
109 | 108 | #define PAGE_READONLY_X __pgprot(_PAGE_BASE | _PAGE_USER | _PAGE_EXEC) |
110 | | -#define PAGE_KERNEL __pgprot(_PAGE_BASE | _PAGE_WRENABLE) |
111 | | -#define PAGE_KERNEL_CI __pgprot(_PAGE_PRESENT | _PAGE_ACCESSED | \ |
112 | | - _PAGE_WRENABLE | _PAGE_NO_CACHE | _PAGE_GUARDED) |
113 | | -#define PAGE_KERNEL_EXEC __pgprot(_PAGE_BASE | _PAGE_WRENABLE | _PAGE_EXEC) |
114 | 109 |
|
115 | | -#define PAGE_AGP __pgprot(_PAGE_BASE | _PAGE_WRENABLE | _PAGE_NO_CACHE) |
116 | | -#define HAVE_PAGE_AGP |
| 110 | +/* Permission masks used for kernel mappings */ |
| 111 | +#define PAGE_KERNEL __pgprot(_PAGE_BASE | _PAGE_KERNEL_RW) |
| 112 | +#define PAGE_KERNEL_NC __pgprot(_PAGE_BASE_NC | _PAGE_KERNEL_RW | \ |
| 113 | + _PAGE_NO_CACHE) |
| 114 | +#define PAGE_KERNEL_NCG __pgprot(_PAGE_BASE_NC | _PAGE_KERNEL_RW | \ |
| 115 | + _PAGE_NO_CACHE | _PAGE_GUARDED) |
| 116 | +#define PAGE_KERNEL_X __pgprot(_PAGE_BASE | _PAGE_KERNEL_RW | _PAGE_EXEC) |
| 117 | +#define PAGE_KERNEL_RO __pgprot(_PAGE_BASE | _PAGE_KERNEL_RO) |
| 118 | +#define PAGE_KERNEL_ROX __pgprot(_PAGE_BASE | _PAGE_KERNEL_RO | _PAGE_EXEC) |
| 119 | + |
| 120 | +/* Protection bits for use by pte_pgprot() */ |
| 121 | +#define PAGE_PROT_BITS (_PAGE_GUARDED | _PAGE_COHERENT | \ |
| 122 | + _PAGE_NO_CACHE | _PAGE_WRITETHRU | \ |
| 123 | + _PAGE_4K_PFN | _PAGE_USER | _PAGE_RW | \ |
| 124 | + _PAGE_ACCESSED | _PAGE_DIRTY | _PAGE_EXEC) |
| 125 | + |
117 | 126 |
|
118 | 127 | /* We always have _PAGE_SPECIAL on 64 bit */ |
119 | 128 | #define __HAVE_ARCH_PTE_SPECIAL |
120 | 129 |
|
| 130 | +/* Make modules code happy. We don't set RO yet */ |
| 131 | +#define PAGE_KERNEL_EXEC PAGE_KERNEL_X |
121 | 132 |
|
122 | 133 | /* |
123 | 134 | * POWER4 and newer have per page execute protection, older chips can only |
@@ -395,7 +406,8 @@ static inline void pte_clear(struct mm_struct *mm, unsigned long addr, |
395 | 406 | static inline void __ptep_set_access_flags(pte_t *ptep, pte_t entry) |
396 | 407 | { |
397 | 408 | unsigned long bits = pte_val(entry) & |
398 | | - (_PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_RW | _PAGE_EXEC); |
| 409 | + (_PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_RW | |
| 410 | + _PAGE_EXEC | _PAGE_HWEXEC); |
399 | 411 | unsigned long old, tmp; |
400 | 412 |
|
401 | 413 | __asm__ __volatile__( |
|
0 commit comments