From be04f210f954bed8663943a94ece50c2ca410231 Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Thu, 5 Aug 2021 18:15:47 -0600 Subject: bsd-user: Update mapping to handle reserved and starting conditions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update the reserved base based on what platform we're on, as well as the start of the mmap range. Update routines that find va ranges to interact with the reserved ranges as well as properly align the mapping (this is especially important for targets whose page size does not match the host's). Loop where appropriate when the initial address space offered by mmap does not meet the contraints. This has 18e80c55bb6 from linux-user folded in to the upstream bsd-user code as well. Signed-off-by: Mikaƫl Urankar Signed-off-by: Stacey Son Signed-off-by: Warner Losh Acked-by: Richard Henderson Reviewed-by: Kyle Evans --- bsd-user/qemu.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'bsd-user/qemu.h') diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h index 8d20554688..522d6c4031 100644 --- a/bsd-user/qemu.h +++ b/bsd-user/qemu.h @@ -105,7 +105,6 @@ typedef struct TaskState { void init_task_state(TaskState *ts); extern const char *qemu_uname_release; -extern unsigned long mmap_min_addr; /* * TARGET_ARG_MAX defines the number of bytes allocated for arguments @@ -215,13 +214,15 @@ abi_long do_sigaltstack(abi_ulong uss_addr, abi_ulong uoss_addr, abi_ulong sp); /* mmap.c */ int target_mprotect(abi_ulong start, abi_ulong len, int prot); abi_long target_mmap(abi_ulong start, abi_ulong len, int prot, - int flags, int fd, abi_ulong offset); + int flags, int fd, off_t offset); int target_munmap(abi_ulong start, abi_ulong len); abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size, abi_ulong new_size, unsigned long flags, abi_ulong new_addr); int target_msync(abi_ulong start, abi_ulong len, int flags); extern unsigned long last_brk; +extern abi_ulong mmap_next_start; +abi_ulong mmap_find_vma(abi_ulong start, abi_ulong size); void mmap_fork_start(void); void mmap_fork_end(int child); -- cgit 1.4.1