mman.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * This program is free software; you can redistribute it and/or
  3. * modify it under the terms of the GNU General Public License
  4. * as published by the Free Software Foundation; either version
  5. * 2 of the License, or (at your option) any later version.
  6. */
  7. #ifndef _ASM_POWERPC_MMAN_H
  8. #define _ASM_POWERPC_MMAN_H
  9. #include <uapi/asm/mman.h>
  10. #ifdef CONFIG_PPC64
  11. #include <asm/cputable.h>
  12. #include <linux/mm.h>
  13. /*
  14. * This file is included by linux/mman.h, so we can't use cacl_vm_prot_bits()
  15. * here. How important is the optimization?
  16. */
  17. static inline unsigned long arch_calc_vm_prot_bits(unsigned long prot)
  18. {
  19. return (prot & PROT_SAO) ? VM_SAO : 0;
  20. }
  21. #define arch_calc_vm_prot_bits(prot) arch_calc_vm_prot_bits(prot)
  22. static inline pgprot_t arch_vm_get_page_prot(unsigned long vm_flags)
  23. {
  24. return (vm_flags & VM_SAO) ? __pgprot(_PAGE_SAO) : __pgprot(0);
  25. }
  26. #define arch_vm_get_page_prot(vm_flags) arch_vm_get_page_prot(vm_flags)
  27. static inline int arch_validate_prot(unsigned long prot)
  28. {
  29. if (prot & ~(PROT_READ | PROT_WRITE | PROT_EXEC | PROT_SEM | PROT_SAO))
  30. return 0;
  31. if ((prot & PROT_SAO) && !cpu_has_feature(CPU_FTR_SAO))
  32. return 0;
  33. return 1;
  34. }
  35. #define arch_validate_prot(prot) arch_validate_prot(prot)
  36. #endif /* CONFIG_PPC64 */
  37. #endif /* _ASM_POWERPC_MMAN_H */