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