]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Fix for the HWCAP2 aux vector.
authorCarl Love <cel@us.ibm.com>
Tue, 19 May 2015 16:08:05 +0000 (16:08 +0000)
committerCarl Love <cel@us.ibm.com>
Tue, 19 May 2015 16:08:05 +0000 (16:08 +0000)
The support assumed that if HWCAP2 is present that the system also supports
ISA2.07.  That assumption is not correct as we have found a few systems (OS)
where the HWCAP2 entry is present but the ISA2.07 bit is not set.  This patch
fixes the assertion test to specifically check the ISA2.07 support bit setting
in the HWCAP2 and vex_archinfo->hwcaps variable.  The setting for the
ISA2.07 support must be the same in both variables if the HWCAP2 entry exists.

This patch updates Vagrind bugzilla 345695.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15257

coregrind/m_initimg/initimg-linux.c

index cd0b7f3046a2e30dc73c06294765b5e1641371f1..d8ff159cca7513b267feacf4f8c7af15882c6582 100644 (file)
@@ -704,10 +704,12 @@ Addr setup_client_stack( void*  init_sp,
 #           endif
             break;
 #        if defined(VGP_ppc64be_linux) || defined(VGP_ppc64le_linux)
-         case AT_HWCAP2:
-            /* The HWCAP2 value has the entry arch_2_07 which indicates the
-             * processor is a Power 8 or beyond.  The Valgrind vai.hwcaps
-             * value (coregrind/m_machine.c) has the VEX_HWCAPS_PPC64_ISA2_07
+         case AT_HWCAP2:  {
+            Bool auxv_2_07, hw_caps_2_07;
+           /* The HWCAP2 field may contain an arch_2_07 entry that indicates
+             * if the processor is compliant with the 2.07 ISA. (i.e. Power 8
+             * or beyond).  The Valgrind vai.hwcaps value
+             * (coregrind/m_machine.c) has the VEX_HWCAPS_PPC64_ISA2_07
              * flag set so Valgrind knows about Power8.  Need to pass the
              * HWCAP2 value along so the user level programs can detect that
              * the processor supports ISA 2.07 and beyond.
@@ -728,13 +730,15 @@ Addr setup_client_stack( void*  init_sp,
                 PPC_FEATURE2_HAS_TAR          0x04000000
                 PPC_FEATURE2_HAS_VCRYPTO      0x02000000
             */
-
-           if ((auxv->u.a_val & ~(0x80000000ULL)) != 0) {
-                /* Verify if PPC_FEATURE2_ARCH_2_07 is set in HWCAP2
-                 * that arch_2_07 is also set in VEX HWCAPS
-                 */
-               vg_assert((vex_archinfo->hwcaps & VEX_HWCAPS_PPC64_ISA2_07) == VEX_HWCAPS_PPC64_ISA2_07);
-             }
+            auxv_2_07 = (auxv->u.a_val & 0x80000000ULL) == 0x80000000ULL;
+            hw_caps_2_07 = (vex_archinfo->hwcaps & VEX_HWCAPS_PPC64_ISA2_07)
+               == VEX_HWCAPS_PPC64_ISA2_07;
+
+            /* Verify the PPC_FEATURE2_ARCH_2_07 setting in HWCAP2
+            * matches the setting in VEX HWCAPS.
+            */
+            vg_assert(auxv_2_07 == hw_caps_2_07);
+            }
 
             break;
 #           endif