~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Linux/include/asm-alpha/page.h

Version: ~ [ 2.4.0 ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 #ifndef _ALPHA_PAGE_H
  2 #define _ALPHA_PAGE_H
  3 
  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))
  8 
  9 #ifdef __KERNEL__
 10 
 11 #ifndef __ASSEMBLY__
 12 
 13 #define STRICT_MM_TYPECHECKS
 14 
 15 /*
 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.
 21  */
 22 static inline void clear_page(void * page)
 23 {
 24         unsigned long count = PAGE_SIZE/64;
 25         unsigned long *ptr = (unsigned long *)page;
 26 
 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);
 39 }
 40 
 41 #define clear_user_page(page, vaddr)    clear_page(page)
 42 
 43 static inline void copy_page(void * _to, void * _from)
 44 {
 45         unsigned long count = PAGE_SIZE/64;
 46         unsigned long *to = (unsigned long *)_to;
 47         unsigned long *from = (unsigned long *)_from;
 48 
 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);
 71 }
 72 
 73 #define copy_user_page(to, from, vaddr) copy_page(to, from)
 74 
 75 #ifdef STRICT_MM_TYPECHECKS
 76 /*
 77  * These are used to make use of C type-checking..
 78  */
 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;
 83 
 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)
 88 
 89 #define __pte(x)        ((pte_t) { (x) } )
 90 #define __pgd(x)        ((pgd_t) { (x) } )
 91 #define __pgprot(x)     ((pgprot_t) { (x) } )
 92 
 93 #else
 94 /*
 95  * .. while these make it easier on the compiler
 96  */
 97 typedef unsigned long pte_t;
 98 typedef unsigned long pmd_t;
 99 typedef unsigned long pgd_t;
100 typedef unsigned long pgprot_t;
101 
102 #define pte_val(x)      (x)
103 #define pmd_val(x)      (x)
104 #define pgd_val(x)      (x)
105 #define pgprot_val(x)   (x)
106 
107 #define __pte(x)        (x)
108 #define __pgd(x)        (x)
109 #define __pgprot(x)     (x)
110 
111 #endif /* STRICT_MM_TYPECHECKS */
112 
113 #define BUG()           __asm__ __volatile__("call_pal 129 # bugchk")
114 #define PAGE_BUG(page)  BUG()
115 
116 /* Pure 2^n version of get_order */
117 extern __inline__ int get_order(unsigned long size)
118 {
119         int order;
120 
121         size = (size-1) >> (PAGE_SHIFT-1);
122         order = -1;
123         do {
124                 size >>= 1;
125                 order++;
126         } while (size);
127         return order;
128 }
129 
130 #endif /* !ASSEMBLY */
131 
132 /* to align the pointer to the (next) page boundary */
133 #define PAGE_ALIGN(addr)        (((addr)+PAGE_SIZE-1)&PAGE_MASK)
134 
135 #ifdef USE_48_BIT_KSEG
136 #define PAGE_OFFSET             0xffff800000000000
137 #else
138 #define PAGE_OFFSET             0xfffffc0000000000
139 #endif
140 
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)
145 
146 #endif /* __KERNEL__ */
147 
148 #endif /* _ALPHA_PAGE_H */
149 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.