- Mar 29, 2023
-
-
Richard Henderson authored
Change the semantics to be the last byte of the guest va, rather than the following byte. This avoids some overflow conditions. Reviewed-by:
Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by:
Richard Henderson <richard.henderson@linaro.org>
-
Richard Henderson authored
Pass the address of the last byte to be changed, rather than the first address past the last byte. This avoids overflow when the last page of the address space is involved. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1528 Reviewed-by:
Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by:
Richard Henderson <richard.henderson@linaro.org>
-
- Oct 26, 2022
-
-
Richard Henderson authored
When PAGE_RESET is set, we are replacing pages with new content, which means that we need to invalidate existing cached data, such as TranslationBlocks. Perform the reset invalidate while we're doing other invalidates, which allows us to remove the separate invalidates from the user-only mmap/munmap/mprotect routines. In addition, restrict invalidation to PAGE_EXEC pages. Since cdf71308, we have validated PAGE_EXEC is present before translation, which means we can assume that if the bit is not present, there are no translations to invalidate. Reviewed-by:
Alex Bennée <alex.bennee@linaro.org> Signed-off-by:
Richard Henderson <richard.henderson@linaro.org>
-
- Apr 06, 2022
-
-
Marc-André Lureau authored
Signed-off-by:
Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20220323155743.1585078-33-marcandre.lureau@redhat.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Marc-André Lureau authored
Replace the global variables with inlined helper functions. getpagesize() is very likely annotated with a "const" function attribute (at least with glibc), and thus optimization should apply even better. This avoids the need for a constructor initialization too. Signed-off-by:
Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20220323155743.1585078-12-marcandre.lureau@redhat.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
- Oct 18, 2021
-
-
Warner Losh authored
Similar to the equivalent linux-user change 86abac06. All error conditions that target_mprotect checks are also checked by target_mmap. EACCESS cannot happen because we are just removing PROT_WRITE. ENOMEM should not happen because we are modifying a whole VMA (and we have bigger problems anyway if it happens). Fixes a Coverity false positive, where Coverity complains about target_mprotect's return value being passed to tb_invalidate_phys_range. Signed-off-by:
Mikaël Urankar <mikael.urankar@gmail.com> Signed-off-by:
Warner Losh <imp@bsdimp.com> Reviewed-by:
Richard Henderson <richard.henderson@linaro.org> Reviewed-by:
Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by:
Kyle Evans <kevans@FreeBSD.org>
-
Kyle Evans authored
jemalloc requires a working MAP_EXCL. Ensure that no page is double mapped when specified. In addition, use guest_range_valid_untagged to test for valid ranges of pages rather than an incomplete inlined version of the test that might be wrong. Signed-off-by:
Kyle Evans <kevans@FreeBSD.org> Signed-off-by:
Warner Losh <imp@bsdimp.com> Reviewed-by:
Richard Henderson <richard.henderson@linaro.org>
-
Warner Losh authored
Switch checks for !(flags & MAP_ANONYMOUS) with checks for fd != -1. MAP_STACK and MAP_GUARD both require fd == -1 and don't require mapping the fd either. Add analysis from Guy Yur detailing the different cases for MAP_GUARD and MAP_STACK. Signed-off-by:
Guy Yur <guyyur@gmail.com> [ partially merged before, finishing the job and documenting origin] Signed-off-by:
Warner Losh <imp@bsdimp.com> Reviewed-by:
Richard Henderson <richard.henderson@linaro.org> Reviewed-by:
Kyle Evans <kevans@FreeBSD.org>
-
Warner Losh authored
Convert DEBUG_MMAP to qemu_log CPU_LOG_PAGE. Signed-off-by:
Warner Losh <imp@bsdimp.com> Reviewed-by:
Richard Henderson <richard.henderson@linaro.org> Reviewed-by:
Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by:
Kyle Evans <kevans@FreeBSD.org>
-
Warner Losh authored
MAP_ANON and MAP_ANONYMOUS are identical. Prefer MAP_ANON for BSD since the file is now a confusing mix of the two. Signed-off-by:
Warner Losh <imp@bsdimp.com> Reviewed-by:
Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by:
Richard Henderson <richard.henderson@linaro.org> Reviewed-by:
Kyle Evans <kevans@FreeBSD.org>
-
Warner Losh authored
mmap should return ENOMEM on len overflow rather than EINVAL. Return EINVAL when len == 0 and ENOMEM when the rounded to a page length is 0. Found by make check-tcg. Signed-off-by:
Warner Losh <imp@bsdimp.com> Reviewed-by:
Richard Henderson <richard.henderson@linaro.org> Reviewed-by:
Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by:
Kyle Evans <kevans@FreeBSD.org>
-
Warner Losh authored
All these MAP_ symbols are always defined on supported FreeBSD versions (12.2 and newer), so remove the #ifdefs since they aren't needed. Signed-off-by:
Warner Losh <imp@bsdimp.com> Reviewed-by:
Philippe Mathieu-Daudé <f4bug@amsat.org> Acked-by:
Richard Henderson <richard.henderson@linaro.org> Reviewed-by:
Kyle Evans <kevans@FreeBSD.org>
-
Mikaël Urankar authored
Simmilar to the equivalent linux-user: commit fb7e378c, which added checking to pread's return value. Update to current qemu standards with {} around the if statement. Signed-off-by:
Mikaël Urankar <mikael.urankar@gmail.com> Signed-off-by:
Warner Losh <imp@bsdimp.com> Reviewed-by:
Richard Henderson <richard.henderson@linaro.org> Reviewed-by:
Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by:
Kyle Evans <kevans@FreeBSD.org>
-
Mikaël Urankar authored
Similar to the equivalent linux-user commit e6deac9c When mapping MAP_ANONYMOUS memory fragments, still need notice about to set it zero, or it will cause issues. Signed-off-by:
Mikaël Urankar <mikael.urankar@gmail.com> Signed-off-by:
Warner Losh <imp@bsdimp.com> Reviewed-by:
Richard Henderson <richard.henderson@linaro.org> Reviewed-by:
Kyle Evans <kevans@FreeBSD.org>
-
- Sep 10, 2021
-
-
Warner Losh authored
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 18e80c55 from linux-user folded in to the upstream bsd-user code as well. Signed-off-by:
Mikaël Urankar <mikael.urankar@gmail.com> Signed-off-by:
Stacey Son <sson@FreeBSD.org> Signed-off-by:
Warner Losh <imp@bsdimp.com> Acked-by:
Richard Henderson <richard.henderson@linaro.org> Reviewed-by:
Kyle Evans <kevans@FreeBSD.org>
-
Warner Losh authored
Update the debugging code for new features and different targets. Signed-off-by:
Mikaël Urankar <mikael.urankar@gmail.com> Signed-off-by:
Sean Bruno <sbruno@FreeBSD.org> Signed-off-by:
Kyle Evans <kevans@FreeBSD.org> Signed-off-by:
Warner Losh <imp@bsdimp.com> Acked-by:
Richard Henderson <richard.henderson@linaro.org> Reviewed-by:
Kyle Evans <kevans@FreeBSD.org>
-
Warner Losh authored
Rewrite target definnitions to interface with the FreeBSD system calls. This covers basic types (time_t, iovec, umtx_time, timespec, timeval, rusage, rwusage) and basic defines (mmap, rusage). Also included are FreeBSD version-specific variations. Signed-off-by:
Stacey Son <sson@FreeBSD.org> Signed-off-by:
Warner Losh <imp@bsdimp.com> Acked-by:
Richard Henderson <richard.henderson@linaro.org> Reviewed-by:
Kyle Evans <kevans@FreeBSD.org>
-
- May 11, 2021
-
-
Warner Losh authored
Reviewed-by:
Richard Henderson <richard.henderson@linaro.org> Signed-off-by:
Warner Losh <imp@bsdimp.com>
-
- Feb 16, 2021
-
-
Richard Henderson authored
Use g2h_untagged in contexts that have no cpu, e.g. the binary loaders that operate before the primary cpu is created. As a colollary, target_mmap and friends must use untagged addresses, since they are used by the loaders. Use g2h_untagged on values returned from target_mmap, as the kernel never applies a tag itself. Use g2h_untagged on all pc values. The only current user of tags, aarch64, removes tags from code addresses upon branch, so "pc" is always untagged. Use g2h with the cpu context on hand wherever possible. Use g2h_untagged in lock_user, which will be updated soon. Reviewed-by:
Peter Maydell <peter.maydell@linaro.org> Signed-off-by:
Richard Henderson <richard.henderson@linaro.org> Message-id: 20210212184902.1251044-13-richard.henderson@linaro.org Signed-off-by:
Peter Maydell <peter.maydell@linaro.org>
-
- Jun 01, 2018
-
-
Paolo Bonzini authored
Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
- Jul 21, 2017
-
-
Peter Maydell authored
Avoid a compiler warning on OpenBSD: bsd-user/mmap.c:28:1: warning: '__thread' is not at beginning of declaration [-Wold-style-declaration] by moving the __thread attribute to its proper place. Signed-off-by:
Peter Maydell <peter.maydell@linaro.org> Reviewed-by:
Philippe Mathieu-Daudé <f4bug@amsat.org> Message-id: 1500395194-21455-2-git-send-email-peter.maydell@linaro.org
-
- Mar 28, 2017
-
-
Alex Bennée authored
The introduction of stricter mmap_lock checking in translate-all broke the BSD user build. The working mmap_lock functions were hidden behind CONFIG_USE_NPTL which is never defined. This patch brings them inline with linux-user. Despite the disapearence of the comment "We aren't threadsafe to start with..." this doesn't make bsd-user so. It will still need the rest of the fixes that have been done in linux-user ported over. Signed-off-by:
Alex Bennée <alex.bennee@linaro.org> Reviewed-by:
Paolo Bonzini <pbonzini@redhat.com>
-
- Mar 20, 2017
-
-
Paolo Bonzini authored
The Cygwin target is really compiling for native Win32 with -mno-cygwin. Except, GCC 4.7.0 has finally removed the long deprecated -mno-cygwin option, and that happened about five years ago. Let it rest in peace. Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com> Reviewed-by:
Stefan Weil <sw@weilnetz.de> Message-id: 20170317160811.28370-1-pbonzini@redhat.com Signed-off-by:
Peter Maydell <peter.maydell@linaro.org>
-
- Mar 19, 2017
-
-
Paolo Bonzini authored
The Cygwin target is really compiling for native Win32 with -mno-cygwin. Except, GCC 4.7.0 has finally removed the long deprecated -mno-cygwin option, and that happened about five years ago. Let it rest in peace. Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
- Oct 31, 2016
-
-
Alex Bennée authored
This adds asserts to check the locking on the various translation engines structures. There are two sets of structures that are protected by locks. The first the l1map and PageDesc structures used to track which translation blocks are associated with which physical addresses. In user-mode this is covered by the mmap_lock. The second case are TB context related structures which are protected by tb_lock which is also user-mode only. Currently the asserts do nothing in SoftMMU mode but this will change for MTTCG. Signed-off-by:
Alex Bennée <alex.bennee@linaro.org> Reviewed-by:
Richard Henderson <rth@twiddle.net> Message-Id: <20161027151030.20863-4-alex.bennee@linaro.org> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
- Jun 16, 2016
-
-
Paolo Bonzini authored
qemu/osdep.h checks whether MAP_ANONYMOUS is defined, but this check is bogus without a previous inclusion of sys/mman.h. Include it in sysemu/os-posix.h and remove it from everywhere else. Reviewed-by:
Peter Maydell <peter.maydell@linaro.org> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
- Feb 04, 2016
-
-
Peter Maydell authored
Clean up includes so that osdep.h is included first and headers which it implies are not included manually. This commit was created with scripts/clean-includes. Signed-off-by:
Peter Maydell <peter.maydell@linaro.org> Message-id: 1454089805-5470-4-git-send-email-peter.maydell@linaro.org
-
- Jun 11, 2014
-
-
Peter Maydell authored
Trying to override the implementations of g_malloc and g_free is a really bad idea -- it means statically linked builds fail to link (because of the multiple definitions provided by this file and by glib), and non-statically linked builds segfault as soon as they try to do anything more complicated than printing the usage message. Remove these overridden versions and just use the glib ones. This is sufficient that bsd-user can run basic x86-64 binaries on OpenBSD again; FreeBSD and NetBSD seem to have further issues. Signed-off-by:
Peter Maydell <peter.maydell@linaro.org> Reviewed-by:
Sean Bruno <sbruno@freebsd.org> Reviewed-by:
Ed Maste <emaste@freebsd.org>
-
- Jan 26, 2013
-
-
Blue Swirl authored
Rename qemu_vmalloc() to bsd_vmalloc(), adjust the only user. Remove #ifdeffery in oslib-posix.c. Tested-by:
Andreas Färber <andreas.faerber@web.de> Signed-off-by:
Blue Swirl <blauwirbel@gmail.com>
-
- Aug 21, 2011
-
-
Anthony Liguori authored
qemu_malloc/qemu_free no longer exist after this commit. Signed-off-by:
Anthony Liguori <aliguori@us.ibm.com>
-
- Mar 30, 2010
-
-
Juergen Lock authored
Just do the same as linux-user does. Signed-off-by:
Juergen Lock <nox@jelal.kn-bremen.de> Signed-off-by:
Blue Swirl <blauwirbel@gmail.com>
-
- Jan 31, 2010
-
-
Blue Swirl authored
See also ee636500. Signed-off-by:
Blue Swirl <blauwirbel@gmail.com>
-
- Jul 27, 2009
-
-
Juan Quintela authored
Signed-off-by:
Juan Quintela <quintela@redhat.com> Signed-off-by:
Anthony Liguori <aliguori@us.ibm.com>
-
- Jul 16, 2009
-
-
Blue Swirl authored
Signed-off-by:
Blue Swirl <blauwirbel@gmail.com>
-
- Jan 28, 2009
-
-
malc authored
make {linux,bsd}-user qemu_realloc handle ptr == NULL correctly. spotted by malc. git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6466 c046a42c-6fe2-441c-8c8c-71466251a162
-
- Jan 24, 2009
-
-
Blue Swirl authored
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6434 c046a42c-6fe2-441c-8c8c-71466251a162
-
- Jan 05, 2009
-
-
Blue Swirl authored
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6192 c046a42c-6fe2-441c-8c8c-71466251a162
-
- Nov 29, 2008
-
-
Blue Swirl authored
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5809 c046a42c-6fe2-441c-8c8c-71466251a162
-
- Oct 26, 2008
-
-
Blue Swirl authored
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5544 c046a42c-6fe2-441c-8c8c-71466251a162
-
- Oct 02, 2008
-
-
Blue Swirl authored
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5402 c046a42c-6fe2-441c-8c8c-71466251a162
-