Mercurial > hg > truffle
comparison src/cpu/sparc/vm/vm_version_sparc.hpp @ 641:6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
Summary: A similar function to getisax(2) should be used to determine all possible instruction set extensions.
Reviewed-by: never, kvn
author | twisti |
---|---|
date | Wed, 11 Mar 2009 14:16:13 -0700 |
parents | d1605aabd0a1 |
children | c771b7f43bbf |
comparison
equal
deleted
inserted
replaced
625:2f2f54ed12ce | 641:6af0a709d52b |
---|---|
1 /* | 1 /* |
2 * Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved. | 2 * Copyright 1997-2009 Sun Microsystems, Inc. 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. |
23 */ | 23 */ |
24 | 24 |
25 class VM_Version: public Abstract_VM_Version { | 25 class VM_Version: public Abstract_VM_Version { |
26 protected: | 26 protected: |
27 enum Feature_Flag { | 27 enum Feature_Flag { |
28 v8_instructions = 0, | 28 v8_instructions = 0, |
29 hardware_int_muldiv = 1, | 29 hardware_mul32 = 1, |
30 hardware_fsmuld = 2, | 30 hardware_div32 = 2, |
31 v9_instructions = 3, | 31 hardware_fsmuld = 3, |
32 vis1_instructions = 4, | 32 v9_instructions = 4, |
33 vis2_instructions = 5, | 33 vis1_instructions = 5, |
34 sun4v_instructions = 6 | 34 vis2_instructions = 6, |
35 sun4v_instructions = 7 | |
35 }; | 36 }; |
36 | 37 |
37 enum Feature_Flag_Set { | 38 enum Feature_Flag_Set { |
38 unknown_m = 0, | 39 unknown_m = 0, |
39 all_features_m = -1, | 40 all_features_m = -1, |
40 | 41 |
41 v8_instructions_m = 1 << v8_instructions, | 42 v8_instructions_m = 1 << v8_instructions, |
42 hardware_int_muldiv_m = 1 << hardware_int_muldiv, | 43 hardware_mul32_m = 1 << hardware_mul32, |
43 hardware_fsmuld_m = 1 << hardware_fsmuld, | 44 hardware_div32_m = 1 << hardware_div32, |
44 v9_instructions_m = 1 << v9_instructions, | 45 hardware_fsmuld_m = 1 << hardware_fsmuld, |
45 vis1_instructions_m = 1 << vis1_instructions, | 46 v9_instructions_m = 1 << v9_instructions, |
46 vis2_instructions_m = 1 << vis2_instructions, | 47 vis1_instructions_m = 1 << vis1_instructions, |
47 sun4v_m = 1 << sun4v_instructions, | 48 vis2_instructions_m = 1 << vis2_instructions, |
49 sun4v_m = 1 << sun4v_instructions, | |
48 | 50 |
49 generic_v8_m = v8_instructions_m | hardware_int_muldiv_m | hardware_fsmuld_m, | 51 generic_v8_m = v8_instructions_m | hardware_mul32_m | hardware_div32_m | hardware_fsmuld_m, |
50 generic_v9_m = generic_v8_m | v9_instructions_m | vis1_instructions_m, | 52 generic_v9_m = generic_v8_m | v9_instructions_m, |
51 ultra3_m = generic_v9_m | vis2_instructions_m, | 53 ultra3_m = generic_v9_m | vis1_instructions_m | vis2_instructions_m, |
52 | 54 |
53 // Temporary until we have something more accurate | 55 // Temporary until we have something more accurate |
54 niagara1_unique_m = sun4v_m, | 56 niagara1_unique_m = sun4v_m, |
55 niagara1_m = generic_v9_m | niagara1_unique_m | 57 niagara1_m = generic_v9_m | niagara1_unique_m |
56 }; | 58 }; |
57 | 59 |
58 static int _features; | 60 static int _features; |
59 static const char* _features_str; | 61 static const char* _features_str; |
60 | 62 |
61 static void print_features(); | 63 static void print_features(); |
62 static int determine_features(); | 64 static int determine_features(); |
63 static int platform_features(int features); | 65 static int platform_features(int features); |
64 | 66 |
65 static bool is_niagara1(int features) { return (features & niagara1_m) == niagara1_m; } | 67 static bool is_niagara1(int features) { return (features & sun4v_m) != 0; } |
66 | 68 |
67 static int maximum_niagara1_processor_count() { return 32; } | 69 static int maximum_niagara1_processor_count() { return 32; } |
68 // Returns true if the platform is in the niagara line and | 70 // Returns true if the platform is in the niagara line and |
69 // newer than the niagara1. | 71 // newer than the niagara1. |
70 static bool is_niagara1_plus(); | 72 static bool is_niagara1_plus(); |
74 static void initialize(); | 76 static void initialize(); |
75 | 77 |
76 // Instruction support | 78 // Instruction support |
77 static bool has_v8() { return (_features & v8_instructions_m) != 0; } | 79 static bool has_v8() { return (_features & v8_instructions_m) != 0; } |
78 static bool has_v9() { return (_features & v9_instructions_m) != 0; } | 80 static bool has_v9() { return (_features & v9_instructions_m) != 0; } |
79 static bool has_hardware_int_muldiv() { return (_features & hardware_int_muldiv_m) != 0; } | 81 static bool has_hardware_mul32() { return (_features & hardware_mul32_m) != 0; } |
82 static bool has_hardware_div32() { return (_features & hardware_div32_m) != 0; } | |
80 static bool has_hardware_fsmuld() { return (_features & hardware_fsmuld_m) != 0; } | 83 static bool has_hardware_fsmuld() { return (_features & hardware_fsmuld_m) != 0; } |
81 static bool has_vis1() { return (_features & vis1_instructions_m) != 0; } | 84 static bool has_vis1() { return (_features & vis1_instructions_m) != 0; } |
82 static bool has_vis2() { return (_features & vis2_instructions_m) != 0; } | 85 static bool has_vis2() { return (_features & vis2_instructions_m) != 0; } |
83 | 86 |
84 static bool supports_compare_and_exchange() | 87 static bool supports_compare_and_exchange() |