From: Szabolcs Nagy <nsz@port70.net>
To: musl@lists.openwall.com
Cc: Hauke Mehrtens <hauke@hauke-m.de>
Subject: [PATCH with-mips] add bits/hwcap.h and include it in sys/auxv.h
Date: Sun, 9 Oct 2016 20:42:02 +0200 [thread overview]
Message-ID: <20161009184202.GK28065@port70.net> (raw)
In-Reply-To: <20161009183257.GJ28065@port70.net>
aarch64, arm, mips, mips64, mipsn32, powerpc, powerpc64 and sh have
cpu feature bits defined in linux for AT_HWCAP auxv entry, so expose
those in sys/auxv.h
it seems the mips hwcaps were never exposed to userspace neither
by linux nor by glibc, but that's most likely an oversight.
---
arch/aarch64/bits/hwcap.h | 11 +++++++++++
arch/arm/bits/hwcap.h | 29 +++++++++++++++++++++++++++++
arch/generic/bits/hwcap.h | 0
arch/mips/bits/hwcap.h | 2 ++
arch/mips64/bits/hwcap.h | 2 ++
arch/mipsn32/bits/hwcap.h | 2 ++
arch/powerpc/bits/hwcap.h | 40 ++++++++++++++++++++++++++++++++++++++++
arch/powerpc64/bits/hwcap.h | 40 ++++++++++++++++++++++++++++++++++++++++
arch/sh/bits/hwcap.h | 11 +++++++++++
include/sys/auxv.h | 1 +
10 files changed, 138 insertions(+)
create mode 100644 arch/aarch64/bits/hwcap.h
create mode 100644 arch/arm/bits/hwcap.h
create mode 100644 arch/generic/bits/hwcap.h
create mode 100644 arch/mips/bits/hwcap.h
create mode 100644 arch/mips64/bits/hwcap.h
create mode 100644 arch/mipsn32/bits/hwcap.h
create mode 100644 arch/powerpc/bits/hwcap.h
create mode 100644 arch/powerpc64/bits/hwcap.h
create mode 100644 arch/sh/bits/hwcap.h
diff --git a/arch/aarch64/bits/hwcap.h b/arch/aarch64/bits/hwcap.h
new file mode 100644
index 0000000..2b923f7
--- /dev/null
+++ b/arch/aarch64/bits/hwcap.h
@@ -0,0 +1,11 @@
+#define HWCAP_FP (1 << 0)
+#define HWCAP_ASIMD (1 << 1)
+#define HWCAP_EVTSTRM (1 << 2)
+#define HWCAP_AES (1 << 3)
+#define HWCAP_PMULL (1 << 4)
+#define HWCAP_SHA1 (1 << 5)
+#define HWCAP_SHA2 (1 << 6)
+#define HWCAP_CRC32 (1 << 7)
+#define HWCAP_ATOMICS (1 << 8)
+#define HWCAP_FPHP (1 << 9)
+#define HWCAP_ASIMDHP (1 << 10)
diff --git a/arch/arm/bits/hwcap.h b/arch/arm/bits/hwcap.h
new file mode 100644
index 0000000..ac4edea
--- /dev/null
+++ b/arch/arm/bits/hwcap.h
@@ -0,0 +1,29 @@
+#define HWCAP_SWP (1 << 0)
+#define HWCAP_HALF (1 << 1)
+#define HWCAP_THUMB (1 << 2)
+#define HWCAP_26BIT (1 << 3)
+#define HWCAP_FAST_MULT (1 << 4)
+#define HWCAP_FPA (1 << 5)
+#define HWCAP_VFP (1 << 6)
+#define HWCAP_EDSP (1 << 7)
+#define HWCAP_JAVA (1 << 8)
+#define HWCAP_IWMMXT (1 << 9)
+#define HWCAP_CRUNCH (1 << 10)
+#define HWCAP_THUMBEE (1 << 11)
+#define HWCAP_NEON (1 << 12)
+#define HWCAP_VFPv3 (1 << 13)
+#define HWCAP_VFPv3D16 (1 << 14)
+#define HWCAP_TLS (1 << 15)
+#define HWCAP_VFPv4 (1 << 16)
+#define HWCAP_IDIVA (1 << 17)
+#define HWCAP_IDIVT (1 << 18)
+#define HWCAP_VFPD32 (1 << 19)
+#define HWCAP_IDIV (HWCAP_IDIVA | HWCAP_IDIVT)
+#define HWCAP_LPAE (1 << 20)
+#define HWCAP_EVTSTRM (1 << 21)
+
+#define HWCAP2_AES (1 << 0)
+#define HWCAP2_PMULL (1 << 1)
+#define HWCAP2_SHA1 (1 << 2)
+#define HWCAP2_SHA2 (1 << 3)
+#define HWCAP2_CRC32 (1 << 4)
diff --git a/arch/generic/bits/hwcap.h b/arch/generic/bits/hwcap.h
new file mode 100644
index 0000000..e69de29
diff --git a/arch/mips/bits/hwcap.h b/arch/mips/bits/hwcap.h
new file mode 100644
index 0000000..05cffba
--- /dev/null
+++ b/arch/mips/bits/hwcap.h
@@ -0,0 +1,2 @@
+#define HWCAP_MIPS_R6 (1 << 0)
+#define HWCAP_MIPS_MSA (1 << 1)
diff --git a/arch/mips64/bits/hwcap.h b/arch/mips64/bits/hwcap.h
new file mode 100644
index 0000000..05cffba
--- /dev/null
+++ b/arch/mips64/bits/hwcap.h
@@ -0,0 +1,2 @@
+#define HWCAP_MIPS_R6 (1 << 0)
+#define HWCAP_MIPS_MSA (1 << 1)
diff --git a/arch/mipsn32/bits/hwcap.h b/arch/mipsn32/bits/hwcap.h
new file mode 100644
index 0000000..05cffba
--- /dev/null
+++ b/arch/mipsn32/bits/hwcap.h
@@ -0,0 +1,2 @@
+#define HWCAP_MIPS_R6 (1 << 0)
+#define HWCAP_MIPS_MSA (1 << 1)
diff --git a/arch/powerpc/bits/hwcap.h b/arch/powerpc/bits/hwcap.h
new file mode 100644
index 0000000..82c92a9
--- /dev/null
+++ b/arch/powerpc/bits/hwcap.h
@@ -0,0 +1,40 @@
+#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
+
+#define PPC_FEATURE2_ARCH_2_07 0x80000000
+#define PPC_FEATURE2_HTM 0x40000000
+#define PPC_FEATURE2_DSCR 0x20000000
+#define PPC_FEATURE2_EBB 0x10000000
+#define PPC_FEATURE2_ISEL 0x08000000
+#define PPC_FEATURE2_TAR 0x04000000
+#define PPC_FEATURE2_VEC_CRYPTO 0x02000000
+#define PPC_FEATURE2_HTM_NOSC 0x01000000
+#define PPC_FEATURE2_ARCH_3_00 0x00800000
+#define PPC_FEATURE2_HAS_IEEE128 0x00400000
diff --git a/arch/powerpc64/bits/hwcap.h b/arch/powerpc64/bits/hwcap.h
new file mode 100644
index 0000000..82c92a9
--- /dev/null
+++ b/arch/powerpc64/bits/hwcap.h
@@ -0,0 +1,40 @@
+#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
+
+#define PPC_FEATURE2_ARCH_2_07 0x80000000
+#define PPC_FEATURE2_HTM 0x40000000
+#define PPC_FEATURE2_DSCR 0x20000000
+#define PPC_FEATURE2_EBB 0x10000000
+#define PPC_FEATURE2_ISEL 0x08000000
+#define PPC_FEATURE2_TAR 0x04000000
+#define PPC_FEATURE2_VEC_CRYPTO 0x02000000
+#define PPC_FEATURE2_HTM_NOSC 0x01000000
+#define PPC_FEATURE2_ARCH_3_00 0x00800000
+#define PPC_FEATURE2_HAS_IEEE128 0x00400000
diff --git a/arch/sh/bits/hwcap.h b/arch/sh/bits/hwcap.h
new file mode 100644
index 0000000..f85121d
--- /dev/null
+++ b/arch/sh/bits/hwcap.h
@@ -0,0 +1,11 @@
+#define CPU_HAS_FPU 0x0001
+#define CPU_HAS_P2_FLUSH_BUG 0x0002
+#define CPU_HAS_MMU_PAGE_ASSOC 0x0004
+#define CPU_HAS_DSP 0x0008
+#define CPU_HAS_PERF_COUNTER 0x0010
+#define CPU_HAS_PTEA 0x0020
+#define CPU_HAS_LLSC 0x0040
+#define CPU_HAS_L2_CACHE 0x0080
+#define CPU_HAS_OP32 0x0100
+#define CPU_HAS_PTEAEX 0x0200
+#define CPU_HAS_CAS_L 0x0400
diff --git a/include/sys/auxv.h b/include/sys/auxv.h
index 6dcf9ad..ddccf57 100644
--- a/include/sys/auxv.h
+++ b/include/sys/auxv.h
@@ -6,6 +6,7 @@ extern "C" {
#endif
#include <elf.h>
+#include <bits/hwcap.h>
unsigned long getauxval(unsigned long);
--
2.10.0
next prev parent reply other threads:[~2016-10-09 18:42 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-09 16:57 [PATCH 0/7] updates for linux v4.8 Szabolcs Nagy
2016-10-09 17:00 ` [PATCH 2/7] add sh syscall numbers from " Szabolcs Nagy
2016-10-09 17:00 ` [PATCH 3/7] add ETH_P_NCSI to netinet/if_ether.h " Szabolcs Nagy
2016-10-09 17:01 ` [PATCH 4/7] elf.h: update EM_ elf machine defines and add R_BPF_ defines Szabolcs Nagy
2016-10-09 17:01 ` [PATCH 5/7] add bits/hwcap.h and include it in sys/auxv.h Szabolcs Nagy
2016-10-09 17:24 ` Hauke Mehrtens
2016-10-09 18:32 ` Szabolcs Nagy
2016-10-09 18:42 ` Szabolcs Nagy [this message]
2016-10-09 17:02 ` [PATCH 6/7] add TCP_REPAIR_WINDOW to netinet/tcp.h from linux v4.8 Szabolcs Nagy
2016-10-09 17:02 ` [PATCH 7/7] update icmphdr struct following " Szabolcs Nagy
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=20161009184202.GK28065@port70.net \
--to=nsz@port70.net \
--cc=hauke@hauke-m.de \
--cc=musl@lists.openwall.com \
/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.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
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).