xref: /qemu/linux-user/user-mmap.h (revision 2d708164e0475064e0e2167bd73e8570e22df1e0)
1 /*
2  * user-mmap.h: prototypes for linux-user guest binary loader
3  *
4  *  This program is free software; you can redistribute it and/or modify
5  *  it under the terms of the GNU General Public License as published by
6  *  the Free Software Foundation; either version 2 of the License, or
7  *  (at your option) any later version.
8  *
9  *  This program is distributed in the hope that it will be useful,
10  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  *  GNU General Public License for more details.
13  *
14  *  You should have received a copy of the GNU General Public License
15  *  along with this program; if not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef LINUX_USER_USER_MMAP_H
19 #define LINUX_USER_USER_MMAP_H
20 
21 /*
22  * Guest parameters for the ADDR_COMPAT_LAYOUT personality
23  * (at present this is the only layout supported by QEMU).
24  *
25  * TASK_UNMAPPED_BASE: For mmap without hint (addr != 0), the search
26  * for unused virtual memory begins at TASK_UNMAPPED_BASE.
27  *
28  * task_unmapped_base: When the guest address space is limited via -R,
29  * the value of TASK_UNMAPPED_BASE is adjusted to fit.
30  */
31 extern abi_ulong task_unmapped_base;
32 
33 /*
34  * mmap_next_start: The base address for the next mmap without hint,
35  * increased after each successful map, starting at task_unmapped_base.
36  * This is an optimization within QEMU and not part of ADDR_COMPAT_LAYOUT.
37  */
38 extern abi_ulong mmap_next_start;
39 
40 int target_mprotect(abi_ulong start, abi_ulong len, int prot);
41 abi_long target_mmap(abi_ulong start, abi_ulong len, int prot,
42                      int flags, int fd, off_t offset);
43 int target_munmap(abi_ulong start, abi_ulong len);
44 abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
45                        abi_ulong new_size, unsigned long flags,
46                        abi_ulong new_addr);
47 abi_long target_madvise(abi_ulong start, abi_ulong len_in, int advice);
48 abi_ulong mmap_find_vma(abi_ulong, abi_ulong, abi_ulong);
49 void mmap_fork_start(void);
50 void mmap_fork_end(int child);
51 
52 #endif /* LINUX_USER_USER_MMAP_H */
53