1 /* |
1 /* |
2 * Copyright (c) 2006, 2009, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
63 |
63 |
64 int VM_Version::platform_features(int features) { |
64 int VM_Version::platform_features(int features) { |
65 // getisax(2), SI_ARCHITECTURE_32, and SI_ARCHITECTURE_64 are |
65 // getisax(2), SI_ARCHITECTURE_32, and SI_ARCHITECTURE_64 are |
66 // supported on Solaris 10 and later. |
66 // supported on Solaris 10 and later. |
67 if (os::Solaris::supports_getisax()) { |
67 if (os::Solaris::supports_getisax()) { |
68 #ifndef PRODUCT |
|
69 if (PrintMiscellaneous && Verbose) |
|
70 tty->print_cr("getisax(2) supported."); |
|
71 #endif |
|
72 |
68 |
73 // Check 32-bit architecture. |
69 // Check 32-bit architecture. |
74 do_sysinfo(SI_ARCHITECTURE_32, "sparc", &features, v8_instructions_m); |
70 do_sysinfo(SI_ARCHITECTURE_32, "sparc", &features, v8_instructions_m); |
75 |
71 |
76 // Check 64-bit architecture. |
72 // Check 64-bit architecture. |
79 // Extract valid instruction set extensions. |
75 // Extract valid instruction set extensions. |
80 uint_t av; |
76 uint_t av; |
81 uint_t avn = os::Solaris::getisax(&av, 1); |
77 uint_t avn = os::Solaris::getisax(&av, 1); |
82 assert(avn == 1, "should only return one av"); |
78 assert(avn == 1, "should only return one av"); |
83 |
79 |
|
80 #ifndef PRODUCT |
|
81 if (PrintMiscellaneous && Verbose) |
|
82 tty->print_cr("getisax(2) returned: " PTR32_FORMAT, av); |
|
83 #endif |
|
84 |
84 if (av & AV_SPARC_MUL32) features |= hardware_mul32_m; |
85 if (av & AV_SPARC_MUL32) features |= hardware_mul32_m; |
85 if (av & AV_SPARC_DIV32) features |= hardware_div32_m; |
86 if (av & AV_SPARC_DIV32) features |= hardware_div32_m; |
86 if (av & AV_SPARC_FSMULD) features |= hardware_fsmuld_m; |
87 if (av & AV_SPARC_FSMULD) features |= hardware_fsmuld_m; |
87 if (av & AV_SPARC_V8PLUS) features |= v9_instructions_m; |
88 if (av & AV_SPARC_V8PLUS) features |= v9_instructions_m; |
88 if (av & AV_SPARC_POPC) features |= hardware_popc_m; |
89 if (av & AV_SPARC_POPC) features |= hardware_popc_m; |
89 if (av & AV_SPARC_VIS) features |= vis1_instructions_m; |
90 if (av & AV_SPARC_VIS) features |= vis1_instructions_m; |
90 if (av & AV_SPARC_VIS2) features |= vis2_instructions_m; |
91 if (av & AV_SPARC_VIS2) features |= vis2_instructions_m; |
|
92 |
|
93 // Next values are not defined before Solaris 10 |
|
94 // but Solaris 8 is used for jdk6 update builds. |
|
95 #ifndef AV_SPARC_ASI_BLK_INIT |
|
96 #define AV_SPARC_ASI_BLK_INIT 0x0080 /* ASI_BLK_INIT_xxx ASI */ |
|
97 #endif |
|
98 #ifndef AV_SPARC_FMAF |
|
99 #define AV_SPARC_FMAF 0x0100 /* Sparc64 Fused Multiply-Add */ |
|
100 #endif |
|
101 if (av & AV_SPARC_ASI_BLK_INIT) features |= blk_init_instructions_m; |
|
102 if (av & AV_SPARC_FMAF) features |= fmaf_instructions_m; |
91 } else { |
103 } else { |
92 // getisax(2) failed, use the old legacy code. |
104 // getisax(2) failed, use the old legacy code. |
93 #ifndef PRODUCT |
105 #ifndef PRODUCT |
94 if (PrintMiscellaneous && Verbose) |
106 if (PrintMiscellaneous && Verbose) |
95 tty->print_cr("getisax(2) not supported."); |
107 tty->print_cr("getisax(2) is not supported."); |
96 #endif |
108 #endif |
97 |
109 |
98 char tmp; |
110 char tmp; |
99 size_t bufsize = sysinfo(SI_ISALIST, &tmp, 1); |
111 size_t bufsize = sysinfo(SI_ISALIST, &tmp, 1); |
100 char* buf = (char*) malloc(bufsize); |
112 char* buf = (char*) malloc(bufsize); |