]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
FreeBSD: synthesize AT_HWCAP on arm64
authorPaul Floyd <pjfloyd@wanadoo.fr>
Wed, 22 May 2024 05:34:34 +0000 (07:34 +0200)
committerPaul Floyd <pjfloyd@wanadoo.fr>
Wed, 22 May 2024 05:34:34 +0000 (07:34 +0200)
Not used on amd64. Less hardware variation?

coregrind/m_initimg/initimg-freebsd.c
include/vki/vki-arm64-freebsd.h
none/tests/freebsd/auxv.stderr.exp-arm64

index 53dbf7961f6280e2b7ab77b07a1ece90500edf28..8c2c6b0e8e05303f2ec5006813fc537df1e83c0d 100644 (file)
@@ -713,12 +713,35 @@ static Addr setup_client_stack(const void*  init_sp,
       case VKI_AT_CANARYLEN:
 
 #if (FREEBSD_VERS >= FREEBSD_11)
-      // FreeBSD 11+ also have HWCAP and HWCAP2
       case VKI_AT_EHDRFLAGS:
 #endif
          /* All these are pointerless, so we don't need to do
             anything about them. */
          break;
+#if defined(VGP_arm64_freebsd)
+      // FreeBSD 11+ also have HWCAP and HWCAP2
+      // but they aren't used on amd64
+      case VKI_AT_HWCAP:
+#define ARM64_SUPPORTED_HWCAP (VKI_HWCAP_ATOMICS        \
+                               | VKI_HWCAP_AES          \
+                               | VKI_HWCAP_PMULL        \
+                               | VKI_HWCAP_SHA1         \
+                               | VKI_HWCAP_SHA2         \
+                               | VKI_HWCAP_SHA512       \
+                               | VKI_HWCAP_CRC32        \
+                               | VKI_HWCAP_ASIMDRDM     \
+                               | VKI_HWCAP_FP           \
+                               | VKI_HWCAP_ASIMD        \
+                               | VKI_HWCAP_ASIMDDP)
+               auxv->u.a_val &= ARM64_SUPPORTED_HWCAP;
+         break;
+#undef ARM64_SUPPORTED_HWCAP
+      // not yet
+      /*
+      case VKI_AT_HWCAP2:
+         break;
+      */
+#endif
 
       case VKI_AT_EXECPATH:
          auxv->u.a_ptr = copy_str(&strtab, resolved_name);
index 32e81db1e19255a345f8b15c1238fd72cb1df095..e535fe7feef23bbd4516fad3df32b1432c44bfe1 100644 (file)
@@ -70,16 +70,6 @@ typedef struct {
 // Used by PTRACE and coredump-elf.h */
 //----------------------------------------------------------------------
 
-/*
-struct vki_reg {
-   vki_uint64_t x[30];
-   vki_uint64_t lr;
-   vki_uint64_t sp;
-   vki_uint64_t elr;
-   vki_uint64_t spsr;
-};
-*/
-
 struct vki_dbreg {
    vki_uint8_t db_debug_ver;
    vki_uint8_t db_nbkpts;
@@ -177,4 +167,61 @@ struct vki_vdso_timehands {
    VKI_VDSO_TIMEHANDS_MD
 };
 
+//----------------------------------------------------------------------
+// machine/elf.h
+//----------------------------------------------------------------------
+
+#define        VKI_HWCAP_FP            0x00000001
+#define        VKI_HWCAP_ASIMD         0x00000002
+#define        VKI_HWCAP_EVTSTRM               0x00000004
+#define        VKI_HWCAP_AES           0x00000008
+#define        VKI_HWCAP_PMULL         0x00000010
+#define        VKI_HWCAP_SHA1          0x00000020
+#define        VKI_HWCAP_SHA2          0x00000040
+#define        VKI_HWCAP_CRC32         0x00000080
+#define        VKI_HWCAP_ATOMICS               0x00000100
+#define        VKI_HWCAP_FPHP          0x00000200
+#define        VKI_HWCAP_ASIMDHP               0x00000400
+#define        VKI_HWCAP_CPUID         0x00000800
+#define        VKI_HWCAP_ASIMDRDM              0x00001000
+#define        VKI_HWCAP_JSCVT         0x00002000
+#define        VKI_HWCAP_FCMA          0x00004000
+#define        VKI_HWCAP_LRCPC         0x00008000
+#define        VKI_HWCAP_DCPOP         0x00010000
+#define        VKI_HWCAP_SHA3          0x00020000
+#define        VKI_HWCAP_SM3           0x00040000
+#define        VKI_HWCAP_SM4           0x00080000
+#define        VKI_HWCAP_ASIMDDP               0x00100000
+#define        VKI_HWCAP_SHA512                0x00200000
+#define        VKI_HWCAP_SVE           0x00400000
+#define        VKI_HWCAP_ASIMDFHM              0x00800000
+#define        VKI_HWCAP_DIT           0x01000000
+#define        VKI_HWCAP_USCAT         0x02000000
+#define        VKI_HWCAP_ILRCPC                0x04000000
+#define        VKI_HWCAP_FLAGM         0x08000000
+#define        VKI_HWCAP_SSBS          0x10000000
+#define        VKI_HWCAP_SB            0x20000000
+#define        VKI_HWCAP_PACA          0x40000000
+#define        VKI_HWCAP_PACG          0x80000000
+
+#define        VKI_HWCAP2_DCPODP               0x00000001
+#define        VKI_HWCAP2_SVE2         0x00000002
+#define        VKI_HWCAP2_SVEAES               0x00000004
+#define        VKI_HWCAP2_SVEPMULL             0x00000008
+#define        VKI_HWCAP2_SVEBITPERM   0x00000010
+#define        VKI_HWCAP2_SVESHA3              0x00000020
+#define        VKI_HWCAP2_SVESM4               0x00000040
+#define        VKI_HWCAP2_FLAGM2               0x00000080
+#define        VKI_HWCAP2_FRINT                0x00000100
+#define        VKI_HWCAP2_SVEI8MM              0x00000200
+#define        VKI_HWCAP2_SVEF32MM             0x00000400
+#define        VKI_HWCAP2_SVEF64MM             0x00000800
+#define        VKI_HWCAP2_SVEBF16              0x00001000
+#define        VKI_HWCAP2_I8MM         0x00002000
+#define        VKI_HWCAP2_BF16         0x00004000
+#define        VKI_HWCAP2_DGH          0x00008000
+#define        VKI_HWCAP2_RNG          0x00010000
+#define        VKI_HWCAP2_BTI          0x00020000
+
+
 #endif /* VKI_ARM64_FREEBSD_H */
index 949e740d4f63eb04281affd005289e9d1baa5362..738a284dcb4a3ca9aca10628dd0325b0dee3708b 100644 (file)
@@ -16,7 +16,7 @@ val: AT_PAGESIZES int: 20 ptr: 0x........
 val: AT_PAGESIZESLEN int: 21 ptr: 0x........
 val: AT_IGNORE int: 01 ptr: 0x........
 val: AT_STACKPROT int: 23 ptr: 0x........
-val: AT_IGNORE int: 01 ptr: 0x........
+val: AT_HWCAP int: 25 ptr: 0x........
 val: AT_IGNORE int: 01 ptr: 0x........
 val: AT_IGNORE int: 01 ptr: 0x........
 val: AT_ARGC int: 28 ptr: 0x........