blob: 39bca7fac087098c1f972de4b1468733ffe6220a [file] [log] [blame]
H. Peter Anvin1965aae2008-10-22 22:26:29 -07001#ifndef _ASM_X86_MMAN_H
2#define _ASM_X86_MMAN_H
Thomas Gleixner5c8eec52007-10-15 23:28:21 +02003
Thomas Gleixner5c8eec52007-10-15 23:28:21 +02004#define MAP_32BIT 0x40 /* only give out 32bit addresses */
5
Andi Kleen42d73952012-12-11 16:01:34 -08006#define MAP_HUGE_2MB (21 << MAP_HUGE_SHIFT)
7#define MAP_HUGE_1GB (30 << MAP_HUGE_SHIFT)
8
Dave Hansen8f62c882016-02-12 13:02:10 -08009#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))
Dave Hansen878ba032016-02-12 13:02:37 -080023
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))
Dave Hansen8f62c882016-02-12 13:02:10 -080029#endif
30
Arnd Bergmann73a2d092009-06-18 21:48:20 +020031#include <asm-generic/mman.h>
Thomas Gleixner5c8eec52007-10-15 23:28:21 +020032
H. Peter Anvin1965aae2008-10-22 22:26:29 -070033#endif /* _ASM_X86_MMAN_H */