Mon, 16 Jun 2014 16:27:41 -0700
8046769: Set T family feature bit on Niagara systems
Reviewed-by: kvn, iveresov
phh@568 | 1 | /* |
stefank@2314 | 2 | * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. |
phh@568 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
phh@568 | 4 | * |
phh@568 | 5 | * This code is free software; you can redistribute it and/or modify it |
phh@568 | 6 | * under the terms of the GNU General Public License version 2 only, as |
phh@568 | 7 | * published by the Free Software Foundation. |
phh@568 | 8 | * |
phh@568 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
phh@568 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
phh@568 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
phh@568 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
phh@568 | 13 | * accompanied this code). |
phh@568 | 14 | * |
phh@568 | 15 | * You should have received a copy of the GNU General Public License version |
phh@568 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
phh@568 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
phh@568 | 18 | * |
trims@1907 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
trims@1907 | 20 | * or visit www.oracle.com if you need additional information or have any |
trims@1907 | 21 | * questions. |
phh@568 | 22 | * |
phh@568 | 23 | */ |
phh@568 | 24 | |
stefank@2314 | 25 | #include "precompiled.hpp" |
stefank@2314 | 26 | #include "runtime/os.hpp" |
stefank@2314 | 27 | #include "vm_version_sparc.hpp" |
phh@568 | 28 | |
phh@568 | 29 | static bool detect_niagara() { |
phh@568 | 30 | char cpu[128]; |
phh@568 | 31 | bool rv = false; |
phh@568 | 32 | |
phh@568 | 33 | FILE* fp = fopen("/proc/cpuinfo", "r"); |
phh@568 | 34 | if (fp == NULL) { |
phh@568 | 35 | return rv; |
phh@568 | 36 | } |
phh@568 | 37 | |
phh@568 | 38 | while (!feof(fp)) { |
phh@568 | 39 | if (fscanf(fp, "cpu\t\t: %100[^\n]", &cpu) == 1) { |
phh@568 | 40 | if (strstr(cpu, "Niagara") != NULL) { |
phh@568 | 41 | rv = true; |
phh@568 | 42 | } |
phh@568 | 43 | break; |
phh@568 | 44 | } |
phh@568 | 45 | } |
phh@568 | 46 | |
phh@568 | 47 | fclose(fp); |
phh@568 | 48 | |
phh@568 | 49 | return rv; |
phh@568 | 50 | } |
phh@568 | 51 | |
phh@568 | 52 | int VM_Version::platform_features(int features) { |
phh@568 | 53 | // Default to generic v9 |
phh@568 | 54 | features = generic_v9_m; |
phh@568 | 55 | |
phh@568 | 56 | if (detect_niagara()) { |
phh@568 | 57 | NOT_PRODUCT(if (PrintMiscellaneous && Verbose) tty->print_cr("Detected Linux on Niagara");) |
mikael@6908 | 58 | features = niagara1_m | T_family_m; |
phh@568 | 59 | } |
phh@568 | 60 | |
phh@568 | 61 | return features; |
phh@568 | 62 | } |