pgtable-bits.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (C) 2012 Regents of the University of California
  4. */
  5. #ifndef _ASM_RISCV_PGTABLE_BITS_H
  6. #define _ASM_RISCV_PGTABLE_BITS_H
  7. #define _PAGE_ACCESSED_OFFSET 6
  8. #define _PAGE_PRESENT (1 << 0)
  9. #define _PAGE_READ (1 << 1) /* Readable */
  10. #define _PAGE_WRITE (1 << 2) /* Writable */
  11. #define _PAGE_EXEC (1 << 3) /* Executable */
  12. #define _PAGE_USER (1 << 4) /* User */
  13. #define _PAGE_GLOBAL (1 << 5) /* Global */
  14. #define _PAGE_ACCESSED (1 << 6) /* Set by hardware on any access */
  15. #define _PAGE_DIRTY (1 << 7) /* Set by hardware on any write */
  16. #define _PAGE_SOFT (1 << 8) /* Reserved for software */
  17. #define _PAGE_SPECIAL _PAGE_SOFT
  18. #define _PAGE_TABLE _PAGE_PRESENT
  19. /*
  20. * _PAGE_PROT_NONE is set on not-present pages (and ignored by the hardware) to
  21. * distinguish them from swapped out pages
  22. */
  23. #define _PAGE_PROT_NONE _PAGE_GLOBAL
  24. #define _PAGE_PFN_SHIFT 10
  25. /*
  26. * when all of R/W/X are zero, the PTE is a pointer to the next level
  27. * of the page table; otherwise, it is a leaf PTE.
  28. */
  29. #define _PAGE_LEAF (_PAGE_READ | _PAGE_WRITE | _PAGE_EXEC)
  30. #endif /* _ASM_RISCV_PGTABLE_BITS_H */