1 /*
2 * Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
87
88 address generate_check_simd() {
89 StubCodeMark mark(this, "VM_Version", "check_simd");
90 address start = __ pc();
91
92 __ vcnt(Stemp, Stemp);
93 __ mov(R0, 1);
94 __ bx(LR);
95
96 return start;
97 };
98 };
99
100 #undef __
101
102
103 extern "C" address check_vfp3_32_fault_instr;
104 extern "C" address check_vfp_fault_instr;
105 extern "C" address check_simd_fault_instr;
106
107 void VM_Version::initialize() {
108 ResourceMark rm;
109
110 // Making this stub must be FIRST use of assembler
111 const int stub_size = 128;
112 BufferBlob* stub_blob = BufferBlob::create("get_cpu_info", stub_size);
113 if (stub_blob == NULL) {
114 vm_exit_during_initialization("Unable to allocate get_cpu_info stub");
115 }
116
117 CodeBuffer c(stub_blob);
118 VM_Version_StubGenerator g(&c);
119 address get_cpu_info_pc = g.generate_get_cpu_info();
120 get_cpu_info_t get_cpu_info = CAST_TO_FN_PTR(get_cpu_info_t, get_cpu_info_pc);
121
122 int pc_adjustment = get_cpu_info();
123
124 VM_Version::_stored_pc_adjustment = pc_adjustment;
125
126 #ifndef __SOFTFP__
199 warning("CRC32 intrinsics are not available on this CPU");
200 FLAG_SET_DEFAULT(UseCRC32Intrinsics, false);
201 }
202
203 if (UseCRC32CIntrinsics) {
204 if (!FLAG_IS_DEFAULT(UseCRC32CIntrinsics))
205 warning("CRC32C intrinsics are not available on this CPU");
206 FLAG_SET_DEFAULT(UseCRC32CIntrinsics, false);
207 }
208
209 if (UseAdler32Intrinsics) {
210 warning("Adler32 intrinsics are not available on this CPU");
211 FLAG_SET_DEFAULT(UseAdler32Intrinsics, false);
212 }
213
214 if (UseVectorizedMismatchIntrinsic) {
215 warning("vectorizedMismatch intrinsic is not available on this CPU.");
216 FLAG_SET_DEFAULT(UseVectorizedMismatchIntrinsic, false);
217 }
218
219 get_os_cpu_info();
220
221 _kuser_helper_version = *(int*)KUSER_HELPER_VERSION_ADDR;
222
223 #ifdef COMPILER2
224 // C2 is only supported on v7+ VFP at this time
225 if (_arm_arch < 7 || !has_vfp()) {
226 vm_exit_during_initialization("Server VM is only supported on ARMv7+ VFP");
227 }
228 #endif
229
230 // armv7 has the ldrexd instruction that can be used to implement cx8
231 // armv5 with linux >= 3.1 can use kernel helper routine
232 _supports_cx8 = (supports_ldrexd() || supports_kuser_cmpxchg64());
233 // ARM doesn't have special instructions for these but ldrex/ldrexd
234 // enable shorter instruction sequences that the ones based on cas.
235 _supports_atomic_getset4 = supports_ldrex();
236 _supports_atomic_getadd4 = supports_ldrex();
237 _supports_atomic_getset8 = supports_ldrexd();
238 _supports_atomic_getadd8 = supports_ldrexd();
239
240 #ifdef COMPILER2
241 assert(_supports_cx8 && _supports_atomic_getset4 && _supports_atomic_getadd4
242 && _supports_atomic_getset8 && _supports_atomic_getadd8, "C2: atomic operations must be supported");
243 #endif
244 char buf[512];
245 jio_snprintf(buf, sizeof(buf), "(ARMv%d)%s%s%s",
246 _arm_arch,
247 (has_vfp() ? ", vfp" : ""),
248 (has_vfp3_32() ? ", vfp3-32" : ""),
249 (has_simd() ? ", simd" : ""));
250
251 // buf is started with ", " or is empty
252 _features_string = os::strdup(buf);
|
1 /*
2 * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
87
88 address generate_check_simd() {
89 StubCodeMark mark(this, "VM_Version", "check_simd");
90 address start = __ pc();
91
92 __ vcnt(Stemp, Stemp);
93 __ mov(R0, 1);
94 __ bx(LR);
95
96 return start;
97 };
98 };
99
100 #undef __
101
102
103 extern "C" address check_vfp3_32_fault_instr;
104 extern "C" address check_vfp_fault_instr;
105 extern "C" address check_simd_fault_instr;
106
107 void VM_Version::early_initialize() {
108
109 // Make sure that _arm_arch is initialized so that any calls to OrderAccess will
110 // use proper dmb instruction
111 get_os_cpu_info();
112
113 _kuser_helper_version = *(int*)KUSER_HELPER_VERSION_ADDR;
114 // armv7 has the ldrexd instruction that can be used to implement cx8
115 // armv5 with linux >= 3.1 can use kernel helper routine
116 _supports_cx8 = (supports_ldrexd() || supports_kuser_cmpxchg64());
117 }
118
119 void VM_Version::initialize() {
120 ResourceMark rm;
121
122 // Making this stub must be FIRST use of assembler
123 const int stub_size = 128;
124 BufferBlob* stub_blob = BufferBlob::create("get_cpu_info", stub_size);
125 if (stub_blob == NULL) {
126 vm_exit_during_initialization("Unable to allocate get_cpu_info stub");
127 }
128
129 CodeBuffer c(stub_blob);
130 VM_Version_StubGenerator g(&c);
131 address get_cpu_info_pc = g.generate_get_cpu_info();
132 get_cpu_info_t get_cpu_info = CAST_TO_FN_PTR(get_cpu_info_t, get_cpu_info_pc);
133
134 int pc_adjustment = get_cpu_info();
135
136 VM_Version::_stored_pc_adjustment = pc_adjustment;
137
138 #ifndef __SOFTFP__
211 warning("CRC32 intrinsics are not available on this CPU");
212 FLAG_SET_DEFAULT(UseCRC32Intrinsics, false);
213 }
214
215 if (UseCRC32CIntrinsics) {
216 if (!FLAG_IS_DEFAULT(UseCRC32CIntrinsics))
217 warning("CRC32C intrinsics are not available on this CPU");
218 FLAG_SET_DEFAULT(UseCRC32CIntrinsics, false);
219 }
220
221 if (UseAdler32Intrinsics) {
222 warning("Adler32 intrinsics are not available on this CPU");
223 FLAG_SET_DEFAULT(UseAdler32Intrinsics, false);
224 }
225
226 if (UseVectorizedMismatchIntrinsic) {
227 warning("vectorizedMismatch intrinsic is not available on this CPU.");
228 FLAG_SET_DEFAULT(UseVectorizedMismatchIntrinsic, false);
229 }
230
231 #ifdef COMPILER2
232 // C2 is only supported on v7+ VFP at this time
233 if (_arm_arch < 7 || !has_vfp()) {
234 vm_exit_during_initialization("Server VM is only supported on ARMv7+ VFP");
235 }
236 #endif
237
238 // ARM doesn't have special instructions for these but ldrex/ldrexd
239 // enable shorter instruction sequences that the ones based on cas.
240 _supports_atomic_getset4 = supports_ldrex();
241 _supports_atomic_getadd4 = supports_ldrex();
242 _supports_atomic_getset8 = supports_ldrexd();
243 _supports_atomic_getadd8 = supports_ldrexd();
244
245 #ifdef COMPILER2
246 assert(_supports_cx8 && _supports_atomic_getset4 && _supports_atomic_getadd4
247 && _supports_atomic_getset8 && _supports_atomic_getadd8, "C2: atomic operations must be supported");
248 #endif
249 char buf[512];
250 jio_snprintf(buf, sizeof(buf), "(ARMv%d)%s%s%s",
251 _arm_arch,
252 (has_vfp() ? ", vfp" : ""),
253 (has_vfp3_32() ? ", vfp3-32" : ""),
254 (has_simd() ? ", simd" : ""));
255
256 // buf is started with ", " or is empty
257 _features_string = os::strdup(buf);
|