]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
linux-user: Move get_elf_hwcap to {i386,x86_64}/elfload.c
authorRichard Henderson <richard.henderson@linaro.org>
Mon, 28 Jul 2025 06:34:19 +0000 (20:34 -1000)
committerRichard Henderson <richard.henderson@linaro.org>
Wed, 27 Aug 2025 20:39:25 +0000 (06:39 +1000)
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/elfload.c
linux-user/i386/elfload.c
linux-user/i386/target_elf.h
linux-user/loader.h
linux-user/x86_64/elfload.c
linux-user/x86_64/target_elf.h

index 4ca8c39dc26b2d5cc86daa28320f098545d57e04..0c62c249e9f1eb8efe5ecd6beea1023bcd2d3130 100644 (file)
@@ -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
index f92adb73085b9b094e2f7a0132162b4476fdbb17..f99336e73c09c558c97e45018bcdabeebbf216fb 100644 (file)
@@ -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];
+}
index e6f0d8fa4e6796eeddfbd3052cd7b40013bc0e04..802395af3a0417fe5723ee52d81468372f70a52c 100644 (file)
@@ -8,4 +8,6 @@
 #ifndef I386_TARGET_ELF_H
 #define I386_TARGET_ELF_H
 
+#define HAVE_ELF_HWCAP          1
+
 #endif
index 75ee9975a08d33f5654f2c55ba5d5076965842a1..457bb36daa4d31d64ab4250ca44ac2f574f363e8 100644 (file)
@@ -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);
index f92adb73085b9b094e2f7a0132162b4476fdbb17..f99336e73c09c558c97e45018bcdabeebbf216fb 100644 (file)
@@ -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];
+}
index 5849f96350161335f57e3e34cade1be0d489da08..03483bad57360c063ba9035b305338ea2ad8b31a 100644 (file)
@@ -8,4 +8,6 @@
 #ifndef X86_64_TARGET_ELF_H
 #define X86_64_TARGET_ELF_H
 
+#define HAVE_ELF_HWCAP          1
+
 #endif