1 #ifndef __ASM_MIPS_PAGE_H
2 #define __ASM_MIPS_PAGE_H
3
4 #include <linux/linkage.h>
5
6 #ifndef __ASSEMBLY__
7 #define invalidate() tlbflush();
8 extern asmlinkage void tlbflush(void);
9 #endif
10
11
12 #define PAGE_SHIFT 12
13 #define PGDIR_SHIFT 22
14 #define PAGE_SIZE (1UL << PAGE_SHIFT)
15 #define PGDIR_SIZE (1UL << PGDIR_SHIFT)
16
17 #ifdef __KERNEL__
18
19
20 #define BITS_PER_PTR (8*sizeof(unsigned long))
21
22 #define PAGE_MASK (~(PAGE_SIZE-1))
23
24 #define PGDIR_MASK (~(PGDIR_SIZE-1))
25
26 #define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
27
28 #define PTR_MASK (~(sizeof(void*)-1))
29
30
31
32 #define SIZEOF_PTR_LOG2 2
33
34
35 #define PAGE_DIR_OFFSET(tsk,address) \
36 ((((unsigned long)(address)) >> 22) + (unsigned long *) (tsk)->tss.pg_dir)
37
38
39 #define PAGE_PTR(address) \
40 ((unsigned long)(address)>>(PAGE_SHIFT-SIZEOF_PTR_LOG2)&PTR_MASK&~PAGE_MASK)
41
42
43 #define PTRS_PER_PAGE (PAGE_SIZE/sizeof(void*))
44
45
46 #define SET_PAGE_DIR(tsk,pgdir) \
47 do { \
48 (tsk)->tss.pg_dir = (unsigned long) (pgdir); \
49 if ((tsk) == current) \
50 invalidate(); \
51 } while (0)
52
53 #endif
54
55 #endif