1633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham/*
2633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * This file is subject to the terms and conditions of the GNU General Public
3633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * License.  See the file "COPYING" in the main directory of this archive
4633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * for more details.
5633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham *
6633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * Copyright (C) 1995, 1999, 2002 by Ralf Baechle
7633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham */
8633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#ifndef _ASM_MMAN_H
9633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define _ASM_MMAN_H
10633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham
11633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham/*
12633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * Protections are chosen from these bits, OR'd together.  The
13633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * implementation does not necessarily support PROT_EXEC or PROT_WRITE
14633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * without PROT_READ.  The only guarantees are that no writing will be
15633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * allowed without PROT_WRITE and no access will be allowed for PROT_NONE.
16633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham */
17633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define PROT_NONE	0x00		/* page can not be accessed */
18633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define PROT_READ	0x01		/* page can be read */
19633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define PROT_WRITE	0x02		/* page can be written */
20633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define PROT_EXEC	0x04		/* page can be executed */
21633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham/*			0x08		   reserved for PROT_EXEC_NOFLUSH */
22633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define PROT_SEM	0x10		/* page may be used for atomic ops */
23633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define PROT_GROWSDOWN	0x01000000	/* mprotect flag: extend change to start of growsdown vma */
24633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define PROT_GROWSUP	0x02000000	/* mprotect flag: extend change to end of growsup vma */
25633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham
26633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham/*
27633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * Flags for mmap
28633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham */
29633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define MAP_SHARED	0x001		/* Share changes */
30633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define MAP_PRIVATE	0x002		/* Changes are private */
31633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define MAP_TYPE	0x00f		/* Mask for type of mapping */
32633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define MAP_FIXED	0x010		/* Interpret addr exactly */
33633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham
34633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham/* not used by linux, but here to make sure we don't clash with ABI defines */
35633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define MAP_RENAME	0x020		/* Assign page to file */
36633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define MAP_AUTOGROW	0x040		/* File may grow by writing */
37633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define MAP_LOCAL	0x080		/* Copy on fork/sproc */
38633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define MAP_AUTORSRV	0x100		/* Logical swap reserved on demand */
39633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham
40633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham/* These are linux-specific */
41633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define MAP_NORESERVE	0x0400		/* don't check for reservations */
42633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define MAP_ANONYMOUS	0x0800		/* don't use a file */
43633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define MAP_GROWSDOWN	0x1000		/* stack-like segment */
44633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define MAP_DENYWRITE	0x2000		/* ETXTBSY */
45633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define MAP_EXECUTABLE	0x4000		/* mark it as an executable */
46633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define MAP_LOCKED	0x8000		/* pages are locked */
47633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define MAP_POPULATE	0x10000		/* populate (prefault) pagetables */
48633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define MAP_NONBLOCK	0x20000		/* do not block on IO */
4937ed891e8a84d23f13a87c067391b0e8a5bb14eaRaghu Gandham#define MAP_STACK	0x40000		/* give out an address that is best suited for process/thread stacks */
5037ed891e8a84d23f13a87c067391b0e8a5bb14eaRaghu Gandham#define MAP_HUGETLB	0x80000		/* create a huge page mapping */
51633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham
52633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham/*
53633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * Flags for msync
54633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham */
55633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define MS_ASYNC	0x0001		/* sync memory asynchronously */
56633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define MS_INVALIDATE	0x0002		/* invalidate mappings & caches */
57633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define MS_SYNC		0x0004		/* synchronous memory sync */
58633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham
59633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham/*
60633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * Flags for mlockall
61633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham */
62633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define MCL_CURRENT	1		/* lock all current mappings */
63633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define MCL_FUTURE	2		/* lock all future mappings */
64633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham
65633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define MADV_NORMAL	0		/* no further special treatment */
66633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define MADV_RANDOM	1		/* expect random page references */
67633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define MADV_SEQUENTIAL	2		/* expect sequential page references */
68633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define MADV_WILLNEED	3		/* will need these pages */
69633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define MADV_DONTNEED	4		/* don't need these pages */
70633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham
71633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham/* common parameters: try to keep these consistent across architectures */
72633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define MADV_REMOVE	9		/* remove these pages & resources */
73633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define MADV_DONTFORK	10		/* don't inherit across fork */
74633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define MADV_DOFORK	11		/* do inherit across fork */
75633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham
7637ed891e8a84d23f13a87c067391b0e8a5bb14eaRaghu Gandham#define MADV_MERGEABLE   12		/* KSM may merge identical pages */
7737ed891e8a84d23f13a87c067391b0e8a5bb14eaRaghu Gandham#define MADV_UNMERGEABLE 13		/* KSM may not merge identical pages */
7837ed891e8a84d23f13a87c067391b0e8a5bb14eaRaghu Gandham#define MADV_HWPOISON    100		/* poison a page for testing */
7937ed891e8a84d23f13a87c067391b0e8a5bb14eaRaghu Gandham
8037ed891e8a84d23f13a87c067391b0e8a5bb14eaRaghu Gandham#define MADV_HUGEPAGE	14		/* Worth backing with hugepages */
8137ed891e8a84d23f13a87c067391b0e8a5bb14eaRaghu Gandham#define MADV_NOHUGEPAGE	15		/* Not worth backing with hugepages */
8237ed891e8a84d23f13a87c067391b0e8a5bb14eaRaghu Gandham
8337ed891e8a84d23f13a87c067391b0e8a5bb14eaRaghu Gandham#define MADV_DONTDUMP   16		/* Explicity exclude from the core dump,
8437ed891e8a84d23f13a87c067391b0e8a5bb14eaRaghu Gandham					   overrides the coredump filter bits */
8537ed891e8a84d23f13a87c067391b0e8a5bb14eaRaghu Gandham#define MADV_DODUMP	17		/* Clear the MADV_NODUMP flag */
8637ed891e8a84d23f13a87c067391b0e8a5bb14eaRaghu Gandham
87633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham/* compatibility flags */
88633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define MAP_FILE	0
89633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham
90633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#endif /* _ASM_MMAN_H */
91