1e2be04c7SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 261730c53SDavid Howells /* 361730c53SDavid Howells * This file is subject to the terms and conditions of the GNU General Public 461730c53SDavid Howells * License. See the file "COPYING" in the main directory of this archive 561730c53SDavid Howells * for more details. 661730c53SDavid Howells * 761730c53SDavid Howells * Copyright (C) 1995, 1999, 2002 by Ralf Baechle 861730c53SDavid Howells */ 961730c53SDavid Howells #ifndef _ASM_MMAN_H 1061730c53SDavid Howells #define _ASM_MMAN_H 1161730c53SDavid Howells 1261730c53SDavid Howells /* 1361730c53SDavid Howells * Protections are chosen from these bits, OR'd together. The 1461730c53SDavid Howells * implementation does not necessarily support PROT_EXEC or PROT_WRITE 1561730c53SDavid Howells * without PROT_READ. The only guarantees are that no writing will be 1661730c53SDavid Howells * allowed without PROT_WRITE and no access will be allowed for PROT_NONE. 1761730c53SDavid Howells */ 1861730c53SDavid Howells #define PROT_NONE 0x00 /* page can not be accessed */ 1961730c53SDavid Howells #define PROT_READ 0x01 /* page can be read */ 2061730c53SDavid Howells #define PROT_WRITE 0x02 /* page can be written */ 2161730c53SDavid Howells #define PROT_EXEC 0x04 /* page can be executed */ 2261730c53SDavid Howells /* 0x08 reserved for PROT_EXEC_NOFLUSH */ 2361730c53SDavid Howells #define PROT_SEM 0x10 /* page may be used for atomic ops */ 2461730c53SDavid Howells #define PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */ 2561730c53SDavid Howells #define PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end of growsup vma */ 2661730c53SDavid Howells 2761730c53SDavid Howells /* 2861730c53SDavid Howells * Flags for mmap 2961730c53SDavid Howells */ 3061730c53SDavid Howells #define MAP_SHARED 0x001 /* Share changes */ 3161730c53SDavid Howells #define MAP_PRIVATE 0x002 /* Changes are private */ 321c972597SDan Williams #define MAP_SHARED_VALIDATE 0x003 /* share + validate extension flags */ 3361730c53SDavid Howells #define MAP_TYPE 0x00f /* Mask for type of mapping */ 3461730c53SDavid Howells #define MAP_FIXED 0x010 /* Interpret addr exactly */ 3561730c53SDavid Howells 3661730c53SDavid Howells /* not used by linux, but here to make sure we don't clash with ABI defines */ 3761730c53SDavid Howells #define MAP_RENAME 0x020 /* Assign page to file */ 3861730c53SDavid Howells #define MAP_AUTOGROW 0x040 /* File may grow by writing */ 3961730c53SDavid Howells #define MAP_LOCAL 0x080 /* Copy on fork/sproc */ 4061730c53SDavid Howells #define MAP_AUTORSRV 0x100 /* Logical swap reserved on demand */ 4161730c53SDavid Howells 4261730c53SDavid Howells /* These are linux-specific */ 4361730c53SDavid Howells #define MAP_NORESERVE 0x0400 /* don't check for reservations */ 4461730c53SDavid Howells #define MAP_ANONYMOUS 0x0800 /* don't use a file */ 4561730c53SDavid Howells #define MAP_GROWSDOWN 0x1000 /* stack-like segment */ 4661730c53SDavid Howells #define MAP_DENYWRITE 0x2000 /* ETXTBSY */ 4761730c53SDavid Howells #define MAP_EXECUTABLE 0x4000 /* mark it as an executable */ 4861730c53SDavid Howells #define MAP_LOCKED 0x8000 /* pages are locked */ 4961730c53SDavid Howells #define MAP_POPULATE 0x10000 /* populate (prefault) pagetables */ 5061730c53SDavid Howells #define MAP_NONBLOCK 0x20000 /* do not block on IO */ 5161730c53SDavid Howells #define MAP_STACK 0x40000 /* give out an address that is best suited for process/thread stacks */ 5261730c53SDavid Howells #define MAP_HUGETLB 0x80000 /* create a huge page mapping */ 53a4ff8e86SMichal Hocko #define MAP_FIXED_NOREPLACE 0x100000 /* MAP_FIXED which doesn't unmap underlying mapping */ 5461730c53SDavid Howells 5561730c53SDavid Howells /* 5661730c53SDavid Howells * Flags for msync 5761730c53SDavid Howells */ 5861730c53SDavid Howells #define MS_ASYNC 0x0001 /* sync memory asynchronously */ 5961730c53SDavid Howells #define MS_INVALIDATE 0x0002 /* invalidate mappings & caches */ 6061730c53SDavid Howells #define MS_SYNC 0x0004 /* synchronous memory sync */ 6161730c53SDavid Howells 6261730c53SDavid Howells /* 6361730c53SDavid Howells * Flags for mlockall 6461730c53SDavid Howells */ 6561730c53SDavid Howells #define MCL_CURRENT 1 /* lock all current mappings */ 6661730c53SDavid Howells #define MCL_FUTURE 2 /* lock all future mappings */ 67b0f205c2SEric B Munson #define MCL_ONFAULT 4 /* lock all pages that are faulted in */ 68b0f205c2SEric B Munson 69b0f205c2SEric B Munson /* 70b0f205c2SEric B Munson * Flags for mlock 71b0f205c2SEric B Munson */ 72b0f205c2SEric B Munson #define MLOCK_ONFAULT 0x01 /* Lock pages in range after they are faulted in, do not prefault */ 7361730c53SDavid Howells 7461730c53SDavid Howells #define MADV_NORMAL 0 /* no further special treatment */ 7561730c53SDavid Howells #define MADV_RANDOM 1 /* expect random page references */ 7661730c53SDavid Howells #define MADV_SEQUENTIAL 2 /* expect sequential page references */ 7761730c53SDavid Howells #define MADV_WILLNEED 3 /* will need these pages */ 7861730c53SDavid Howells #define MADV_DONTNEED 4 /* don't need these pages */ 7961730c53SDavid Howells 8061730c53SDavid Howells /* common parameters: try to keep these consistent across architectures */ 8121f55b01SChen Gang #define MADV_FREE 8 /* free pages only if memory pressure */ 8261730c53SDavid Howells #define MADV_REMOVE 9 /* remove these pages & resources */ 8361730c53SDavid Howells #define MADV_DONTFORK 10 /* don't inherit across fork */ 8461730c53SDavid Howells #define MADV_DOFORK 11 /* do inherit across fork */ 8561730c53SDavid Howells 8661730c53SDavid Howells #define MADV_MERGEABLE 12 /* KSM may merge identical pages */ 8761730c53SDavid Howells #define MADV_UNMERGEABLE 13 /* KSM may not merge identical pages */ 8861730c53SDavid Howells #define MADV_HWPOISON 100 /* poison a page for testing */ 8961730c53SDavid Howells 9061730c53SDavid Howells #define MADV_HUGEPAGE 14 /* Worth backing with hugepages */ 9161730c53SDavid Howells #define MADV_NOHUGEPAGE 15 /* Not worth backing with hugepages */ 9261730c53SDavid Howells 9361730c53SDavid Howells #define MADV_DONTDUMP 16 /* Explicity exclude from the core dump, 9461730c53SDavid Howells overrides the coredump filter bits */ 9561730c53SDavid Howells #define MADV_DODUMP 17 /* Clear the MADV_NODUMP flag */ 9661730c53SDavid Howells 97d2cd9edeSRik van Riel #define MADV_WIPEONFORK 18 /* Zero memory on fork, child only */ 98d2cd9edeSRik van Riel #define MADV_KEEPONFORK 19 /* Undo MADV_WIPEONFORK */ 99d2cd9edeSRik van Riel 10061730c53SDavid Howells /* compatibility flags */ 10161730c53SDavid Howells #define MAP_FILE 0 10261730c53SDavid Howells 103e8c24d3aSDave Hansen #define PKEY_DISABLE_ACCESS 0x1 104e8c24d3aSDave Hansen #define PKEY_DISABLE_WRITE 0x2 105e8c24d3aSDave Hansen #define PKEY_ACCESS_MASK (PKEY_DISABLE_ACCESS |\ 106e8c24d3aSDave Hansen PKEY_DISABLE_WRITE) 107e8c24d3aSDave Hansen 10861730c53SDavid Howells #endif /* _ASM_MMAN_H */ 109