From: Richard Henderson <rth@twiddle.net>
To: qemu-devel@nongnu.org
Cc: aurelien@aurel32.net
Subject: [Qemu-devel] [PATCH v2 2/6] tcg-ppc64: Use qemu_getauxval
Date: Tue, 10 Sep 2013 15:07:34 -0700 [thread overview]
Message-ID: <1378850858-10799-3-git-send-email-rth@twiddle.net> (raw)
In-Reply-To: <1378850858-10799-1-git-send-email-rth@twiddle.net>
Allow host detection on linux systems without glibc 2.16 or later.
Signed-off-by: Richard Henderson <rth@twiddle.net>
---
include/elf.h | 34 ++++++++++++++++++++++++++++++++++
tcg/ppc64/tcg-target.c | 11 ++---------
2 files changed, 36 insertions(+), 9 deletions(-)
diff --git a/include/elf.h b/include/elf.h
index 58bfbf8..7fdd3df 100644
--- a/include/elf.h
+++ b/include/elf.h
@@ -411,6 +411,40 @@ typedef struct {
#define R_SPARC_5 44
#define R_SPARC_6 45
+/* Bits present in AT_HWCAP for PowerPC. */
+
+#define PPC_FEATURE_32 0x80000000
+#define PPC_FEATURE_64 0x40000000
+#define PPC_FEATURE_601_INSTR 0x20000000
+#define PPC_FEATURE_HAS_ALTIVEC 0x10000000
+#define PPC_FEATURE_HAS_FPU 0x08000000
+#define PPC_FEATURE_HAS_MMU 0x04000000
+#define PPC_FEATURE_HAS_4xxMAC 0x02000000
+#define PPC_FEATURE_UNIFIED_CACHE 0x01000000
+#define PPC_FEATURE_HAS_SPE 0x00800000
+#define PPC_FEATURE_HAS_EFP_SINGLE 0x00400000
+#define PPC_FEATURE_HAS_EFP_DOUBLE 0x00200000
+#define PPC_FEATURE_NO_TB 0x00100000
+#define PPC_FEATURE_POWER4 0x00080000
+#define PPC_FEATURE_POWER5 0x00040000
+#define PPC_FEATURE_POWER5_PLUS 0x00020000
+#define PPC_FEATURE_CELL 0x00010000
+#define PPC_FEATURE_BOOKE 0x00008000
+#define PPC_FEATURE_SMT 0x00004000
+#define PPC_FEATURE_ICACHE_SNOOP 0x00002000
+#define PPC_FEATURE_ARCH_2_05 0x00001000
+#define PPC_FEATURE_PA6T 0x00000800
+#define PPC_FEATURE_HAS_DFP 0x00000400
+#define PPC_FEATURE_POWER6_EXT 0x00000200
+#define PPC_FEATURE_ARCH_2_06 0x00000100
+#define PPC_FEATURE_HAS_VSX 0x00000080
+
+#define PPC_FEATURE_PSERIES_PERFMON_COMPAT \
+ 0x00000040
+
+#define PPC_FEATURE_TRUE_LE 0x00000002
+#define PPC_FEATURE_PPC_LE 0x00000001
+
/* Bits present in AT_HWCAP, primarily for Sparc32. */
#define HWCAP_SPARC_FLUSH 1 /* CPU supports flush instruction. */
diff --git a/tcg/ppc64/tcg-target.c b/tcg/ppc64/tcg-target.c
index 0bd1e0c..399861f 100644
--- a/tcg/ppc64/tcg-target.c
+++ b/tcg/ppc64/tcg-target.c
@@ -45,15 +45,10 @@ static uint8_t *tb_ret_addr;
#define GUEST_BASE 0
#endif
-#ifdef CONFIG_GETAUXVAL
-#include <sys/auxv.h>
+#include "elf.h"
static bool have_isa_2_06;
#define HAVE_ISA_2_06 have_isa_2_06
#define HAVE_ISEL have_isa_2_06
-#else
-#define HAVE_ISA_2_06 0
-#define HAVE_ISEL 0
-#endif
#ifdef CONFIG_USE_GUEST_BASE
#define TCG_GUEST_BASE_REG 30
@@ -2111,12 +2106,10 @@ static const TCGTargetOpDef ppc_op_defs[] = {
static void tcg_target_init (TCGContext *s)
{
-#ifdef CONFIG_GETAUXVAL
- unsigned long hwcap = getauxval(AT_HWCAP);
+ unsigned long hwcap = qemu_getauxval(AT_HWCAP);
if (hwcap & PPC_FEATURE_ARCH_2_06) {
have_isa_2_06 = true;
}
-#endif
tcg_regset_set32 (tcg_target_available_regs[TCG_TYPE_I32], 0, 0xffffffff);
tcg_regset_set32 (tcg_target_available_regs[TCG_TYPE_I64], 0, 0xffffffff);
--
1.8.1.4
next prev parent reply other threads:[~2013-09-10 22:08 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-10 22:07 [Qemu-devel] [PATCH v2 0/6] Improve getauxval support Richard Henderson
2013-09-10 22:07 ` [Qemu-devel] [PATCH v2 1/6] osdep: Create qemu_getauxval and qemu_init_auxval Richard Henderson
2013-10-17 11:48 ` Peter Maydell
2013-09-10 22:07 ` Richard Henderson [this message]
2013-10-17 11:49 ` [Qemu-devel] [PATCH v2 2/6] tcg-ppc64: Use qemu_getauxval Peter Maydell
2013-09-10 22:07 ` [Qemu-devel] [PATCH v2 3/6] tcg-arm: " Richard Henderson
2013-10-17 11:59 ` Peter Maydell
2013-09-10 22:07 ` [Qemu-devel] [PATCH v2 4/6] tcg-s390: Use qemu_getauxval in query_facilities Richard Henderson
2013-09-10 22:07 ` [Qemu-devel] [PATCH v2 5/6] util: Provide fallback hwcap and platform for powerpc Richard Henderson
2013-10-17 12:03 ` Peter Maydell
2013-10-17 13:11 ` Richard Henderson
2013-09-10 22:07 ` [Qemu-devel] [PATCH v2 6/6] util: Use qemu_getauxval in linux qemu_cache_utils_init Richard Henderson
2013-10-17 12:05 ` Peter Maydell
2013-09-25 18:15 ` [Qemu-devel] [PATCH v2 0/6] Improve getauxval support Richard Henderson
2013-10-01 21:25 ` Richard Henderson
2013-10-02 1:42 ` Peter Maydell
2013-10-02 15:31 ` 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=1378850858-10799-3-git-send-email-rth@twiddle.net \
--to=rth@twiddle.net \
--cc=aurelien@aurel32.net \
--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).