44 #ifndef HWCAP_AES
45 #define HWCAP_AES (1<<3)
46 #endif
47
48 #ifndef HWCAP_PMULL
49 #define HWCAP_PMULL (1<<4)
50 #endif
51
52 #ifndef HWCAP_SHA1
53 #define HWCAP_SHA1 (1<<5)
54 #endif
55
56 #ifndef HWCAP_SHA2
57 #define HWCAP_SHA2 (1<<6)
58 #endif
59
60 #ifndef HWCAP_CRC32
61 #define HWCAP_CRC32 (1<<7)
62 #endif
63
64 int VM_Version::_cpu;
65 int VM_Version::_model;
66 int VM_Version::_model2;
67 int VM_Version::_variant;
68 int VM_Version::_revision;
69 int VM_Version::_stepping;
70
71 static BufferBlob* stub_blob;
72 static const int stub_size = 550;
73
74 extern "C" {
75 typedef void (*getPsrInfo_stub_t)(void*);
76 }
77 static getPsrInfo_stub_t getPsrInfo_stub = NULL;
78
79
80 class VM_Version_StubGenerator: public StubCodeGenerator {
81 public:
82
83 VM_Version_StubGenerator(CodeBuffer *c) : StubCodeGenerator(c) {}
155 }
156 }
157 fclose(f);
158 }
159
160 // Enable vendor specific features
161 if (_cpu == CPU_CAVIUM && _variant == 0) _features |= CPU_DMB_ATOMICS;
162 if (_cpu == CPU_ARM && (_model == 0xd03 || _model2 == 0xd03)) _features |= CPU_A53MAC;
163 // If an olde style /proc/cpuinfo (cpu_lines == 1) then if _model is an A57 (0xd07)
164 // we assume the worst and assume we could be on a big little system and have
165 // undisclosed A53 cores which we could be swapped to at any stage
166 if (_cpu == CPU_ARM && cpu_lines == 1 && _model == 0xd07) _features |= CPU_A53MAC;
167
168 sprintf(buf, "0x%02x:0x%x:0x%03x:%d", _cpu, _variant, _model, _revision);
169 if (_model2) sprintf(buf+strlen(buf), "(0x%03x)", _model2);
170 if (auxv & HWCAP_ASIMD) strcat(buf, ", simd");
171 if (auxv & HWCAP_CRC32) strcat(buf, ", crc");
172 if (auxv & HWCAP_AES) strcat(buf, ", aes");
173 if (auxv & HWCAP_SHA1) strcat(buf, ", sha1");
174 if (auxv & HWCAP_SHA2) strcat(buf, ", sha256");
175
176 _features_string = os::strdup(buf);
177
178 if (FLAG_IS_DEFAULT(UseCRC32)) {
179 UseCRC32 = (auxv & HWCAP_CRC32) != 0;
180 }
181 if (UseCRC32 && (auxv & HWCAP_CRC32) == 0) {
182 warning("UseCRC32 specified, but not supported on this CPU");
183 }
184
185 if (FLAG_IS_DEFAULT(UseAdler32Intrinsics)) {
186 FLAG_SET_DEFAULT(UseAdler32Intrinsics, true);
187 }
188
189 if (UseVectorizedMismatchIntrinsic) {
190 warning("UseVectorizedMismatchIntrinsic specified, but not available on this CPU.");
191 FLAG_SET_DEFAULT(UseVectorizedMismatchIntrinsic, false);
192 }
193
194 if (auxv & HWCAP_AES) {
195 UseAES = UseAES || FLAG_IS_DEFAULT(UseAES);
196 UseAESIntrinsics =
197 UseAESIntrinsics || (UseAES && FLAG_IS_DEFAULT(UseAESIntrinsics));
198 if (UseAESIntrinsics && !UseAES) {
199 warning("UseAESIntrinsics enabled, but UseAES not, enabling");
200 UseAES = true;
201 }
202 } else {
203 if (UseAES) {
204 warning("UseAES specified, but not supported on this CPU");
205 }
206 if (UseAESIntrinsics) {
207 warning("UseAESIntrinsics specified, but not supported on this CPU");
208 }
209 }
210
211 if (UseAESCTRIntrinsics) {
|
44 #ifndef HWCAP_AES
45 #define HWCAP_AES (1<<3)
46 #endif
47
48 #ifndef HWCAP_PMULL
49 #define HWCAP_PMULL (1<<4)
50 #endif
51
52 #ifndef HWCAP_SHA1
53 #define HWCAP_SHA1 (1<<5)
54 #endif
55
56 #ifndef HWCAP_SHA2
57 #define HWCAP_SHA2 (1<<6)
58 #endif
59
60 #ifndef HWCAP_CRC32
61 #define HWCAP_CRC32 (1<<7)
62 #endif
63
64 #ifndef HWCAP_ATOMICS
65 #define HWCAP_ATOMICS (1<<8)
66 #endif
67
68 int VM_Version::_cpu;
69 int VM_Version::_model;
70 int VM_Version::_model2;
71 int VM_Version::_variant;
72 int VM_Version::_revision;
73 int VM_Version::_stepping;
74
75 static BufferBlob* stub_blob;
76 static const int stub_size = 550;
77
78 extern "C" {
79 typedef void (*getPsrInfo_stub_t)(void*);
80 }
81 static getPsrInfo_stub_t getPsrInfo_stub = NULL;
82
83
84 class VM_Version_StubGenerator: public StubCodeGenerator {
85 public:
86
87 VM_Version_StubGenerator(CodeBuffer *c) : StubCodeGenerator(c) {}
159 }
160 }
161 fclose(f);
162 }
163
164 // Enable vendor specific features
165 if (_cpu == CPU_CAVIUM && _variant == 0) _features |= CPU_DMB_ATOMICS;
166 if (_cpu == CPU_ARM && (_model == 0xd03 || _model2 == 0xd03)) _features |= CPU_A53MAC;
167 // If an olde style /proc/cpuinfo (cpu_lines == 1) then if _model is an A57 (0xd07)
168 // we assume the worst and assume we could be on a big little system and have
169 // undisclosed A53 cores which we could be swapped to at any stage
170 if (_cpu == CPU_ARM && cpu_lines == 1 && _model == 0xd07) _features |= CPU_A53MAC;
171
172 sprintf(buf, "0x%02x:0x%x:0x%03x:%d", _cpu, _variant, _model, _revision);
173 if (_model2) sprintf(buf+strlen(buf), "(0x%03x)", _model2);
174 if (auxv & HWCAP_ASIMD) strcat(buf, ", simd");
175 if (auxv & HWCAP_CRC32) strcat(buf, ", crc");
176 if (auxv & HWCAP_AES) strcat(buf, ", aes");
177 if (auxv & HWCAP_SHA1) strcat(buf, ", sha1");
178 if (auxv & HWCAP_SHA2) strcat(buf, ", sha256");
179 if (auxv & HWCAP_ATOMICS) strcat(buf, ", lse");
180
181 _features_string = os::strdup(buf);
182
183 if (FLAG_IS_DEFAULT(UseCRC32)) {
184 UseCRC32 = (auxv & HWCAP_CRC32) != 0;
185 }
186 if (UseCRC32 && (auxv & HWCAP_CRC32) == 0) {
187 warning("UseCRC32 specified, but not supported on this CPU");
188 }
189
190 if (FLAG_IS_DEFAULT(UseAdler32Intrinsics)) {
191 FLAG_SET_DEFAULT(UseAdler32Intrinsics, true);
192 }
193
194 if (UseVectorizedMismatchIntrinsic) {
195 warning("UseVectorizedMismatchIntrinsic specified, but not available on this CPU.");
196 FLAG_SET_DEFAULT(UseVectorizedMismatchIntrinsic, false);
197 }
198
199 if (auxv & HWCAP_ATOMICS) {
200 if (FLAG_IS_DEFAULT(UseLSE))
201 FLAG_SET_DEFAULT(UseLSE, true);
202 } else {
203 if (UseLSE) {
204 warning("UseLSE specified, but not supported on this CPU");
205 }
206 }
207
208 if (auxv & HWCAP_AES) {
209 UseAES = UseAES || FLAG_IS_DEFAULT(UseAES);
210 UseAESIntrinsics =
211 UseAESIntrinsics || (UseAES && FLAG_IS_DEFAULT(UseAESIntrinsics));
212 if (UseAESIntrinsics && !UseAES) {
213 warning("UseAESIntrinsics enabled, but UseAES not, enabling");
214 UseAES = true;
215 }
216 } else {
217 if (UseAES) {
218 warning("UseAES specified, but not supported on this CPU");
219 }
220 if (UseAESIntrinsics) {
221 warning("UseAESIntrinsics specified, but not supported on this CPU");
222 }
223 }
224
225 if (UseAESCTRIntrinsics) {
|