pgtable-bits.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. #define _PAGE_PFN_SHIFT 10
  33. /* Set of bits to preserve across pte_modify() */
  34. #define _PAGE_CHG_MASK (~(unsigned long)(_PAGE_PRESENT | _PAGE_READ | \
  35. _PAGE_WRITE | _PAGE_EXEC | \
  36. _PAGE_USER | _PAGE_GLOBAL))
  37. #endif /* _ASM_RISCV_PGTABLE_BITS_H */