From: Tom Musta <tommusta@gmail.com>
To: qemu-devel@nongnu.org
Cc: tommusta@gmail.com, qemu-ppc@nongnu.org
Subject: [Qemu-devel] [PATCH 4/4] linux-user: Support HWCAP2 in PowerPC
Date: Mon, 16 Jun 2014 11:03:22 -0500 [thread overview]
Message-ID: <1402934602-29002-5-git-send-email-tommusta@gmail.com> (raw)
In-Reply-To: <1402934602-29002-1-git-send-email-tommusta@gmail.com>
Set bits in the AT_HWCAP2 entry of the AUXV. Specifically, detect and set bits
for bctar, ISEL and ISA 2.07.
Signed-off-by: Tom Musta <tommusta@gmail.com>
---
linux-user/elfload.c | 31 +++++++++++++++++++++++++++++++
1 files changed, 31 insertions(+), 0 deletions(-)
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index ab46695..d661127 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -729,6 +729,14 @@ enum {
QEMU_PPC_FEATURE_TRUE_LE = 0x00000002,
QEMU_PPC_FEATURE_PPC_LE = 0x00000001,
+
+ /* Feature definitions in AT_HWCAP2. */
+ QEMU_PPC_FEATURE2_ARCH_2_07 = 0x80000000, /* ISA 2.07 */
+ QEMU_PPC_FEATURE2_HAS_HTM = 0x40000000, /* Hardware Transactional Memory */
+ QEMU_PPC_FEATURE2_HAS_DSCR = 0x20000000, /* Data Stream Control Register */
+ QEMU_PPC_FEATURE2_HAS_EBB = 0x10000000, /* Event Base Branching */
+ QEMU_PPC_FEATURE2_HAS_ISEL = 0x08000000, /* Integer Select */
+ QEMU_PPC_FEATURE2_HAS_TAR = 0x04000000, /* Target Address Register */
};
#define ELF_HWCAP get_elf_hwcap()
@@ -763,6 +771,29 @@ static uint32_t get_elf_hwcap(void)
return features;
}
+#define ELF_HWCAP2 get_elf_hwcap2()
+
+static uint32_t get_elf_hwcap2(void)
+{
+ PowerPCCPU *cpu = POWERPC_CPU(thread_cpu);
+ uint32_t features = 0;
+
+#define GET_FEATURE(flag, feature) \
+ do { if (cpu->env.insns_flags & flag) { features |= feature; } } while (0)
+#define GET_FEATURE2(flag, feature) \
+ do { if (cpu->env.insns_flags2 & flag) { features |= feature; } } while (0)
+
+ GET_FEATURE(PPC_ISEL, QEMU_PPC_FEATURE2_HAS_ISEL);
+ GET_FEATURE2(PPC2_BCTAR_ISA207, QEMU_PPC_FEATURE2_HAS_TAR);
+ GET_FEATURE2((PPC2_BCTAR_ISA207 | PPC2_LSQ_ISA207 | PPC2_ALTIVEC_207 |
+ PPC2_ISA207S), QEMU_PPC_FEATURE2_ARCH_2_07);
+
+#undef GET_FEATURE
+#undef GET_FEATURE2
+
+ return features;
+}
+
/*
* The requirements here are:
* - keep the final alignment of sp (sp & 0xf)
--
1.7.1
next prev parent reply other threads:[~2014-06-16 16:04 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-16 16:03 [Qemu-devel] [PATCH 0/4] AUXV Fixes for PowerPC Linux User Mode Tom Musta
2014-06-16 16:03 ` [Qemu-devel] [PATCH 1/4] linux-user: Correct AUXV Cache Line Sizes for PowerPC Tom Musta
2014-06-16 16:03 ` [Qemu-devel] [PATCH 2/4] target-ppc: Add DFP to Emulated Instructions Flag Tom Musta
2014-06-16 16:03 ` [Qemu-devel] [PATCH 3/4] linux-user: Identify Addition Hardware Capabilities for PowerPC Tom Musta
2014-06-16 16:03 ` Tom Musta [this message]
2014-06-16 22:39 ` [Qemu-devel] [Qemu-ppc] [PATCH 0/4] AUXV Fixes for PowerPC Linux User Mode Alexander Graf
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=1402934602-29002-5-git-send-email-tommusta@gmail.com \
--to=tommusta@gmail.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@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).