Ok. I didn't make 2.4.0 in 2000. Tough. I tried, but we had some
[davej-history.git] / include / asm-alpha / page.h
blob41afdcbd82a675199ef6c18b45a74ab61bda9314
1 #ifndef _ALPHA_PAGE_H
2 #define _ALPHA_PAGE_H
4 /* PAGE_SHIFT determines the page size */
5 #define PAGE_SHIFT 13
6 #define PAGE_SIZE (1UL << PAGE_SHIFT)
7 #define PAGE_MASK (~(PAGE_SIZE-1))
9 #ifdef __KERNEL__
11 #ifndef __ASSEMBLY__
13 #define STRICT_MM_TYPECHECKS
16 * A _lot_ of the kernel time is spent clearing pages, so
17 * do this as fast as we possibly can. Also, doing this
18 * as a separate inline function (rather than memset())
19 * results in clearer kernel profiles as we see _who_ is
20 * doing page clearing or copying.
22 static inline void clear_page(void * page)
24 unsigned long count = PAGE_SIZE/64;
25 unsigned long *ptr = (unsigned long *)page;
27 do {
28 ptr[0] = 0;
29 ptr[1] = 0;
30 ptr[2] = 0;
31 ptr[3] = 0;
32 count--;
33 ptr[4] = 0;
34 ptr[5] = 0;
35 ptr[6] = 0;
36 ptr[7] = 0;
37 ptr += 8;
38 } while (count);
41 #define clear_user_page(page, vaddr) clear_page(page)
43 static inline void copy_page(void * _to, void * _from)
45 unsigned long count = PAGE_SIZE/64;
46 unsigned long *to = (unsigned long *)_to;
47 unsigned long *from = (unsigned long *)_from;
49 do {
50 unsigned long a,b,c,d,e,f,g,h;
51 a = from[0];
52 b = from[1];
53 c = from[2];
54 d = from[3];
55 e = from[4];
56 f = from[5];
57 g = from[6];
58 h = from[7];
59 count--;
60 from += 8;
61 to[0] = a;
62 to[1] = b;
63 to[2] = c;
64 to[3] = d;
65 to[4] = e;
66 to[5] = f;
67 to[6] = g;
68 to[7] = h;
69 to += 8;
70 } while (count);
73 #define copy_user_page(to, from, vaddr) copy_page(to, from)
75 #ifdef STRICT_MM_TYPECHECKS
77 * These are used to make use of C type-checking..
79 typedef struct { unsigned long pte; } pte_t;
80 typedef struct { unsigned long pmd; } pmd_t;
81 typedef struct { unsigned long pgd; } pgd_t;
82 typedef struct { unsigned long pgprot; } pgprot_t;
84 #define pte_val(x) ((x).pte)
85 #define pmd_val(x) ((x).pmd)
86 #define pgd_val(x) ((x).pgd)
87 #define pgprot_val(x) ((x).pgprot)
89 #define __pte(x) ((pte_t) { (x) } )
90 #define __pgd(x) ((pgd_t) { (x) } )
91 #define __pgprot(x) ((pgprot_t) { (x) } )
93 #else
95 * .. while these make it easier on the compiler
97 typedef unsigned long pte_t;
98 typedef unsigned long pmd_t;
99 typedef unsigned long pgd_t;
100 typedef unsigned long pgprot_t;
102 #define pte_val(x) (x)
103 #define pmd_val(x) (x)
104 #define pgd_val(x) (x)
105 #define pgprot_val(x) (x)
107 #define __pte(x) (x)
108 #define __pgd(x) (x)
109 #define __pgprot(x) (x)
111 #endif /* STRICT_MM_TYPECHECKS */
113 #define BUG() __asm__ __volatile__("call_pal 129 # bugchk")
114 #define PAGE_BUG(page) BUG()
116 /* Pure 2^n version of get_order */
117 extern __inline__ int get_order(unsigned long size)
119 int order;
121 size = (size-1) >> (PAGE_SHIFT-1);
122 order = -1;
123 do {
124 size >>= 1;
125 order++;
126 } while (size);
127 return order;
130 #endif /* !ASSEMBLY */
132 /* to align the pointer to the (next) page boundary */
133 #define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
135 #ifdef USE_48_BIT_KSEG
136 #define PAGE_OFFSET 0xffff800000000000
137 #else
138 #define PAGE_OFFSET 0xfffffc0000000000
139 #endif
141 #define __pa(x) ((unsigned long) (x) - PAGE_OFFSET)
142 #define __va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET))
143 #define virt_to_page(kaddr) (mem_map + (__pa(kaddr) >> PAGE_SHIFT))
144 #define VALID_PAGE(page) ((page - mem_map) < max_mapnr)
146 #endif /* __KERNEL__ */
148 #endif /* _ALPHA_PAGE_H */