Nguyen Dinh Phi and Richard Henderson
2ee80bce4f
linux-user: replace calloc() with g_new0()
...
Use glib allocation as recommended by the coding convention
Signed-off-by: Nguyen Dinh Phi <phind.uet@gmail.com >
Message-Id: <20240317171747.1642207-1-phind.uet@gmail.com >
Reviewed-by: Alex Bennée <alex.bennee@linaro.org >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
2024-04-09 07:43:31 -10:00
Gustavo Romero and Alex Bennée
f84e313e02
gdbstub: Save target's siginfo
...
Save target's siginfo into gdbserver_state so it can be used later, for
example, in any stub that requires the target's si_signo and si_code.
This change affects only linux-user mode.
Signed-off-by: Gustavo Romero <gustavo.romero@linaro.org >
Suggested-by: Richard Henderson <richard.henderson@linaro.org >
Message-Id: <20240309030901.1726211-4-gustavo.romero@linaro.org >
Signed-off-by: Alex Bennée <alex.bennee@linaro.org >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
2024-03-13 11:43:52 +00:00
Gustavo Romero and Alex Bennée
b6617e937e
gdbstub: Rename back gdb_handlesig
...
Rename gdb_handlesig_reason back to gdb_handlesig. There is no need to
add a wrapper for gdb_handlesig and rename it when a new parameter is
added.
Signed-off-by: Gustavo Romero <gustavo.romero@linaro.org >
Reviewed-by: Alex Bennée <alex.bennee@linaro.org >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Message-Id: <20240309030901.1726211-2-gustavo.romero@linaro.org >
Signed-off-by: Alex Bennée <alex.bennee@linaro.org >
2024-03-13 11:43:52 +00:00
Ilya Leoshkevich and Alex Bennée
6604b05763
gdbstub: Call gdbserver_fork() both in parent and in child
...
The upcoming follow-fork-mode child support requires post-fork message
exchange between the parent and the child. Prepare gdbserver_fork() for
this purpose. Rename it to gdbserver_fork_end() to better reflect its
purpose.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com >
Message-Id: <20240219141628.246823-8-iii@linux.ibm.com >
Signed-off-by: Alex Bennée <alex.bennee@linaro.org >
Message-Id: <20240305121005.3528075-9-alex.bennee@linaro.org >
2024-03-06 12:35:19 +00:00
Ilya Leoshkevich and Alex Bennée
9d456e092d
{linux,bsd}-user: Pass pid to gdbserver_fork()
...
The upcoming follow-fork-mode child support requires knowing the child
pid. Pass it down.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com >
Message-Id: <20240219141628.246823-7-iii@linux.ibm.com >
Signed-off-by: Alex Bennée <alex.bennee@linaro.org >
Message-Id: <20240305121005.3528075-8-alex.bennee@linaro.org >
2024-03-06 12:35:19 +00:00
Ilya Leoshkevich and Alex Bennée
4edc98fcc8
{linux,bsd}-user: Pass pid to fork_end()
...
The upcoming follow-fork-mode child support requires knowing the child
pid. Pass it down.
Reviewed-by: Alex Bennée <alex.bennee@linaro.org >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com >
Message-Id: <20240219141628.246823-6-iii@linux.ibm.com >
Signed-off-by: Alex Bennée <alex.bennee@linaro.org >
Message-Id: <20240305121005.3528075-7-alex.bennee@linaro.org >
2024-03-06 12:35:19 +00:00
Ilya Leoshkevich and Alex Bennée
3d6ed98da8
gdbstub: Introduce gdbserver_fork_start()
...
The upcoming follow-fork-mode child support requires knowing when
fork() is about to happen in order to initialize its state. Add a hook
for that.
Reviewed-by: Alex Bennée <alex.bennee@linaro.org >
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com >
Message-Id: <20240219141628.246823-5-iii@linux.ibm.com >
Signed-off-by: Alex Bennée <alex.bennee@linaro.org >
Message-Id: <20240305121005.3528075-6-alex.bennee@linaro.org >
2024-03-06 12:35:19 +00:00
Ilya Leoshkevich and Alex Bennée
d4e1369abe
{linux,bsd}-user: Update ts_tid after fork()
...
Currently ts_tid contains the parent tid after fork(), which is not
correct. So far it has not affected anything, but the upcoming
follow-fork-mode child support relies on the correct value, so fix it.
Reviewed-by: Alex Bennée <alex.bennee@linaro.org >
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com >
Reviewed-by: Warner Losh <imp@bsdimp.com >
Message-Id: <20240219141628.246823-4-iii@linux.ibm.com >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Signed-off-by: Alex Bennée <alex.bennee@linaro.org >
Message-Id: <20240305121005.3528075-5-alex.bennee@linaro.org >
2024-03-06 12:35:19 +00:00
Richard Henderson
78b79b2cb3
linux-user: Bound mmap_min_addr by host page size
...
Bizzarely, it is possible to set /proc/sys/vm/mmap_min_addr
to a value below the host page size. Fix that.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com >
Acked-by: Helge Deller <deller@gmx.de >
Message-Id: <20240102015808.132373-32-richard.henderson@linaro.org >
2024-02-29 11:35:37 -10:00
Richard Henderson
ff8a8bbc2a
linux-user: Allow TARGET_PAGE_BITS_VARY
...
If set, match the host and guest page sizes.
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
Acked-by: Helge Deller <deller@gmx.de >
Message-Id: <20240102015808.132373-30-richard.henderson@linaro.org >
2024-02-29 11:35:37 -10:00
Richard Henderson
01e449809b
*-user: Deprecate and disable -p pagesize
...
This option controls the host page size. From the mis-usage in
our own testsuite, this is easily confused with guest page size.
The only thing that occurs when changing the host page size is
that stuff breaks, because one cannot actually change the host
page size. Therefore reject all but the no-op setting as part
of the deprecation process.
Reviewed-by: Warner Losh <imp@bsdimp.com >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Acked-by: Helge Deller <deller@gmx.de >
Message-Id: <20240102015808.132373-27-richard.henderson@linaro.org >
2024-02-29 11:35:37 -10:00
Richard Henderson
13c1339755
linux-user: Remove qemu_host_page_size from main
...
Use qemu_real_host_page_size() instead.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com >
Acked-by: Helge Deller <deller@gmx.de >
Message-Id: <20240102015808.132373-16-richard.henderson@linaro.org >
2024-02-29 11:35:36 -10:00
Ilya Leoshkevich and Richard Henderson
327b75a469
accel/tcg: Move perf and debuginfo support to tcg/
...
tcg/ should not depend on accel/tcg/, but perf and debuginfo
support provided by the latter are being used by tcg/tcg.c.
Since that's the only user, move both to tcg/.
Suggested-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Message-ID: <20231212003837.64090-5-iii@linux.ibm.com >
Message-Id: <20240125054631.78867-5-philmd@linaro.org >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
2024-01-29 21:04:10 +10:00
Philippe Mathieu-Daudé and Thomas Huth
c61a0d31f8
cli: Remove deprecated '-singlestep' command line option
...
This option has been deprecated before the 8.1 release,
in commit 12fd0f41d0 ("Document that -singlestep command
line option is deprecated"). Time to drop it.
Inspired-by: Thomas Huth <thuth@redhat.com >
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Reviewed-by: Thomas Huth <thuth@redhat.com >
Reviewed-by: Markus Armbruster <armbru@redhat.com >
Message-ID: <20240117151430.29235-4-philmd@linaro.org >
Signed-off-by: Thomas Huth <thuth@redhat.com >
2024-01-19 11:38:32 +01:00
Philippe Mathieu-Daudé
3c55dd5896
hw/cpu: Clean up global variable shadowing
...
Fix:
hw/core/machine.c:1302:22: error: declaration shadows a variable in the global scope [-Werror,-Wshadow]
const CPUArchId *cpus = possible_cpus->cpus;
^
hw/core/numa.c:69:17: error: declaration shadows a variable in the global scope [-Werror,-Wshadow]
uint16List *cpus = NULL;
^
hw/acpi/aml-build.c:2005:20: error: declaration shadows a variable in the global scope [-Werror,-Wshadow]
CPUArchIdList *cpus = ms->possible_cpus;
^
hw/core/machine-smp.c:77:14: error: declaration shadows a variable in the global scope [-Werror,-Wshadow]
unsigned cpus = config->has_cpus ? config->cpus : 0;
^
include/hw/core/cpu.h:589:17: note: previous declaration is here
extern CPUTailQ cpus;
^
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Reviewed-by: Ani Sinha <anisinha@redhat.com >
Message-Id: <20231010115048.11856-2-philmd@linaro.org >
2023-11-07 13:08:48 +01:00
Richard Henderson
d7ec12f83c
tcg: Split out tcg init functions to tcg/startup.h
...
The tcg/tcg.h header is a big bucket, containing stuff related to
the translators and the JIT backend. The places that initialize
tcg or create new threads do not need all of that, so split out
these three functions to a new header.
Suggested-by: Peter Maydell <peter.maydell@linaro.org >
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
2023-10-04 11:03:54 -07:00
Richard Henderson
935f75ae63
tcg: Remove argument to tcg_prologue_init
...
We can load tcg_ctx just as easily within the callee.
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
2023-10-04 11:03:54 -07:00
Richard Henderson
b77af26e97
accel/tcg: Replace CPUState.env_ptr with cpu_env()
...
Reviewed-by: Anton Johansson <anjo@rev.ng >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
2023-10-04 11:03:54 -07:00
Richard Henderson
da2b71fab6
linux-user: Define ELF_ET_DYN_BASE in $guest/target_mman.h
...
Copy each guest kernel's default value, then bound it
against reserved_va or the host address space.
Tested-by: Helge Deller <deller@gmx.de >
Reviewed-by: Helge Deller <deller@gmx.de >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
2023-08-08 13:27:15 -07:00
Richard Henderson
c8fb5cf97d
linux-user: Adjust task_unmapped_base for reserved_va
...
Ensure that the chosen values for mmap_next_start and
task_unmapped_base are within the guest address space.
Tested-by: Helge Deller <deller@gmx.de >
Reviewed-by: Akihiko Odaki <akihiko.odaki@daynix.com >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
2023-08-08 13:24:21 -07:00
Richard Henderson
0662a626a7
linux-user: Properly set image_info.brk in flatload
...
The heap starts at "brk" not "start_brk". With this fixed,
image_info.start_brk is unused and may be removed.
Tested-by: Helge Deller <deller@gmx.de >
Reviewed-by: Helge Deller <deller@gmx.de >
Reviewed-by: Akihiko Odaki <akihiko.odaki@daynix.com >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
2023-08-06 16:46:13 -07:00
Andreas Schwab and Philippe Mathieu-Daudé
7f750efcaa
linux-user, bsd-user: Preserve incoming order of environment variables in the target
...
Do not reverse the order of environment variables in the target environ
array relative to the incoming environ order. Some testsuites depend on a
specific order, even though it is not defined by any standard.
Signed-off-by: Andreas Schwab <schwab@suse.de >
Reviewed-by: Warner Losh <imp@bsdimp.com >
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Message-Id: <mvmlejfsivd.fsf@suse.de >
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org >
2023-06-13 11:28:53 +02:00
Richard Henderson
19200a0edf
Merge tag 'linux-user-for-8.1-pull-request' of https://github.com/vivier/qemu into staging
...
linux-user pull request 20230512-v4
add open_tree(), move_mount()
add /proc/cpuinfo for riscv
fixes and cleanup
# -----BEGIN PGP SIGNATURE-----
#
# iQJGBAABCAAwFiEEzS913cjjpNwuT1Fz8ww4vT8vvjwFAmRkiZISHGxhdXJlbnRA
# dml2aWVyLmV1AAoJEPMMOL0/L748FdIP/RC1JaCftkP7ajAstNbZLMLegMxjUYHV
# TrdhsMOsm804ZmLgTqqfS3bJ080mIHup0xUnHBckcEtUcwaz54cJ1BAR2WlM3/8A
# t3fHMt3PDkh3OPd/3AnmpLE8XRh7yBztirPYfZc6SKqnFzT0TZrwBoQnwprEnZ5r
# c0gbrgLZLunZhrWU1BbQmuIufW1qDoQo4PzwnyZeux1fHA1/v/dx3wgSLpv3V4k6
# x0Kj8TvtMUU4/io2RqYF4jKopfhwsh0jnr9rlOmydOExalKq1VbRptJI2UC4KVOY
# MZuApF1EaZfrW+v/WSlvmzaZ/zRzP1L0X3Xh0wB4J9Rj3057/elXr6bi+R+rM46p
# xGTcti9ahWKP2J4/xrazRw2lfPsLcw/YbqVGG79AX1xLJPCiWq6lamzc/g3ptFnx
# F/RRETe65z7apzF/nzU7SDOsMdN5p4/fMb1SysLuAov5OepNVjNVWyiTgqOHB5uC
# ye+lOYkkvk+qRdMbls/fIcjDQ3C4AjoBWj4QlgRc0/Qf6ac4TkVjzPa70Y6eyzzS
# LEV9D4fXD8EZgYWENNGmbbKPNbtfqc9uR6gXdgkEsKDx/rf5IMf1d6r1C99dhB3A
# nbu0JpFKKY2lhD2oGVPDE3UQMW9DXXhZpDApUBsLNiEwfuoXZee+apH+6jc8tbn6
# r+8LFB1mM9os
# =NfIV
# -----END PGP SIGNATURE-----
# gpg: Signature made Wed 17 May 2023 01:00:18 AM PDT
# gpg: using RSA key CD2F75DDC8E3A4DC2E4F5173F30C38BD3F2FBE3C
# gpg: issuer "laurent@vivier.eu "
# gpg: Good signature from "Laurent Vivier <lvivier@redhat.com >" [undefined]
# gpg: aka "Laurent Vivier <laurent@vivier.eu >" [undefined]
# gpg: aka "Laurent Vivier (Red Hat) <lvivier@redhat.com >" [undefined]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg: There is no indication that the signature belongs to the owner.
# Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F 5173 F30C 38BD 3F2F BE3C
* tag 'linux-user-for-8.1-pull-request' of https://github.com/vivier/qemu :
linux-user: fix getgroups/setgroups allocations
linux-user: Fix mips fp64 executables loading
linux-user: Don't require PROT_READ for mincore
linux-user: Add new flag VERIFY_NONE
linux-user/main: Use list_cpus() instead of cpu_list()
linux-user: Add open_tree() syscall
linux-user: Add move_mount() syscall
linux-user: report ENOTTY for unknown ioctls
linux-user: Emulate /proc/cpuinfo output for riscv
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
2023-05-17 05:42:14 -07:00
Thomas Huth and Laurent Vivier
b67e5cb43b
linux-user/main: Use list_cpus() instead of cpu_list()
...
This way we can get rid of the if'deffery and the XXX comment
here (it's repeated in the list_cpus() function anyway).
Signed-off-by: Thomas Huth <thuth@redhat.com >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Message-Id: <20230424122126.236586-1-thuth@redhat.com >
Signed-off-by: Laurent Vivier <laurent@vivier.eu >
2023-05-17 07:20:29 +02:00
Peter Maydell
e99c1f89b2
linux-user: Add '-one-insn-per-tb' option equivalent to '-singlestep'
...
The '-singlestep' option is confusing, because it doesn't actually
have anything to do with single-stepping the CPU. What it does do
is force TCG emulation to put one guest instruction in each TB,
which can be useful in some situations.
Create a new command line argument -one-insn-per-tb, so we can
document that -singlestep is just a deprecated synonym for it,
and eventually perhaps drop it.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Reviewed-by: Warner Losh <imp@bsdimp.com >
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Message-id: 20230417164041.684562-5-peter.maydell@linaro.org
2023-05-02 15:47:40 +01:00