1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2*4882a593Smuzhiyun #ifndef _ASM_X86_MMAN_H 3*4882a593Smuzhiyun #define _ASM_X86_MMAN_H 4*4882a593Smuzhiyun 5*4882a593Smuzhiyun #define MAP_32BIT 0x40 /* only give out 32bit addresses */ 6*4882a593Smuzhiyun 7*4882a593Smuzhiyun #ifdef CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS 8*4882a593Smuzhiyun /* 9*4882a593Smuzhiyun * Take the 4 protection key bits out of the vma->vm_flags 10*4882a593Smuzhiyun * value and turn them in to the bits that we can put in 11*4882a593Smuzhiyun * to a pte. 12*4882a593Smuzhiyun * 13*4882a593Smuzhiyun * Only override these if Protection Keys are available 14*4882a593Smuzhiyun * (which is only on 64-bit). 15*4882a593Smuzhiyun */ 16*4882a593Smuzhiyun #define arch_vm_get_page_prot(vm_flags) __pgprot( \ 17*4882a593Smuzhiyun ((vm_flags) & VM_PKEY_BIT0 ? _PAGE_PKEY_BIT0 : 0) | \ 18*4882a593Smuzhiyun ((vm_flags) & VM_PKEY_BIT1 ? _PAGE_PKEY_BIT1 : 0) | \ 19*4882a593Smuzhiyun ((vm_flags) & VM_PKEY_BIT2 ? _PAGE_PKEY_BIT2 : 0) | \ 20*4882a593Smuzhiyun ((vm_flags) & VM_PKEY_BIT3 ? _PAGE_PKEY_BIT3 : 0)) 21*4882a593Smuzhiyun 22*4882a593Smuzhiyun #define arch_calc_vm_prot_bits(prot, key) ( \ 23*4882a593Smuzhiyun ((key) & 0x1 ? VM_PKEY_BIT0 : 0) | \ 24*4882a593Smuzhiyun ((key) & 0x2 ? VM_PKEY_BIT1 : 0) | \ 25*4882a593Smuzhiyun ((key) & 0x4 ? VM_PKEY_BIT2 : 0) | \ 26*4882a593Smuzhiyun ((key) & 0x8 ? VM_PKEY_BIT3 : 0)) 27*4882a593Smuzhiyun #endif 28*4882a593Smuzhiyun 29*4882a593Smuzhiyun #include <asm-generic/mman.h> 30*4882a593Smuzhiyun 31*4882a593Smuzhiyun #endif /* _ASM_X86_MMAN_H */ 32