page.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. /*
  2. * arch/arm/include/asm/page.h
  3. *
  4. * Copyright (C) 1995-2003 Russell King
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. */
  10. #ifndef _ASMARM_PAGE_H
  11. #define _ASMARM_PAGE_H
  12. /* PAGE_SHIFT determines the page size */
  13. #define PAGE_SHIFT 12
  14. #define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT)
  15. #define PAGE_MASK (~(PAGE_SIZE-1))
  16. #ifndef __ASSEMBLY__
  17. #ifndef CONFIG_MMU
  18. #include "page-nommu.h"
  19. #else
  20. #include <asm/glue.h>
  21. /*
  22. * User Space Model
  23. * ================
  24. *
  25. * This section selects the correct set of functions for dealing with
  26. * page-based copying and clearing for user space for the particular
  27. * processor(s) we're building for.
  28. *
  29. * We have the following to choose from:
  30. * v3 - ARMv3
  31. * v4wt - ARMv4 with writethrough cache, without minicache
  32. * v4wb - ARMv4 with writeback cache, without minicache
  33. * v4_mc - ARMv4 with minicache
  34. * xscale - Xscale
  35. * xsc3 - XScalev3
  36. */
  37. #undef _USER
  38. #undef MULTI_USER
  39. #ifdef CONFIG_CPU_COPY_V3
  40. # ifdef _USER
  41. # define MULTI_USER 1
  42. # else
  43. # define _USER v3
  44. # endif
  45. #endif
  46. #ifdef CONFIG_CPU_COPY_V4WT
  47. # ifdef _USER
  48. # define MULTI_USER 1
  49. # else
  50. # define _USER v4wt
  51. # endif
  52. #endif
  53. #ifdef CONFIG_CPU_COPY_V4WB
  54. # ifdef _USER
  55. # define MULTI_USER 1
  56. # else
  57. # define _USER v4wb
  58. # endif
  59. #endif
  60. #ifdef CONFIG_CPU_COPY_FEROCEON
  61. # ifdef _USER
  62. # define MULTI_USER 1
  63. # else
  64. # define _USER feroceon
  65. # endif
  66. #endif
  67. #ifdef CONFIG_CPU_COPY_FA
  68. # ifdef _USER
  69. # define MULTI_USER 1
  70. # else
  71. # define _USER fa
  72. # endif
  73. #endif
  74. #ifdef CONFIG_CPU_SA1100
  75. # ifdef _USER
  76. # define MULTI_USER 1
  77. # else
  78. # define _USER v4_mc
  79. # endif
  80. #endif
  81. #ifdef CONFIG_CPU_XSCALE
  82. # ifdef _USER
  83. # define MULTI_USER 1
  84. # else
  85. # define _USER xscale_mc
  86. # endif
  87. #endif
  88. #ifdef CONFIG_CPU_XSC3
  89. # ifdef _USER
  90. # define MULTI_USER 1
  91. # else
  92. # define _USER xsc3_mc
  93. # endif
  94. #endif
  95. #ifdef CONFIG_CPU_COPY_V6
  96. # define MULTI_USER 1
  97. #endif
  98. #if !defined(_USER) && !defined(MULTI_USER)
  99. #error Unknown user operations model
  100. #endif
  101. struct page;
  102. struct vm_area_struct;
  103. struct cpu_user_fns {
  104. void (*cpu_clear_user_highpage)(struct page *page, unsigned long vaddr);
  105. void (*cpu_copy_user_highpage)(struct page *to, struct page *from,
  106. unsigned long vaddr, struct vm_area_struct *vma);
  107. };
  108. #ifdef MULTI_USER
  109. extern struct cpu_user_fns cpu_user;
  110. #define __cpu_clear_user_highpage cpu_user.cpu_clear_user_highpage
  111. #define __cpu_copy_user_highpage cpu_user.cpu_copy_user_highpage
  112. #else
  113. #define __cpu_clear_user_highpage __glue(_USER,_clear_user_highpage)
  114. #define __cpu_copy_user_highpage __glue(_USER,_copy_user_highpage)
  115. extern void __cpu_clear_user_highpage(struct page *page, unsigned long vaddr);
  116. extern void __cpu_copy_user_highpage(struct page *to, struct page *from,
  117. unsigned long vaddr, struct vm_area_struct *vma);
  118. #endif
  119. #define clear_user_highpage(page,vaddr) \
  120. __cpu_clear_user_highpage(page, vaddr)
  121. #define __HAVE_ARCH_COPY_USER_HIGHPAGE
  122. #define copy_user_highpage(to,from,vaddr,vma) \
  123. __cpu_copy_user_highpage(to, from, vaddr, vma)
  124. #define clear_page(page) memset((void *)(page), 0, PAGE_SIZE)
  125. extern void copy_page(void *to, const void *from);
  126. #undef STRICT_MM_TYPECHECKS
  127. #ifdef STRICT_MM_TYPECHECKS
  128. /*
  129. * These are used to make use of C type-checking..
  130. */
  131. typedef struct { unsigned long pte; } pte_t;
  132. typedef struct { unsigned long pmd; } pmd_t;
  133. typedef struct { unsigned long pgd[2]; } pgd_t;
  134. typedef struct { unsigned long pgprot; } pgprot_t;
  135. #define pte_val(x) ((x).pte)
  136. #define pmd_val(x) ((x).pmd)
  137. #define pgd_val(x) ((x).pgd[0])
  138. #define pgprot_val(x) ((x).pgprot)
  139. #define __pte(x) ((pte_t) { (x) } )
  140. #define __pmd(x) ((pmd_t) { (x) } )
  141. #define __pgprot(x) ((pgprot_t) { (x) } )
  142. #else
  143. /*
  144. * .. while these make it easier on the compiler
  145. */
  146. typedef unsigned long pte_t;
  147. typedef unsigned long pmd_t;
  148. typedef unsigned long pgd_t[2];
  149. typedef unsigned long pgprot_t;
  150. #define pte_val(x) (x)
  151. #define pmd_val(x) (x)
  152. #define pgd_val(x) ((x)[0])
  153. #define pgprot_val(x) (x)
  154. #define __pte(x) (x)
  155. #define __pmd(x) (x)
  156. #define __pgprot(x) (x)
  157. #endif /* STRICT_MM_TYPECHECKS */
  158. #endif /* CONFIG_MMU */
  159. typedef struct page *pgtable_t;
  160. #ifndef CONFIG_SPARSEMEM
  161. extern int pfn_valid(unsigned long);
  162. #endif
  163. #include <asm/memory.h>
  164. #endif /* !__ASSEMBLY__ */
  165. #define VM_DATA_DEFAULT_FLAGS \
  166. (((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0) | \
  167. VM_READ | VM_WRITE | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
  168. #include <asm-generic/getorder.h>
  169. #endif