pgtable-bits.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef __ASM_CSKY_PGTABLE_BITS_H
  3. #define __ASM_CSKY_PGTABLE_BITS_H
  4. /* implemented in software */
  5. #define _PAGE_ACCESSED (1<<7)
  6. #define _PAGE_READ (1<<8)
  7. #define _PAGE_WRITE (1<<9)
  8. #define _PAGE_PRESENT (1<<10)
  9. #define _PAGE_MODIFIED (1<<11)
  10. /* implemented in hardware */
  11. #define _PAGE_GLOBAL (1<<0)
  12. #define _PAGE_VALID (1<<1)
  13. #define _PAGE_DIRTY (1<<2)
  14. #define _PAGE_SO (1<<5)
  15. #define _PAGE_BUF (1<<6)
  16. #define _PAGE_CACHE (1<<3)
  17. #define _CACHE_MASK _PAGE_CACHE
  18. #define _CACHE_CACHED (_PAGE_CACHE | _PAGE_BUF)
  19. #define _CACHE_UNCACHED (0)
  20. #define _PAGE_PROT_NONE _PAGE_WRITE
  21. /*
  22. * Encode and decode a swap entry
  23. *
  24. * Format of swap PTE:
  25. * bit 0: _PAGE_GLOBAL (zero)
  26. * bit 1: _PAGE_VALID (zero)
  27. * bit 2 - 6: swap type
  28. * bit 7 - 8: swap offset[0 - 1]
  29. * bit 9: _PAGE_WRITE (zero)
  30. * bit 10: _PAGE_PRESENT (zero)
  31. * bit 11 - 31: swap offset[2 - 22]
  32. */
  33. #define __swp_type(x) (((x).val >> 2) & 0x1f)
  34. #define __swp_offset(x) ((((x).val >> 7) & 0x3) | \
  35. (((x).val >> 9) & 0x7ffffc))
  36. #define __swp_entry(type, offset) ((swp_entry_t) { \
  37. ((type & 0x1f) << 2) | \
  38. ((offset & 0x3) << 7) | \
  39. ((offset & 0x7ffffc) << 9)})
  40. #endif /* __ASM_CSKY_PGTABLE_BITS_H */