blob: d3f23ac4d468fc748c3f366dbd383b2196ace705 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef _ASMARM_PAGE_H
2#define _ASMARM_PAGE_H
3
4#include <linux/config.h>
5
6#ifdef __KERNEL__
7#ifndef __ASSEMBLY__
8
9extern void __clear_user_page(void *p, unsigned long user);
10extern void __copy_user_page(void *to, const void *from, unsigned long user);
11extern void copy_page(void *to, const void *from);
12
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)
20
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)
27
28#define clear_page(page) memzero((void *)(page), PAGE_SIZE)
29#define copy_page(to, from) __copy_user_page(to, from, 0);
30
31#undef STRICT_MM_TYPECHECKS
32
33#ifdef STRICT_MM_TYPECHECKS
34/*
35 * These are used to make use of C type-checking..
36 */
37typedef struct { unsigned long pgd; } pgd_t;
38typedef struct { unsigned long pte; } pte_t;
39typedef struct { unsigned long pmd; } pmd_t;
40typedef struct { unsigned long pgprot; } pgprot_t;
41
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)
46
47#define __pte(x) ((pte_t) { (x) } )
48#define __pmd(x) ((pmd_t) { (x) } )
49#define __pgprot(x) ((pgprot_t) { (x) } )
50
51#else
52/*
53 * .. while these make it easier on the compiler
54 */
55typedef unsigned long pgd_t;
56typedef unsigned long pte_t;
57typedef unsigned long pmd_t;
58typedef unsigned long pgprot_t;
59
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)
65
66#define __pte(x) (x)
67#define __pmd(x) (x)
68#define __pgprot(x) (x)
69
70#endif /* STRICT_MM_TYPECHECKS */
71#endif /* !__ASSEMBLY__ */
72#endif /* __KERNEL__ */
73
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
80
81#define EXEC_PAGESIZE 32768
82
83#define PAGE_SIZE (1UL << PAGE_SHIFT)
84#define PAGE_MASK (~(PAGE_SIZE-1))
85
86/* to align the pointer to the (next) page boundary */
87#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
88
89#ifdef __KERNEL__
90#ifndef __ASSEMBLY__
91
Linus Torvalds1da177e2005-04-16 15:20:36 -070092#include <asm/memory.h>
93
94#endif /* !__ASSEMBLY__ */
95
96#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
97 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
98
99#endif /* __KERNEL__ */
100
Stephen Rothwellfd4fd5a2005-09-03 15:54:30 -0700101#include <asm-generic/page.h>
102
Linus Torvalds1da177e2005-04-16 15:20:36 -0700103#endif