xref: /openbmc/linux/arch/x86/include/uapi/asm/mman.h (revision bc5aa3a0)
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 
24 #define arch_calc_vm_prot_bits(prot, key) (		\
25 		((key) & 0x1 ? VM_PKEY_BIT0 : 0) |      \
26 		((key) & 0x2 ? VM_PKEY_BIT1 : 0) |      \
27 		((key) & 0x4 ? VM_PKEY_BIT2 : 0) |      \
28 		((key) & 0x8 ? VM_PKEY_BIT3 : 0))
29 #endif
30 
31 #include <asm-generic/mman.h>
32 
33 #endif /* _ASM_X86_MMAN_H */
34