equal
deleted
inserted
replaced
21 * questions. |
21 * questions. |
22 * |
22 * |
23 */ |
23 */ |
24 |
24 |
25 #include "precompiled.hpp" |
25 #include "precompiled.hpp" |
|
26 #include "memory/allocation.hpp" |
|
27 #include "memory/allocation.inline.hpp" |
26 #include "runtime/os.hpp" |
28 #include "runtime/os.hpp" |
27 #include "vm_version_sparc.hpp" |
29 #include "vm_version_sparc.hpp" |
28 |
30 |
29 # include <sys/auxv.h> |
31 # include <sys/auxv.h> |
30 # include <sys/auxv_SPARC.h> |
32 # include <sys/auxv_SPARC.h> |
46 size_t bufsize = sysinfo(si, &tmp, 1); |
48 size_t bufsize = sysinfo(si, &tmp, 1); |
47 |
49 |
48 // All SI defines used below must be supported. |
50 // All SI defines used below must be supported. |
49 guarantee(bufsize != -1, "must be supported"); |
51 guarantee(bufsize != -1, "must be supported"); |
50 |
52 |
51 char* buf = (char*) malloc(bufsize); |
53 char* buf = (char*) os::malloc(bufsize, mtInternal); |
52 |
54 |
53 if (buf == NULL) |
55 if (buf == NULL) |
54 return; |
56 return; |
55 |
57 |
56 if (sysinfo(si, buf, bufsize) == bufsize) { |
58 if (sysinfo(si, buf, bufsize) == bufsize) { |
58 if (strcmp(buf, string) == 0) { |
60 if (strcmp(buf, string) == 0) { |
59 *features |= mask; |
61 *features |= mask; |
60 } |
62 } |
61 } |
63 } |
62 |
64 |
63 free(buf); |
65 os::free(buf); |
64 } |
66 } |
65 |
67 |
66 int VM_Version::platform_features(int features) { |
68 int VM_Version::platform_features(int features) { |
67 // getisax(2), SI_ARCHITECTURE_32, and SI_ARCHITECTURE_64 are |
69 // getisax(2), SI_ARCHITECTURE_32, and SI_ARCHITECTURE_64 are |
68 // supported on Solaris 10 and later. |
70 // supported on Solaris 10 and later. |
159 tty->print_cr("getisax(2) is not supported."); |
161 tty->print_cr("getisax(2) is not supported."); |
160 #endif |
162 #endif |
161 |
163 |
162 char tmp; |
164 char tmp; |
163 size_t bufsize = sysinfo(SI_ISALIST, &tmp, 1); |
165 size_t bufsize = sysinfo(SI_ISALIST, &tmp, 1); |
164 char* buf = (char*) malloc(bufsize); |
166 char* buf = (char*) os::malloc(bufsize, mtInternal); |
165 |
167 |
166 if (buf != NULL) { |
168 if (buf != NULL) { |
167 if (sysinfo(SI_ISALIST, buf, bufsize) == bufsize) { |
169 if (sysinfo(SI_ISALIST, buf, bufsize) == bufsize) { |
168 // Figure out what kind of sparc we have |
170 // Figure out what kind of sparc we have |
169 char *sparc_string = strstr(buf, "sparc"); |
171 char *sparc_string = strstr(buf, "sparc"); |
182 char *vis = strstr(buf, "vis"); |
184 char *vis = strstr(buf, "vis"); |
183 if (vis != NULL) { features |= vis1_instructions_m; |
185 if (vis != NULL) { features |= vis1_instructions_m; |
184 if (vis[3] == '2') features |= vis2_instructions_m; |
186 if (vis[3] == '2') features |= vis2_instructions_m; |
185 } |
187 } |
186 } |
188 } |
187 free(buf); |
189 os::free(buf); |
188 } |
190 } |
189 } |
191 } |
190 |
192 |
191 // Determine the machine type. |
193 // Determine the machine type. |
192 do_sysinfo(SI_MACHINE, "sun4v", &features, sun4v_m); |
194 do_sysinfo(SI_MACHINE, "sun4v", &features, sun4v_m); |
226 if (PrintMiscellaneous && Verbose) { |
228 if (PrintMiscellaneous && Verbose) { |
227 tty->print_cr("cpu_info.implementation: %s", implementation); |
229 tty->print_cr("cpu_info.implementation: %s", implementation); |
228 } |
230 } |
229 #endif |
231 #endif |
230 // Convert to UPPER case before compare. |
232 // Convert to UPPER case before compare. |
231 char* impl = strdup(implementation); |
233 char* impl = os::strdup_check_oom(implementation); |
232 |
234 |
233 for (int i = 0; impl[i] != 0; i++) |
235 for (int i = 0; impl[i] != 0; i++) |
234 impl[i] = (char)toupper((uint)impl[i]); |
236 impl[i] = (char)toupper((uint)impl[i]); |
235 if (strstr(impl, "SPARC64") != NULL) { |
237 if (strstr(impl, "SPARC64") != NULL) { |
236 features |= sparc64_family_m; |
238 features |= sparc64_family_m; |
250 warning("kstat cpu_info implementation = '%s', should contain SPARC", impl); |
252 warning("kstat cpu_info implementation = '%s', should contain SPARC", impl); |
251 #endif |
253 #endif |
252 implementation = "SPARC"; |
254 implementation = "SPARC"; |
253 } |
255 } |
254 } |
256 } |
255 free((void*)impl); |
257 os::free((void*)impl); |
256 break; |
258 break; |
257 } |
259 } |
258 } // for( |
260 } // for( |
259 } |
261 } |
260 } |
262 } |