page.h 4.2 KB

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