git: 85007872d122 - main - sys: Add AT_HWCAP3 and AT_HWCAP4
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 25 Jun 2025 09:25:36 UTC
The branch main has been updated by andrew:
URL: https://cgit.FreeBSD.org/src/commit/?id=85007872d1227006adf2ce119fe30de856cbe12d
commit 85007872d1227006adf2ce119fe30de856cbe12d
Author: Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2025-06-24 14:56:46 +0000
Commit: Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2025-06-24 16:26:40 +0000
sys: Add AT_HWCAP3 and AT_HWCAP4
It is likely we will need these on arm64. Add them in preparation for
flags in these to be added at some point in the future.
Reviewed by: brooks, imp, kib
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D51005
---
sys/amd64/linux/linux_sysvec.c | 2 ++
sys/amd64/linux32/linux32_sysvec.c | 2 ++
sys/arm/arm/elf_machdep.c | 2 ++
sys/arm64/arm64/elf32_machdep.c | 2 ++
sys/arm64/arm64/elf_machdep.c | 2 ++
sys/arm64/linux/linux_sysvec.c | 2 ++
sys/compat/linux/linux_misc.h | 4 +++-
sys/i386/linux/linux_sysvec.c | 4 ++++
sys/kern/imgact_elf.c | 4 ++++
sys/powerpc/powerpc/elf32_machdep.c | 2 ++
sys/powerpc/powerpc/elf64_machdep.c | 4 ++++
sys/powerpc/powerpc/elf_common.c | 1 +
sys/sys/elf_common.h | 4 +++-
sys/sys/sysent.h | 2 ++
14 files changed, 35 insertions(+), 2 deletions(-)
diff --git a/sys/amd64/linux/linux_sysvec.c b/sys/amd64/linux/linux_sysvec.c
index 3760a5455a73..c8579c5da4ad 100644
--- a/sys/amd64/linux/linux_sysvec.c
+++ b/sys/amd64/linux/linux_sysvec.c
@@ -711,6 +711,8 @@ struct sysentvec elf_linux_sysvec = {
.sv_trap = linux_vsyscall,
.sv_hwcap = NULL,
.sv_hwcap2 = NULL,
+ .sv_hwcap3 = NULL,
+ .sv_hwcap4 = NULL,
.sv_onexec = linux_on_exec_vmspace,
.sv_onexit = linux_on_exit,
.sv_ontdexit = linux_thread_dtor,
diff --git a/sys/amd64/linux32/linux32_sysvec.c b/sys/amd64/linux32/linux32_sysvec.c
index d7f87e2fdf34..8fac626f9053 100644
--- a/sys/amd64/linux32/linux32_sysvec.c
+++ b/sys/amd64/linux32/linux32_sysvec.c
@@ -811,6 +811,8 @@ struct sysentvec elf_linux_sysvec = {
.sv_trap = NULL,
.sv_hwcap = NULL,
.sv_hwcap2 = NULL,
+ .sv_hwcap3 = NULL,
+ .sv_hwcap4 = NULL,
.sv_onexec = linux_on_exec_vmspace,
.sv_onexit = linux_on_exit,
.sv_ontdexit = linux_thread_dtor,
diff --git a/sys/arm/arm/elf_machdep.c b/sys/arm/arm/elf_machdep.c
index e1003b71543a..ea6437f320ce 100644
--- a/sys/arm/arm/elf_machdep.c
+++ b/sys/arm/arm/elf_machdep.c
@@ -97,6 +97,8 @@ struct sysentvec elf32_freebsd_sysvec = {
.sv_trap = NULL,
.sv_hwcap = &elf_hwcap,
.sv_hwcap2 = &elf_hwcap2,
+ .sv_hwcap3 = NULL,
+ .sv_hwcap4 = NULL,
.sv_onexec_old = exec_onexec_old,
.sv_onexit = exit_onexit,
.sv_regset_begin = SET_BEGIN(__elfN(regset)),
diff --git a/sys/arm64/arm64/elf32_machdep.c b/sys/arm64/arm64/elf32_machdep.c
index fd2a2690b7a1..7cd5327b9f1b 100644
--- a/sys/arm64/arm64/elf32_machdep.c
+++ b/sys/arm64/arm64/elf32_machdep.c
@@ -134,6 +134,8 @@ static struct sysentvec elf32_freebsd_sysvec = {
.sv_trap = NULL,
.sv_hwcap = &elf32_hwcap,
.sv_hwcap2 = &elf32_hwcap2,
+ .sv_hwcap3 = NULL,
+ .sv_hwcap4 = NULL,
.sv_onexec_old = exec_onexec_old,
.sv_onexit = exit_onexit,
.sv_regset_begin = SET_BEGIN(__elfN(regset)),
diff --git a/sys/arm64/arm64/elf_machdep.c b/sys/arm64/arm64/elf_machdep.c
index d5b420a8b519..6ca8a711839f 100644
--- a/sys/arm64/arm64/elf_machdep.c
+++ b/sys/arm64/arm64/elf_machdep.c
@@ -101,6 +101,8 @@ static struct sysentvec elf64_freebsd_sysvec = {
.sv_trap = NULL,
.sv_hwcap = &elf_hwcap,
.sv_hwcap2 = &elf_hwcap2,
+ .sv_hwcap3 = NULL,
+ .sv_hwcap4 = NULL,
.sv_onexec_old = exec_onexec_old,
.sv_protect = arm64_exec_protect,
.sv_onexit = exit_onexit,
diff --git a/sys/arm64/linux/linux_sysvec.c b/sys/arm64/linux/linux_sysvec.c
index 185c4f3044b1..13c42e061094 100644
--- a/sys/arm64/linux/linux_sysvec.c
+++ b/sys/arm64/linux/linux_sysvec.c
@@ -458,6 +458,8 @@ struct sysentvec elf_linux_sysvec = {
.sv_trap = NULL,
.sv_hwcap = &linux_elf_hwcap,
.sv_hwcap2 = &linux_elf_hwcap2,
+ .sv_hwcap3 = NULL,
+ .sv_hwcap4 = NULL,
.sv_onexec = linux_on_exec_vmspace,
.sv_onexit = linux_on_exit,
.sv_ontdexit = linux_thread_dtor,
diff --git a/sys/compat/linux/linux_misc.h b/sys/compat/linux/linux_misc.h
index 445110c598cc..2d2b12ef0127 100644
--- a/sys/compat/linux/linux_misc.h
+++ b/sys/compat/linux/linux_misc.h
@@ -85,7 +85,9 @@
* differ from AT_PLATFORM.
*/
#define LINUX_AT_RANDOM 25 /* address of random bytes */
-#define LINUX_AT_HWCAP2 26 /* CPU capabilities, second part */
+#define LINUX_AT_HWCAP2 26 /* CPU capabilities */
+#define LINUX_AT_HWCAP3 29 /* CPU capabilities */
+#define LINUX_AT_HWCAP4 30 /* CPU capabilities */
#define LINUX_AT_EXECFN 31 /* filename of program */
#define LINUX_AT_SYSINFO 32 /* vsyscall */
#define LINUX_AT_SYSINFO_EHDR 33 /* vdso header */
diff --git a/sys/i386/linux/linux_sysvec.c b/sys/i386/linux/linux_sysvec.c
index c68a0e17a8e4..85877bf40997 100644
--- a/sys/i386/linux/linux_sysvec.c
+++ b/sys/i386/linux/linux_sysvec.c
@@ -606,6 +606,8 @@ struct sysentvec linux_sysvec = {
.sv_trap = NULL,
.sv_hwcap = NULL,
.sv_hwcap2 = NULL,
+ .sv_hwcap3 = NULL,
+ .sv_hwcap4 = NULL,
.sv_onexec = linux_on_exec_vmspace,
.sv_onexit = linux_on_exit,
.sv_ontdexit = linux_thread_dtor,
@@ -650,6 +652,8 @@ struct sysentvec elf_linux_sysvec = {
.sv_trap = NULL,
.sv_hwcap = NULL,
.sv_hwcap2 = NULL,
+ .sv_hwcap3 = NULL,
+ .sv_hwcap4 = NULL,
.sv_onexec = linux_on_exec_vmspace,
.sv_onexit = linux_on_exit,
.sv_ontdexit = linux_thread_dtor,
diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c
index 1a2c0e2ef93d..b7ffbe68b483 100644
--- a/sys/kern/imgact_elf.c
+++ b/sys/kern/imgact_elf.c
@@ -1487,6 +1487,10 @@ __elfN(freebsd_copyout_auxargs)(struct image_params *imgp, uintptr_t base)
AUXARGS_ENTRY(pos, AT_HWCAP, *imgp->sysent->sv_hwcap);
if (imgp->sysent->sv_hwcap2 != NULL)
AUXARGS_ENTRY(pos, AT_HWCAP2, *imgp->sysent->sv_hwcap2);
+ if (imgp->sysent->sv_hwcap3 != NULL)
+ AUXARGS_ENTRY(pos, AT_HWCAP3, *imgp->sysent->sv_hwcap3);
+ if (imgp->sysent->sv_hwcap4 != NULL)
+ AUXARGS_ENTRY(pos, AT_HWCAP4, *imgp->sysent->sv_hwcap4);
bsdflags = 0;
bsdflags |= __elfN(sigfastblock) ? ELF_BSDF_SIGFASTBLK : 0;
oc = atomic_load_int(&vm_overcommit);
diff --git a/sys/powerpc/powerpc/elf32_machdep.c b/sys/powerpc/powerpc/elf32_machdep.c
index af01043878db..e1118713bff0 100644
--- a/sys/powerpc/powerpc/elf32_machdep.c
+++ b/sys/powerpc/powerpc/elf32_machdep.c
@@ -134,6 +134,8 @@ struct sysentvec elf32_freebsd_sysvec = {
.sv_trap = NULL,
.sv_hwcap = &cpu_features,
.sv_hwcap2 = &cpu_features2,
+ .sv_hwcap3 = NULL,
+ .sv_hwcap4 = NULL,
.sv_onexec_old = exec_onexec_old,
.sv_onexit = exit_onexit,
.sv_regset_begin = SET_BEGIN(__elfN(regset)),
diff --git a/sys/powerpc/powerpc/elf64_machdep.c b/sys/powerpc/powerpc/elf64_machdep.c
index 1035e35d286e..a999f742caeb 100644
--- a/sys/powerpc/powerpc/elf64_machdep.c
+++ b/sys/powerpc/powerpc/elf64_machdep.c
@@ -97,6 +97,8 @@ struct sysentvec elf64_freebsd_sysvec_v1 = {
.sv_trap = NULL,
.sv_hwcap = &cpu_features,
.sv_hwcap2 = &cpu_features2,
+ .sv_hwcap3 = NULL,
+ .sv_hwcap4 = NULL,
.sv_onexec_old = exec_onexec_old,
.sv_onexit = exit_onexit,
.sv_regset_begin = SET_BEGIN(__elfN(regset)),
@@ -139,6 +141,8 @@ struct sysentvec elf64_freebsd_sysvec_v2 = {
.sv_trap = NULL,
.sv_hwcap = &cpu_features,
.sv_hwcap2 = &cpu_features2,
+ .sv_hwcap3 = NULL,
+ .sv_hwcap4 = NULL,
.sv_onexec_old = exec_onexec_old,
.sv_onexit = exit_onexit,
.sv_regset_begin = SET_BEGIN(__elfN(regset)),
diff --git a/sys/powerpc/powerpc/elf_common.c b/sys/powerpc/powerpc/elf_common.c
index e7960feb2c10..01a7e9febd68 100644
--- a/sys/powerpc/powerpc/elf_common.c
+++ b/sys/powerpc/powerpc/elf_common.c
@@ -93,6 +93,7 @@ __elfN(powerpc_copyout_auxargs)(struct image_params *imgp, uintptr_t base)
AUXARGS_ENTRY(pos, AT_OLD_HWCAP, *imgp->sysent->sv_hwcap);
if (imgp->sysent->sv_hwcap2 != NULL)
AUXARGS_ENTRY(pos, AT_OLD_HWCAP2, *imgp->sysent->sv_hwcap2);
+ if (imgp->sysent->sv_hwcap3 != NULL)
AUXARGS_ENTRY(pos, AT_OLD_NULL, 0);
free(imgp->auxargs, M_TEMP);
diff --git a/sys/sys/elf_common.h b/sys/sys/elf_common.h
index a5e605624e1e..87460aae2dd4 100644
--- a/sys/sys/elf_common.h
+++ b/sys/sys/elf_common.h
@@ -1015,8 +1015,10 @@ typedef struct {
#define AT_USRSTACKBASE 35 /* Top of user stack */
#define AT_USRSTACKLIM 36 /* Grow limit of user stack */
#define AT_CHERI_STATS 37 /* Reserved */
+#define AT_HWCAP3 38 /* CPU feature flags 3. */
+#define AT_HWCAP4 39 /* CPU feature flags 4. */
-#define AT_COUNT 38 /* Count of defined aux entry types. */
+#define AT_COUNT 40 /* Count of defined aux entry types. */
/*
* Relocation types.
diff --git a/sys/sys/sysent.h b/sys/sys/sysent.h
index dffe77de91d0..6314b03142e7 100644
--- a/sys/sys/sysent.h
+++ b/sys/sys/sysent.h
@@ -145,6 +145,8 @@ struct sysentvec {
int (*sv_trap)(struct thread *);
u_long *sv_hwcap; /* Value passed in AT_HWCAP. */
u_long *sv_hwcap2; /* Value passed in AT_HWCAP2. */
+ u_long *sv_hwcap3; /* Value passed in AT_HWCAP3. */
+ u_long *sv_hwcap4; /* Value passed in AT_HWCAP4. */
const char *(*sv_machine_arch)(struct proc *);
vm_offset_t sv_fxrng_gen_offset;
void (*sv_onexec_old)(struct thread *td);