Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
0002 #ifndef __ASM_GENERIC_MMAN_COMMON_H
0003 #define __ASM_GENERIC_MMAN_COMMON_H
0004 
0005 /*
0006  Author: Michael S. Tsirkin <mst@mellanox.co.il>, Mellanox Technologies Ltd.
0007  Based on: asm-xxx/mman.h
0008 */
0009 
0010 #define PROT_READ   0x1     /* page can be read */
0011 #define PROT_WRITE  0x2     /* page can be written */
0012 #define PROT_EXEC   0x4     /* page can be executed */
0013 #define PROT_SEM    0x8     /* page may be used for atomic ops */
0014 /*          0x10           reserved for arch-specific use */
0015 /*          0x20           reserved for arch-specific use */
0016 #define PROT_NONE   0x0     /* page can not be accessed */
0017 #define PROT_GROWSDOWN  0x01000000  /* mprotect flag: extend change to start of growsdown vma */
0018 #define PROT_GROWSUP    0x02000000  /* mprotect flag: extend change to end of growsup vma */
0019 
0020 /* 0x01 - 0x03 are defined in linux/mman.h */
0021 #define MAP_TYPE    0x0f        /* Mask for type of mapping */
0022 #define MAP_FIXED   0x10        /* Interpret addr exactly */
0023 #define MAP_ANONYMOUS   0x20        /* don't use a file */
0024 
0025 /* 0x0100 - 0x4000 flags are defined in asm-generic/mman.h */
0026 #define MAP_POPULATE        0x008000    /* populate (prefault) pagetables */
0027 #define MAP_NONBLOCK        0x010000    /* do not block on IO */
0028 #define MAP_STACK       0x020000    /* give out an address that is best suited for process/thread stacks */
0029 #define MAP_HUGETLB     0x040000    /* create a huge page mapping */
0030 #define MAP_SYNC        0x080000 /* perform synchronous page faults for the mapping */
0031 #define MAP_FIXED_NOREPLACE 0x100000    /* MAP_FIXED which doesn't unmap underlying mapping */
0032 
0033 #define MAP_UNINITIALIZED 0x4000000 /* For anonymous mmap, memory could be
0034                      * uninitialized */
0035 
0036 /*
0037  * Flags for mlock
0038  */
0039 #define MLOCK_ONFAULT   0x01        /* Lock pages in range after they are faulted in, do not prefault */
0040 
0041 #define MS_ASYNC    1       /* sync memory asynchronously */
0042 #define MS_INVALIDATE   2       /* invalidate the caches */
0043 #define MS_SYNC     4       /* synchronous memory sync */
0044 
0045 #define MADV_NORMAL 0       /* no further special treatment */
0046 #define MADV_RANDOM 1       /* expect random page references */
0047 #define MADV_SEQUENTIAL 2       /* expect sequential page references */
0048 #define MADV_WILLNEED   3       /* will need these pages */
0049 #define MADV_DONTNEED   4       /* don't need these pages */
0050 
0051 /* common parameters: try to keep these consistent across architectures */
0052 #define MADV_FREE   8       /* free pages only if memory pressure */
0053 #define MADV_REMOVE 9       /* remove these pages & resources */
0054 #define MADV_DONTFORK   10      /* don't inherit across fork */
0055 #define MADV_DOFORK 11      /* do inherit across fork */
0056 #define MADV_HWPOISON   100     /* poison a page for testing */
0057 #define MADV_SOFT_OFFLINE 101       /* soft offline page for testing */
0058 
0059 #define MADV_MERGEABLE   12     /* KSM may merge identical pages */
0060 #define MADV_UNMERGEABLE 13     /* KSM may not merge identical pages */
0061 
0062 #define MADV_HUGEPAGE   14      /* Worth backing with hugepages */
0063 #define MADV_NOHUGEPAGE 15      /* Not worth backing with hugepages */
0064 
0065 #define MADV_DONTDUMP   16      /* Explicity exclude from the core dump,
0066                        overrides the coredump filter bits */
0067 #define MADV_DODUMP 17      /* Clear the MADV_DONTDUMP flag */
0068 
0069 #define MADV_WIPEONFORK 18      /* Zero memory on fork, child only */
0070 #define MADV_KEEPONFORK 19      /* Undo MADV_WIPEONFORK */
0071 
0072 #define MADV_COLD   20      /* deactivate these pages */
0073 #define MADV_PAGEOUT    21      /* reclaim these pages */
0074 
0075 #define MADV_POPULATE_READ  22  /* populate (prefault) page tables readable */
0076 #define MADV_POPULATE_WRITE 23  /* populate (prefault) page tables writable */
0077 
0078 #define MADV_DONTNEED_LOCKED    24  /* like DONTNEED, but drop locked pages too */
0079 
0080 /* compatibility flags */
0081 #define MAP_FILE    0
0082 
0083 #define PKEY_DISABLE_ACCESS 0x1
0084 #define PKEY_DISABLE_WRITE  0x2
0085 #define PKEY_ACCESS_MASK    (PKEY_DISABLE_ACCESS |\
0086                  PKEY_DISABLE_WRITE)
0087 
0088 #endif /* __ASM_GENERIC_MMAN_COMMON_H */