|
Mark Wielaard |
c0730c |
commit d2c954603a211e11c35db7d8b3fdd60675483738
|
|
Mark Wielaard |
c0730c |
Author: florian <florian@8f6e269a-dfd6-0310-a8e1-e2731360e62c>
|
|
Mark Wielaard |
c0730c |
Date: Tue Dec 4 04:45:32 2012 +0000
|
|
Mark Wielaard |
c0730c |
|
|
Mark Wielaard |
c0730c |
In the past, the implementation of STFLE returned the facilities of the host
|
|
Mark Wielaard |
c0730c |
machine. This was not consistent in the following sense: Suppose the host
|
|
Mark Wielaard |
c0730c |
has a facility F installed and this facility implies the availability of an
|
|
Mark Wielaard |
c0730c |
insn X. Suppose further, that insn X is not supported in valgrind.
|
|
Mark Wielaard |
c0730c |
An application progrm that tests the availability of insn X by checking
|
|
Mark Wielaard |
c0730c |
for its associated facility F will fail under valgrind when using X because
|
|
Mark Wielaard |
c0730c |
valgrind will SIGILL. Not so good.
|
|
Mark Wielaard |
c0730c |
|
|
Mark Wielaard |
c0730c |
This patch changes the STFLE behaviour to adjust the facilities of the
|
|
Mark Wielaard |
c0730c |
virtual machine according to what the set of insns that is actually
|
|
Mark Wielaard |
c0730c |
supported. It's an approximation, because for some facilities we only
|
|
Mark Wielaard |
c0730c |
support a subset of the insns enabled by that facility.
|
|
Mark Wielaard |
c0730c |
|
|
Mark Wielaard |
c0730c |
Fixes BZ 310931.
|
|
Mark Wielaard |
c0730c |
|
|
Mark Wielaard |
c0730c |
|
|
Mark Wielaard |
c0730c |
git-svn-id: svn://svn.valgrind.org/vex/trunk@2579 8f6e269a-dfd6-0310-a8e1-e2731360e62c
|
|
Mark Wielaard |
c0730c |
|
|
Mark Wielaard |
c0730c |
diff --git a/VEX/priv/guest_s390_helpers.c b/priv/guest_s390_helpers.c
|
|
Mark Wielaard |
c0730c |
index 8169916..b0c0225 100644
|
|
Mark Wielaard |
c0730c |
--- a/VEX/priv/guest_s390_helpers.c
|
|
Mark Wielaard |
c0730c |
+++ b/VEX/priv/guest_s390_helpers.c
|
|
Mark Wielaard |
c0730c |
@@ -292,6 +292,22 @@ ULong s390x_dirtyhelper_STCKE(ULong *addr) {return 3;}
|
|
Mark Wielaard |
c0730c |
/*--- Dirty helper for Store Facility instruction ---*/
|
|
Mark Wielaard |
c0730c |
/*------------------------------------------------------------*/
|
|
Mark Wielaard |
c0730c |
#if defined(VGA_s390x)
|
|
Mark Wielaard |
c0730c |
+static void
|
|
Mark Wielaard |
c0730c |
+s390_set_facility_bit(ULong *addr, UInt bitno, UInt value)
|
|
Mark Wielaard |
c0730c |
+{
|
|
Mark Wielaard |
c0730c |
+ addr += bitno / 64;
|
|
Mark Wielaard |
c0730c |
+ bitno = bitno % 64;
|
|
Mark Wielaard |
c0730c |
+
|
|
Mark Wielaard |
c0730c |
+ ULong mask = 1;
|
|
Mark Wielaard |
c0730c |
+ mask <<= (63 - bitno);
|
|
Mark Wielaard |
c0730c |
+
|
|
Mark Wielaard |
c0730c |
+ if (value == 1) {
|
|
Mark Wielaard |
c0730c |
+ *addr |= mask; // set
|
|
Mark Wielaard |
c0730c |
+ } else {
|
|
Mark Wielaard |
c0730c |
+ *addr &= ~mask; // clear
|
|
Mark Wielaard |
c0730c |
+ }
|
|
Mark Wielaard |
c0730c |
+}
|
|
Mark Wielaard |
c0730c |
+
|
|
Mark Wielaard |
c0730c |
ULong
|
|
Mark Wielaard |
c0730c |
s390x_dirtyhelper_STFLE(VexGuestS390XState *guest_state, ULong *addr)
|
|
Mark Wielaard |
c0730c |
{
|
|
Mark Wielaard |
c0730c |
@@ -313,9 +329,56 @@ s390x_dirtyhelper_STFLE(VexGuestS390XState *guest_state, ULong *addr)
|
|
Mark Wielaard |
c0730c |
/* Update guest register 0 with what STFLE set r0 to */
|
|
Mark Wielaard |
c0730c |
guest_state->guest_r0 = reg0;
|
|
Mark Wielaard |
c0730c |
|
|
Mark Wielaard |
c0730c |
+ /* Set default: VM facilities = host facilities */
|
|
Mark Wielaard |
c0730c |
for (i = 0; i < num_dw; ++i)
|
|
Mark Wielaard |
c0730c |
addr[i] = hoststfle[i];
|
|
Mark Wielaard |
c0730c |
|
|
Mark Wielaard |
c0730c |
+ /* Enumerators for interesting facilities. The value of the enumerator
|
|
Mark Wielaard |
c0730c |
+ is the number of the facility bit as per POP. */
|
|
Mark Wielaard |
c0730c |
+ enum {
|
|
Mark Wielaard |
c0730c |
+ S390_FAC_MSA = 17, // message-security-assist
|
|
Mark Wielaard |
c0730c |
+ S390_FAC_LDISP = 18, // long displacement
|
|
Mark Wielaard |
c0730c |
+ S390_FAC_HFPMAS = 20, // HFP multiply-and-add-subtract
|
|
Mark Wielaard |
c0730c |
+ S390_FAC_EIMM = 21, // extended immediate
|
|
Mark Wielaard |
c0730c |
+ S390_FAC_HFPUNX = 23, // HFP unnormalized extension
|
|
Mark Wielaard |
c0730c |
+ S390_FAC_ETF2 = 24, // ETF2-enhancement
|
|
Mark Wielaard |
c0730c |
+ S390_FAC_PENH = 26, // parsing-enhancement
|
|
Mark Wielaard |
c0730c |
+ S390_FAC_ETF3 = 30, // ETF3-enhancement
|
|
Mark Wielaard |
c0730c |
+ S390_FAC_XCPUT = 31, // extract-CPU-time
|
|
Mark Wielaard |
c0730c |
+ S390_FAC_GIE = 34, // general insn extension
|
|
Mark Wielaard |
c0730c |
+ S390_FAC_EXEXT = 35, // execute extension
|
|
Mark Wielaard |
c0730c |
+ S390_FAC_DFP = 42, // decimal floating point
|
|
Mark Wielaard |
c0730c |
+ S390_FAC_PFPO = 44, // perform floating point operation insn
|
|
Mark Wielaard |
c0730c |
+ S390_FAC_HIGHW = 45, // high-word extension
|
|
Mark Wielaard |
c0730c |
+ S390_FAC_DFPZC = 48, // DFP zoned-conversion
|
|
Mark Wielaard |
c0730c |
+ S390_FAC_MISC = 49, // miscellaneous insn
|
|
Mark Wielaard |
c0730c |
+ S390_FAC_CTREXE = 50, // constrained transactional execution
|
|
Mark Wielaard |
c0730c |
+ S390_FAC_TREXE = 73, // transactional execution
|
|
Mark Wielaard |
c0730c |
+ S390_FAC_MSA4 = 77 // message-security-assist 4
|
|
Mark Wielaard |
c0730c |
+ };
|
|
Mark Wielaard |
c0730c |
+
|
|
Mark Wielaard |
c0730c |
+ /* Now adjust the VM facilities according to what the VM supports */
|
|
Mark Wielaard |
c0730c |
+ s390_set_facility_bit(addr, S390_FAC_LDISP, 1);
|
|
Mark Wielaard |
c0730c |
+ s390_set_facility_bit(addr, S390_FAC_EIMM, 1);
|
|
Mark Wielaard |
c0730c |
+ s390_set_facility_bit(addr, S390_FAC_ETF2, 1);
|
|
Mark Wielaard |
c0730c |
+ s390_set_facility_bit(addr, S390_FAC_ETF3, 1);
|
|
Mark Wielaard |
c0730c |
+ s390_set_facility_bit(addr, S390_FAC_GIE, 1);
|
|
Mark Wielaard |
c0730c |
+ s390_set_facility_bit(addr, S390_FAC_EXEXT, 1);
|
|
Mark Wielaard |
c0730c |
+ s390_set_facility_bit(addr, S390_FAC_HIGHW, 1);
|
|
Mark Wielaard |
c0730c |
+
|
|
Mark Wielaard |
c0730c |
+ s390_set_facility_bit(addr, S390_FAC_HFPMAS, 0);
|
|
Mark Wielaard |
c0730c |
+ s390_set_facility_bit(addr, S390_FAC_HFPUNX, 0);
|
|
Mark Wielaard |
c0730c |
+ s390_set_facility_bit(addr, S390_FAC_XCPUT, 0);
|
|
Mark Wielaard |
c0730c |
+ s390_set_facility_bit(addr, S390_FAC_MSA, 0);
|
|
Mark Wielaard |
c0730c |
+ s390_set_facility_bit(addr, S390_FAC_PENH, 0);
|
|
Mark Wielaard |
c0730c |
+ s390_set_facility_bit(addr, S390_FAC_DFP, 0);
|
|
Mark Wielaard |
c0730c |
+ s390_set_facility_bit(addr, S390_FAC_PFPO, 0);
|
|
Mark Wielaard |
c0730c |
+ s390_set_facility_bit(addr, S390_FAC_DFPZC, 0);
|
|
Mark Wielaard |
c0730c |
+ s390_set_facility_bit(addr, S390_FAC_MISC, 0);
|
|
Mark Wielaard |
c0730c |
+ s390_set_facility_bit(addr, S390_FAC_CTREXE, 0);
|
|
Mark Wielaard |
c0730c |
+ s390_set_facility_bit(addr, S390_FAC_TREXE, 0);
|
|
Mark Wielaard |
c0730c |
+ s390_set_facility_bit(addr, S390_FAC_MSA4, 0);
|
|
Mark Wielaard |
c0730c |
+
|
|
Mark Wielaard |
c0730c |
return cc;
|
|
Mark Wielaard |
c0730c |
}
|
|
Mark Wielaard |
c0730c |
|
|
Mark Wielaard |
c0730c |
commit a53843d425a9cc64159bd46833e93febb0a8d797
|
|
Mark Wielaard |
c0730c |
Author: florian <florian@a5019735-40e9-0310-863c-91ae7b9d1cf9>
|
|
Mark Wielaard |
c0730c |
Date: Tue Dec 4 04:46:52 2012 +0000
|
|
Mark Wielaard |
c0730c |
|
|
Mark Wielaard |
c0730c |
Beef up testcase. Announce fix.
|
|
Mark Wielaard |
c0730c |
Part of fixing BZ 310931.
|
|
Mark Wielaard |
c0730c |
|
|
Mark Wielaard |
c0730c |
|
|
Mark Wielaard |
c0730c |
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13150 a5019735-40e9-0310-863c-91ae7b9d1cf9
|
|
Mark Wielaard |
c0730c |
|
|
Mark Wielaard |
c0730c |
diff --git a/none/tests/s390x/stfle.c b/none/tests/s390x/stfle.c
|
|
Mark Wielaard |
c0730c |
index 7bfe2d6..6c8007b 100644
|
|
Mark Wielaard |
c0730c |
--- a/none/tests/s390x/stfle.c
|
|
Mark Wielaard |
c0730c |
+++ b/none/tests/s390x/stfle.c
|
|
Mark Wielaard |
c0730c |
@@ -52,5 +52,11 @@ int main()
|
|
Mark Wielaard |
c0730c |
else
|
|
Mark Wielaard |
c0730c |
printf("The z/Architecture architectural mode is not installed\n");
|
|
Mark Wielaard |
c0730c |
|
|
Mark Wielaard |
c0730c |
+ /* Test #4: Message security assist */
|
|
Mark Wielaard |
c0730c |
+ if (stfle(dw, 17)) {
|
|
Mark Wielaard |
c0730c |
+ printf("MSA facility is present\n");
|
|
Mark Wielaard |
c0730c |
+ } else {
|
|
Mark Wielaard |
c0730c |
+ printf("No MSA facility available\n");
|
|
Mark Wielaard |
c0730c |
+ }
|
|
Mark Wielaard |
c0730c |
return 0;
|
|
Mark Wielaard |
c0730c |
}
|
|
Mark Wielaard |
c0730c |
diff --git a/none/tests/s390x/stfle.stdout.exp b/none/tests/s390x/stfle.stdout.exp
|
|
Mark Wielaard |
c0730c |
index c4653a9..00c2c75 100644
|
|
Mark Wielaard |
c0730c |
--- a/none/tests/s390x/stfle.stdout.exp
|
|
Mark Wielaard |
c0730c |
+++ b/none/tests/s390x/stfle.stdout.exp
|
|
Mark Wielaard |
c0730c |
@@ -6,3 +6,4 @@ STFLE facility is installed
|
|
Mark Wielaard |
c0730c |
the value of cc is 3 and #double words is 2
|
|
Mark Wielaard |
c0730c |
the value of cc is 3 and #double words is 2
|
|
Mark Wielaard |
c0730c |
The z/Architecture architectural mode is installed and active
|
|
Mark Wielaard |
c0730c |
+No MSA facility available
|