summaryrefslogtreecommitdiffstats
path: root/semihosting
Commit message (Collapse)AuthorAgeFilesLines
...
* semihosting: Simplify softmmu_lock_user_stringRichard Henderson2022-06-281-12/+3Star
| | | | | | | | | | | We are not currently bounding the search to the 1024 bytes that we allocated, possibly overrunning the buffer. Use softmmu_strlen_user to find the length and allocate the correct size from the beginning. Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
* semihosting: Add target_strlen for softmmu-uaccess.hRichard Henderson2022-06-281-0/+49
| | | | | | | | | | | Mirror the interface of the user-only function of the same name. Use probe_access_flags for the common case of ram, and cpu_memory_rw_debug for the uncommon case of mmio. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> --- v3: Use probe_access_flags (pmm)
* semihosting: Move softmmu-uaccess.h functions out of lineRichard Henderson2022-06-282-0/+52
| | | | | | | | Rather that static (and not even inline) functions within a header, move the functions to semihosting/uaccess.c. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
* semihosting: Improve condition for config.c and console.cRichard Henderson2022-06-281-1/+1
| | | | | | | | While CONFIG_SEMIHOSTING is currently only set for softmmu, this will not continue to be true. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
* semihosting: Move exec/softmmu-semi.h to semihosting/softmmu-uaccess.hRichard Henderson2022-06-281-1/+1
| | | | | | | | | We have a subdirectory for semihosting; move this file out of exec. Rename to emphasize the contents are a replacement for the functions in linux-user/bsd-user uaccess.c. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
* semihosting/config: Merge --semihosting-config option groupsPeter Maydell2022-06-101-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Currently we mishandle the --semihosting-config option if the user specifies it on the command line more than once. For example with: --semihosting-config target=gdb --semihosting-config arg=foo,arg=bar the function qemu_semihosting_config_options() is called twice, once for each argument. But that function expects to be called only once, and it always unconditionally sets the semihosting.enabled, semihost_chardev and semihosting.target variables. This means that if any of those options were set anywhere except the last --semihosting-config option on the command line, those settings are ignored. In the example above, 'target=gdb' in the first option is overridden by an implied default 'target=auto' in the second. The QemuOptsList machinery has a flag for handling this kind of "option group is setting global state": by setting .merge_lists = true; we make the machinery merge all the --semihosting-config arguments the user passes into a single set of options and call our qemu_semihosting_config_options() just once. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Luc Michel <luc@lmichel.fr> Message-id: 20220526190053.521505-3-peter.maydell@linaro.org
* linux-user: Clean up arg_start/arg_end confusionRichard Henderson2022-05-231-2/+2
| | | | | | | | | | | | | | | | | | | | We had two sets of variables: arg_start/arg_end, and arg_strings/env_strings. In linuxload.c, we set the first pair to the bounds of the argv strings, but in elfload.c, we set the first pair to the bounds of the argv pointers and the second pair to the bounds of the argv strings. Remove arg_start/arg_end, replacing them with the standard argc/argv/envc/envp values. Retain arg_strings/env_strings with the meaning we were using in elfload.c. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/714 Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20220427025129.160184-1-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
* semihosting: clean up handling of expanded argvAlex Bennée2022-03-231-3/+3
| | | | | | | | | | | | | Another cleanup patch tripped over the fact we weren't being careful in our casting. Fix the casts, allow for a non-const and switch from g_realloc to g_renew. The whole semihosting argument handling could do with some tests though. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20220315121251.2280317-8-alex.bennee@linaro.org>
* semihosting/arm-compat: replace heuristic for softmmu SYS_HEAPINFOAlex Bennée2022-02-281-61/+63
| | | | | | | | | | | | | | | | | | | The previous numbers were a guess at best and rather arbitrary without taking into account anything that might be loaded. Instead of using guesses based on the state of registers implement a new function that: a) scans the MemoryRegions for the largest RAM block b) iterates through all "ROM" blobs looking for the biggest gap The "ROM" blobs include all code loaded via -kernel and the various -device loader techniques. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Cc: Andrew Strauss <astrauss11@gmail.com> Cc: Keith Packard <keithp@keithp.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20220225172021.3493923-18-alex.bennee@linaro.org>
* target/riscv: Replace riscv_cpu_is_32bit with riscv_cpu_mxlRichard Henderson2021-10-211-1/+1
| | | | | | | | | | | | | | | | Shortly, the set of supported XL will not be just 32 and 64, and representing that properly using the enumeration will be imperative. Two places, booting and gdb, intentionally use misa_mxl_max to emphasize the use of the reset value of misa.mxl, and not the current cpu state. Reviewed-by: LIU Zhiwei <zhiwei_liu@c-sky.com> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20211020031709.359469-5-richard.henderson@linaro.org Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
* linux-user: Don't include gdbstub.h in qemu.hPeter Maydell2021-09-131-1/+1
| | | | | | | | | | | | | | | | Currently the linux-user qemu.h pulls in gdbstub.h. There's no real reason why it should do this; include it directly from the C files which require it, and drop the include line in qemu.h. (Note that several of the C files previously relying on this indirect include were going out of their way to only include gdbstub.h conditionally on not CONFIG_USER_ONLY!) Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20210908154405.15417-9-peter.maydell@linaro.org> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
* Do not include cpu.h if it's not really necessaryThomas Huth2021-05-022-2/+0Star
| | | | | | | | Stop including cpu.h in files that don't need it. Signed-off-by: Thomas Huth <thuth@redhat.com> Message-Id: <20210416171314.2074665-4-thuth@redhat.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
* Do not include sysemu/sysemu.h if it's not really necessaryThomas Huth2021-05-022-2/+0Star
| | | | | | | | Stop including sysemu/sysemu.h in files that don't need it. Signed-off-by: Thomas Huth <thuth@redhat.com> Message-Id: <20210416171314.2074665-2-thuth@redhat.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
* hw: Do not include qemu/log.h if it is not necessaryThomas Huth2021-05-021-1/+0Star
| | | | | | | | | | Many files include qemu/log.h without needing it. Remove the superfluous include statements. Signed-off-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Message-Id: <20210328054833.2351597-1-thuth@redhat.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
* semihosting/arm-compat-semi: don't use SET_ARG to report SYS_HEAPINFOAlex Bennée2021-03-241-1/+5
| | | | | | | | | | | | | | | | | As per the spec: the PARAMETER REGISTER contains the address of a pointer to a four-field data block. So we need to follow arg0 and place the results of SYS_HEAPINFO there. Fixes: 3c37cfe0b1 ("semihosting: Change internal common-semi interfaces to use CPUState *") Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Cc: Bug 1915925 <1915925@bugs.launchpad.net> Cc: Keith Packard <keithp@keithp.com> Bug: https://bugs.launchpad.net/bugs/1915925 Message-Id: <20210323165308.15244-8-alex.bennee@linaro.org>
* semihosting/arm-compat-semi: unify GET/SET_ARG helpersAlex Bennée2021-03-241-37/+19Star
| | | | | | | | | | | | | | | >>>From the semihosting point of view what we want to know is the current mode of the processor. Unify this into a single helper and allow us to use the same GET/SET_ARG helpers for the rest of the code. Having the helper will also be useful later. Note: we aren't currently testing riscv32 due to missing toolchain for check-tcg tests. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Keith Packard <keithp@keithp.com> Message-Id: <20210323165308.15244-7-alex.bennee@linaro.org>
* semihosting: Move hw/semihosting/ -> semihosting/Philippe Mathieu-Daudé2021-03-106-0/+1726
With the exception of hw/core/, the hw/ directory only contains device models used in system emulation. Semihosting is also used by user emulation. As a generic feature, move it out of hw/ directory. Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20210226131356.3964782-3-f4bug@amsat.org> Message-Id: <20210305135451.15427-3-alex.bennee@linaro.org>