normalDataOperation.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. #ifndef _ALPHA_PGTABLE_H
  2. #define _ALPHA_PGTABLE_H
  3. #include <asm-generic/4level-fixup.h>
  4. /*
  5. * This file contains the functions and defines necessary to modify and use
  6. * the Alpha page table tree.
  7. *
  8. * This hopefully works with any standard Alpha page-size, as defined
  9. * in <asm/page.h> (currently 8192).
  10. */
  11. #include <linux/mmzone.h>
  12. #include <asm/page.h>
  13. #include <asm/processor.h> /* For TASK_SIZE */
  14. #include <asm/machvec.h>
  15. #include <asm/setup.h>
  16. struct mm_struct;
  17. struct vm_area_struct;
  18. /* Certain architectures need to do special things when PTEs
  19. * within a page table are directly modified. Thus, the following
  20. * hook is made available.
  21. */
  22. #define set_pte(pteptr, pteval) ((*(pteptr)) = (pteval))
  23. #define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
  24. /* PMD_SHIFT determines the size of the area a second-level page table can map */
  25. #define PMD_SHIFT (PAGE_SHIFT + (PAGE_SHIFT-3))
  26. #define PMD_SIZE (1UL << PMD_SHIFT)
  27. #define PMD_MASK (~(PMD_SIZE-1))
  28. /* PGDIR_SHIFT determines what a third-level page table entry can map */
  29. #define PGDIR_SHIFT (PAGE_SHIFT + 2*(PAGE_SHIFT-3))
  30. #define PGDIR_SIZE (1UL << PGDIR_SHIFT)
  31. #define PGDIR_MASK (~(PGDIR_SIZE-1))
  32. /*
  33. * Entries per page directory level: the Alpha is three-level, with
  34. * all levels having a one-page page table.
  35. */
  36. #define PTRS_PER_PTE (1UL << (PAGE_SHIFT-3))
  37. #define PTRS_PER_PMD (1UL << (PAGE_SHIFT-3))
  38. #define PTRS_PER_PGD (1UL << (PAGE_SHIFT-3))
  39. #define USER_PTRS_PER_PGD (TASK_SIZE / PGDIR_SIZE)
  40. #define FIRST_USER_ADDRESS 0
  41. /* Number of pointers that fit on a page: this will go away. */
  42. #define PTRS_PER_PAGE (1UL << (PAGE_SHIFT-3))
  43. #ifdef CONFIG_ALPHA_LARGE_VMALLOC
  44. #define VMALLOC_START 0xfffffe0000000000
  45. #else
  46. #define VMALLOC_START (-2*PGDIR_SIZE)
  47. #endif
  48. #define VMALLOC_END (-PGDIR_SIZE)
  49. /*
  50. * OSF/1 PAL-code-imposed page table bits
  51. */
  52. #define _PAGE_VALID 0x0001
  53. #define _PAGE_FOR 0x0002 /* used for page protection (fault on read) */
  54. #define _PAGE_FOW 0x0004 /* used for page protection (fault on write) */
  55. #define _PAGE_FOE 0x0008 /* used for page protection (fault on exec) */
  56. #define _PAGE_ASM 0x0010
  57. #define _PAGE_KRE 0x0100 /* xxx - see below on the "accessed" bit */
  58. #define _PAGE_URE 0x0200 /* xxx */
  59. #define _PAGE_KWE 0x1000 /* used to do the dirty bit in software */
  60. #define _PAGE_UWE 0x2000 /* used to do the dirty bit in software */
  61. /* .. and these are ours ... */
  62. #define _PAGE_DIRTY 0x20000
  63. #define _PAGE_ACCESSED 0x40000
  64. #define _PAGE_FILE 0x80000 /* set:pagecache, unset:swap */
  65. /*
  66. * NOTE! The "accessed" bit isn't necessarily exact: it can be kept exactly
  67. * by software (use the KRE/URE/KWE/UWE bits appropriately), but I'll fake it.
  68. * Under Linux/AXP, the "accessed" bit just means "read", and I'll just use
  69. * the KRE/URE bits to watch for it. That way we don't need to overload the
  70. * KWE/UWE bits with both handling dirty and accessed.
  71. *
  72. * Note that the kernel uses the accessed bit just to check whether to page
  73. * out a page or not, so it doesn't have to be exact anyway.
  74. */
  75. #define __DIRTY_BITS (_PAGE_DIRTY | _PAGE_KWE | _PAGE_UWE)
  76. #define __ACCESS_BITS (_PAGE_ACCESSED | _PAGE_KRE | _PAGE_URE)
  77. #define _PFN_MASK 0xFFFFFFFF00000000UL
  78. #define _PAGE_TABLE (_PAGE_VALID | __DIRTY_BITS | __ACCESS_BITS)
  79. #define _PAGE_CHG_MASK (_PFN_MASK | __DIRTY_BITS | __ACCESS_BITS)
  80. /*
  81. * All the normal masks have the "page accessed" bits on, as any time they are used,
  82. * the page is accessed. They are cleared only by the page-out routines
  83. */
  84. #define PAGE_NONE __pgprot(_PAGE_VALID | __ACCESS_BITS | _PAGE_FOR | _PAGE_FOW | _PAGE_FOE)
  85. #define PAGE_SHARED __pgprot(_PAGE_VALID | __ACCESS_BITS)
  86. #define PAGE_COPY __pgprot(_PAGE_VALID | __ACCESS_BITS | _PAGE_FOW)
  87. #define PAGE_READONLY __pgprot(_PAGE_VALID | __ACCESS_BITS | _PAGE_FOW)
  88. #define PAGE_KERNEL __pgprot(_PAGE_VALID | _PAGE_ASM | _PAGE_KRE | _PAGE_KWE)
  89. #define _PAGE_NORMAL(x) __pgprot(_PAGE_VALID | __ACCESS_BITS | (x))