diff options
| author | Richard Henderson <richard.henderson@linaro.org> | 2025-07-27 20:34:19 -1000 |
|---|---|---|
| committer | Richard Henderson <richard.henderson@linaro.org> | 2025-08-28 06:39:25 +1000 |
| commit | 39476538942f0ae1eff5e03f08399ef1eeca0cc0 (patch) | |
| tree | 6a96d28f701e965e353df59348d8e9a3e4d30ec4 /linux-user | |
| parent | af880af8d4624b619c9d44ff5d27440ae064f99a (diff) | |
| download | focaccia-qemu-39476538942f0ae1eff5e03f08399ef1eeca0cc0.tar.gz focaccia-qemu-39476538942f0ae1eff5e03f08399ef1eeca0cc0.zip | |
linux-user: Move get_elf_hwcap to {i386,x86_64}/elfload.c
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>
Diffstat (limited to 'linux-user')
| -rw-r--r-- | linux-user/elfload.c | 9 | ||||
| -rw-r--r-- | linux-user/i386/elfload.c | 5 | ||||
| -rw-r--r-- | linux-user/i386/target_elf.h | 2 | ||||
| -rw-r--r-- | linux-user/loader.h | 3 | ||||
| -rw-r--r-- | linux-user/x86_64/elfload.c | 5 | ||||
| -rw-r--r-- | linux-user/x86_64/target_elf.h | 2 |
6 files changed, 18 insertions, 8 deletions
diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 4ca8c39dc2..0c62c249e9 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -148,14 +148,7 @@ typedef abi_int target_pid_t; #ifdef TARGET_I386 -#define ELF_HWCAP get_elf_hwcap() - -static uint32_t get_elf_hwcap(void) -{ - X86CPU *cpu = X86_CPU(thread_cpu); - - return cpu->env.features[FEAT_1_EDX]; -} +#define ELF_HWCAP get_elf_hwcap(thread_cpu) #ifdef TARGET_X86_64 #define ELF_CLASS ELFCLASS64 diff --git a/linux-user/i386/elfload.c b/linux-user/i386/elfload.c index f92adb7308..f99336e73c 100644 --- a/linux-user/i386/elfload.c +++ b/linux-user/i386/elfload.c @@ -9,3 +9,8 @@ const char *get_elf_cpu_model(uint32_t eflags) { return "max"; } + +abi_ulong get_elf_hwcap(CPUState *cs) +{ + return cpu_env(cs)->features[FEAT_1_EDX]; +} diff --git a/linux-user/i386/target_elf.h b/linux-user/i386/target_elf.h index e6f0d8fa4e..802395af3a 100644 --- a/linux-user/i386/target_elf.h +++ b/linux-user/i386/target_elf.h @@ -8,4 +8,6 @@ #ifndef I386_TARGET_ELF_H #define I386_TARGET_ELF_H +#define HAVE_ELF_HWCAP 1 + #endif diff --git a/linux-user/loader.h b/linux-user/loader.h index 75ee9975a0..457bb36daa 100644 --- a/linux-user/loader.h +++ b/linux-user/loader.h @@ -101,6 +101,9 @@ extern unsigned long guest_stack_size; /* Note that Elf32 and Elf64 use uint32_t for e_flags. */ const char *get_elf_cpu_model(uint32_t eflags); +#if defined(TARGET_I386) || defined(TARGET_X86_64) +abi_ulong get_elf_hwcap(CPUState *cs); +#endif #if defined(TARGET_S390X) || defined(TARGET_AARCH64) || defined(TARGET_ARM) uint32_t get_elf_hwcap(void); const char *elf_hwcap_str(uint32_t bit); diff --git a/linux-user/x86_64/elfload.c b/linux-user/x86_64/elfload.c index f92adb7308..f99336e73c 100644 --- a/linux-user/x86_64/elfload.c +++ b/linux-user/x86_64/elfload.c @@ -9,3 +9,8 @@ const char *get_elf_cpu_model(uint32_t eflags) { return "max"; } + +abi_ulong get_elf_hwcap(CPUState *cs) +{ + return cpu_env(cs)->features[FEAT_1_EDX]; +} diff --git a/linux-user/x86_64/target_elf.h b/linux-user/x86_64/target_elf.h index 5849f96350..03483bad57 100644 --- a/linux-user/x86_64/target_elf.h +++ b/linux-user/x86_64/target_elf.h @@ -8,4 +8,6 @@ #ifndef X86_64_TARGET_ELF_H #define X86_64_TARGET_ELF_H +#define HAVE_ELF_HWCAP 1 + #endif |