1*e2be04c7SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 283596729SDavid Howells /* 383596729SDavid Howells * include/asm-xtensa/mman.h 483596729SDavid Howells * 583596729SDavid Howells * Xtensa Processor memory-manager definitions 683596729SDavid Howells * 783596729SDavid Howells * This file is subject to the terms and conditions of the GNU General Public 883596729SDavid Howells * License. See the file "COPYING" in the main directory of this archive 983596729SDavid Howells * for more details. 1083596729SDavid Howells * 1183596729SDavid Howells * Copyright (C) 1995 by Ralf Baechle 1283596729SDavid Howells * Copyright (C) 2001 - 2005 Tensilica Inc. 1383596729SDavid Howells */ 1483596729SDavid Howells 1583596729SDavid Howells #ifndef _XTENSA_MMAN_H 1683596729SDavid Howells #define _XTENSA_MMAN_H 1783596729SDavid Howells 1883596729SDavid Howells /* 1983596729SDavid Howells * Protections are chosen from these bits, OR'd together. The 2083596729SDavid Howells * implementation does not necessarily support PROT_EXEC or PROT_WRITE 2183596729SDavid Howells * without PROT_READ. The only guarantees are that no writing will be 2283596729SDavid Howells * allowed without PROT_WRITE and no access will be allowed for PROT_NONE. 2383596729SDavid Howells */ 2483596729SDavid Howells 2583596729SDavid Howells #define PROT_NONE 0x0 /* page can not be accessed */ 2683596729SDavid Howells #define PROT_READ 0x1 /* page can be read */ 2783596729SDavid Howells #define PROT_WRITE 0x2 /* page can be written */ 2883596729SDavid Howells #define PROT_EXEC 0x4 /* page can be executed */ 2983596729SDavid Howells 3083596729SDavid Howells #define PROT_SEM 0x10 /* page may be used for atomic ops */ 3183596729SDavid Howells #define PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */ 3283596729SDavid Howells #define PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end fo growsup vma */ 3383596729SDavid Howells 3483596729SDavid Howells /* 3583596729SDavid Howells * Flags for mmap 3683596729SDavid Howells */ 3783596729SDavid Howells #define MAP_SHARED 0x001 /* Share changes */ 3883596729SDavid Howells #define MAP_PRIVATE 0x002 /* Changes are private */ 3983596729SDavid Howells #define MAP_TYPE 0x00f /* Mask for type of mapping */ 4083596729SDavid Howells #define MAP_FIXED 0x010 /* Interpret addr exactly */ 4183596729SDavid Howells 4283596729SDavid Howells /* not used by linux, but here to make sure we don't clash with ABI defines */ 4383596729SDavid Howells #define MAP_RENAME 0x020 /* Assign page to file */ 4483596729SDavid Howells #define MAP_AUTOGROW 0x040 /* File may grow by writing */ 4583596729SDavid Howells #define MAP_LOCAL 0x080 /* Copy on fork/sproc */ 4683596729SDavid Howells #define MAP_AUTORSRV 0x100 /* Logical swap reserved on demand */ 4783596729SDavid Howells 4883596729SDavid Howells /* These are linux-specific */ 4983596729SDavid Howells #define MAP_NORESERVE 0x0400 /* don't check for reservations */ 5083596729SDavid Howells #define MAP_ANONYMOUS 0x0800 /* don't use a file */ 5183596729SDavid Howells #define MAP_GROWSDOWN 0x1000 /* stack-like segment */ 5283596729SDavid Howells #define MAP_DENYWRITE 0x2000 /* ETXTBSY */ 5383596729SDavid Howells #define MAP_EXECUTABLE 0x4000 /* mark it as an executable */ 5483596729SDavid Howells #define MAP_LOCKED 0x8000 /* pages are locked */ 5583596729SDavid Howells #define MAP_POPULATE 0x10000 /* populate (prefault) pagetables */ 5683596729SDavid Howells #define MAP_NONBLOCK 0x20000 /* do not block on IO */ 5783596729SDavid Howells #define MAP_STACK 0x40000 /* give out an address that is best suited for process/thread stacks */ 5883596729SDavid Howells #define MAP_HUGETLB 0x80000 /* create a huge page mapping */ 59f6891ddbSMax Filippov #ifdef CONFIG_MMAP_ALLOW_UNINITIALIZED 60f6891ddbSMax Filippov # define MAP_UNINITIALIZED 0x4000000 /* For anonymous mmap, memory could be 61f6891ddbSMax Filippov * uninitialized */ 62f6891ddbSMax Filippov #else 63f6891ddbSMax Filippov # define MAP_UNINITIALIZED 0x0 /* Don't support this flag */ 64f6891ddbSMax Filippov #endif 6583596729SDavid Howells 6683596729SDavid Howells /* 6783596729SDavid Howells * Flags for msync 6883596729SDavid Howells */ 6983596729SDavid Howells #define MS_ASYNC 0x0001 /* sync memory asynchronously */ 7083596729SDavid Howells #define MS_INVALIDATE 0x0002 /* invalidate mappings & caches */ 7183596729SDavid Howells #define MS_SYNC 0x0004 /* synchronous memory sync */ 7283596729SDavid Howells 7383596729SDavid Howells /* 7483596729SDavid Howells * Flags for mlockall 7583596729SDavid Howells */ 7683596729SDavid Howells #define MCL_CURRENT 1 /* lock all current mappings */ 7783596729SDavid Howells #define MCL_FUTURE 2 /* lock all future mappings */ 78b0f205c2SEric B Munson #define MCL_ONFAULT 4 /* lock all pages that are faulted in */ 79b0f205c2SEric B Munson 80b0f205c2SEric B Munson /* 81b0f205c2SEric B Munson * Flags for mlock 82b0f205c2SEric B Munson */ 83b0f205c2SEric B Munson #define MLOCK_ONFAULT 0x01 /* Lock pages in range after they are faulted in, do not prefault */ 8483596729SDavid Howells 8583596729SDavid Howells #define MADV_NORMAL 0 /* no further special treatment */ 8683596729SDavid Howells #define MADV_RANDOM 1 /* expect random page references */ 8783596729SDavid Howells #define MADV_SEQUENTIAL 2 /* expect sequential page references */ 8883596729SDavid Howells #define MADV_WILLNEED 3 /* will need these pages */ 8983596729SDavid Howells #define MADV_DONTNEED 4 /* don't need these pages */ 9083596729SDavid Howells 9183596729SDavid Howells /* common parameters: try to keep these consistent across architectures */ 9221f55b01SChen Gang #define MADV_FREE 8 /* free pages only if memory pressure */ 9383596729SDavid Howells #define MADV_REMOVE 9 /* remove these pages & resources */ 9483596729SDavid Howells #define MADV_DONTFORK 10 /* don't inherit across fork */ 9583596729SDavid Howells #define MADV_DOFORK 11 /* do inherit across fork */ 9683596729SDavid Howells 9783596729SDavid Howells #define MADV_MERGEABLE 12 /* KSM may merge identical pages */ 9883596729SDavid Howells #define MADV_UNMERGEABLE 13 /* KSM may not merge identical pages */ 9983596729SDavid Howells 10083596729SDavid Howells #define MADV_HUGEPAGE 14 /* Worth backing with hugepages */ 10183596729SDavid Howells #define MADV_NOHUGEPAGE 15 /* Not worth backing with hugepages */ 10283596729SDavid Howells 10383596729SDavid Howells #define MADV_DONTDUMP 16 /* Explicity exclude from the core dump, 10483596729SDavid Howells overrides the coredump filter bits */ 10583596729SDavid Howells #define MADV_DODUMP 17 /* Clear the MADV_NODUMP flag */ 10683596729SDavid Howells 107d2cd9edeSRik van Riel #define MADV_WIPEONFORK 18 /* Zero memory on fork, child only */ 108d2cd9edeSRik van Riel #define MADV_KEEPONFORK 19 /* Undo MADV_WIPEONFORK */ 109d2cd9edeSRik van Riel 11083596729SDavid Howells /* compatibility flags */ 11183596729SDavid Howells #define MAP_FILE 0 11283596729SDavid Howells 113e8c24d3aSDave Hansen #define PKEY_DISABLE_ACCESS 0x1 114e8c24d3aSDave Hansen #define PKEY_DISABLE_WRITE 0x2 115e8c24d3aSDave Hansen #define PKEY_ACCESS_MASK (PKEY_DISABLE_ACCESS |\ 116e8c24d3aSDave Hansen PKEY_DISABLE_WRITE) 117e8c24d3aSDave Hansen 11883596729SDavid Howells #endif /* _XTENSA_MMAN_H */ 119