pgtable-bits.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * Copyright (C) 2012 Regents of the University of California
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License
  6. * as published by the Free Software Foundation, version 2.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. */
  13. #ifndef _ASM_RISCV_PGTABLE_BITS_H
  14. #define _ASM_RISCV_PGTABLE_BITS_H
  15. /*
  16. * PTE format:
  17. * | XLEN-1 10 | 9 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0
  18. * PFN reserved for SW D A G U X W R V
  19. */
  20. #define _PAGE_ACCESSED_OFFSET 6
  21. #define _PAGE_PRESENT (1 << 0)
  22. #define _PAGE_READ (1 << 1) /* Readable */
  23. #define _PAGE_WRITE (1 << 2) /* Writable */
  24. #define _PAGE_EXEC (1 << 3) /* Executable */
  25. #define _PAGE_USER (1 << 4) /* User */
  26. #define _PAGE_GLOBAL (1 << 5) /* Global */
  27. #define _PAGE_ACCESSED (1 << 6) /* Set by hardware on any access */
  28. #define _PAGE_DIRTY (1 << 7) /* Set by hardware on any write */
  29. #define _PAGE_SOFT (1 << 8) /* Reserved for software */
  30. #define _PAGE_SPECIAL _PAGE_SOFT
  31. #define _PAGE_TABLE _PAGE_PRESENT
  32. /*
  33. * _PAGE_PROT_NONE is set on not-present pages (and ignored by the hardware) to
  34. * distinguish them from swapped out pages
  35. */
  36. #define _PAGE_PROT_NONE _PAGE_READ
  37. #define _PAGE_PFN_SHIFT 10
  38. /* Set of bits to preserve across pte_modify() */
  39. #define _PAGE_CHG_MASK (~(unsigned long)(_PAGE_PRESENT | _PAGE_READ | \
  40. _PAGE_WRITE | _PAGE_EXEC | \
  41. _PAGE_USER | _PAGE_GLOBAL))
  42. #endif /* _ASM_RISCV_PGTABLE_BITS_H */