diff options
author | Brad Smith <brad@comstyle.com> | 2024-07-27 23:58:55 -0400 |
---|---|---|
committer | Richard Henderson <richard.henderson@linaro.org> | 2024-07-30 07:59:23 +1000 |
commit | 27fca0a0d560ae704457c5f89e0be658afef034d (patch) | |
tree | 735b9409587ef9aad8b1ad744972887802bd779d /util/cpuinfo-aarch64.c | |
parent | 25268a18550323f6babbcc260838fa09941e5c85 (diff) | |
download | qemu-27fca0a0d560ae704457c5f89e0be658afef034d.zip qemu-27fca0a0d560ae704457c5f89e0be658afef034d.tar.gz qemu-27fca0a0d560ae704457c5f89e0be658afef034d.tar.bz2 |
util/cpuinfo: Make use of elf_aux_info(3) on OpenBSD
Signed-off-by: Brad Smith <brad@comstyle.com>
Message-ID: <ZqXB_zz0fR1CpA7k@humpty.home.comstyle.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'util/cpuinfo-aarch64.c')
-rw-r--r-- | util/cpuinfo-aarch64.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/util/cpuinfo-aarch64.c b/util/cpuinfo-aarch64.c index 8ca775a..5746889 100644 --- a/util/cpuinfo-aarch64.c +++ b/util/cpuinfo-aarch64.c @@ -17,10 +17,13 @@ # define HWCAP2_BTI 0 /* added in glibc 2.32 */ # endif #endif +#ifdef CONFIG_ELF_AUX_INFO +#include <sys/auxv.h> +#endif #ifdef CONFIG_DARWIN # include <sys/sysctl.h> #endif -#ifdef __OpenBSD__ +#if defined(__OpenBSD__) && !defined(CONFIG_ELF_AUX_INFO) # include <machine/armreg.h> # include <machine/cpu.h> # include <sys/types.h> @@ -61,7 +64,7 @@ unsigned __attribute__((constructor)) cpuinfo_init(void) info = CPUINFO_ALWAYS; -#ifdef CONFIG_LINUX +#if defined(CONFIG_LINUX) || defined(CONFIG_ELF_AUX_INFO) unsigned long hwcap = qemu_getauxval(AT_HWCAP); info |= (hwcap & HWCAP_ATOMICS ? CPUINFO_LSE : 0); info |= (hwcap & HWCAP_USCAT ? CPUINFO_LSE2 : 0); @@ -78,7 +81,7 @@ unsigned __attribute__((constructor)) cpuinfo_init(void) info |= sysctl_for_bool("hw.optional.arm.FEAT_PMULL") * CPUINFO_PMULL; info |= sysctl_for_bool("hw.optional.arm.FEAT_BTI") * CPUINFO_BTI; #endif -#ifdef __OpenBSD__ +#if defined(__OpenBSD__) && !defined(CONFIG_ELF_AUX_INFO) int mib[2]; uint64_t isar0; uint64_t pfr1; |