Author: mhorne
Date: Tue Sep  8 15:08:20 2020
New Revision: 365459
URL: https://svnweb.freebsd.org/changeset/base/365459

Log:
  arm64: fix incorrect HWCAP definitions
  
  FreeBSD exports CPU features as bits in the AT_HWCAP and AT_HWCAP2
  vectors via elf_aux_info(3). This interface is similar to getauxval(3)
  on Linux, and for simplicity to consumers we try to maintain an
  identical set of feature flags on arm64.
  
  The first batch of AT_HWCAP flags were added in r350166, corresponding
  to definitions that already existed in Linux. Unfortunately, one flag
  was missed, and a portion of the values are shifted one bit to the right
  as a result.
  
  Add the missing definition for HWCAP_ASIMDHP, and adjust the affected
  values to match their Linux counterparts.
  
  Although this is an ABI-breaking change, there is no plan to provide
  compat code for old binaries. An audit of our ports tree and other
  software via Debian code search indicates that there are not yet any
  consumers of this interface for FreeBSD/arm64.
  
  Bump __FreeBSD_version to be on the safe side, in case compat code needs
  to be added in the future.
  
  Reviewed by:  emaste, manu
  MFC after:    2 weeks
  Sponsored by: The FreeBSD Foundation
  Differential Revision:        https://reviews.freebsd.org/D26329

Modified:
  head/sys/arm64/include/elf.h
  head/sys/sys/param.h

Modified: head/sys/arm64/include/elf.h
==============================================================================
--- head/sys/arm64/include/elf.h        Tue Sep  8 15:01:49 2020        
(r365458)
+++ head/sys/arm64/include/elf.h        Tue Sep  8 15:08:20 2020        
(r365459)
@@ -102,25 +102,29 @@ __ElfType(Auxinfo);
 #define        HWCAP_CRC32             0x00000080
 #define        HWCAP_ATOMICS           0x00000100
 #define        HWCAP_FPHP              0x00000200
-/* XXX: The following bits don't match the Linux definitions */
-#define        HWCAP_CPUID             0x00000400
-#define        HWCAP_ASIMDRDM          0x00000800
-#define        HWCAP_JSCVT             0x00001000
-#define        HWCAP_FCMA              0x00002000
-#define        HWCAP_LRCPC             0x00004000
-#define        HWCAP_DCPOP             0x00008000
-#define        HWCAP_SHA3              0x00010000
-#define        HWCAP_SM3               0x00020000
-#define        HWCAP_SM4               0x00040000
-#define        HWCAP_ASIMDDP           0x00080000
-#define        HWCAP_SHA512            0x00100000
-#define        HWCAP_SVE               0x00200000
-#define        HWCAP_ASIMDFHM          0x00400000
-#define        HWCAP_DIT               0x00800000
-#define        HWCAP_USCAT             0x01000000
-#define        HWCAP_ILRCPC            0x02000000
-#define        HWCAP_FLAGM             0x04000000
-/* XXX: end of incorrect definitions */
+#define        HWCAP_ASIMDHP           0x00000400
+/*
+ * XXX: The following bits (from CPUID to FLAGM) were originally incorrect,
+ * but later changed to match the Linux definitions. No compatibility code is
+ * provided, as the fix was expected to result in near-zero fallout.
+ */
+#define        HWCAP_CPUID             0x00000800
+#define        HWCAP_ASIMDRDM          0x00001000
+#define        HWCAP_JSCVT             0x00002000
+#define        HWCAP_FCMA              0x00004000
+#define        HWCAP_LRCPC             0x00008000
+#define        HWCAP_DCPOP             0x00010000
+#define        HWCAP_SHA3              0x00020000
+#define        HWCAP_SM3               0x00040000
+#define        HWCAP_SM4               0x00080000
+#define        HWCAP_ASIMDDP           0x00100000
+#define        HWCAP_SHA512            0x00200000
+#define        HWCAP_SVE               0x00400000
+#define        HWCAP_ASIMDFHM          0x00800000
+#define        HWCAP_DIT               0x01000000
+#define        HWCAP_USCAT             0x02000000
+#define        HWCAP_ILRCPC            0x04000000
+#define        HWCAP_FLAGM             0x08000000
 #define        HWCAP_SSBS              0x10000000
 #define        HWCAP_SB                0x20000000
 #define        HWCAP_PACA              0x40000000

Modified: head/sys/sys/param.h
==============================================================================
--- head/sys/sys/param.h        Tue Sep  8 15:01:49 2020        (r365458)
+++ head/sys/sys/param.h        Tue Sep  8 15:08:20 2020        (r365459)
@@ -60,7 +60,7 @@
  *             in the range 5 to 9.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 1300113      /* Master, propagated to newvers */
+#define __FreeBSD_version 1300114      /* Master, propagated to newvers */
 
 /*
  * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to