Automatic merge of rsync://rsync.kernel.org/pub/scm/linux/kernel/git/gregkh/driver...
[linux-2.6/verdex.git] / include / asm-arm26 / page.h
blobc334079b082b267e12998da8151e84f4aa1003ed
1 #ifndef _ASMARM_PAGE_H
2 #define _ASMARM_PAGE_H
4 #include <linux/config.h>
6 #ifdef __KERNEL__
7 #ifndef __ASSEMBLY__
9 extern void __clear_user_page(void *p, unsigned long user);
10 extern void __copy_user_page(void *to, const void *from, unsigned long user);
11 extern void copy_page(void *to, const void *from);
13 //FIXME these may be wrong on ARM26
14 #define clear_user_page(addr,vaddr,pg) \
15 do { \
16 preempt_disable(); \
17 __clear_user_page(addr, vaddr); \
18 preempt_enable(); \
19 } while (0)
21 #define copy_user_page(to,from,vaddr,pg) \
22 do { \
23 preempt_disable(); \
24 __copy_user_page(to, from, vaddr); \
25 preempt_enable(); \
26 } while (0)
28 #define clear_page(page) memzero((void *)(page), PAGE_SIZE)
29 #define copy_page(to, from) __copy_user_page(to, from, 0);
31 #undef STRICT_MM_TYPECHECKS
33 #ifdef STRICT_MM_TYPECHECKS
35 * These are used to make use of C type-checking..
37 typedef struct { unsigned long pgd; } pgd_t;
38 typedef struct { unsigned long pte; } pte_t;
39 typedef struct { unsigned long pmd; } pmd_t;
40 typedef struct { unsigned long pgprot; } pgprot_t;
42 #define pgd_val(x) ((x).pgd)
43 #define pte_val(x) ((x).pte)
44 #define pmd_val(x) ((x).pmd)
45 #define pgprot_val(x) ((x).pgprot)
47 #define __pte(x) ((pte_t) { (x) } )
48 #define __pmd(x) ((pmd_t) { (x) } )
49 #define __pgprot(x) ((pgprot_t) { (x) } )
51 #else
53 * .. while these make it easier on the compiler
55 typedef unsigned long pgd_t;
56 typedef unsigned long pte_t;
57 typedef unsigned long pmd_t;
58 typedef unsigned long pgprot_t;
60 //FIXME - should these cast to unsigned long?
61 #define pgd_val(x) (x)
62 #define pte_val(x) (x)
63 #define pmd_val(x) (x)
64 #define pgprot_val(x) (x)
66 #define __pte(x) (x)
67 #define __pmd(x) (x)
68 #define __pgprot(x) (x)
70 #endif /* STRICT_MM_TYPECHECKS */
71 #endif /* !__ASSEMBLY__ */
72 #endif /* __KERNEL__ */
74 /* PAGE_SHIFT determines the page size. This is configurable. */
75 #if defined(CONFIG_PAGESIZE_16)
76 #define PAGE_SHIFT 14 /* 16K */
77 #else /* default */
78 #define PAGE_SHIFT 15 /* 32K */
79 #endif
81 #define EXEC_PAGESIZE 32768
83 #define PAGE_SIZE (1UL << PAGE_SHIFT)
84 #define PAGE_MASK (~(PAGE_SIZE-1))
86 /* to align the pointer to the (next) page boundary */
87 #define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
89 #ifdef __KERNEL__
90 #ifndef __ASSEMBLY__
92 /* Pure 2^n version of get_order */
93 static inline int get_order(unsigned long size)
95 int order;
97 size = (size-1) >> (PAGE_SHIFT-1);
98 order = -1;
99 do {
100 size >>= 1;
101 order++;
102 } while (size);
103 return order;
106 #include <asm/memory.h>
108 #endif /* !__ASSEMBLY__ */
110 #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
111 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
113 #endif /* __KERNEL__ */
115 #endif