x86/mm/pkeys: Add arch-specific VMA protection bits
[cascardo/linux.git] / arch / x86 / include / uapi / asm / mman.h
1 #ifndef _ASM_X86_MMAN_H
2 #define _ASM_X86_MMAN_H
3
4 #define MAP_32BIT       0x40            /* only give out 32bit addresses */
5
6 #define MAP_HUGE_2MB    (21 << MAP_HUGE_SHIFT)
7 #define MAP_HUGE_1GB    (30 << MAP_HUGE_SHIFT)
8
9 #ifdef CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS
10 /*
11  * Take the 4 protection key bits out of the vma->vm_flags
12  * value and turn them in to the bits that we can put in
13  * to a pte.
14  *
15  * Only override these if Protection Keys are available
16  * (which is only on 64-bit).
17  */
18 #define arch_vm_get_page_prot(vm_flags) __pgprot(       \
19                 ((vm_flags) & VM_PKEY_BIT0 ? _PAGE_PKEY_BIT0 : 0) |     \
20                 ((vm_flags) & VM_PKEY_BIT1 ? _PAGE_PKEY_BIT1 : 0) |     \
21                 ((vm_flags) & VM_PKEY_BIT2 ? _PAGE_PKEY_BIT2 : 0) |     \
22                 ((vm_flags) & VM_PKEY_BIT3 ? _PAGE_PKEY_BIT3 : 0))
23 #endif
24
25 #include <asm-generic/mman.h>
26
27 #endif /* _ASM_X86_MMAN_H */