Gustavo Romero and Alex Bennée
4d6d8a05a0
linux-user: Move tswap_siginfo out of target code
...
Move tswap_siginfo from target code to handle_pending_signal. This will
allow some cleanups and having the siginfo ready to be used in gdbstub.
Signed-off-by: Gustavo Romero <gustavo.romero@linaro.org >
Suggested-by: Richard Henderson <richard.henderson@linaro.org >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Message-Id: <20240309030901.1726211-3-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
e4e5cb4a54
{linux,bsd}-user: Introduce get_task_state()
...
A CPU's TaskState is stored in the CPUState's void *opaque field,
accessing which is somewhat awkward due to having to use a cast.
Introduce a wrapper and use it everywhere.
Suggested-by: Alex Bennée <alex.bennee@linaro.org >
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com >
Reviewed-by: Warner Losh <imp@bsdimp.com >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Message-Id: <20240219141628.246823-3-iii@linux.ibm.com >
Signed-off-by: Alex Bennée <alex.bennee@linaro.org >
Message-Id: <20240305121005.3528075-4-alex.bennee@linaro.org >
2024-03-06 12:35:19 +00:00
Richard Henderson and Peter Maydell
681dfc0d55
linux-user/aarch64: Choose SYNC as the preferred MTE mode
...
The API does not generate an error for setting ASYNC | SYNC; that merely
constrains the selection vs the per-cpu default. For qemu linux-user,
choose SYNC as the default.
Cc: qemu-stable@nongnu.org
Reported-by: Gustavo Romero <gustavo.romero@linaro.org >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
Tested-by: Gustavo Romero <gustavo.romero@linaro.org >
Message-id: 20240207025210.8837-2-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org >
2024-02-15 11:30:44 +00:00
Richard Henderson
6400be014f
linux-user/aarch64: Add padding before __kernel_rt_sigreturn
...
Without this padding, an unwind through the signal handler
will pick up the unwind info for the preceding syscall.
This fixes gcc's 30_threads/thread/native_handle/cancel.cc.
Cc: qemu-stable@nongnu.org
Fixes: ee95fae075 ("linux-user/aarch64: Add vdso")
Resolves: https://linaro.atlassian.net/browse/GNU-974
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
Reviewed-by: Alex Bennée <alex.bennee@linaro.org >
Message-Id: <20240202034427.504686-1-richard.henderson@linaro.org >
2024-02-03 16:46:10 +10:00
Stefan Hajnoczi
516fffc993
Merge tag 'pull-lu-20231030' of https://gitlab.com/rth7680/qemu into staging
...
linux-user: Fix guest signal remapping after adjusting SIGABRT
linux-user: Implement VDSOs
* tag 'pull-lu-20231030' of https://gitlab.com/rth7680/qemu : (21 commits)
build: Add update-linux-vdso makefile rule
linux-user: Show vdso address in /proc/pid/maps
linux-user/s390x: Add vdso
linux-user/s390x: Rename __SIGNAL_FRAMESIZE to STACK_FRAME_OVERHEAD
linux-user/ppc: Add vdso
linux-user/loongarch64: Add vdso
linux-user/riscv: Add vdso
linux-user/hppa: Add vdso
linux-user/arm: Add vdso
linux-user/aarch64: Add vdso
linux-user/x86_64: Add vdso
linux-user/i386: Add vdso
linux-user: Add gen-vdso tool
linux-user: Load vdso image if available
linux-user: Replace bprm->fd with bprm->src.fd
linux-user: Use ImageSource in load_symbols
linux-user: Use ImageSource in load_elf_image
linux-user: Do not clobber bprm_buf swapping ehdr
linux-user: Tidy loader_exec
linux-user: Introduce imgsrc_read, imgsrc_read_alloc
...
Conflicts:
linux-user/arm/signal.c
Fix an #include context conflict.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com >
2023-10-31 07:12:40 +09:00
Richard Henderson
ee95fae075
linux-user/aarch64: Add vdso
...
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
2023-10-30 13:41:55 -07:00
Peter Maydell
5a534314a8
target/arm: Move feature test functions to their own header
...
The feature test functions isar_feature_*() now take up nearly
a thousand lines in target/arm/cpu.h. This header file is included
by a lot of source files, most of which don't need these functions.
Move the feature test functions to their own header file.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org >
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Message-id: 20231024163510.2972081-2-peter.maydell@linaro.org
2023-10-27 11:44:32 +01:00
Helge Deller and Richard Henderson
a55b9e7226
linux-user: Emulate /proc/cpuinfo on aarch64 and arm
...
Add emulation for /proc/cpuinfo for arm architecture.
The output below mimics output as seen on debian porterboxes.
aarch64 output example:
processor : 0
model name : ARMv8 Processor rev 0 (v8l)
BogoMIPS : 100.00
Features : swp half thumb fast_mult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae aes pmull sha1 sha2 crc32
CPU implementer : 0x41
CPU architecture: 8
CPU variant : 0x1
CPU part : 0xd07
CPU revision : 0
arm 32-bit output example:
processor : 0
model name : ARMv7 Processor rev 5 (armv7l)
BogoMIPS : 100.00
Features : swp half thumb fast_mult vfp edsp thumbee neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0f
CPU part : 0xc07
CPU revision : 5
Signed-off-by: Helge Deller <deller@gmx.de >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Message-Id: <20230803214450.647040-3-deller@gmx.de >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
2023-09-01 13:33:36 -07:00
Richard Henderson
121c8dd69d
linux-user: Split out cpu/target_proc.h
...
Move the various open_cpuinfo functions into new files.
Move the m68k open_hardware function as well.
All other guest architectures get a boilerplate empty file.
Tested-by: Helge Deller <deller@gmx.de >
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
2023-09-01 13:33:09 -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
2d708164e0
linux-user: Define TASK_UNMAPPED_BASE in $guest/target_mman.h
...
Provide default values that are as close as possible to the
values used by the guest's kernel.
Tested-by: Helge Deller <deller@gmx.de >
Reviewed-by: Helge Deller <deller@gmx.de >
Reviewed-by: Akihiko Odaki <akihiko.odaki@daynix.com >
Reviewed-by: Alex Bennée <alex.bennee@linaro.org >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
2023-08-08 13:24:27 -07:00
Richard Henderson
6edfca9eae
linux-user: Split TARGET_PROT_* out of syscall_defs.h
...
Move the values into the per-target target_mman.h headers
Reviewed-by: Alex Bennée <alex.bennee@linaro.org >
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
Message-Id: <20230707204054.8792-8-richard.henderson@linaro.org >
2023-07-15 08:02:32 +01:00
Mike Frysinger and Laurent Vivier
95fc5ed4a8
linux-user: move target_flat.h to target subdirs
...
This makes target_flat.h behave like every other target_xxx.h header.
It also makes it actually work -- while the current header says adding
a header to the target subdir overrides the common one, it doesn't.
This is for two reasons:
* meson.build adds -Ilinux-user before -Ilinux-user/$arch
* the compiler search path for "target_flat.h" looks in the same dir
as the source file before searching -I paths.
This can be seen with the xtensa port -- the subdir settings aren't
used which breaks stack setup.
Move it to the generic/ subdir and add include stubs like every
other target_xxx.h header is handled.
Signed-off-by: Mike Frysinger <vapier@gentoo.org >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Message-Id: <20230129004625.11228-1-vapier@gentoo.org >
Signed-off-by: Laurent Vivier <laurent@vivier.eu >
2023-02-03 22:55:12 +01:00
Richard Henderson and Peter Maydell
f431855714
target/arm/sme: Rebuild hflags in aarch64_set_svcr()
...
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
Reviewed-by: Fabiano Rosas <farosas@suse.de >
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Message-id: 20230112102436.1913-7-philmd@linaro.org
Message-Id: <20230112004322.161330-1-richard.henderson@linaro.org >
[PMD: Split patch in multiple tiny steps]
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Signed-off-by: Peter Maydell <peter.maydell@linaro.org >
2023-01-23 13:32:38 +00:00
Richard Henderson and Peter Maydell
7f2a01e736
target/arm/sme: Reset SVE state in aarch64_set_svcr()
...
Move arm_reset_sve_state() calls to aarch64_set_svcr().
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
Reviewed-by: Fabiano Rosas <farosas@suse.de >
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Message-id: 20230112102436.1913-5-philmd@linaro.org
Message-Id: <20230112004322.161330-1-richard.henderson@linaro.org >
[PMD: Split patch in multiple tiny steps]
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Signed-off-by: Peter Maydell <peter.maydell@linaro.org >
2023-01-23 13:32:38 +00:00
Richard Henderson and Peter Maydell
2a8af38259
target/arm/sme: Introduce aarch64_set_svcr()
...
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
Reviewed-by: Fabiano Rosas <farosas@suse.de >
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Message-id: 20230112102436.1913-4-philmd@linaro.org
Message-Id: <20230112004322.161330-1-richard.henderson@linaro.org >
[PMD: Split patch in multiple tiny steps]
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Signed-off-by: Peter Maydell <peter.maydell@linaro.org >
2023-01-23 13:32:38 +00:00
Ilya Leoshkevich and Laurent Vivier
9f22020b91
linux-user: Provide MADV_* definitions
...
Provide MADV_* definitions using target_mman.h header, similar to what
kernel does. Most architectures use the same values, with the exception
of alpha and hppa.
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Message-Id: <20220906000839.1672934-2-iii@linux.ibm.com >
Signed-off-by: Laurent Vivier <laurent@vivier.eu >
2022-09-27 09:30:09 +02:00
Richard Henderson and Peter Maydell
24d87c187c
linux-user/aarch64: Implement PR_SME_GET_VL, PR_SME_SET_VL
...
These prctl set the Streaming SVE vector length, which may
be completely different from the Normal SVE vector length.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
Message-id: 20220708151540.18136-43-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org >
2022-07-11 13:43:52 +01:00
Richard Henderson and Peter Maydell
fd72f5d0ba
linux-user: Rename sve prctls
...
Add "sve" to the sve prctl functions, to distinguish
them from the coming "sme" prctls with similar names.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
Message-id: 20220708151540.18136-42-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org >
2022-07-11 13:43:52 +01:00
Richard Henderson and Peter Maydell
78fd56ba13
linux-user/aarch64: Implement SME signal handling
...
Set the SM bit in the SVE record on signal delivery, create the ZA record.
Restore SM and ZA state according to the records present on return.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
Message-id: 20220708151540.18136-41-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org >
2022-07-11 13:43:52 +01:00
Richard Henderson and Peter Maydell
d3b4f7170f
linux-user/aarch64: Move sve record checks into restore
...
Move the checks out of the parsing loop and into the
restore function. This more closely mirrors the code
structure in the kernel, and is slightly clearer.
Reject rather than silently skip incorrect VL and SVE record sizes,
bringing our checks in to line with those the kernel does.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
Message-id: 20220708151540.18136-40-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org >
2022-07-11 13:43:51 +01:00
Richard Henderson and Peter Maydell
8e5e19ee41
linux-user/aarch64: Verify extra record lock succeeded
...
Reviewed-by: Peter Maydell <peter.maydell@linaro.org >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
Message-id: 20220708151540.18136-39-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org >
2022-07-11 13:43:51 +01:00
Richard Henderson and Peter Maydell
affb1a50b9
linux-user/aarch64: Do not allow duplicate or short sve records
...
In parse_user_sigframe, the kernel rejects duplicate sve records,
or records that are smaller than the header. We were silently
allowing these cases to pass, dropping the record.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
Message-id: 20220708151540.18136-38-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org >
2022-07-11 13:43:51 +01:00
Richard Henderson and Peter Maydell
5726597c3b
linux-user/aarch64: Tidy target_restore_sigframe error return
...
Fold the return value setting into the goto, so each
point of failure need not do both.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
Message-id: 20220708151540.18136-37-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org >
2022-07-11 13:43:51 +01:00
Richard Henderson and Peter Maydell
4a29c36316
linux-user/aarch64: Add SM bit to SVE signal context
...
Make sure to zero the currently reserved fields.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
Message-id: 20220708151540.18136-36-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org >
2022-07-11 13:43:51 +01:00