Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef _ASMARM_PAGE_H |
| 2 | #define _ASMARM_PAGE_H |
| 3 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4 | |
| 5 | #ifdef __KERNEL__ |
| 6 | #ifndef __ASSEMBLY__ |
| 7 | |
| 8 | extern void __clear_user_page(void *p, unsigned long user); |
| 9 | extern void __copy_user_page(void *to, const void *from, unsigned long user); |
| 10 | extern void copy_page(void *to, const void *from); |
| 11 | |
| 12 | //FIXME these may be wrong on ARM26 |
| 13 | #define clear_user_page(addr,vaddr,pg) \ |
| 14 | do { \ |
| 15 | preempt_disable(); \ |
| 16 | __clear_user_page(addr, vaddr); \ |
| 17 | preempt_enable(); \ |
| 18 | } while (0) |
| 19 | |
| 20 | #define copy_user_page(to,from,vaddr,pg) \ |
| 21 | do { \ |
| 22 | preempt_disable(); \ |
| 23 | __copy_user_page(to, from, vaddr); \ |
| 24 | preempt_enable(); \ |
| 25 | } while (0) |
| 26 | |
| 27 | #define clear_page(page) memzero((void *)(page), PAGE_SIZE) |
| 28 | #define copy_page(to, from) __copy_user_page(to, from, 0); |
| 29 | |
| 30 | #undef STRICT_MM_TYPECHECKS |
| 31 | |
| 32 | #ifdef STRICT_MM_TYPECHECKS |
| 33 | /* |
| 34 | * These are used to make use of C type-checking.. |
| 35 | */ |
| 36 | typedef struct { unsigned long pgd; } pgd_t; |
| 37 | typedef struct { unsigned long pte; } pte_t; |
| 38 | typedef struct { unsigned long pmd; } pmd_t; |
| 39 | typedef struct { unsigned long pgprot; } pgprot_t; |
| 40 | |
| 41 | #define pgd_val(x) ((x).pgd) |
| 42 | #define pte_val(x) ((x).pte) |
| 43 | #define pmd_val(x) ((x).pmd) |
| 44 | #define pgprot_val(x) ((x).pgprot) |
| 45 | |
| 46 | #define __pte(x) ((pte_t) { (x) } ) |
| 47 | #define __pmd(x) ((pmd_t) { (x) } ) |
| 48 | #define __pgprot(x) ((pgprot_t) { (x) } ) |
| 49 | |
| 50 | #else |
| 51 | /* |
| 52 | * .. while these make it easier on the compiler |
| 53 | */ |
| 54 | typedef unsigned long pgd_t; |
| 55 | typedef unsigned long pte_t; |
| 56 | typedef unsigned long pmd_t; |
| 57 | typedef unsigned long pgprot_t; |
| 58 | |
| 59 | //FIXME - should these cast to unsigned long? |
| 60 | #define pgd_val(x) (x) |
| 61 | #define pte_val(x) (x) |
| 62 | #define pmd_val(x) (x) |
| 63 | #define pgprot_val(x) (x) |
| 64 | |
| 65 | #define __pte(x) (x) |
| 66 | #define __pmd(x) (x) |
| 67 | #define __pgprot(x) (x) |
| 68 | |
| 69 | #endif /* STRICT_MM_TYPECHECKS */ |
| 70 | #endif /* !__ASSEMBLY__ */ |
| 71 | #endif /* __KERNEL__ */ |
| 72 | |
| 73 | /* PAGE_SHIFT determines the page size. This is configurable. */ |
| 74 | #if defined(CONFIG_PAGESIZE_16) |
| 75 | #define PAGE_SHIFT 14 /* 16K */ |
| 76 | #else /* default */ |
| 77 | #define PAGE_SHIFT 15 /* 32K */ |
| 78 | #endif |
| 79 | |
| 80 | #define EXEC_PAGESIZE 32768 |
| 81 | |
| 82 | #define PAGE_SIZE (1UL << PAGE_SHIFT) |
| 83 | #define PAGE_MASK (~(PAGE_SIZE-1)) |
| 84 | |
| 85 | /* to align the pointer to the (next) page boundary */ |
| 86 | #define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK) |
| 87 | |
| 88 | #ifdef __KERNEL__ |
| 89 | #ifndef __ASSEMBLY__ |
| 90 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 91 | #include <asm/memory.h> |
| 92 | |
| 93 | #endif /* !__ASSEMBLY__ */ |
| 94 | |
| 95 | #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ |
| 96 | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) |
| 97 | |
| 98 | #endif /* __KERNEL__ */ |
| 99 | |
Stephen Rothwell | fd4fd5a | 2005-09-03 15:54:30 -0700 | [diff] [blame] | 100 | #include <asm-generic/page.h> |
| 101 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 102 | #endif |