Linux-2.3.3 and a short hiatus..
[davej-history.git] / include / asm-alpha / page.h
blobc2d27951e54e90042d9ea5d2219afc49314b5a9b
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(unsigned long 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 static inline void copy_page(unsigned long _to, unsigned long _from)
43 unsigned long count = PAGE_SIZE/64;
44 unsigned long *to = (unsigned long *)_to;
45 unsigned long *from = (unsigned long *)_from;
47 do {
48 unsigned long a,b,c,d,e,f,g,h;
49 a = from[0];
50 b = from[1];
51 c = from[2];
52 d = from[3];
53 e = from[4];
54 f = from[5];
55 g = from[6];
56 h = from[7];
57 count--;
58 from += 8;
59 to[0] = a;
60 to[1] = b;
61 to[2] = c;
62 to[3] = d;
63 to[4] = e;
64 to[5] = f;
65 to[6] = g;
66 to[7] = h;
67 to += 8;
68 } while (count);
71 #ifdef STRICT_MM_TYPECHECKS
73 * These are used to make use of C type-checking..
75 typedef struct { unsigned long pte; } pte_t;
76 typedef struct { unsigned long pmd; } pmd_t;
77 typedef struct { unsigned long pgd; } pgd_t;
78 typedef struct { unsigned long pgprot; } pgprot_t;
80 #define pte_val(x) ((x).pte)
81 #define pmd_val(x) ((x).pmd)
82 #define pgd_val(x) ((x).pgd)
83 #define pgprot_val(x) ((x).pgprot)
85 #define __pte(x) ((pte_t) { (x) } )
86 #define __pgd(x) ((pgd_t) { (x) } )
87 #define __pgprot(x) ((pgprot_t) { (x) } )
89 #else
91 * .. while these make it easier on the compiler
93 typedef unsigned long pte_t;
94 typedef unsigned long pmd_t;
95 typedef unsigned long pgd_t;
96 typedef unsigned long pgprot_t;
98 #define pte_val(x) (x)
99 #define pmd_val(x) (x)
100 #define pgd_val(x) (x)
101 #define pgprot_val(x) (x)
103 #define __pte(x) (x)
104 #define __pgd(x) (x)
105 #define __pgprot(x) (x)
107 #endif /* STRICT_MM_TYPECHECKS */
108 #endif /* !ASSEMBLY */
110 /* to align the pointer to the (next) page boundary */
111 #define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
113 #ifdef USE_48_BIT_KSEG
114 #define PAGE_OFFSET 0xffff800000000000
115 #else
116 #define PAGE_OFFSET 0xfffffc0000000000
117 #endif
119 #define __pa(x) ((unsigned long) (x) - PAGE_OFFSET)
120 #define __va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET))
121 #define MAP_NR(addr) (__pa(addr) >> PAGE_SHIFT)
123 #endif /* __KERNEL__ */
125 #endif /* _ALPHA_PAGE_H */