The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=fc04d82226e5844fcf57d681b711e47e38b5f7c4
commit fc04d82226e5844fcf57d681b711e47e38b5f7c4 Author: Andrew Turner <and...@freebsd.org> AuthorDate: 2025-06-24 14:57:08 +0000 Commit: Andrew Turner <and...@freebsd.org> CommitDate: 2025-06-24 16:26:40 +0000 arm64: Add AT_HWCAP3 and AT_HWCAP4 support The adds the parts needed to export the new AT_HWCAP3 and 4 from the kernel. Reviewed by: brooks, imp, kib Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D51008 --- sys/arm64/arm64/elf_machdep.c | 8 ++++++-- sys/arm64/include/md_var.h | 4 ++++ sys/arm64/linux/linux.h | 2 +- sys/arm64/linux/linux_sysvec.c | 6 ++++-- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/sys/arm64/arm64/elf_machdep.c b/sys/arm64/arm64/elf_machdep.c index 6ca8a711839f..970dba0ca7d9 100644 --- a/sys/arm64/arm64/elf_machdep.c +++ b/sys/arm64/arm64/elf_machdep.c @@ -57,9 +57,13 @@ u_long __read_frequently elf_hwcap; u_long __read_frequently elf_hwcap2; +u_long __read_frequently elf_hwcap3; +u_long __read_frequently elf_hwcap4; /* TODO: Move to a better location */ u_long __read_frequently linux_elf_hwcap; u_long __read_frequently linux_elf_hwcap2; +u_long __read_frequently linux_elf_hwcap3; +u_long __read_frequently linux_elf_hwcap4; struct arm64_addr_mask elf64_addr_mask; @@ -101,8 +105,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_hwcap3 = &elf_hwcap3, + .sv_hwcap4 = &elf_hwcap4, .sv_onexec_old = exec_onexec_old, .sv_protect = arm64_exec_protect, .sv_onexit = exit_onexit, diff --git a/sys/arm64/include/md_var.h b/sys/arm64/include/md_var.h index f9aaaeba7306..da136ff091db 100644 --- a/sys/arm64/include/md_var.h +++ b/sys/arm64/include/md_var.h @@ -37,8 +37,12 @@ extern char sigcode[]; extern int szsigcode; extern u_long elf_hwcap; extern u_long elf_hwcap2; +extern u_long elf_hwcap3; +extern u_long elf_hwcap4; extern u_long linux_elf_hwcap; extern u_long linux_elf_hwcap2; +extern u_long linux_elf_hwcap3; +extern u_long linux_elf_hwcap4; #ifdef COMPAT_FREEBSD32 extern u_long elf32_hwcap; extern u_long elf32_hwcap2; diff --git a/sys/arm64/linux/linux.h b/sys/arm64/linux/linux.h index d612ba8e5d9e..00a70fabc54f 100644 --- a/sys/arm64/linux/linux.h +++ b/sys/arm64/linux/linux.h @@ -77,7 +77,7 @@ typedef struct { #define l_fd_set fd_set /* Miscellaneous */ -#define LINUX_AT_COUNT 21 /* Count of used aux entry types. +#define LINUX_AT_COUNT 23 /* Count of used aux entry types. * Keep this synchronized with * linux_copyout_auxargs() code. */ diff --git a/sys/arm64/linux/linux_sysvec.c b/sys/arm64/linux/linux_sysvec.c index 13c42e061094..084b7a11b01f 100644 --- a/sys/arm64/linux/linux_sysvec.c +++ b/sys/arm64/linux/linux_sysvec.c @@ -156,6 +156,8 @@ linux64_arch_copyout_auxargs(struct image_params *imgp, Elf_Auxinfo **pos) AUXARGS_ENTRY((*pos), LINUX_AT_SYSINFO_EHDR, linux_vdso_base); AUXARGS_ENTRY((*pos), LINUX_AT_HWCAP, *imgp->sysent->sv_hwcap); AUXARGS_ENTRY((*pos), LINUX_AT_HWCAP2, *imgp->sysent->sv_hwcap2); + AUXARGS_ENTRY((*pos), LINUX_AT_HWCAP3, *imgp->sysent->sv_hwcap3); + AUXARGS_ENTRY((*pos), LINUX_AT_HWCAP4, *imgp->sysent->sv_hwcap4); AUXARGS_ENTRY((*pos), LINUX_AT_PLATFORM, PTROUT(linux_platform)); } @@ -458,8 +460,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_hwcap3 = &linux_elf_hwcap3, + .sv_hwcap4 = &linux_elf_hwcap4, .sv_onexec = linux_on_exec_vmspace, .sv_onexit = linux_on_exit, .sv_ontdexit = linux_thread_dtor,