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>
#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
{
return "max";
}
+
+abi_ulong get_elf_hwcap(CPUState *cs)
+{
+ return cpu_env(cs)->features[FEAT_1_EDX];
+}
#ifndef I386_TARGET_ELF_H
#define I386_TARGET_ELF_H
+#define HAVE_ELF_HWCAP 1
+
#endif
/* 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);
{
return "max";
}
+
+abi_ulong get_elf_hwcap(CPUState *cs)
+{
+ return cpu_env(cs)->features[FEAT_1_EDX];
+}
#ifndef X86_64_TARGET_ELF_H
#define X86_64_TARGET_ELF_H
+#define HAVE_ELF_HWCAP 1
+
#endif