ULong
s390x_dirtyhelper_STFLE(VexGuestS390XState *guest_state, ULong *addr)
{
- ULong hoststfle[S390_NUM_FACILITY_DW], cc, num_dw, i;
- register ULong reg0 asm("0") = guest_state->guest_r0 & 0xF; /* r0[56:63] */
+ ULong hoststfle[S390_NUM_FACILITY_DW], cc, last_dw, i;
+ register ULong reg0 asm("0") = guest_state->guest_r0;
+ last_dw = reg0 & 0xf;
/* Restrict to facilities that we know about and that we assume to be
compatible with Valgrind. Of course, in this way we may reject features
/* 157-167: unassigned */
| s390_stfle_range(168, 168)
/* 168-191: unassigned */ ),
- };
-
- /* We cannot store more than S390_NUM_FACILITY_DW
- (and it makes not much sense to do so anyhow) */
- if (reg0 > S390_NUM_FACILITY_DW - 1)
- reg0 = S390_NUM_FACILITY_DW - 1;
- num_dw = reg0 + 1; /* number of double words written */
+ /* === 192 .. 255 === */
+ /* 192: vector-packed-decimal, not supported */
+ (s390_stfle_range(193, 194)
+ /* 195: unassigned */
+ | s390_stfle_range(196, 197)),
+ };
- asm volatile(" .insn s,0xb2b00000,%0\n" /* stfle */
- "ipm %2\n"
- "srl %2,28\n"
- : "=m" (hoststfle), "+d"(reg0), "=d"(cc) : : "cc", "memory");
+ asm(".insn s,0xb2b00000,%0\n" /* stfle */
+ "ipm %2\n"
+ "srl %2,28\n"
+ : "=Q"(hoststfle), "+d"(reg0), "=d"(cc)
+ :
+ : "cc");
/* Update guest register 0 with what STFLE set r0 to */
guest_state->guest_r0 = reg0;
/* VM facilities = host facilities, filtered by acceptance */
- for (i = 0; i < num_dw; ++i)
- addr[i] = hoststfle[i] & accepted_facility[i];
+ for (i = 0; i <= last_dw; ++i) {
+ if (i < S390_NUM_FACILITY_DW)
+ addr[i] = hoststfle[i] & accepted_facility[i];
+ else
+ addr[i] = 0; /* mask out any excess doublewords */
+ }
return cc;
}
#define VEX_S390X_MODEL_Z14 14
#define VEX_S390X_MODEL_Z14_ZR1 15
#define VEX_S390X_MODEL_Z15 16
-#define VEX_S390X_MODEL_UNKNOWN 17 /* always last in list */
+#define VEX_S390X_MODEL_Z16 17
+#define VEX_S390X_MODEL_UNKNOWN 18 /* always last in list */
#define VEX_S390X_MODEL_MASK 0x3F
#define VEX_HWCAPS_S390X_LDISP (1<<6) /* Long-displacement facility */
#define S390_NUM_GPRPARMS 5
/* Number of double words needed to store all facility bits. */
-#define S390_NUM_FACILITY_DW 3
+#define S390_NUM_FACILITY_DW 4
#endif /* __LIBVEX_PUB_S390X_H */
my %toir_implemented = ();
my %toir_decoded = ();
my %known_arch = map {($_ => 1)}
- qw(g5 z900 z990 z9-109 z9-ec z10 z196 zEC12 z13 arch12 arch13);
+ qw(g5 z900 z990 z9-109 z9-ec z10 z196 zEC12 z13 arch12 arch13 arch14);
# Patterns for identifying certain extended mnemonics that shall be
# skipped in "s390-opc.txt" and "s390-opcodes.csv".
{ "3907", VEX_S390X_MODEL_Z14_ZR1 },
{ "8561", VEX_S390X_MODEL_Z15 },
{ "8562", VEX_S390X_MODEL_Z15 },
+ { "3931", VEX_S390X_MODEL_Z16 },
+ { "3932", VEX_S390X_MODEL_Z16 },
};
Int model, n, fh;
} else {
register ULong reg0 asm("0") = S390_NUM_FACILITY_DW - 1;
- __asm__ __volatile__(" .insn s,0xb2b00000,%0\n" /* stfle */
- : "=m" (hoststfle), "+d"(reg0)
- : : "cc", "memory");
+ __asm__(".insn s,0xb2b00000,%0" /* stfle */
+ : "=Q"(hoststfle), "+d"(reg0)
+ :
+ : "cc");
}
/* Restore signals */
dfpext.stderr.exp dfpext.stdout.exp dfpext.vgtest \
dfpconv.stderr.exp dfpconv.stdout.exp dfpconv.vgtest \
srnmt.stderr.exp srnmt.stdout.exp srnmt.vgtest \
+ stfle.stdout.exp-z16 \
pfpo.stderr.exp pfpo.stdout.exp pfpo.vgtest
AM_CFLAGS += @FLAG_M64@
#include <stdio.h>
/* Number of double words needed to store all facility bits. */
-#define S390_NUM_FACILITY_DW 3
+#define S390_NUM_FACILITY_DW 4
unsigned long long stfle(unsigned long dw, unsigned bit_to_test)
--- /dev/null
+the value of cc is 0 and #double words is 4
+the value of cc is 0 and #double words is 4
+The z/Architecture architectural mode is installed and active
+the value of cc is 0 and #double words is 4
+STFLE facility is installed
+the value of cc is 3 and #double words is 4
+the value of cc is 3 and #double words is 4
+The z/Architecture architectural mode is installed and active
+the value of cc is 3 and #double words is 4
+No MSA facility available
{ "3907", "z14 ZR1"},
{ "8561", "z15" },
{ "8562", "z15" },
+ { "3931", "z16" },
+ { "3932", "z16" },
};