3 /* Number of double words needed to store all facility bits. */
4 #define S390_NUM_FACILITY_DW 4
7 unsigned long long stfle(unsigned long dw
, unsigned bit_to_test
)
9 unsigned long long hoststfle
[S390_NUM_FACILITY_DW
];
10 register unsigned long long __nr
asm("0") = dw
- 1;
13 asm volatile(" .insn s,0xb2b00000,%0 \n" /* stfle */
16 : "=Q" (*hoststfle
), "+d" (__nr
), "=d" (cc
) : : "cc", "memory");
18 printf("the value of cc is %d and #double words is %llu\n", cc
, __nr
+ 1);
20 return (hoststfle
[0] & (1ULL << (63 - bit_to_test
)));
21 else if (bit_to_test
< 128)
22 return (hoststfle
[1] & (1ULL << (63 - bit_to_test
)));
23 else if (bit_to_test
< 192)
24 return (hoststfle
[2] & (1ULL << (63 - bit_to_test
)));
26 printf("code needs to be updated\n");
32 int dw
= S390_NUM_FACILITY_DW
;
34 /* Test #1: Make sure STFLE returns sensible values. z/Arch facilities
36 if ((stfle(dw
, 1)) && stfle(dw
, 2))
37 printf("The z/Architecture architectural mode is installed and active\n");
39 printf("The z/Architecture architectural mode is not installed\n");
41 /* Test #2: Make sure the STFLE is supported. */
43 printf("STFLE facility is installed\n");
45 printf("STFLE facility is not installed\n");
47 /* Test #3: Tell STFLE to only write 1 DW of facility bits. Expected condition
48 code should be 3 because this test is run on those machines only
49 that need 3 do double words to store facility bits. */
51 if ((stfle(dw
, 1)) && stfle(dw
, 2))
52 printf("The z/Architecture architectural mode is installed and active\n");
54 printf("The z/Architecture architectural mode is not installed\n");
56 /* Test #4: Constrained transactional-execution */
58 printf("Constrained transactional-execution is supported\n");
60 printf("No constrained transactional-execution facility available\n");