page.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. /*
  2. * linux/include/asm-arm/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 (1UL << PAGE_SHIFT)
  15. #define PAGE_MASK (~(PAGE_SIZE-1))
  16. /* to align the pointer to the (next) page boundary */
  17. #define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
  18. #ifndef __ASSEMBLY__
  19. #ifndef CONFIG_MMU
  20. #include "page-nommu.h"
  21. #else
  22. #include <asm/glue.h>
  23. /*
  24. * User Space Model
  25. * ================
  26. *
  27. * This section selects the correct set of functions for dealing with
  28. * page-based copying and clearing for user space for the particular
  29. * processor(s) we're building for.
  30. *
  31. * We have the following to choose from:
  32. * v3 - ARMv3
  33. * v4wt - ARMv4 with writethrough cache, without minicache
  34. * v4wb - ARMv4 with writeback cache, without minicache
  35. * v4_mc - ARMv4 with minicache
  36. * xscale - Xscale
  37. * xsc3 - XScalev3
  38. */
  39. #undef _USER
  40. #undef MULTI_USER
  41. #ifdef CONFIG_CPU_COPY_V3
  42. # ifdef _USER
  43. # define MULTI_USER 1
  44. # else
  45. # define _USER v3
  46. # endif
  47. #endif
  48. #ifdef CONFIG_CPU_COPY_V4WT
  49. # ifdef _USER
  50. # define MULTI_USER 1
  51. # else
  52. # define _USER v4wt
  53. # endif
  54. #endif
  55. #ifdef CONFIG_CPU_COPY_V4WB
  56. # ifdef _USER
  57. # define MULTI_USER 1
  58. # else
  59. # define _USER v4wb
  60. # endif
  61. #endif
  62. #ifdef CONFIG_CPU_COPY_FEROCEON
  63. # ifdef _USER
  64. # define MULTI_USER 1
  65. # else
  66. # define _USER feroceon
  67. # endif
  68. #endif
  69. #ifdef CONFIG_CPU_SA1100
  70. # ifdef _USER
  71. # define MULTI_USER 1
  72. # else
  73. # define _USER v4_mc
  74. # endif
  75. #endif
  76. #ifdef CONFIG_CPU_XSCALE
  77. # ifdef _USER
  78. # define MULTI_USER 1
  79. # else
  80. # define _USER xscale_mc
  81. # endif
  82. #endif
  83. #ifdef CONFIG_CPU_XSC3
  84. # ifdef _USER
  85. # define MULTI_USER 1
  86. # else
  87. # define _USER xsc3_mc
  88. # endif
  89. #endif
  90. #ifdef CONFIG_CPU_COPY_V6
  91. # define MULTI_USER 1
  92. #endif
  93. #if !defined(_USER) && !defined(MULTI_USER)
  94. #error Unknown user operations model
  95. #endif
  96. struct cpu_user_fns {
  97. void (*cpu_clear_user_page)(void *p, unsigned long user);
  98. void (*cpu_copy_user_page)(void *to, const void *from,
  99. unsigned long user);
  100. };
  101. #ifdef MULTI_USER
  102. extern struct cpu_user_fns cpu_user;
  103. #define __cpu_clear_user_page cpu_user.cpu_clear_user_page
  104. #define __cpu_copy_user_page cpu_user.cpu_copy_user_page
  105. #else
  106. #define __cpu_clear_user_page __glue(_USER,_clear_user_page)
  107. #define __cpu_copy_user_page __glue(_USER,_copy_user_page)
  108. extern void __cpu_clear_user_page(void *p, unsigned long user);
  109. extern void __cpu_copy_user_page(void *to, const void *from,
  110. unsigned long user);
  111. #endif
  112. #define clear_user_page(addr,vaddr,pg) __cpu_clear_user_page(addr, vaddr)
  113. #define copy_user_page(to,from,vaddr,pg) __cpu_copy_user_page(to, from, vaddr)
  114. #define clear_page(page) memzero((void *)(page), PAGE_SIZE)
  115. extern void copy_page(void *to, const void *from);
  116. #undef STRICT_MM_TYPECHECKS
  117. #ifdef STRICT_MM_TYPECHECKS
  118. /*
  119. * These are used to make use of C type-checking..
  120. */
  121. typedef struct { unsigned long pte; } pte_t;
  122. typedef struct { unsigned long pmd; } pmd_t;
  123. typedef struct { unsigned long pgd[2]; } pgd_t;
  124. typedef struct { unsigned long pgprot; } pgprot_t;
  125. #define pte_val(x) ((x).pte)
  126. #define pmd_val(x) ((x).pmd)
  127. #define pgd_val(x) ((x).pgd[0])
  128. #define pgprot_val(x) ((x).pgprot)
  129. #define __pte(x) ((pte_t) { (x) } )
  130. #define __pmd(x) ((pmd_t) { (x) } )
  131. #define __pgprot(x) ((pgprot_t) { (x) } )
  132. #else
  133. /*
  134. * .. while these make it easier on the compiler
  135. */
  136. typedef unsigned long pte_t;
  137. typedef unsigned long pmd_t;
  138. typedef unsigned long pgd_t[2];
  139. typedef unsigned long pgprot_t;
  140. #define pte_val(x) (x)
  141. #define pmd_val(x) (x)
  142. #define pgd_val(x) ((x)[0])
  143. #define pgprot_val(x) (x)
  144. #define __pte(x) (x)
  145. #define __pmd(x) (x)
  146. #define __pgprot(x) (x)
  147. #endif /* STRICT_MM_TYPECHECKS */
  148. #endif /* CONFIG_MMU */
  149. typedef struct page *pgtable_t;
  150. #include <asm/memory.h>
  151. #endif /* !__ASSEMBLY__ */
  152. #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
  153. VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
  154. /*
  155. * With EABI on ARMv5 and above we must have 64-bit aligned slab pointers.
  156. */
  157. #if defined(CONFIG_AEABI) && (__LINUX_ARM_ARCH__ >= 5)
  158. #define ARCH_SLAB_MINALIGN 8
  159. #endif
  160. #include <asm-generic/page.h>
  161. #endif