commandProcessing.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. /*
  2. * arch/arm/include/asm/pgtable.h
  3. *
  4. * Copyright (C) 1995-2002 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_PGTABLE_H
  11. #define _ASMARM_PGTABLE_H
  12. #include <linux/const.h>
  13. #include <asm/proc-fns.h>
  14. #ifndef CONFIG_MMU
  15. #include <asm-generic/4level-fixup.h>
  16. #include <asm/pgtable-nommu.h>
  17. #else
  18. #include <asm-generic/pgtable-nopud.h>
  19. #include <asm/memory.h>
  20. #include <asm/pgtable-hwdef.h>
  21. #ifdef CONFIG_ARM_LPAE
  22. #include <asm/pgtable-3level.h>
  23. #else
  24. #include <asm/pgtable-2level.h>
  25. #endif
  26. /*
  27. * Just any arbitrary offset to the start of the vmalloc VM area: the
  28. * current 8MB value just means that there will be a 8MB "hole" after the
  29. * physical memory until the kernel virtual memory starts. That means that
  30. * any out-of-bounds memory accesses will hopefully be caught.
  31. * The vmalloc() routines leaves a hole of 4kB between each vmalloced
  32. * area for the same reason. ;)
  33. */
  34. #define VMALLOC_OFFSET (8*1024*1024)
  35. #define VMALLOC_START (((unsigned long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1))
  36. #define VMALLOC_END 0xff000000UL
  37. #define LIBRARY_TEXT_START 0x0c000000
  38. #ifndef __ASSEMBLY__
  39. extern void __pte_error(const char *file, int line, pte_t);
  40. extern void __pmd_error(const char *file, int line, pmd_t);
  41. extern void __pgd_error(const char *file, int line, pgd_t);
  42. #define pte_ERROR(pte) __pte_error(__FILE__, __LINE__, pte)
  43. #define pmd_ERROR(pmd) __pmd_error(__FILE__, __LINE__, pmd)
  44. #define pgd_ERROR(pgd) __pgd_error(__FILE__, __LINE__, pgd)
  45. /*
  46. * This is the lowest virtual address we can permit any user space
  47. * mapping to be mapped at. This is particularly important for
  48. * non-high vector CPUs.
  49. */
  50. #define FIRST_USER_ADDRESS PAGE_SIZE
  51. /*
  52. * The pgprot_* and protection_map entries will be fixed up in runtime
  53. * to include the cachable and bufferable bits based on memory policy,
  54. * as well as any architecture dependent bits like global/ASID and SMP
  55. * shared mapping bits.
  56. */
  57. #define _L_PTE_DEFAULT L_PTE_PRESENT | L_PTE_YOUNG
  58. extern pgprot_t pgprot_user;
  59. extern pgprot_t pgprot_kernel;
  60. #define _MOD_PROT(p, b) __pgprot(pgprot_val(p) | (b))
  61. #define PAGE_NONE _MOD_PROT(pgprot_user, L_PTE_XN | L_PTE_RDONLY | L_PTE_NONE)
  62. #define PAGE_SHARED _MOD_PROT(pgprot_user, L_PTE_USER | L_PTE_XN)
  63. #define PAGE_SHARED_EXEC _MOD_PROT(pgprot_user, L_PTE_USER)
  64. #define PAGE_COPY _MOD_PROT(pgprot_user, L_PTE_USER | L_PTE_RDONLY | L_PTE_XN)
  65. #define PAGE_COPY_EXEC _MOD_PROT(pgprot_user, L_PTE_USER | L_PTE_RDONLY)
  66. #define PAGE_READONLY _MOD_PROT(pgprot_user, L_PTE_USER | L_PTE_RDONLY | L_PTE_XN)
  67. #define PAGE_READONLY_EXEC _MOD_PROT(pgprot_user, L_PTE_USER | L_PTE_RDONLY)
  68. #define PAGE_KERNEL _MOD_PROT(pgprot_kernel, L_PTE_XN)
  69. #define PAGE_KERNEL_EXEC pgprot_kernel
  70. #define __PAGE_NONE __pgprot(_L_PTE_DEFAULT | L_PTE_RDONLY | L_PTE_XN | L_PTE_NONE)
  71. #define __PAGE_SHARED __pgprot(_L_PTE_DEFAULT | L_PTE_USER | L_PTE_XN)
  72. #define __PAGE_SHARED_EXEC __pgprot(_L_PTE_DEFAULT | L_PTE_USER)
  73. #define __PAGE_COPY __pgprot(_L_PTE_DEFAULT | L_PTE_USER | L_PTE_RDONLY | L_PTE_XN)
  74. #define __PAGE_COPY_EXEC __pgprot(_L_PTE_DEFAULT | L_PTE_USER | L_PTE_RDONLY)
  75. #define __PAGE_READONLY __pgprot(_L_PTE_DEFAULT | L_PTE_USER | L_PTE_RDONLY | L_PTE_XN)
  76. #define __PAGE_READONLY_EXEC __pgprot(_L_PTE_DEFAULT | L_PTE_USER | L_PTE_RDONLY)
  77. #define __pgprot_modify(prot,mask,bits) \
  78. __pgprot((pgprot_val(prot) & ~(mask)) | (bits))
  79. #define pgprot_noncached(prot) \
  80. __pgprot_modify(prot, L_PTE_MT_MASK, L_PTE_MT_UNCACHED)
  81. #define pgprot_writecombine(prot) \
  82. __pgprot_modify(prot, L_PTE_MT_MASK, L_PTE_MT_BUFFERABLE)
  83. #define pgprot_stronglyordered(prot) \
  84. __pgprot_modify(prot, L_PTE_MT_MASK, L_PTE_MT_UNCACHED)
  85. #ifdef CONFIG_ARM_DMA_MEM_BUFFERABLE
  86. #define pgprot_dmacoherent(prot) \
  87. __pgprot_modify(prot, L_PTE_MT_MASK, L_PTE_MT_BUFFERABLE | L_PTE_XN)
  88. #define __HAVE_PHYS_MEM_ACCESS_PROT
  89. struct file;
  90. extern pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,
  91. unsigned long size, pgprot_t vma_prot);
  92. #else
  93. #define pgprot_dmacoherent(prot) \
  94. __pgprot_modify(prot, L_PTE_MT_MASK, L_PTE_MT_UNCACHED | L_PTE_XN)
  95. #endif
  96. #endif /* __ASSEMBLY__ */
  97. /*
  98. * The table below defines the page protection levels that we insert into our
  99. * Linux page table version. These get translated into the best that the
  100. * architecture can perform. Note that on most ARM hardware:
  101. * 1) We cannot do execute protection
  102. * 2) If we could do execute protection, then read is implied
  103. * 3) write implies read permissions
  104. */
  105. #define __P000 __PAGE_NONE
  106. #define __P001 __PAGE_READONLY
  107. #define __P010 __PAGE_COPY
  108. #define __P011 __PAGE_COPY
  109. #define __P100 __PAGE_READONLY_EXEC
  110. #define __P101 __PAGE_READONLY_EXEC
  111. #define __P110 __PAGE_COPY_EXEC
  112. #define __P111 __PAGE_COPY_EXEC
  113. #define __S000 __PAGE_NONE
  114. #define __S001 __PAGE_READONLY
  115. #define __S010 __PAGE_SHARED
  116. #define __S011 __PAGE_SHARED
  117. #define __S100 __PAGE_READONLY_EXEC
  118. #define __S101 __PAGE_READONLY_EXEC
  119. #define __S110 __PAGE_SHARED_EXEC
  120. #define __S111 __PAGE_SHARED_EXEC
  121. #ifndef __ASSEMBLY__
  122. /*
  123. * ZERO_PAGE is a global shared page that is always zero: used
  124. * for zero-mapped memory areas etc..
  125. */
  126. extern struct page *empty_zero_page;
  127. #define ZERO_PAGE(vaddr) (empty_zero_page)
  128. extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
  129. /* to find an entry in a page-table-directory */