]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
s390: long displacement facility related cleanups (BZ 509562)
authorFlorian Krohm <flo2030@eich-krohm.de>
Fri, 21 Nov 2025 15:51:53 +0000 (15:51 +0000)
committerFlorian Krohm <flo2030@eich-krohm.de>
Fri, 21 Nov 2025 15:51:53 +0000 (15:51 +0000)
The long displacement facilities are always present on the supported
machines.
- Remove s390_host_has_ldisp and VEX_HWCAPS_S390X_LDISP
- Update tests/s390x_features.c

Part of fixing https://bugs.kde.org/show_bug.cgi?id=509562

VEX/priv/host_s390_defs.h
VEX/priv/main_main.c
VEX/pub/libvex.h
coregrind/m_machine.c
none/tests/libvex_test.c
tests/s390x_features.c

index fdcc199c64ba20906247653911595b511cee1759..8fc1a94b9dc59919be7d212f4c77ab5e68df7afe 100644 (file)
@@ -918,8 +918,6 @@ VexInvalRange patchProfInc_S390(VexEndness endness_host,
 extern UInt s390_host_hwcaps;
 
 /* Convenience macros to test installed facilities */
-#define s390_host_has_ldisp \
-                      (s390_host_hwcaps & (VEX_HWCAPS_S390X_LDISP))
 #define s390_host_has_eimm \
                       (s390_host_hwcaps & (VEX_HWCAPS_S390X_EIMM))
 #define s390_host_has_gie \
index 8f3ab89458ca7cbd4cef55a9d4cf889712e5813d..c40e642b99cbae4d5c276236df1a7c80e31d8f38 100644 (file)
@@ -1923,7 +1923,6 @@ static const HChar* show_hwcaps_s390x ( UInt hwcaps )
       UInt  hwcaps_bit;
       HChar name[6];
    } hwcaps_list[] = {
-      { VEX_HWCAPS_S390X_LDISP, "ldisp" },
       { VEX_HWCAPS_S390X_EIMM,  "eimm" },
       { VEX_HWCAPS_S390X_GIE,   "gie" },
       { VEX_HWCAPS_S390X_DFP,   "dfp" },
@@ -2298,9 +2297,6 @@ static void check_hwcaps ( VexArch arch, UInt hwcaps )
       }
 
       case VexArchS390X:
-         if (! s390_host_has_ldisp)
-            invalid_hwcaps(arch, hwcaps,
-                           "Host does not have long displacement facility.\n");
          return;
 
       case VexArchMIPS32:
index a1eb48f41404b1fc61e61fa5e33c5e46b0cc658a..a3345af5b8dcf5def6d6be537ef4732c9f72e16f 100644 (file)
@@ -162,7 +162,6 @@ typedef
 #define VEX_S390X_MODEL_UNKNOWN  19     /* always last in list */
 #define VEX_S390X_MODEL_MASK     0x3F
 
-#define VEX_HWCAPS_S390X_LDISP (1<<6)   /* Long-displacement facility */
 #define VEX_HWCAPS_S390X_EIMM  (1<<7)   /* Extended-immediate facility */
 #define VEX_HWCAPS_S390X_GIE   (1<<8)   /* General-instruction-extension facility */
 #define VEX_HWCAPS_S390X_DFP   (1<<9)   /* Decimal floating point facility */
@@ -188,8 +187,7 @@ typedef
 #define VEX_HWCAPS_S390X_MSA9  (1<<30)  /* Message-security-assist extension 9 */
 
 /* Special value representing all available s390x hwcaps */
-#define VEX_HWCAPS_S390X_ALL   (VEX_HWCAPS_S390X_LDISP | \
-                                VEX_HWCAPS_S390X_EIMM  | \
+#define VEX_HWCAPS_S390X_ALL   (VEX_HWCAPS_S390X_EIMM  | \
                                 VEX_HWCAPS_S390X_GIE   | \
                                 VEX_HWCAPS_S390X_DFP   | \
                                 VEX_HWCAPS_S390X_FGX   | \
index 6729e57c6ddd36470926f3eaff959bb1e70f780c..73dfaf8ea8bf0622033c3301b6d56db3b0485e3c 100644 (file)
@@ -1533,7 +1533,7 @@ Bool VG_(machine_get_hwcaps)( void )
      vki_sigaction_fromK_t saved_sigill_act;
      vki_sigaction_toK_t     tmp_sigill_act;
 
-     volatile Bool have_LDISP, have_STFLE;
+     volatile Bool have_STFLE;
      Int i, r, model;
 
      /* If the model is "unknown" don't treat this as an error. Assume
@@ -1570,17 +1570,6 @@ Bool VG_(machine_get_hwcaps)( void )
      /* Determine hwcaps. Note, we cannot use the stfle insn because it
         is not supported on z900. */
 
-     have_LDISP = True;
-     if (VG_MINIMAL_SETJMP(env_unsup_insn)) {
-        have_LDISP = False;
-     } else {
-       /* BASR loads the address of the next insn into r1. Needed to avoid
-          a segfault in XY. */
-        __asm__ __volatile__("basr %%r1,%%r0\n\t"
-                             ".long  0xe3001000\n\t"  /* XY  0,0(%r1) */
-                             ".short 0x0057" : : : "r0", "r1", "cc", "memory");
-     }
-
      /* Check availability of STFLE. If available store facility bits
         in hoststfle. */
      ULong hoststfle[S390_NUM_FACILITY_DW];
@@ -1610,12 +1599,6 @@ Bool VG_(machine_get_hwcaps)( void )
 
      vai.hwcaps = model;
      if (have_STFLE) vai.hwcaps |= VEX_HWCAPS_S390X_STFLE;
-     if (have_LDISP) {
-        /* Use long displacement only on machines >= z990. For all other
-           machines it is millicoded and therefore slow. */
-        if (model >= VEX_S390X_MODEL_Z990)
-           vai.hwcaps |= VEX_HWCAPS_S390X_LDISP;
-     }
 
      /* Detect presence of certain facilities using the STFLE insn.
         Note, that these facilities were introduced at the same time or later
@@ -1627,7 +1610,6 @@ Bool VG_(machine_get_hwcaps)( void )
         UInt hwcaps_bit;
         const HChar name[6];   // may need adjustment for new facility names
      } fac_hwcaps[] = {
-        { False,  18,  VEX_HWCAPS_S390X_LDISP, "LDISP" },
         { False,  21,  VEX_HWCAPS_S390X_EIMM,  "EIMM"  },
         { False,  34,  VEX_HWCAPS_S390X_GIE,   "GIE"   },
         { False,  42,  VEX_HWCAPS_S390X_DFP,   "DFP"   },
index 6a8086aced0b5542829b069a2fab0cf881df9b68..b56e9cbd670c0e94f65862c10b9a4ada3a5f05ad 100644 (file)
@@ -131,7 +131,7 @@ static UInt arch_hwcaps (VexArch va) {
    case VexArchARM64:  return 0;
    case VexArchPPC32:  return 0;
    case VexArchPPC64:  return 0;
-   case VexArchS390X:  return VEX_HWCAPS_S390X_LDISP;
+   case VexArchS390X:  return 0;
 #if (__mips_isa_rev>=6)
    case VexArchMIPS32: return VEX_PRID_COMP_MIPS | VEX_MIPS_CPU_ISA_M32R6 |
                               VEX_MIPS_HOST_FR;
index 625984dbb6b33cf29b959b5d5661a36bda1d406f..cad15885303252ad452288eba3dd353aa3b85467 100644 (file)
@@ -246,8 +246,6 @@ static int go(char *feature, char *cpu)
       match = facilities[0] & FAC_BIT(0);
    } else if (strcmp(feature, "s390x-stfle") == 0 ) {
       match = facilities[0] & FAC_BIT(7);
-   } else if (strcmp(feature, "s390x-ldisp") == 0 ) {
-      match = (facilities[0] & FAC_BIT(18)) && (facilities[0] & FAC_BIT(19));
    } else if (strcmp(feature, "s390x-eimm") == 0 ) {
       match = facilities[0] & FAC_BIT(21);
    } else if (strcmp(feature, "s390x-genins") == 0 ) {