1 /*
2 * Copyright (c) 2006, 2012, 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 *
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
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
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
140 } else {
141 // getisax(2) failed, use the old legacy code.
142 #ifndef PRODUCT
143 if (PrintMiscellaneous && Verbose)
144 tty->print_cr("getisax(2) is not supported.");
145 #endif
146
147 char tmp;
148 size_t bufsize = sysinfo(SI_ISALIST, &tmp, 1);
149 char* buf = (char*) malloc(bufsize);
150
151 if (buf != NULL) {
152 if (sysinfo(SI_ISALIST, buf, bufsize) == bufsize) {
153 // Figure out what kind of sparc we have
154 char *sparc_string = strstr(buf, "sparc");
155 if (sparc_string != NULL) { features |= v8_instructions_m;
156 if (sparc_string[5] == 'v') {
157 if (sparc_string[6] == '8') {
158 if (sparc_string[7] == '-') { features |= hardware_mul32_m;
159 features |= hardware_div32_m;
|
1 /*
2 * Copyright (c) 2006, 2014, 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 *
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
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
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
140 #ifndef AV_SPARC_SHA1
141 #define AV_SPARC_SHA1 0x00400000 /* sha1 instruction supported */
142 #endif
143 if (av & AV_SPARC_SHA1) features |= sha1_instruction_m;
144
145 #ifndef AV_SPARC_SHA256
146 #define AV_SPARC_SHA256 0x00800000 /* sha256 instruction supported */
147 #endif
148 if (av & AV_SPARC_SHA256) features |= sha256_instruction_m;
149
150 #ifndef AV_SPARC_SHA512
151 #define AV_SPARC_SHA512 0x01000000 /* sha512 instruction supported */
152 #endif
153 if (av & AV_SPARC_SHA512) features |= sha512_instruction_m;
154
155 } else {
156 // getisax(2) failed, use the old legacy code.
157 #ifndef PRODUCT
158 if (PrintMiscellaneous && Verbose)
159 tty->print_cr("getisax(2) is not supported.");
160 #endif
161
162 char tmp;
163 size_t bufsize = sysinfo(SI_ISALIST, &tmp, 1);
164 char* buf = (char*) malloc(bufsize);
165
166 if (buf != NULL) {
167 if (sysinfo(SI_ISALIST, buf, bufsize) == bufsize) {
168 // Figure out what kind of sparc we have
169 char *sparc_string = strstr(buf, "sparc");
170 if (sparc_string != NULL) { features |= v8_instructions_m;
171 if (sparc_string[5] == 'v') {
172 if (sparc_string[6] == '8') {
173 if (sparc_string[7] == '-') { features |= hardware_mul32_m;
174 features |= hardware_div32_m;
|