Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 25 Jun 2025 09:25:37 GMT
From:      Andrew Turner <andrew@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: fa1c23da01e0 - main - libsys: Add AT_HWCAP3 and AT_HWCAP4
Message-ID:  <202506250925.55P9PbXe077179@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by andrew:

URL: https://cgit.FreeBSD.org/src/commit/?id=fa1c23da01e07f308aa30d3cf3625d014c55ba94

commit fa1c23da01e07f308aa30d3cf3625d014c55ba94
Author:     Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2025-06-24 14:56:54 +0000
Commit:     Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2025-06-24 16:26:40 +0000

    libsys: Add AT_HWCAP3 and AT_HWCAP4
    
    This is needed to read these values.
    
    Reviewed by:    brooks, imp, kib
    Sponsored by:   Arm Ltd
    Differential Revision:  https://reviews.freebsd.org/D51006
---
 lib/libsys/auxv.3 |  8 +++++++-
 lib/libsys/auxv.c | 28 ++++++++++++++++++++++++++--
 2 files changed, 33 insertions(+), 3 deletions(-)

diff --git a/lib/libsys/auxv.3 b/lib/libsys/auxv.3
index 10ec10e8755c..b3b741937ac7 100644
--- a/lib/libsys/auxv.3
+++ b/lib/libsys/auxv.3
@@ -22,7 +22,7 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd September 16, 2022
+.Dd June 24, 2025
 .Dt ELF_AUX_INFO 3
 .Os
 .Sh NAME
@@ -59,6 +59,12 @@ CPU / hardware feature flags
 .It AT_HWCAP2
 CPU / hardware feature flags
 .Dv (sizeof(u_long)).
+.It AT_HWCAP3
+CPU / hardware feature flags
+.Dv (sizeof(u_long)).
+.It AT_HWCAP4
+CPU / hardware feature flags
+.Dv (sizeof(u_long)).
 .It AT_NCPUS
 Number of CPUs
 .Dv (sizeof(int)).
diff --git a/lib/libsys/auxv.c b/lib/libsys/auxv.c
index 1a4fd352950e..80702c66ba22 100644
--- a/lib/libsys/auxv.c
+++ b/lib/libsys/auxv.c
@@ -69,10 +69,10 @@ __init_elf_aux_vector(void)
 
 static int aux_once;
 static int pagesize, osreldate, canary_len, ncpus, pagesizes_len, bsdflags;
-static int hwcap_present, hwcap2_present;
+static int hwcap_present, hwcap2_present, hwcap3_present, hwcap4_present;
 static char *canary, *pagesizes, *execpath;
 static void *ps_strings, *timekeep;
-static u_long hwcap, hwcap2;
+static u_long hwcap, hwcap2, hwcap3, hwcap4;
 static void *fxrng_seed_version;
 static u_long usrstackbase, usrstacklim;
 
@@ -123,6 +123,16 @@ init_aux(void)
 			hwcap2 = (u_long)(aux->a_un.a_val);
 			break;
 
+		case AT_HWCAP3:
+			hwcap3_present = 1;
+			hwcap3 = (u_long)(aux->a_un.a_val);
+			break;
+
+		case AT_HWCAP4:
+			hwcap4_present = 1;
+			hwcap4 = (u_long)(aux->a_un.a_val);
+			break;
+
 		case AT_PAGESIZES:
 			pagesizes = (char *)(aux->a_un.a_ptr);
 			break;
@@ -318,6 +328,20 @@ _elf_aux_info(int aux, void *buf, int buflen)
 		} else
 			res = ENOENT;
 		break;
+	case AT_HWCAP3:
+		if (hwcap3_present && buflen == sizeof(u_long)) {
+			*(u_long *)buf = hwcap3;
+			res = 0;
+		} else
+			res = ENOENT;
+		break;
+	case AT_HWCAP4:
+		if (hwcap4_present && buflen == sizeof(u_long)) {
+			*(u_long *)buf = hwcap4;
+			res = 0;
+		} else
+			res = ENOENT;
+		break;
 	case AT_PAGESIZES:
 		if (pagesizes != NULL && pagesizes_len >= buflen) {
 			memcpy(buf, pagesizes, buflen);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202506250925.55P9PbXe077179>