page.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  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 (~((1 << PAGE_SHIFT) - 1))
  16. #ifndef __ASSEMBLY__
  17. #ifndef CONFIG_MMU
  18. #include <asm/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. * v4wt - ARMv4 with writethrough cache, without minicache
  31. * v4wb - ARMv4 with writeback cache, without minicache
  32. * v4_mc - ARMv4 with minicache
  33. * xscale - Xscale
  34. * xsc3 - XScalev3
  35. */
  36. #undef _USER
  37. #undef MULTI_USER
  38. #ifdef CONFIG_CPU_COPY_V4WT
  39. # ifdef _USER
  40. # define MULTI_USER 1
  41. # else
  42. # define _USER v4wt
  43. # endif
  44. #endif
  45. #ifdef CONFIG_CPU_COPY_V4WB
  46. # ifdef _USER
  47. # define MULTI_USER 1
  48. # else
  49. # define _USER v4wb
  50. # endif
  51. #endif
  52. #ifdef CONFIG_CPU_COPY_FEROCEON
  53. # ifdef _USER
  54. # define MULTI_USER 1
  55. # else
  56. # define _USER feroceon
  57. # endif
  58. #endif
  59. #ifdef CONFIG_CPU_COPY_FA
  60. # ifdef _USER
  61. # define MULTI_USER 1
  62. # else
  63. # define _USER fa
  64. # endif
  65. #endif
  66. #ifdef CONFIG_CPU_SA1100
  67. # ifdef _USER
  68. # define MULTI_USER 1
  69. # else
  70. # define _USER v4_mc
  71. # endif
  72. #endif
  73. #ifdef CONFIG_CPU_XSCALE
  74. # ifdef _USER
  75. # define MULTI_USER 1
  76. # else
  77. # define _USER xscale_mc
  78. # endif
  79. #endif
  80. #ifdef CONFIG_CPU_XSC3
  81. # ifdef _USER
  82. # define MULTI_USER 1
  83. # else
  84. # define _USER xsc3_mc
  85. # endif
  86. #endif
  87. #ifdef CONFIG_CPU_COPY_V6
  88. # define MULTI_USER 1
  89. #endif
  90. #if !defined(_USER) && !defined(MULTI_USER)
  91. #error Unknown user operations model
  92. #endif
  93. struct page;
  94. struct vm_area_struct;
  95. struct cpu_user_fns {
  96. void (*cpu_clear_user_highpage)(struct page *page, unsigned long vaddr);
  97. void (*cpu_copy_user_highpage)(struct page *to, struct page *from,
  98. unsigned long vaddr, struct vm_area_struct *vma);
  99. };
  100. #ifdef MULTI_USER
  101. extern struct cpu_user_fns cpu_user;
  102. #define __cpu_clear_user_highpage cpu_user.cpu_clear_user_highpage
  103. #define __cpu_copy_user_highpage cpu_user.cpu_copy_user_highpage
  104. #else
  105. #define __cpu_clear_user_highpage __glue(_USER,_clear_user_highpage)
  106. #define __cpu_copy_user_highpage __glue(_USER,_copy_user_highpage)
  107. extern void __cpu_clear_user_highpage(struct page *page, unsigned long vaddr);
  108. extern void __cpu_copy_user_highpage(struct page *to, struct page *from,
  109. unsigned long vaddr, struct vm_area_struct *vma);
  110. #endif
  111. #define clear_user_highpage(page,vaddr) \
  112. __cpu_clear_user_highpage(page, vaddr)
  113. #define __HAVE_ARCH_COPY_USER_HIGHPAGE
  114. #define copy_user_highpage(to,from,vaddr,vma) \
  115. __cpu_copy_user_highpage(to, from, vaddr, vma)
  116. #define clear_page(page) memset((void *)(page), 0, PAGE_SIZE)
  117. extern void copy_page(void *to, const void *from);
  118. #ifdef CONFIG_KUSER_HELPERS
  119. #define __HAVE_ARCH_GATE_AREA 1
  120. #endif
  121. #ifdef CONFIG_ARM_LPAE
  122. #include <asm/pgtable-3level-types.h>
  123. #else
  124. #include <asm/pgtable-2level-types.h>
  125. #endif
  126. #endif /* CONFIG_MMU */
  127. typedef struct page *pgtable_t;
  128. #ifdef CONFIG_HAVE_ARCH_PFN_VALID
  129. extern int pfn_valid(unsigned long);
  130. #endif
  131. #include <asm/memory.h>
  132. #endif /* !__ASSEMBLY__ */
  133. #define VM_DATA_DEFAULT_FLAGS \
  134. (((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0) | \
  135. VM_READ | VM_WRITE | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
  136. #include <asm-generic/getorder.h>
  137. #endif