From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-arm@nongnu.org, qemu-devel@nongnu.org
Subject: [PATCH 2/3] linux-user: Report AArch64 hwcap2 fields above bit 31
Date: Mon, 30 Oct 2023 17:39:59 +0000 [thread overview]
Message-ID: <20231030174000.3792225-3-peter.maydell@linaro.org> (raw)
In-Reply-To: <20231030174000.3792225-1-peter.maydell@linaro.org>
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>
---
linux-user/loader.h | 2 +-
linux-user/elfload.c | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/linux-user/loader.h b/linux-user/loader.h
index 324e5c872af..9be00da40a4 100644
--- a/linux-user/loader.h
+++ b/linux-user/loader.h
@@ -61,7 +61,7 @@ uint32_t get_elf_hwcap(void);
const char *elf_hwcap_str(uint32_t bit);
#endif
#if defined(TARGET_AARCH64) || defined(TARGET_ARM)
-uint32_t get_elf_hwcap2(void);
+uint64_t get_elf_hwcap2(void);
const char *elf_hwcap2_str(uint32_t bit);
#endif
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 2e3809f03c4..6fb44206fab 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -520,10 +520,10 @@ uint32_t get_elf_hwcap(void)
return hwcaps;
}
-uint32_t get_elf_hwcap2(void)
+uint64_t get_elf_hwcap2(void)
{
ARMCPU *cpu = ARM_CPU(thread_cpu);
- uint32_t hwcaps = 0;
+ uint64_t hwcaps = 0;
GET_FEATURE_ID(aa32_aes, ARM_HWCAP2_ARM_AES);
GET_FEATURE_ID(aa32_pmull, ARM_HWCAP2_ARM_PMULL);
@@ -784,10 +784,10 @@ uint32_t get_elf_hwcap(void)
return hwcaps;
}
-uint32_t get_elf_hwcap2(void)
+uint64_t get_elf_hwcap2(void)
{
ARMCPU *cpu = ARM_CPU(thread_cpu);
- uint32_t hwcaps = 0;
+ uint64_t hwcaps = 0;
GET_FEATURE_ID(aa64_dcpodp, ARM_HWCAP2_A64_DCPODP);
GET_FEATURE_ID(aa64_sve2, ARM_HWCAP2_A64_SVE2);
--
2.34.1
next prev parent reply other threads:[~2023-10-30 17:41 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-30 17:39 [PATCH 0/3] target/arm: Fix various FEAT_MOPS bugs Peter Maydell
2023-10-30 17:39 ` [PATCH 1/3] target/arm: Enable FEAT_MOPS insns in user-mode emulation Peter Maydell
2023-10-30 17:39 ` Peter Maydell [this message]
2023-11-02 7:28 ` [PATCH 2/3] linux-user: Report AArch64 hwcap2 fields above bit 31 Philippe Mathieu-Daudé
2023-10-30 17:40 ` [PATCH 3/3] target/arm: Make FEAT_MOPS SET* insns handle Xs == XZR correctly Peter Maydell
2023-10-30 18:24 ` [PATCH 0/3] target/arm: Fix various FEAT_MOPS bugs Richard Henderson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231030174000.3792225-3-peter.maydell@linaro.org \
--to=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).