This source file includes following definitions.
- remove_from_ctx_list
- add_to_ctx_list
1
2 #ifndef _SPARC_PGTABLE_H
3 #define _SPARC_PGTABLE_H
4
5
6
7
8
9
10
11 #include <linux/mm.h>
12 #include <asm/asi.h>
13 #include <asm/pgtsun4c.h>
14 #include <asm/pgtsrmmu.h>
15 #include <asm/vac-ops.h>
16 #include <asm/oplib.h>
17
18 extern void load_mmu(void);
19
20
21 extern void (*mmu_exit_hook)(void *);
22 extern void (*mmu_fork_hook)(void *, unsigned long);
23 extern void (*mmu_release_hook)(void *);
24 extern void (*mmu_flush_hook)(void *);
25 extern void (*mmu_task_cacheflush)(void *);
26
27
28 extern char *(*mmu_lockarea)(char *, unsigned long);
29 extern void (*mmu_unlockarea)(char *, unsigned long);
30
31
32 extern char *(*mmu_get_scsi_buffer)(char *, unsigned long);
33 extern void (*mmu_release_scsi_buffer)(char *, unsigned long);
34
35 extern unsigned int pmd_shift;
36 extern unsigned int pmd_size;
37 extern unsigned int pmd_mask;
38 extern unsigned int (*pmd_align)(unsigned int);
39
40 extern unsigned int pgdir_shift;
41 extern unsigned int pgdir_size;
42 extern unsigned int pgdir_mask;
43 extern unsigned int (*pgdir_align)(unsigned int);
44
45 extern unsigned int ptrs_per_pte;
46 extern unsigned int ptrs_per_pmd;
47 extern unsigned int ptrs_per_pgd;
48
49 extern unsigned int ptrs_per_page;
50
51 extern unsigned long (*(vmalloc_start))(void);
52
53 #define VMALLOC_VMADDR(x) ((unsigned long)(x))
54 #define VMALLOC_START vmalloc_start()
55
56 extern pgprot_t page_none;
57 extern pgprot_t page_shared;
58 extern pgprot_t page_copy;
59 extern pgprot_t page_readonly;
60 extern pgprot_t page_kernel;
61 extern pgprot_t page_invalid;
62
63 #define PMD_SHIFT (pmd_shift)
64 #define PMD_SIZE (pmd_size)
65 #define PMD_MASK (pmd_mask)
66 #define PMD_ALIGN (pmd_align)
67 #define PGDIR_SHIFT (pgdir_shift)
68 #define PGDIR_SIZE (pgdir_size)
69 #define PGDIR_MASK (pgdir_mask)
70 #define PGDIR_ALIGN (pgdir_align)
71 #define PTRS_PER_PTE (ptrs_per_pte)
72 #define PTRS_PER_PMD (ptrs_per_pmd)
73 #define PTRS_PER_PGD (ptrs_per_pgd)
74
75 #define PAGE_NONE (page_none)
76 #define PAGE_SHARED (page_shared)
77 #define PAGE_COPY (page_copy)
78 #define PAGE_READONLY (page_readonly)
79 #define PAGE_KERNEL (page_kernel)
80 #define PAGE_INVALID (page_invalid)
81
82
83 extern pgd_t swapper_pg_dir[1024];
84
85
86
87
88 extern pte_t pg0[1024];
89
90 extern unsigned long ptr_in_current_pgd;
91
92
93 #define PTRS_PER_PAGE (PAGE_SIZE/sizeof(void*))
94
95
96
97
98
99
100 #define __P000 __pgprot(0)
101 #define __P001 __pgprot(0)
102 #define __P010 __pgprot(0)
103 #define __P011 __pgprot(0)
104 #define __P100 __pgprot(0)
105 #define __P101 __pgprot(0)
106 #define __P110 __pgprot(0)
107 #define __P111 __pgprot(0)
108
109 #define __S000 __pgprot(0)
110 #define __S001 __pgprot(0)
111 #define __S010 __pgprot(0)
112 #define __S011 __pgprot(0)
113 #define __S100 __pgprot(0)
114 #define __S101 __pgprot(0)
115 #define __S110 __pgprot(0)
116 #define __S111 __pgprot(0)
117
118 extern int num_contexts;
119
120
121
122
123
124
125
126
127 extern pte_t __bad_page(void);
128 extern pte_t * __bad_pagetable(void);
129
130 extern unsigned long __zero_page(void);
131
132 #define BAD_PAGETABLE __bad_pagetable()
133 #define BAD_PAGE __bad_page()
134 #define ZERO_PAGE __zero_page()
135
136
137 #define BITS_PER_PTR (8*sizeof(unsigned long))
138
139
140 #define PTR_MASK (~(sizeof(void*)-1))
141
142 #define SIZEOF_PTR_LOG2 2
143
144 extern unsigned long (*pte_page)(pte_t);
145 extern unsigned long (*pmd_page)(pmd_t);
146 extern unsigned long (*pgd_page)(pgd_t);
147
148
149
150
151
152
153
154
155
156
157
158
159 extern void (*sparc_update_rootmmu_dir)(struct task_struct *, pgd_t *pgdir);
160
161 #define SET_PAGE_DIR(tsk,pgdir) sparc_update_rootmmu_dir(tsk, pgdir)
162
163
164 #define PAGE_PTR(address) \
165 ((unsigned long)(address)>>(PAGE_SHIFT-SIZEOF_PTR_LOG2)&PTR_MASK&~PAGE_MASK)
166
167 extern unsigned long high_memory;
168
169 extern int (*pte_none)(pte_t);
170 extern int (*pte_present)(pte_t);
171 extern int (*pte_inuse)(pte_t *);
172 extern void (*pte_clear)(pte_t *);
173 extern void (*pte_reuse)(pte_t *);
174
175 extern int (*pmd_none)(pmd_t);
176 extern int (*pmd_bad)(pmd_t);
177 extern int (*pmd_present)(pmd_t);
178 extern int (*pmd_inuse)(pmd_t *);
179 extern void (*pmd_clear)(pmd_t *);
180 extern void (*pmd_reuse)(pmd_t *);
181
182 extern int (*pgd_none)(pgd_t);
183 extern int (*pgd_bad)(pgd_t);
184 extern int (*pgd_present)(pgd_t);
185 extern int (*pgd_inuse)(pgd_t *);
186 extern void (*pgd_clear)(pgd_t *);
187 extern void (*pgd_reuse)(pgd_t *);
188
189
190
191
192
193 extern int (*pte_read)(pte_t);
194 extern int (*pte_write)(pte_t);
195 extern int (*pte_exec)(pte_t);
196 extern int (*pte_dirty)(pte_t);
197 extern int (*pte_young)(pte_t);
198 extern int (*pte_cow)(pte_t);
199
200 extern pte_t (*pte_wrprotect)(pte_t);
201 extern pte_t (*pte_rdprotect)(pte_t);
202 extern pte_t (*pte_exprotect)(pte_t);
203 extern pte_t (*pte_mkclean)(pte_t);
204 extern pte_t (*pte_mkold)(pte_t);
205 extern pte_t (*pte_uncow)(pte_t);
206 extern pte_t (*pte_mkwrite)(pte_t);
207 extern pte_t (*pte_mkread)(pte_t);
208 extern pte_t (*pte_mkexec)(pte_t);
209 extern pte_t (*pte_mkdirty)(pte_t);
210 extern pte_t (*pte_mkyoung)(pte_t);
211 extern pte_t (*pte_mkcow)(pte_t);
212
213
214
215
216
217 extern pte_t (*mk_pte)(unsigned long, pgprot_t);
218
219 extern void (*pgd_set)(pgd_t *, pmd_t *);
220
221 extern pte_t (*pte_modify)(pte_t, pgprot_t);
222
223
224 extern pgd_t * (*pgd_offset)(struct mm_struct *, unsigned long);
225
226
227 extern pmd_t * (*pmd_offset)(pgd_t *, unsigned long);
228
229
230 extern pte_t * (*pte_offset)(pmd_t *, unsigned long);
231
232
233
234
235
236
237 extern void (*pte_free_kernel)(pte_t *);
238
239 extern pte_t * (*pte_alloc_kernel)(pmd_t *, unsigned long);
240
241
242
243
244
245 extern void (*pmd_free_kernel)(pmd_t *);
246
247 extern pmd_t * (*pmd_alloc_kernel)(pgd_t *, unsigned long);
248
249 extern void (*pte_free)(pte_t *);
250
251 extern pte_t * (*pte_alloc)(pmd_t *, unsigned long);
252
253
254
255
256
257 extern void (*pmd_free)(pmd_t *);
258
259 extern pmd_t * (*pmd_alloc)(pgd_t *, unsigned long);
260
261 extern void (*pgd_free)(pgd_t *);
262
263 extern pgd_t * (*pgd_alloc)(void);
264
265
266 #define FAULT_CODE_PROT 0x1
267 #define FAULT_CODE_WRITE 0x2
268 #define FAULT_CODE_USER 0x4
269 extern int (*get_fault_info)(unsigned long *, unsigned long *, unsigned long);
270 extern void (*update_mmu_cache)(struct vm_area_struct *vma, unsigned long address, pte_t pte);
271
272 extern int invalid_segment;
273
274 #define SWP_TYPE(entry) (((entry) >> 1) & 0x7f)
275 #define SWP_OFFSET(entry) ((entry) >> 8)
276 #define SWP_ENTRY(type,offset) (((type) << 1) | ((offset) << 8))
277
278 struct ctx_list {
279 struct ctx_list *next;
280 struct ctx_list *prev;
281 unsigned char ctx_number;
282 struct task_struct *ctx_task;
283 };
284
285 extern struct ctx_list *ctx_list_pool;
286 extern struct ctx_list ctx_free;
287 extern struct ctx_list ctx_used;
288
289 extern inline void remove_from_ctx_list(struct ctx_list *entry)
290 {
291 entry->next->prev = entry->prev;
292 entry->prev->next = entry->next;
293 }
294
295 extern inline void add_to_ctx_list(struct ctx_list *head, struct ctx_list *entry)
296 {
297 entry->next = head;
298 (entry->prev = head->prev)->next = entry;
299 head->prev = entry;
300 }
301 #define add_to_free_ctxlist(entry) add_to_ctx_list(&ctx_free, entry)
302 #define add_to_used_ctxlist(entry) add_to_ctx_list(&ctx_used, entry)
303
304 #endif