42065
|
1 |
/*
|
|
2 |
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
|
3 |
* Copyright (c) 2016 SAP SE. All rights reserved.
|
|
4 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
5 |
*
|
|
6 |
* This code is free software; you can redistribute it and/or modify it
|
|
7 |
* under the terms of the GNU General Public License version 2 only, as
|
|
8 |
* published by the Free Software Foundation.
|
|
9 |
*
|
|
10 |
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
11 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
12 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
13 |
* version 2 for more details (a copy is included in the LICENSE file that
|
|
14 |
* accompanied this code).
|
|
15 |
*
|
|
16 |
* You should have received a copy of the GNU General Public License version
|
|
17 |
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
18 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
19 |
*
|
|
20 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
21 |
* or visit www.oracle.com if you need additional information or have any
|
|
22 |
* questions.
|
|
23 |
*
|
|
24 |
*/
|
|
25 |
|
|
26 |
#ifndef CPU_S390_VM_VM_VERSION_S390_HPP
|
|
27 |
#define CPU_S390_VM_VM_VERSION_S390_HPP
|
|
28 |
|
|
29 |
|
|
30 |
#include "runtime/globals_extension.hpp"
|
|
31 |
#include "runtime/vm_version.hpp"
|
|
32 |
|
|
33 |
class VM_Version: public Abstract_VM_Version {
|
|
34 |
|
|
35 |
protected:
|
|
36 |
// The following list contains the (approximate) announcement/availability
|
|
37 |
// dates of the many System z generations in existence as of now which
|
|
38 |
// implement the z/Architecture.
|
|
39 |
// z900: 2000-10
|
|
40 |
// z990: 2003-06
|
|
41 |
// z9: 2005-09
|
|
42 |
// z10: 2007-04
|
|
43 |
// z10: 2008-02
|
|
44 |
// z196: 2010-08
|
|
45 |
// ec12: 2012-09
|
|
46 |
// z13: 2015-03
|
|
47 |
//
|
|
48 |
// z/Architecture is the name of the 64-bit extension of the 31-bit s390
|
|
49 |
// architecture.
|
|
50 |
//
|
|
51 |
// ----------------------------------------------
|
|
52 |
// --- FeatureBitString Bits 0.. 63 (DW[0]) ---
|
|
53 |
// ----------------------------------------------
|
|
54 |
// 11222334445566
|
|
55 |
// 04826048260482604
|
|
56 |
#define StoreFacilityListExtendedMask 0x0100000000000000UL // z9
|
|
57 |
#define ETF2Mask 0x0000800000000000UL // z900
|
|
58 |
#define CryptoFacilityMask 0x0000400000000000UL // z990
|
|
59 |
#define LongDispFacilityMask 0x0000200000000000UL // z900 with microcode update
|
|
60 |
#define LongDispFacilityHighPerfMask 0x0000300000000000UL // z990
|
|
61 |
#define HFPMultiplyAndAddMask 0x0000080000000000UL // z990
|
|
62 |
#define ExtImmedFacilityMask 0x0000040000000000UL // z9
|
|
63 |
#define ETF3Mask 0x0000020000000000UL // z990/z9 (?)
|
|
64 |
#define HFPUnnormalizedMask 0x0000010000000000UL // z9
|
|
65 |
#define ETF2EnhancementMask 0x0000008000000000UL // z9
|
|
66 |
#define StoreClockFastMask 0x0000004000000000UL // z9
|
|
67 |
#define ParsingEnhancementsMask 0x0000002000000000UL // z10(?)
|
|
68 |
#define ETF3EnhancementMask 0x0000000200000000UL // z9
|
|
69 |
#define ExtractCPUTimeMask 0x0000000100000000UL // z10
|
|
70 |
#define CompareSwapStoreMask 0x00000000c0000000UL // z10
|
|
71 |
#define GnrlInstrExtFacilityMask 0x0000000020000000UL // z10
|
|
72 |
#define ExecuteExtensionsMask 0x0000000010000000UL // z10
|
|
73 |
#define FPExtensionsMask 0x0000000004000000UL // z196
|
|
74 |
#define FPSupportEnhancementsMask 0x0000000000400000UL // z10
|
|
75 |
#define DecimalFloatingPointMask 0x0000000000300000UL // z10
|
|
76 |
// z196 begin
|
|
77 |
#define DistinctOpndsMask 0x0000000000040000UL // z196
|
|
78 |
#define FastBCRSerializationMask DistinctOpndsMask
|
|
79 |
#define HighWordMask DistinctOpndsMask
|
|
80 |
#define LoadStoreConditionalMask DistinctOpndsMask
|
|
81 |
#define PopulationCountMask DistinctOpndsMask
|
|
82 |
#define InterlockedAccess1Mask DistinctOpndsMask
|
|
83 |
// z196 end
|
|
84 |
// EC12 begin
|
|
85 |
#define DFPZonedConversionMask 0x0000000000008000UL // ec12
|
|
86 |
#define MiscInstrExtMask 0x0000000000004000UL // ec12
|
|
87 |
#define ExecutionHintMask MiscInstrExtMask
|
|
88 |
#define LoadAndTrapMask MiscInstrExtMask
|
|
89 |
#define ProcessorAssistMask MiscInstrExtMask
|
|
90 |
#define ConstrainedTxExecutionMask 0x0000000000002000UL // ec12
|
|
91 |
#define InterlockedAccess2Mask 0x0000000000000800UL // ec12
|
|
92 |
// EC12 end
|
|
93 |
// z13 begin
|
|
94 |
#define LoadStoreConditional2Mask 0x0000000000000400UL // z13
|
|
95 |
#define CryptoExtension5Mask 0x0000000000000040UL // z13
|
|
96 |
// z13 end
|
|
97 |
// Feature-DW[0] starts to fill up. Use of these masks is risky.
|
|
98 |
#define TestFeature1ImplMask 0x0000000000000001UL
|
|
99 |
#define TestFeature2ImplMask 0x0000000000000002UL
|
|
100 |
#define TestFeature4ImplMask 0x0000000000000004UL
|
|
101 |
#define TestFeature8ImplMask 0x0000000000000008UL
|
|
102 |
// ----------------------------------------------
|
|
103 |
// --- FeatureBitString Bits 64..127 (DW[1]) ---
|
|
104 |
// ----------------------------------------------
|
|
105 |
// 11111111
|
|
106 |
// 66778889900011222
|
|
107 |
// 48260482604826048
|
|
108 |
#define TransactionalExecutionMask 0x0040000000000000UL // ec12
|
|
109 |
#define CryptoExtension3Mask 0x0008000000000000UL // z196
|
|
110 |
#define CryptoExtension4Mask 0x0004000000000000UL // z196
|
|
111 |
#define DFPPackedConversionMask 0x0000800000000000UL // z13
|
|
112 |
// ----------------------------------------------
|
|
113 |
// --- FeatureBitString Bits 128..192 (DW[2]) ---
|
|
114 |
// ----------------------------------------------
|
|
115 |
// 11111111111111111
|
|
116 |
// 23344455666778889
|
|
117 |
// 82604826048260482
|
|
118 |
#define VectorFacilityMask 0x4000000000000000UL // z13, not avail in VM guest mode!
|
|
119 |
|
|
120 |
enum {
|
|
121 |
_max_cache_levels = 8, // As limited by ECAG instruction.
|
|
122 |
_features_buffer_len = 4, // in DW
|
|
123 |
_code_buffer_len = 2*256 // For feature detection code.
|
|
124 |
};
|
|
125 |
static unsigned long _features[_features_buffer_len];
|
|
126 |
static unsigned long _cipher_features[_features_buffer_len];
|
|
127 |
static unsigned long _msgdigest_features[_features_buffer_len];
|
|
128 |
static unsigned int _nfeatures;
|
|
129 |
static unsigned int _ncipher_features;
|
|
130 |
static unsigned int _nmsgdigest_features;
|
|
131 |
static unsigned int _Dcache_lineSize;
|
|
132 |
static unsigned int _Icache_lineSize;
|
|
133 |
static bool _is_determine_features_test_running;
|
|
134 |
|
|
135 |
static bool test_feature_bit(unsigned long* featureBuffer, int featureNum, unsigned int bufLen);
|
|
136 |
static void set_features_string();
|
|
137 |
static void print_features_internal(const char* text, bool print_anyway=false);
|
|
138 |
static void determine_features();
|
|
139 |
static long call_getFeatures(unsigned long* buffer, int buflen, int functionCode);
|
|
140 |
static void set_getFeatures(address entryPoint);
|
|
141 |
static int calculate_ECAG_functionCode(unsigned int attributeIndication,
|
|
142 |
unsigned int levelIndication,
|
|
143 |
unsigned int typeIndication);
|
|
144 |
|
|
145 |
// Setting features via march=z900|z990|z9|z10|z196|ec12|z13|ztest commandline option.
|
|
146 |
static void reset_features(bool reset);
|
|
147 |
static void set_features_z900(bool reset = true);
|
|
148 |
static void set_features_z990(bool reset = true);
|
|
149 |
static void set_features_z9(bool reset = true);
|
|
150 |
static void set_features_z10(bool reset = true);
|
|
151 |
static void set_features_z196(bool reset = true);
|
|
152 |
static void set_features_ec12(bool reset = true);
|
|
153 |
static void set_features_z13(bool reset = true);
|
|
154 |
static void set_features_from(const char* march);
|
|
155 |
|
|
156 |
// Get the CPU type from feature bit settings.
|
|
157 |
static bool is_z900() { return has_long_displacement() && !has_long_displacement_fast(); }
|
|
158 |
static bool is_z990() { return has_long_displacement_fast() && !has_extended_immediate(); }
|
|
159 |
static bool is_z9() { return has_extended_immediate() && !has_GnrlInstrExtensions(); }
|
|
160 |
static bool is_z10() { return has_GnrlInstrExtensions() && !has_DistinctOpnds(); }
|
|
161 |
static bool is_z196() { return has_DistinctOpnds() && !has_MiscInstrExt(); }
|
|
162 |
static bool is_ec12() { return has_MiscInstrExt() && !has_CryptoExt5(); }
|
|
163 |
static bool is_z13() { return has_CryptoExt5();}
|
|
164 |
|
|
165 |
// Get information about cache line sizes.
|
|
166 |
// As of now and the foreseeable future, line size of all levels will be the same and 256.
|
|
167 |
static unsigned int Dcache_lineSize(unsigned int level = 0) { return _Dcache_lineSize; }
|
|
168 |
static unsigned int Icache_lineSize(unsigned int level = 0) { return _Icache_lineSize; }
|
|
169 |
|
|
170 |
public:
|
|
171 |
|
|
172 |
// Need to use nested class with unscoped enum.
|
|
173 |
// C++11 declaration "enum class Cipher { ... } is not supported.
|
|
174 |
class CipherMode {
|
|
175 |
public:
|
|
176 |
enum {
|
|
177 |
cipher = 0x00,
|
|
178 |
decipher = 0x80
|
|
179 |
};
|
|
180 |
};
|
|
181 |
class Cipher {
|
|
182 |
public:
|
|
183 |
enum { // KM only!!! KMC uses different parmBlk sizes.
|
|
184 |
_Query = 0,
|
|
185 |
_DEA = 1,
|
|
186 |
_TDEA128 = 2,
|
|
187 |
_TDEA192 = 3,
|
|
188 |
_EncryptedDEA = 9,
|
|
189 |
_EncryptedDEA128 = 10,
|
|
190 |
_EncryptedDEA192 = 11,
|
|
191 |
_AES128 = 18,
|
|
192 |
_AES192 = 19,
|
|
193 |
_AES256 = 20,
|
|
194 |
_EnccryptedAES128 = 26,
|
|
195 |
_EnccryptedAES192 = 27,
|
|
196 |
_EnccryptedAES256 = 28,
|
|
197 |
_XTSAES128 = 50,
|
|
198 |
_XTSAES256 = 52,
|
|
199 |
_EncryptedXTSAES128 = 58,
|
|
200 |
_EncryptedXTSAES256 = 60,
|
|
201 |
_PRNG = 67,
|
|
202 |
_featureBits = 128,
|
|
203 |
|
|
204 |
// Parameter block sizes (in bytes) for KM instruction.
|
|
205 |
_Query_parmBlk = 16,
|
|
206 |
_DEA_parmBlk = 8,
|
|
207 |
_TDEA128_parmBlk = 16,
|
|
208 |
_TDEA192_parmBlk = 24,
|
|
209 |
_EncryptedDEA_parmBlk = 32,
|
|
210 |
_EncryptedDEA128_parmBlk = 40,
|
|
211 |
_EncryptedDEA192_parmBlk = 48,
|
|
212 |
_AES128_parmBlk = 16,
|
|
213 |
_AES192_parmBlk = 24,
|
|
214 |
_AES256_parmBlk = 32,
|
|
215 |
_EnccryptedAES128_parmBlk = 48,
|
|
216 |
_EnccryptedAES192_parmBlk = 56,
|
|
217 |
_EnccryptedAES256_parmBlk = 64,
|
|
218 |
_XTSAES128_parmBlk = 32,
|
|
219 |
_XTSAES256_parmBlk = 48,
|
|
220 |
_EncryptedXTSAES128_parmBlk = 64,
|
|
221 |
_EncryptedXTSAES256_parmBlk = 80,
|
|
222 |
|
|
223 |
// Parameter block sizes (in bytes) for KMC instruction.
|
|
224 |
_Query_parmBlk_C = 16,
|
|
225 |
_DEA_parmBlk_C = 16,
|
|
226 |
_TDEA128_parmBlk_C = 24,
|
|
227 |
_TDEA192_parmBlk_C = 32,
|
|
228 |
_EncryptedDEA_parmBlk_C = 40,
|
|
229 |
_EncryptedDEA128_parmBlk_C = 48,
|
|
230 |
_EncryptedDEA192_parmBlk_C = 56,
|
|
231 |
_AES128_parmBlk_C = 32,
|
|
232 |
_AES192_parmBlk_C = 40,
|
|
233 |
_AES256_parmBlk_C = 48,
|
|
234 |
_EnccryptedAES128_parmBlk_C = 64,
|
|
235 |
_EnccryptedAES192_parmBlk_C = 72,
|
|
236 |
_EnccryptedAES256_parmBlk_C = 80,
|
|
237 |
_XTSAES128_parmBlk_C = 32,
|
|
238 |
_XTSAES256_parmBlk_C = 48,
|
|
239 |
_EncryptedXTSAES128_parmBlk_C = 64,
|
|
240 |
_EncryptedXTSAES256_parmBlk_C = 80,
|
|
241 |
_PRNG_parmBlk_C = 32,
|
|
242 |
|
|
243 |
// Data block sizes (in bytes).
|
|
244 |
_Query_dataBlk = 0,
|
|
245 |
_DEA_dataBlk = 8,
|
|
246 |
_TDEA128_dataBlk = 8,
|
|
247 |
_TDEA192_dataBlk = 8,
|
|
248 |
_EncryptedDEA_dataBlk = 8,
|
|
249 |
_EncryptedDEA128_dataBlk = 8,
|
|
250 |
_EncryptedDEA192_dataBlk = 8,
|
|
251 |
_AES128_dataBlk = 16,
|
|
252 |
_AES192_dataBlk = 16,
|
|
253 |
_AES256_dataBlk = 16,
|
|
254 |
_EnccryptedAES128_dataBlk = 16,
|
|
255 |
_EnccryptedAES192_dataBlk = 16,
|
|
256 |
_EnccryptedAES256_dataBlk = 16,
|
|
257 |
_XTSAES128_dataBlk = 16,
|
|
258 |
_XTSAES256_dataBlk = 16,
|
|
259 |
_EncryptedXTSAES128_dataBlk = 16,
|
|
260 |
_EncryptedXTSAES256_dataBlk = 16,
|
|
261 |
_PRNG_dataBlk = 8,
|
|
262 |
};
|
|
263 |
};
|
|
264 |
class MsgDigest {
|
|
265 |
public:
|
|
266 |
enum {
|
|
267 |
_Query = 0,
|
|
268 |
_SHA1 = 1,
|
|
269 |
_SHA256 = 2,
|
|
270 |
_SHA512 = 3,
|
|
271 |
_GHASH = 65,
|
|
272 |
_featureBits = 128,
|
|
273 |
|
|
274 |
// Parameter block sizes (in bytes) for KIMD.
|
|
275 |
_Query_parmBlk_I = 16,
|
|
276 |
_SHA1_parmBlk_I = 20,
|
|
277 |
_SHA256_parmBlk_I = 32,
|
|
278 |
_SHA512_parmBlk_I = 64,
|
|
279 |
_GHASH_parmBlk_I = 32,
|
|
280 |
|
|
281 |
// Parameter block sizes (in bytes) for KLMD.
|
|
282 |
_Query_parmBlk_L = 16,
|
|
283 |
_SHA1_parmBlk_L = 28,
|
|
284 |
_SHA256_parmBlk_L = 40,
|
|
285 |
_SHA512_parmBlk_L = 80,
|
|
286 |
|
|
287 |
// Data block sizes (in bytes).
|
|
288 |
_Query_dataBlk = 0,
|
|
289 |
_SHA1_dataBlk = 64,
|
|
290 |
_SHA256_dataBlk = 64,
|
|
291 |
_SHA512_dataBlk = 128,
|
|
292 |
_GHASH_dataBlk = 16
|
|
293 |
};
|
|
294 |
};
|
|
295 |
class MsgAuthent {
|
|
296 |
public:
|
|
297 |
enum {
|
|
298 |
_Query = 0,
|
|
299 |
_DEA = 1,
|
|
300 |
_TDEA128 = 2,
|
|
301 |
_TDEA192 = 3,
|
|
302 |
_EncryptedDEA = 9,
|
|
303 |
_EncryptedDEA128 = 10,
|
|
304 |
_EncryptedDEA192 = 11,
|
|
305 |
_AES128 = 18,
|
|
306 |
_AES192 = 19,
|
|
307 |
_AES256 = 20,
|
|
308 |
_EnccryptedAES128 = 26,
|
|
309 |
_EnccryptedAES192 = 27,
|
|
310 |
_EnccryptedAES256 = 28,
|
|
311 |
_featureBits = 128,
|
|
312 |
|
|
313 |
_Query_parmBlk = 16,
|
|
314 |
_DEA_parmBlk = 16,
|
|
315 |
_TDEA128_parmBlk = 24,
|
|
316 |
_TDEA192_parmBlk = 32,
|
|
317 |
_EncryptedDEA_parmBlk = 40,
|
|
318 |
_EncryptedDEA128_parmBlk = 48,
|
|
319 |
_EncryptedDEA192_parmBlk = 56,
|
|
320 |
_AES128_parmBlk = 32,
|
|
321 |
_AES192_parmBlk = 40,
|
|
322 |
_AES256_parmBlk = 48,
|
|
323 |
_EnccryptedAES128_parmBlk = 64,
|
|
324 |
_EnccryptedAES192_parmBlk = 72,
|
|
325 |
_EnccryptedAES256_parmBlk = 80,
|
|
326 |
|
|
327 |
_Query_dataBlk = 0,
|
|
328 |
_DEA_dataBlk = 8,
|
|
329 |
_TDEA128_dataBlk = 8,
|
|
330 |
_TDEA192_dataBlk = 8,
|
|
331 |
_EncryptedDEA_dataBlk = 8,
|
|
332 |
_EncryptedDEA128_dataBlk = 8,
|
|
333 |
_EncryptedDEA192_dataBlk = 8,
|
|
334 |
_AES128_dataBlk = 16,
|
|
335 |
_AES192_dataBlk = 16,
|
|
336 |
_AES256_dataBlk = 16,
|
|
337 |
_EnccryptedAES128_dataBlk = 16,
|
|
338 |
_EnccryptedAES192_dataBlk = 16,
|
|
339 |
_EnccryptedAES256_dataBlk = 16
|
|
340 |
};
|
|
341 |
};
|
|
342 |
|
|
343 |
// Initialization
|
|
344 |
static void initialize();
|
|
345 |
static void print_features();
|
|
346 |
static bool is_determine_features_test_running() { return _is_determine_features_test_running; }
|
|
347 |
|
|
348 |
// CPU feature query functions
|
|
349 |
static bool has_StoreFacilityListExtended() { return (_features[0] & StoreFacilityListExtendedMask) == StoreFacilityListExtendedMask; }
|
|
350 |
static bool has_Crypto() { return (_features[0] & CryptoFacilityMask) == CryptoFacilityMask; }
|
|
351 |
static bool has_ETF2() { return (_features[0] & ETF2Mask) == ETF2Mask; }
|
|
352 |
static bool has_ETF3() { return (_features[0] & ETF3Mask) == ETF3Mask; }
|
|
353 |
static bool has_ETF2Enhancements() { return (_features[0] & ETF2EnhancementMask) == ETF2EnhancementMask; }
|
|
354 |
static bool has_ETF3Enhancements() { return (_features[0] & ETF3EnhancementMask) == ETF3EnhancementMask; }
|
|
355 |
static bool has_ParsingEnhancements() { return (_features[0] & ParsingEnhancementsMask) == ParsingEnhancementsMask; }
|
|
356 |
static bool has_long_displacement() { return (_features[0] & LongDispFacilityMask) == LongDispFacilityMask; }
|
|
357 |
static bool has_long_displacement_fast() { return (_features[0] & LongDispFacilityHighPerfMask) == LongDispFacilityHighPerfMask; }
|
|
358 |
static bool has_extended_immediate() { return (_features[0] & ExtImmedFacilityMask) == ExtImmedFacilityMask; }
|
|
359 |
static bool has_StoreClockFast() { return (_features[0] & StoreClockFastMask) == StoreClockFastMask; }
|
|
360 |
static bool has_ExtractCPUtime() { return (_features[0] & ExtractCPUTimeMask) == ExtractCPUTimeMask; }
|
|
361 |
static bool has_CompareSwapStore() { return (_features[0] & CompareSwapStoreMask) == CompareSwapStoreMask; }
|
|
362 |
|
|
363 |
static bool has_HFPMultiplyAndAdd() { return (_features[0] & HFPMultiplyAndAddMask) == HFPMultiplyAndAddMask; }
|
|
364 |
static bool has_HFPUnnormalized() { return (_features[0] & HFPUnnormalizedMask) == HFPUnnormalizedMask; }
|
|
365 |
|
|
366 |
// Make sure we don't run on older ...
|
|
367 |
static bool has_GnrlInstrExtensions() { guarantee((_features[0] & GnrlInstrExtFacilityMask) == GnrlInstrExtFacilityMask, "We no more support older than z10."); return true; }
|
|
368 |
static bool has_CompareBranch() { return has_GnrlInstrExtensions() && is_z10(); } // Only z10 benefits from these.
|
|
369 |
static bool has_CompareTrap() { return has_GnrlInstrExtensions(); }
|
|
370 |
static bool has_RelativeLoadStore() { return has_GnrlInstrExtensions(); }
|
|
371 |
static bool has_MultiplySingleImm32() { return has_GnrlInstrExtensions(); }
|
|
372 |
static bool has_Prefetch() { return has_GnrlInstrExtensions() && (AllocatePrefetchStyle > 0); }
|
|
373 |
static bool has_PrefetchRaw() { return has_GnrlInstrExtensions(); }
|
|
374 |
static bool has_MoveImmToMem() { return has_GnrlInstrExtensions(); }
|
|
375 |
static bool has_ExtractCPUAttributes() { return has_GnrlInstrExtensions(); }
|
|
376 |
static bool has_ExecuteExtensions() { return (_features[0] & ExecuteExtensionsMask) == ExecuteExtensionsMask; }
|
|
377 |
// Memory-immediate arithmetic instructions. There is no performance penalty in using them.
|
|
378 |
// Moreover, these memory-immediate instructions are quasi-atomic (>99.99%) on z10
|
|
379 |
// and 100% atomic from z196 onwards, thanks to the specific operand serialization that comes new with z196.
|
|
380 |
static bool has_MemWithImmALUOps() { return has_GnrlInstrExtensions(); }
|
|
381 |
static bool has_AtomicMemWithImmALUOps() { return has_MemWithImmALUOps() && has_InterlockedAccessV1(); }
|
|
382 |
static bool has_FPExtensions() { return (_features[0] & FPExtensionsMask) == FPExtensionsMask; }
|
|
383 |
static bool has_FPSupportEnhancements() { return (_features[0] & FPSupportEnhancementsMask) == FPSupportEnhancementsMask; }
|
|
384 |
static bool has_DecimalFloatingPoint() { return (_features[0] & DecimalFloatingPointMask) == DecimalFloatingPointMask; }
|
|
385 |
static bool has_InterlockedAccessV1() { return (_features[0] & InterlockedAccess1Mask) == InterlockedAccess1Mask; }
|
|
386 |
static bool has_LoadAndALUAtomicV1() { return (_features[0] & InterlockedAccess1Mask) == InterlockedAccess1Mask; }
|
|
387 |
static bool has_PopCount() { return (_features[0] & PopulationCountMask) == PopulationCountMask; }
|
|
388 |
static bool has_LoadStoreConditional() { return (_features[0] & LoadStoreConditionalMask) == LoadStoreConditionalMask; }
|
|
389 |
static bool has_HighWordInstr() { return (_features[0] & HighWordMask) == HighWordMask; }
|
|
390 |
static bool has_FastSync() { return (_features[0] & FastBCRSerializationMask) == FastBCRSerializationMask; }
|
|
391 |
static bool has_DistinctOpnds() { return (_features[0] & DistinctOpndsMask) == DistinctOpndsMask; }
|
|
392 |
static bool has_CryptoExt3() { return (_features[1] & CryptoExtension3Mask) == CryptoExtension3Mask; }
|
|
393 |
static bool has_CryptoExt4() { return (_features[1] & CryptoExtension4Mask) == CryptoExtension4Mask; }
|
|
394 |
static bool has_DFPZonedConversion() { return (_features[0] & DFPZonedConversionMask) == DFPZonedConversionMask; }
|
|
395 |
static bool has_DFPPackedConversion() { return (_features[1] & DFPPackedConversionMask) == DFPPackedConversionMask; }
|
|
396 |
static bool has_MiscInstrExt() { return (_features[0] & MiscInstrExtMask) == MiscInstrExtMask; }
|
|
397 |
static bool has_ExecutionHint() { return (_features[0] & ExecutionHintMask) == ExecutionHintMask; }
|
|
398 |
static bool has_LoadAndTrap() { return (_features[0] & LoadAndTrapMask) == LoadAndTrapMask; }
|
|
399 |
static bool has_ProcessorAssist() { return (_features[0] & ProcessorAssistMask) == ProcessorAssistMask; }
|
|
400 |
static bool has_InterlockedAccessV2() { return (_features[0] & InterlockedAccess2Mask) == InterlockedAccess2Mask; }
|
|
401 |
static bool has_LoadAndALUAtomicV2() { return (_features[0] & InterlockedAccess2Mask) == InterlockedAccess2Mask; }
|
|
402 |
static bool has_TxMem() { return ((_features[1] & TransactionalExecutionMask) == TransactionalExecutionMask) &&
|
|
403 |
((_features[0] & ConstrainedTxExecutionMask) == ConstrainedTxExecutionMask); }
|
|
404 |
static bool has_CryptoExt5() { return (_features[0] & CryptoExtension5Mask) == CryptoExtension5Mask; }
|
|
405 |
static bool has_LoadStoreConditional2() { return (_features[0] & LoadStoreConditional2Mask) == LoadStoreConditional2Mask; }
|
|
406 |
static bool has_VectorFacility() { return (_features[2] & VectorFacilityMask) == VectorFacilityMask; }
|
|
407 |
|
|
408 |
static bool has_TestFeatureImpl() { return (_features[0] & TestFeature1ImplMask) == TestFeature1ImplMask; }
|
|
409 |
static bool has_TestFeature1Impl() { return (_features[0] & TestFeature1ImplMask) == TestFeature1ImplMask; }
|
|
410 |
static bool has_TestFeature2Impl() { return (_features[0] & TestFeature2ImplMask) == TestFeature2ImplMask; }
|
|
411 |
static bool has_TestFeature4Impl() { return (_features[0] & TestFeature4ImplMask) == TestFeature4ImplMask; }
|
|
412 |
static bool has_TestFeature8Impl() { return (_features[0] & TestFeature8ImplMask) == TestFeature8ImplMask; }
|
|
413 |
static bool has_TestFeaturesImpl() { return has_TestFeature1Impl() || has_TestFeature2Impl() || has_TestFeature4Impl() || has_TestFeature8Impl(); }
|
|
414 |
|
|
415 |
// Crypto features query functions.
|
|
416 |
static bool has_Crypto_AES128() { return has_Crypto() && test_feature_bit(&_cipher_features[0], Cipher::_AES128, Cipher::_featureBits); }
|
|
417 |
static bool has_Crypto_AES192() { return has_Crypto() && test_feature_bit(&_cipher_features[0], Cipher::_AES192, Cipher::_featureBits); }
|
|
418 |
static bool has_Crypto_AES256() { return has_Crypto() && test_feature_bit(&_cipher_features[0], Cipher::_AES256, Cipher::_featureBits); }
|
|
419 |
static bool has_Crypto_AES() { return has_Crypto_AES128() || has_Crypto_AES192() || has_Crypto_AES256(); }
|
|
420 |
|
|
421 |
static bool has_Crypto_SHA1() { return has_Crypto() && test_feature_bit(&_msgdigest_features[0], MsgDigest::_SHA1, MsgDigest::_featureBits); }
|
|
422 |
static bool has_Crypto_SHA256() { return has_Crypto() && test_feature_bit(&_msgdigest_features[0], MsgDigest::_SHA256, MsgDigest::_featureBits); }
|
|
423 |
static bool has_Crypto_SHA512() { return has_Crypto() && test_feature_bit(&_msgdigest_features[0], MsgDigest::_SHA512, MsgDigest::_featureBits); }
|
|
424 |
static bool has_Crypto_GHASH() { return has_Crypto() && test_feature_bit(&_msgdigest_features[0], MsgDigest::_GHASH, MsgDigest::_featureBits); }
|
|
425 |
static bool has_Crypto_SHA() { return has_Crypto_SHA1() || has_Crypto_SHA256() || has_Crypto_SHA512() || has_Crypto_GHASH(); }
|
|
426 |
|
|
427 |
// CPU feature setters (to force model-specific behaviour). Test/debugging only.
|
|
428 |
static void set_has_TestFeature1Impl() { _features[0] |= TestFeature1ImplMask; }
|
|
429 |
static void set_has_TestFeature2Impl() { _features[0] |= TestFeature2ImplMask; }
|
|
430 |
static void set_has_TestFeature4Impl() { _features[0] |= TestFeature4ImplMask; }
|
|
431 |
static void set_has_TestFeature8Impl() { _features[0] |= TestFeature8ImplMask; }
|
|
432 |
static void set_has_DecimalFloatingPoint() { _features[0] |= DecimalFloatingPointMask; }
|
|
433 |
static void set_has_FPSupportEnhancements() { _features[0] |= FPSupportEnhancementsMask; }
|
|
434 |
static void set_has_ExecuteExtensions() { _features[0] |= ExecuteExtensionsMask; }
|
|
435 |
static void set_has_MemWithImmALUOps() { _features[0] |= GnrlInstrExtFacilityMask; }
|
|
436 |
static void set_has_MoveImmToMem() { _features[0] |= GnrlInstrExtFacilityMask; }
|
|
437 |
static void set_has_Prefetch() { _features[0] |= GnrlInstrExtFacilityMask; }
|
|
438 |
static void set_has_MultiplySingleImm32() { _features[0] |= GnrlInstrExtFacilityMask; }
|
|
439 |
static void set_has_CompareBranch() { _features[0] |= GnrlInstrExtFacilityMask; }
|
|
440 |
static void set_has_CompareTrap() { _features[0] |= GnrlInstrExtFacilityMask; }
|
|
441 |
static void set_has_RelativeLoadStore() { _features[0] |= GnrlInstrExtFacilityMask; }
|
|
442 |
static void set_has_GnrlInstrExtensions() { _features[0] |= GnrlInstrExtFacilityMask; }
|
|
443 |
static void set_has_CompareSwapStore() { _features[0] |= CompareSwapStoreMask; }
|
|
444 |
static void set_has_HFPMultiplyAndAdd() { _features[0] |= HFPMultiplyAndAddMask; }
|
|
445 |
static void set_has_HFPUnnormalized() { _features[0] |= HFPUnnormalizedMask; }
|
|
446 |
static void set_has_ExtractCPUtime() { _features[0] |= ExtractCPUTimeMask; }
|
|
447 |
static void set_has_StoreClockFast() { _features[0] |= StoreClockFastMask; }
|
|
448 |
static void set_has_extended_immediate() { _features[0] |= ExtImmedFacilityMask; }
|
|
449 |
static void set_has_long_displacement_fast() { _features[0] |= LongDispFacilityHighPerfMask; }
|
|
450 |
static void set_has_long_displacement() { _features[0] |= LongDispFacilityMask; }
|
|
451 |
static void set_has_ETF2() { _features[0] |= ETF2Mask; }
|
|
452 |
static void set_has_ETF3() { _features[0] |= ETF3Mask; }
|
|
453 |
static void set_has_ETF2Enhancements() { _features[0] |= ETF2EnhancementMask; }
|
|
454 |
static void set_has_ETF3Enhancements() { _features[0] |= ETF3EnhancementMask; }
|
|
455 |
static void set_has_Crypto() { _features[0] |= CryptoFacilityMask; }
|
|
456 |
static void set_has_StoreFacilityListExtended() { _features[0] |= StoreFacilityListExtendedMask; }
|
|
457 |
|
|
458 |
static void set_has_InterlockedAccessV1() { _features[0] |= InterlockedAccess1Mask; }
|
|
459 |
static void set_has_PopCount() { _features[0] |= PopulationCountMask; }
|
|
460 |
static void set_has_LoadStoreConditional() { _features[0] |= LoadStoreConditionalMask; }
|
|
461 |
static void set_has_HighWordInstr() { _features[0] |= HighWordMask; }
|
|
462 |
static void set_has_FastSync() { _features[0] |= FastBCRSerializationMask; }
|
|
463 |
static void set_has_DistinctOpnds() { _features[0] |= DistinctOpndsMask; }
|
|
464 |
static void set_has_FPExtensions() { _features[0] |= FPExtensionsMask; }
|
|
465 |
static void set_has_MiscInstrExt() { _features[0] |= MiscInstrExtMask; }
|
|
466 |
static void set_has_ProcessorAssist() { _features[0] |= ProcessorAssistMask; }
|
|
467 |
static void set_has_InterlockedAccessV2() { _features[0] |= InterlockedAccess2Mask; }
|
|
468 |
static void set_has_LoadAndALUAtomicV2() { _features[0] |= InterlockedAccess2Mask; }
|
|
469 |
static void set_has_TxMem() { _features[0] |= ConstrainedTxExecutionMask; _features[1] |= TransactionalExecutionMask; }
|
|
470 |
static void set_has_CryptoExt3() { _features[1] |= CryptoExtension3Mask; }
|
|
471 |
static void set_has_CryptoExt4() { _features[1] |= CryptoExtension4Mask; }
|
|
472 |
static void set_has_LoadStoreConditional2() { _features[0] |= LoadStoreConditional2Mask; }
|
|
473 |
static void set_has_CryptoExt5() { _features[0] |= CryptoExtension5Mask; }
|
|
474 |
static void set_has_VectorFacility() { _features[2] |= VectorFacilityMask; }
|
|
475 |
|
|
476 |
// Assembler testing.
|
|
477 |
static void allow_all();
|
|
478 |
static void revert();
|
|
479 |
|
|
480 |
// Generate trapping instructions into C-code.
|
|
481 |
// Sometimes helpful for debugging.
|
|
482 |
static unsigned long z_SIGILL();
|
|
483 |
static unsigned long z_SIGSEGV();
|
|
484 |
};
|
|
485 |
|
|
486 |
#endif // CPU_S390_VM_VM_VERSION_S390_HPP
|