aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2021-10-18bsd-user: Add stop_all_tasksWarner Losh
Similar to the same function in linux-user: this stops all the current tasks. Signed-off-by: Stacey Son <sson@FreeBSD.org> Signed-off-by: Warner Losh <imp@bsdimp.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Kyle Evans <kevans@FreeBSD.org>
2021-10-18bsd-user: Remove used from TaskStateWarner Losh
The 'used' field in TaskState is write only. Remove it from TaskState. 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>
2021-10-18bsd-user/target_os_elf: If ELF_HWCAP2 is defined, publish itWarner Losh
Some architectures publish AT_HWCAP2 as well as AT_HWCAP. Those architectures will define ELF_HWCAP2 in their target_arch_elf.h files for the value for this process. If it is defined, then publish it. 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>
2021-10-18bsd-user/target_os_elf.h: Remove fallback ELF_HWCAP and reorderWarner Losh
All architectures have a ELF_HWCAP, so remove the fallback ifdef. Place ELF_HWCAP in the same order as on native FreeBSD. 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>
2021-10-18bsd-user: move TARGET_MC_GET_CLEAR_RET to target_os_signal.hWarner Losh
Move TARGET_MC_GET_CLEAR_RET to freebsd/target_os_signal.h since it's architecture agnostic on FreeBSD. 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>
2021-10-18bsd-user/errno_defs.h: Add internal error numbersStacey Son
To emulate signals and interrupted system calls, we need to have the same mechanisms we have in the kernel, including these errno values. Signed-off-by: Stacey Son <sson@FreeBSD.org> Signed-off-by: Warner Losh <imp@bsdimp.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Kyle Evans <kevans@FreeBSD.org>
2021-10-18bsd-user: export get_errno and is_error from syscall.cWarner Losh
Make get_errno and is_error global so files other than syscall.c can use them. 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>
2021-10-18bsd-user: TARGET_RESET define is unused, remove itWarner Losh
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>
2021-10-18bsd-user/strace.list: Remove support for FreeBSD versions older than 12.0Warner Losh
Signed-off-by: Warner Losh <imp@bsdimp.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Kyle Evans <kevans@FreeBSD.org>
2021-10-18bsd-user/target_os-user.h: Remove support for FreeBSD older than 12.0Warner Losh
Signed-off-by: Warner Losh <imp@bsdimp.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Kyle Evans <kevans@FreeBSD.org>
2021-10-18meson: *-user: only descend into *-user when configuredWarner Losh
To increase flexibility, only descend into *-user when that is configured. This allows *-user to selectively include directories based on the host OS which may not exist on all hosts. Adopt Paolo's suggestion of checking the configuration in the directories that know about the configuration. Message-Id: <20210926220103.1721355-2-f4bug@amsat.org> Message-Id: <20210926220103.1721355-3-f4bug@amsat.org> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Warner Losh <wlosh@bsdimp.com> Acked-by: Paolo Bonzini <pbonzinni@redhat.com> Reviewed-by: Kyle Evans <kevans@FreeBSD.org>
2021-10-18bsd-user/mmap.c: assert that target_mprotect cannot failWarner Losh
Similar to the equivalent linux-user change 86abac06c14. 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>
2021-10-18bsd-user/mmap.c: Implement MAP_EXCL, required by jemalloc in headKyle Evans
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>
2021-10-18bsd-user/mmap.c: Don't mmap fd == -1 independently from MAP_ANON flagWarner Losh
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>
2021-10-18bsd-user/mmap.c: Convert to qemu_log logging for mmap debuggingWarner Losh
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>
2021-10-17bsd-user/mmap.c: mmap prefer MAP_ANON for BSDWarner Losh
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>
2021-10-17bsd-user/mmap.c: mmap return ENOMEM on overflowWarner Losh
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>
2021-10-17bsd-user/mmap.c: MAP_ symbols are defined, so no need for ifdefsWarner Losh
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>
2021-10-17bsd-user/mmap.c: check pread's return value to fix warnings with _FORTIFY_SOURCEMikaël Urankar
Simmilar to the equivalent linux-user: commit fb7e378cf9c, 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>
2021-10-17bsd-user/mmap.c: Always zero MAP_ANONYMOUS memory in mmap_frag()Mikaël Urankar
Similar to the equivalent linux-user commit e6deac9cf99 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>
2021-10-16Merge remote-tracking branch 'remotes/rth/tags/pull-tcg-20211016' into stagingRichard Henderson
Move gdb singlestep to generic code Fix cpu_common_props # gpg: Signature made Sat 16 Oct 2021 11:13:54 AM PDT # gpg: using RSA key 7A481E78868B4DB6A85A05C064DF38E8AF7E215F # gpg: issuer "richard.henderson@linaro.org" # gpg: Good signature from "Richard Henderson <richard.henderson@linaro.org>" [ultimate] * remotes/rth/tags/pull-tcg-20211016: (24 commits) Revert "cpu: Move cpu_common_props to hw/core/cpu.c" target/xtensa: Drop check for singlestep_enabled target/tricore: Drop check for singlestep_enabled target/sh4: Drop check for singlestep_enabled target/s390x: Drop check for singlestep_enabled target/rx: Drop checks for singlestep_enabled target/riscv: Remove exit_tb and lookup_and_goto_ptr target/riscv: Remove dead code after exception target/ppc: Drop exit checks for singlestep_enabled target/openrisc: Drop checks for singlestep_enabled target/mips: Drop exit checks for singlestep_enabled target/mips: Fix single stepping target/microblaze: Drop checks for singlestep_enabled target/microblaze: Check CF_NO_GOTO_TB for DISAS_JUMP target/m68k: Drop checks for singlestep_enabled target/i386: Drop check for singlestep_enabled target/i386: Check CF_NO_GOTO_TB for dc->jmp_opt target/hppa: Drop checks for singlestep_enabled target/arm: Drop checks for singlestep_enabled target/hexagon: Drop checks for singlestep_enabled ... Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2021-10-15Revert "cpu: Move cpu_common_props to hw/core/cpu.c"Richard Henderson
This reverts commit 1b36e4f5a5de585210ea95f2257839c2312be28f. Despite a comment saying why cpu_common_props cannot be placed in a file that is compiled once, it was moved anyway. Revert that. Since then, Property is not defined in hw/core/cpu.h, so it is now easier to declare a function to install the properties rather than the Property array itself. Cc: Eduardo Habkost <ehabkost@redhat.com> Suggested-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2021-10-15target/xtensa: Drop check for singlestep_enabledRichard Henderson
GDB single-stepping is now handled generically. Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2021-10-15target/tricore: Drop check for singlestep_enabledRichard Henderson
GDB single-stepping is now handled generically. Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2021-10-15target/sh4: Drop check for singlestep_enabledRichard Henderson
GDB single-stepping is now handled generically. Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2021-10-15target/s390x: Drop check for singlestep_enabledRichard Henderson
GDB single-stepping is now handled generically. Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2021-10-15target/rx: Drop checks for singlestep_enabledRichard Henderson
GDB single-stepping is now handled generically. Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2021-10-15target/riscv: Remove exit_tb and lookup_and_goto_ptrRichard Henderson
GDB single-stepping is now handled generically, which means we don't need to do anything in the wrappers. Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2021-10-15target/riscv: Remove dead code after exceptionRichard Henderson
We have already set DISAS_NORETURN in generate_exception, which makes the exit_tb unreachable. Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2021-10-15target/ppc: Drop exit checks for singlestep_enabledRichard Henderson
GDB single-stepping is now handled generically. Reuse gen_debug_exception to handle architectural debug exceptions. Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2021-10-15target/openrisc: Drop checks for singlestep_enabledRichard Henderson
GDB single-stepping is now handled generically. Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2021-10-15target/mips: Drop exit checks for singlestep_enabledRichard Henderson
GDB single-stepping is now handled generically. Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2021-10-15target/mips: Fix single steppingRichard Henderson
As per an ancient comment in mips_tr_translate_insn about the expectations of gdb, when restarting the insn in a delay slot we also re-execute the branch. Which means that we are expected to execute two insns in this case. This has been broken since 8b86d6d2580, where we forced max_insns to 1 while single-stepping. This resulted in an exit from the translator loop after the branch but before the delay slot is translated. Increase the max_insns to 2 for this case. In addition, bypass the end-of-page check, for when the branch itself ends the page. Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2021-10-15target/microblaze: Drop checks for singlestep_enabledRichard Henderson
GDB single-stepping is now handled generically. Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2021-10-15target/microblaze: Check CF_NO_GOTO_TB for DISAS_JUMPRichard Henderson
We were using singlestep_enabled as a proxy for whether translator_use_goto_tb would always return false. Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2021-10-15target/m68k: Drop checks for singlestep_enabledRichard Henderson
GDB single-stepping is now handled generically. Acked-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2021-10-15target/i386: Drop check for singlestep_enabledRichard Henderson
GDB single-stepping is now handled generically. Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2021-10-15target/i386: Check CF_NO_GOTO_TB for dc->jmp_optRichard Henderson
We were using singlestep_enabled as a proxy for whether translator_use_goto_tb would always return false. Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2021-10-15target/hppa: Drop checks for singlestep_enabledRichard Henderson
GDB single-stepping is now handled generically. Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2021-10-15target/arm: Drop checks for singlestep_enabledRichard Henderson
GDB single-stepping is now handled generically. Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2021-10-15target/hexagon: Drop checks for singlestep_enabledRichard Henderson
GDB single-stepping is now handled generically. Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2021-10-15target/cris: Drop checks for singlestep_enabledRichard Henderson
GDB single-stepping is now handled generically. Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2021-10-15target/avr: Drop checks for singlestep_enabledRichard Henderson
GDB single-stepping is now handled generically. Tested-by: Michael Rolnik <mrolnik@gmail.com> Reviewed-by: Michael Rolnik <mrolnik@gmail.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2021-10-15target/alpha: Drop checks for singlestep_enabledRichard Henderson
GDB single-stepping is now handled generically. Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2021-10-15accel/tcg: Handle gdb singlestep in cpu_tb_execRichard Henderson
Currently the change in cpu_tb_exec is masked by the debug exception being raised by the translators. But this allows us to remove that code. Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2021-10-15Merge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2021-10-15' into ↵Richard Henderson
staging nbd patches for 2021-10-15 - Vladimir Sementsov-Ogievskiy: Consistent use of 64-bit parameters in block operations - Hanna Reitz: Silence 32-bit compiler warning # gpg: Signature made Fri 15 Oct 2021 02:08:10 PM PDT # gpg: using RSA key 71C2CC22B1C4602927D2F3AAA7A16B4A2527436A # gpg: Good signature from "Eric Blake <eblake@redhat.com>" [full] # gpg: aka "Eric Blake (Free Software Programmer) <ebb9@byu.net>" [full] # gpg: aka "[jpeg image of size 6874]" [full] * remotes/ericb/tags/pull-nbd-2021-10-15: block-backend: update blk_co_pwrite() and blk_co_pread() wrappers block-backend: fix blk_co_flush prototype to mention coroutine_fn block-backend: drop INT_MAX restriction from blk_check_byte_request() block-backend: blk_pread, blk_pwrite: rename count parameter to bytes block-backend: convert blk_aio_ functions to int64_t bytes paramter block-backend: convert blk_co_copy_range to int64_t bytes block-backend: convert blk_foo wrappers to use int64_t bytes parameter block-backend: drop blk_prw, use block-coroutine-wrapper block-coroutine-wrapper.py: support BlockBackend first argument block-backend: rename _do_ helper functions to _co_do_ block-backend: convert blk_co_pdiscard to int64_t bytes block-backend: convert blk_co_pwritev_part to int64_t bytes block-backend: make blk_co_preadv() 64bit block-backend: blk_check_byte_request(): int64_t bytes qcow2: Silence clang -m32 compiler warning Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2021-10-15block-backend: update blk_co_pwrite() and blk_co_pread() wrappersVladimir Sementsov-Ogievskiy
Make bytes argument int64_t to be consistent with modern block-layer. Callers should be OK with it as type becomes wider. What is inside functions? - Conversion from int64_t to size_t. Still, we can't have a buffer larger than SIZE_MAX, therefore bytes should not be larger than SIZE_MAX as well. Add an assertion. - Passing to blk_co_pwritev() / blk_co_preadv() which already has int64_t bytes argument. Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Message-Id: <20211007175243.642516-2-vsementsov@virtuozzo.com> Reviewed-by: Eric Blake <eblake@redhat.com> [eblake: spelling fix] Signed-off-by: Eric Blake <eblake@redhat.com>
2021-10-15block-backend: fix blk_co_flush prototype to mention coroutine_fnVladimir Sementsov-Ogievskiy
We already have this marker for the blk_co_flush function declaration in block/block-backend.c. Add it in the header too. Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Message-Id: <20211007175243.642516-1-vsementsov@virtuozzo.com> Reviewed-by: Eric Blake <eblake@redhat.com> [eblake: wording tweak] Signed-off-by: Eric Blake <eblake@redhat.com>
2021-10-15block-backend: drop INT_MAX restriction from blk_check_byte_request()Vladimir Sementsov-Ogievskiy
blk_check_bytes_request is called from blk_co_do_preadv, blk_co_do_pwritev_part, blk_co_do_pdiscard and blk_co_copy_range before (maybe) calling throttle_group_co_io_limits_intercept() (which has int64_t argument) and then calling corresponding bdrv_co_ function. bdrv_co_ functions are OK with int64_t bytes as well. So dropping the check for INT_MAX we just get same restrictions as in bdrv_ layer: discard and write-zeroes goes through bdrv_check_qiov_request() and are allowed to be 64bit. Other requests go through bdrv_check_request32() and still restricted by INT_MAX boundary. Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Message-Id: <20211006131718.214235-13-vsementsov@virtuozzo.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Eric Blake <eblake@redhat.com>
2021-10-15block-backend: blk_pread, blk_pwrite: rename count parameter to bytesVladimir Sementsov-Ogievskiy
To be consistent with declarations in include/sysemu/block-backend.h. Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Message-Id: <20211006131718.214235-12-vsementsov@virtuozzo.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Eric Blake <eblake@redhat.com>