summary refs log tree commit diff stats
path: root/linux-user/loader.h (follow)
Commit message (Collapse)AuthorAgeFilesLines
* linux-user: Create vdso_sigreturn_region_{start,end}Richard Henderson2025-09-231-0/+2
| | | | | | | These variables will be populated from the vdso, and used for detecting whether we are executing the sigreturn. Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
* linux-user: Move arch_parse_elf_property to aarch64/elfload.cRichard Henderson2025-08-301-0/+5
| | | | | | | | Rename the controlling macro to HAVE_ELF_GNU_PROPERTY to match the other HAVE_* macros. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
* linux-user: Move get_vdso_image_info to arm/elfload.cRichard Henderson2025-08-301-0/+12
| | | | | | | | | Rename from vdso_image_info to avoid a symbol clash. Define HAVE_VDSO_IMAGE_INFO to signal the external definition exists. Provide fallback versions for other targets. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
* linux-user: Move init_guest_commpage to hppa/elfload.cRichard Henderson2025-08-301-2/+0
| | | | | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
* linux-user: Move init_guest_commpage to arm/elfload.cRichard Henderson2025-08-301-1/+1
| | | | | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
* linux-user: Move init_guest_commpage to x86_64/elfload.cRichard Henderson2025-08-301-0/+3
| | | | | | | | Rename INIT_GUEST_COMMPAGE to HAVE_GUEST_COMMPAGE to match the other HAVE_* defines. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
* linux-user: Declare elf_core_copy_regs in loader.hRichard Henderson2025-08-301-0/+3
| | | | | | | Drop the static from all implementations. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
* linux-user: Remove do_init_main_threadRichard Henderson2025-08-281-1/+0
| | | | | | | | All targets have been converted, so we can call init_main_thread directly. Remove do_init_main_thread and HAVE_INIT_MAIN_THREAD. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
* linux-user: Create do_init_main_threadRichard Henderson2025-08-281-3/+2
| | | | | | | | Provide a unified function to initialize the main thread. Keep target_pt_regs isolated to this function. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
* linux-user: Move get_elf_base_platform to mips/elfload.cRichard Henderson2025-08-281-0/+1
| | | | | | | | | Pass in CPUState; define HAVE_ELF_BASE_PLATFORM. Since this was the only instance of ELF_BASE_PLATFORM, go ahead and provide the stub definition for other platforms. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
* linux-user: Move get_elf_platform to arm/elfload.cRichard Henderson2025-08-281-2/+0
| | | | | | | | | | | | | Move the aarch32 get_elf_platform to arm/elfload.c; pass in CPUState. Create a simple version in aarch64/elfload.c, which we must do at the same time because of the ifdef dependency between TARGET_AARCH64 and TARGET_ARM. Since all versions of get_elf_platform now have the same signature, remove the ifdef from the declaration in loader.h. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
* linux-user: Move get_elf_platform to {i386,x86_64}/elfload.cRichard Henderson2025-08-281-0/+3
| | | | | | | | | Move get_elf_platform to i386/elfload.c; pass in CPUState. Create a simple get_elf_platform for x86_64. Introduce HAVE_ELF_PLATFORM. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
* linux-user: Move get_elf_hwcap to riscv/elfload.cRichard Henderson2025-08-281-5/+0
| | | | | | | | | Change the return type to abi_ulong, and pass in the cpu. As this is the last instance of get_elf_hwcap to be converted, remove the ifdef around the declaration in loader.h. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
* linux-user: Move hwcap functions to s390x/elfload.cRichard Henderson2025-08-281-4/+1
| | | | | | | | For get_elf_hwcap, change the return type to abi_ulong and pass in the cpu. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
* linux-user: Move get_elf_hwcap to sh4/elfload.cRichard Henderson2025-08-281-1/+2
| | | | | | | Change the return type to abi_ulong, and pass in the cpu. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
* linux-user: Move get_elf_hwcap to mips/elfload.cRichard Henderson2025-08-281-1/+1
| | | | | | | Change the return type to abi_ulong, and pass in the cpu. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
* linux-user: Move get_elf_hwcap to loongarch64/elfload.cRichard Henderson2025-08-281-1/+2
| | | | | | | Change the return type to abi_ulong, and pass in the cpu. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
* linux-user: Move hwcap functions to ppc/elfload.cRichard Henderson2025-08-281-1/+1
| | | | | | | Change the return type to abi_ulong, and pass in the cpu. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
* linux-user: Move get_elf_hwcap to sparc/elfload.cRichard Henderson2025-08-281-1/+2
| | | | | | | Change the return type to abi_ulong, and pass in the cpu. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
* linux-user: Move hwcap functions to {arm,aarch64}/elfload.cRichard Henderson2025-08-281-6/+4
| | | | | | | | | | For get_elf_hwcap and get_elf_hwcap2, change the return type to abi_ulong, and pass in the cpu. We must do these targets at the same time because of the ifdef dependency between TARGET_AARCH64 and TARGET_ARM. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
* linux-user: Move get_elf_hwcap to {i386,x86_64}/elfload.cRichard Henderson2025-08-281-0/+3
| | | | | | | | | Change the return type to abi_ulong, and pass in the cpu. Duplicate the one line function between i386 and x86_64, as most other additions to elfload.c won't be common. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
* linux-user: Move get_elf_cpu_model to target/elfload.cRichard Henderson2025-08-281-0/+3
| | | | | | | | | | Rename from cpu_get_model to emphasize that this is an elf-specific function. Declare the function once in loader.h. This frees up target_elf.h for other uses. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
* linux-user: Report AArch64 hwcap2 fields above bit 31Peter Maydell2023-11-021-1/+1
| | | | | | | | | | | | | | | | | | | | | The AArch64 ELF hwcap2 field is 64 bits, but our get_elf_hwcap2() works with uint32_t, so it accidentally fails to report any hwcaps over bit 31. Use uint64_t here. The Arm hwcap2 is only 32 bits (because the ELF format makes these fields be the size of "long" in the ABI), but since it shares the prototype declaration for get_elf_hwcap2() it is easier to also expand it to 64 bits. The only hwcap fields we implement already that are affected by this are the HBC and MOPS ones, neither of which were implemented in a previous release, so this doesn't need backporting to older stable branches. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-id: 20231030174000.3792225-3-peter.maydell@linaro.org
* linux-user: Replace bprm->fd with bprm->src.fdRichard Henderson2023-10-301-1/+0
| | | | | | | | There are only a couple of uses of bprm->fd remaining. Migrate to the other field. Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
* linux-user: Introduce imgsrc_read, imgsrc_read_allocRichard Henderson2023-10-301-9/+52
| | | | | | | | | Introduced and initialized, but not yet really used. These will tidy the current tests vs BPRM_BUF_SIZE. 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>
* linux-user: Emulate /proc/cpuinfo on aarch64 and armHelge Deller2023-09-011-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* linux-user/elfload: Introduce elf_hwcap_str() on s390xIlya Leoshkevich2023-06-051-0/+1
| | | | | | | | | It is required for implementing /proc/cpuinfo emulation. Reviewed-by: David Hildenbrand <david@redhat.com> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com> Message-Id: <20230605113950.1169228-4-iii@linux.ibm.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
* linux-user/elfload: Expose get_elf_hwcap() on s390xIlya Leoshkevich2023-06-051-0/+4
| | | | | | | | | It is required for implementing /proc/cpuinfo emulation. Reviewed-by: David Hildenbrand <david@redhat.com> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com> Message-Id: <20230605113950.1169228-3-iii@linux.ibm.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
* linux-user: Split loader-related prototypes into loader.hPeter Maydell2021-09-131-0/+59
Split guest-binary loader prototypes out into a new header loader.h which we include only where required. 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-5-peter.maydell@linaro.org> Signed-off-by: Laurent Vivier <laurent@vivier.eu>