page.h 4.2 KB

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