Mercurial > hg > truffle
annotate src/os_cpu/solaris_sparc/vm/vm_version_solaris_sparc.cpp @ 20259:4af19b914f53
8035393: Use CLDClosure instead of CLDToOopClosure in frame::oops_interpreted_do
Reviewed-by: tschatzl, coleenp
author | stefank |
---|---|
date | Fri, 21 Feb 2014 10:01:20 +0100 |
parents | 031b06eac1a9 |
children | 4ca6dc0799b6 b20a35eae442 |
rev | line source |
---|---|
0 | 1 /* |
6842
b9a9ed0f8eeb
7197424: update copyright year to match last edit in jdk8 hotspot repository
mikael
parents:
6269
diff
changeset
|
2 * Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved. |
0 | 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 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
643
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
643
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
643
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #include "precompiled.hpp" |
26 #include "runtime/os.hpp" | |
27 #include "vm_version_sparc.hpp" | |
0 | 28 |
641
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
29 # include <sys/auxv.h> |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
30 # include <sys/auxv_SPARC.h> |
0 | 31 # include <sys/systeminfo.h> |
2080 | 32 # include <kstat.h> |
0 | 33 |
641
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
34 // We need to keep these here as long as we have to build on Solaris |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
35 // versions before 10. |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
36 #ifndef SI_ARCHITECTURE_32 |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
37 #define SI_ARCHITECTURE_32 516 /* basic 32-bit SI_ARCHITECTURE */ |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
38 #endif |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
39 |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
40 #ifndef SI_ARCHITECTURE_64 |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
41 #define SI_ARCHITECTURE_64 517 /* basic 64-bit SI_ARCHITECTURE */ |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
42 #endif |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
43 |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
44 static void do_sysinfo(int si, const char* string, int* features, int mask) { |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
45 char tmp; |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
46 size_t bufsize = sysinfo(si, &tmp, 1); |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
47 |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
48 // All SI defines used below must be supported. |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
49 guarantee(bufsize != -1, "must be supported"); |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
50 |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
51 char* buf = (char*) malloc(bufsize); |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
52 |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
53 if (buf == NULL) |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
54 return; |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
55 |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
56 if (sysinfo(si, buf, bufsize) == bufsize) { |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
57 // Compare the string. |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
58 if (strcmp(buf, string) == 0) { |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
59 *features |= mask; |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
60 } |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
61 } |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
62 |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
63 free(buf); |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
64 } |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
65 |
0 | 66 int VM_Version::platform_features(int features) { |
641
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
67 // getisax(2), SI_ARCHITECTURE_32, and SI_ARCHITECTURE_64 are |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
68 // supported on Solaris 10 and later. |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
69 if (os::Solaris::supports_getisax()) { |
0 | 70 |
641
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
71 // Check 32-bit architecture. |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
72 do_sysinfo(SI_ARCHITECTURE_32, "sparc", &features, v8_instructions_m); |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
73 |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
74 // Check 64-bit architecture. |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
75 do_sysinfo(SI_ARCHITECTURE_64, "sparcv9", &features, generic_v9_m); |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
76 |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
77 // Extract valid instruction set extensions. |
17683
031b06eac1a9
8031290: Adjust call to getisax() for additional words returned
jmasa
parents:
17670
diff
changeset
|
78 uint_t avs[2]; |
031b06eac1a9
8031290: Adjust call to getisax() for additional words returned
jmasa
parents:
17670
diff
changeset
|
79 uint_t avn = os::Solaris::getisax(avs, 2); |
031b06eac1a9
8031290: Adjust call to getisax() for additional words returned
jmasa
parents:
17670
diff
changeset
|
80 assert(avn <= 2, "should return two or less av's"); |
031b06eac1a9
8031290: Adjust call to getisax() for additional words returned
jmasa
parents:
17670
diff
changeset
|
81 uint_t av = avs[0]; |
0 | 82 |
1914
ae065c367d93
6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents:
1552
diff
changeset
|
83 #ifndef PRODUCT |
17683
031b06eac1a9
8031290: Adjust call to getisax() for additional words returned
jmasa
parents:
17670
diff
changeset
|
84 if (PrintMiscellaneous && Verbose) { |
031b06eac1a9
8031290: Adjust call to getisax() for additional words returned
jmasa
parents:
17670
diff
changeset
|
85 tty->print("getisax(2) returned: " PTR32_FORMAT, av); |
031b06eac1a9
8031290: Adjust call to getisax() for additional words returned
jmasa
parents:
17670
diff
changeset
|
86 if (avn > 1) { |
031b06eac1a9
8031290: Adjust call to getisax() for additional words returned
jmasa
parents:
17670
diff
changeset
|
87 tty->print(", " PTR32_FORMAT, avs[1]); |
031b06eac1a9
8031290: Adjust call to getisax() for additional words returned
jmasa
parents:
17670
diff
changeset
|
88 } |
031b06eac1a9
8031290: Adjust call to getisax() for additional words returned
jmasa
parents:
17670
diff
changeset
|
89 tty->cr(); |
031b06eac1a9
8031290: Adjust call to getisax() for additional words returned
jmasa
parents:
17670
diff
changeset
|
90 } |
1914
ae065c367d93
6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents:
1552
diff
changeset
|
91 #endif |
ae065c367d93
6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents:
1552
diff
changeset
|
92 |
641
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
93 if (av & AV_SPARC_MUL32) features |= hardware_mul32_m; |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
94 if (av & AV_SPARC_DIV32) features |= hardware_div32_m; |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
95 if (av & AV_SPARC_FSMULD) features |= hardware_fsmuld_m; |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
96 if (av & AV_SPARC_V8PLUS) features |= v9_instructions_m; |
643
c771b7f43bbf
6378821: bitCount() should use POPC on SPARC processors and AMD+10h
twisti
parents:
641
diff
changeset
|
97 if (av & AV_SPARC_POPC) features |= hardware_popc_m; |
641
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
98 if (av & AV_SPARC_VIS) features |= vis1_instructions_m; |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
99 if (av & AV_SPARC_VIS2) features |= vis2_instructions_m; |
17683
031b06eac1a9
8031290: Adjust call to getisax() for additional words returned
jmasa
parents:
17670
diff
changeset
|
100 if (avn > 1) { |
031b06eac1a9
8031290: Adjust call to getisax() for additional words returned
jmasa
parents:
17670
diff
changeset
|
101 uint_t av2 = avs[1]; |
031b06eac1a9
8031290: Adjust call to getisax() for additional words returned
jmasa
parents:
17670
diff
changeset
|
102 #ifndef AV2_SPARC_SPARC5 |
031b06eac1a9
8031290: Adjust call to getisax() for additional words returned
jmasa
parents:
17670
diff
changeset
|
103 #define AV2_SPARC_SPARC5 0x00000008 /* The 29 new fp and sub instructions */ |
031b06eac1a9
8031290: Adjust call to getisax() for additional words returned
jmasa
parents:
17670
diff
changeset
|
104 #endif |
031b06eac1a9
8031290: Adjust call to getisax() for additional words returned
jmasa
parents:
17670
diff
changeset
|
105 if (av2 & AV2_SPARC_SPARC5) features |= sparc5_instructions_m; |
031b06eac1a9
8031290: Adjust call to getisax() for additional words returned
jmasa
parents:
17670
diff
changeset
|
106 } |
1914
ae065c367d93
6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents:
1552
diff
changeset
|
107 |
ae065c367d93
6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents:
1552
diff
changeset
|
108 // Next values are not defined before Solaris 10 |
ae065c367d93
6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents:
1552
diff
changeset
|
109 // but Solaris 8 is used for jdk6 update builds. |
ae065c367d93
6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents:
1552
diff
changeset
|
110 #ifndef AV_SPARC_ASI_BLK_INIT |
ae065c367d93
6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents:
1552
diff
changeset
|
111 #define AV_SPARC_ASI_BLK_INIT 0x0080 /* ASI_BLK_INIT_xxx ASI */ |
ae065c367d93
6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents:
1552
diff
changeset
|
112 #endif |
2080 | 113 if (av & AV_SPARC_ASI_BLK_INIT) features |= blk_init_instructions_m; |
114 | |
1914
ae065c367d93
6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents:
1552
diff
changeset
|
115 #ifndef AV_SPARC_FMAF |
2080 | 116 #define AV_SPARC_FMAF 0x0100 /* Fused Multiply-Add */ |
1914
ae065c367d93
6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents:
1552
diff
changeset
|
117 #endif |
ae065c367d93
6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents:
1552
diff
changeset
|
118 if (av & AV_SPARC_FMAF) features |= fmaf_instructions_m; |
2080 | 119 |
120 #ifndef AV_SPARC_FMAU | |
121 #define AV_SPARC_FMAU 0x0200 /* Unfused Multiply-Add */ | |
122 #endif | |
123 if (av & AV_SPARC_FMAU) features |= fmau_instructions_m; | |
124 | |
125 #ifndef AV_SPARC_VIS3 | |
126 #define AV_SPARC_VIS3 0x0400 /* VIS3 instruction set extensions */ | |
127 #endif | |
128 if (av & AV_SPARC_VIS3) features |= vis3_instructions_m; | |
129 | |
3839 | 130 #ifndef AV_SPARC_CBCOND |
131 #define AV_SPARC_CBCOND 0x10000000 /* compare and branch instrs supported */ | |
132 #endif | |
133 if (av & AV_SPARC_CBCOND) features |= cbcond_instructions_m; | |
134 | |
17670 | 135 #ifndef AV_SPARC_AES |
136 #define AV_SPARC_AES 0x00020000 /* aes instrs supported */ | |
137 #endif | |
138 if (av & AV_SPARC_AES) features |= aes_instructions_m; | |
139 | |
641
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
140 } else { |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
141 // getisax(2) failed, use the old legacy code. |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
142 #ifndef PRODUCT |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
143 if (PrintMiscellaneous && Verbose) |
1914
ae065c367d93
6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents:
1552
diff
changeset
|
144 tty->print_cr("getisax(2) is not supported."); |
641
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
145 #endif |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
146 |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
147 char tmp; |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
148 size_t bufsize = sysinfo(SI_ISALIST, &tmp, 1); |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
149 char* buf = (char*) malloc(bufsize); |
0 | 150 |
641
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
151 if (buf != NULL) { |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
152 if (sysinfo(SI_ISALIST, buf, bufsize) == bufsize) { |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
153 // Figure out what kind of sparc we have |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
154 char *sparc_string = strstr(buf, "sparc"); |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
155 if (sparc_string != NULL) { features |= v8_instructions_m; |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
156 if (sparc_string[5] == 'v') { |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
157 if (sparc_string[6] == '8') { |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
158 if (sparc_string[7] == '-') { features |= hardware_mul32_m; |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
159 features |= hardware_div32_m; |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
160 } else if (sparc_string[7] == 'p') features |= generic_v9_m; |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
161 else features |= generic_v8_m; |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
162 } else if (sparc_string[6] == '9') features |= generic_v9_m; |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
163 } |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
164 } |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
165 |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
166 // Check for visualization instructions |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
167 char *vis = strstr(buf, "vis"); |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
168 if (vis != NULL) { features |= vis1_instructions_m; |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
169 if (vis[3] == '2') features |= vis2_instructions_m; |
0 | 170 } |
171 } | |
641
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
172 free(buf); |
0 | 173 } |
174 } | |
175 | |
641
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
176 // Determine the machine type. |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
177 do_sysinfo(SI_MACHINE, "sun4v", &features, sun4v_m); |
0 | 178 |
2080 | 179 { |
180 // Using kstat to determine the machine type. | |
181 kstat_ctl_t* kc = kstat_open(); | |
182 kstat_t* ksp = kstat_lookup(kc, (char*)"cpu_info", -1, NULL); | |
183 const char* implementation = "UNKNOWN"; | |
184 if (ksp != NULL) { | |
185 if (kstat_read(kc, ksp, NULL) != -1 && ksp->ks_data != NULL) { | |
186 kstat_named_t* knm = (kstat_named_t *)ksp->ks_data; | |
187 for (int i = 0; i < ksp->ks_ndata; i++) { | |
188 if (strcmp((const char*)&(knm[i].name),"implementation") == 0) { | |
189 #ifndef KSTAT_DATA_STRING | |
190 #define KSTAT_DATA_STRING 9 | |
191 #endif | |
192 if (knm[i].data_type == KSTAT_DATA_CHAR) { | |
193 // VM is running on Solaris 8 which does not have value.str. | |
194 implementation = &(knm[i].value.c[0]); | |
195 } else if (knm[i].data_type == KSTAT_DATA_STRING) { | |
196 // VM is running on Solaris 10. | |
197 #ifndef KSTAT_NAMED_STR_PTR | |
198 // Solaris 8 was used to build VM, define the structure it misses. | |
199 struct str_t { | |
200 union { | |
201 char *ptr; /* NULL-term string */ | |
202 char __pad[8]; /* 64-bit padding */ | |
203 } addr; | |
204 uint32_t len; /* # bytes for strlen + '\0' */ | |
205 }; | |
206 #define KSTAT_NAMED_STR_PTR(knptr) (( (str_t*)&((knptr)->value) )->addr.ptr) | |
207 #endif | |
208 implementation = KSTAT_NAMED_STR_PTR(&knm[i]); | |
209 } | |
210 #ifndef PRODUCT | |
211 if (PrintMiscellaneous && Verbose) { | |
212 tty->print_cr("cpu_info.implementation: %s", implementation); | |
213 } | |
214 #endif | |
2247
c52cba2a3359
7014998: assert(is_T_family(features) == is_niagara(features)) failed: Niagara should be T series
kvn
parents:
2080
diff
changeset
|
215 // Convert to UPPER case before compare. |
c52cba2a3359
7014998: assert(is_T_family(features) == is_niagara(features)) failed: Niagara should be T series
kvn
parents:
2080
diff
changeset
|
216 char* impl = strdup(implementation); |
c52cba2a3359
7014998: assert(is_T_family(features) == is_niagara(features)) failed: Niagara should be T series
kvn
parents:
2080
diff
changeset
|
217 |
c52cba2a3359
7014998: assert(is_T_family(features) == is_niagara(features)) failed: Niagara should be T series
kvn
parents:
2080
diff
changeset
|
218 for (int i = 0; impl[i] != 0; i++) |
c52cba2a3359
7014998: assert(is_T_family(features) == is_niagara(features)) failed: Niagara should be T series
kvn
parents:
2080
diff
changeset
|
219 impl[i] = (char)toupper((uint)impl[i]); |
c52cba2a3359
7014998: assert(is_T_family(features) == is_niagara(features)) failed: Niagara should be T series
kvn
parents:
2080
diff
changeset
|
220 if (strstr(impl, "SPARC64") != NULL) { |
2080 | 221 features |= sparc64_family_m; |
6269 | 222 } else if (strstr(impl, "SPARC-M") != NULL) { |
223 // M-series SPARC is based on T-series. | |
224 features |= (M_family_m | T_family_m); | |
2247
c52cba2a3359
7014998: assert(is_T_family(features) == is_niagara(features)) failed: Niagara should be T series
kvn
parents:
2080
diff
changeset
|
225 } else if (strstr(impl, "SPARC-T") != NULL) { |
2080 | 226 features |= T_family_m; |
2247
c52cba2a3359
7014998: assert(is_T_family(features) == is_niagara(features)) failed: Niagara should be T series
kvn
parents:
2080
diff
changeset
|
227 if (strstr(impl, "SPARC-T1") != NULL) { |
2080 | 228 features |= T1_model_m; |
229 } | |
2247
c52cba2a3359
7014998: assert(is_T_family(features) == is_niagara(features)) failed: Niagara should be T series
kvn
parents:
2080
diff
changeset
|
230 } else { |
6269 | 231 if (strstr(impl, "SPARC") == NULL) { |
232 #ifndef PRODUCT | |
233 // kstat on Solaris 8 virtual machines (branded zones) | |
234 // returns "(unsupported)" implementation. | |
235 warning("kstat cpu_info implementation = '%s', should contain SPARC", impl); | |
236 #endif | |
237 implementation = "SPARC"; | |
238 } | |
2080 | 239 } |
2247
c52cba2a3359
7014998: assert(is_T_family(features) == is_niagara(features)) failed: Niagara should be T series
kvn
parents:
2080
diff
changeset
|
240 free((void*)impl); |
2080 | 241 break; |
242 } | |
243 } // for( | |
244 } | |
245 } | |
246 assert(strcmp(implementation, "UNKNOWN") != 0, | |
247 "unknown cpu info (changed kstat interface?)"); | |
248 kstat_close(kc); | |
249 } | |
250 | |
0 | 251 return features; |
252 } |