1 /*
   2  * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
   3  * Copyright (c) 2014, Red Hat Inc. All rights reserved.
   4  * Copyright (c) 2015, Linaro Ltd. All rights reserved.
   5  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   6  *
   7  * This code is free software; you can redistribute it and/or modify it
   8  * under the terms of the GNU General Public License version 2 only, as
   9  * published by the Free Software Foundation.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  *
  25  */
  26 
  27 #ifndef CPU_AARCH32_VM_VM_VERSION_AARCH32_HPP
  28 #define CPU_AARCH32_VM_VM_VERSION_AARCH32_HPP
  29 
  30 #include "runtime/globals_extension.hpp"
  31 #include "runtime/vm_version.hpp"
  32 
  33 enum ProcessorFeatures {
  34   FT_NONE = 0,
  35   FT_HW_DIVIDE = 1,
  36   FT_VFPV2 = 2,
  37   FT_VFPV3 = 4,
  38   FT_ARMV7 = 8,
  39   FT_ARMV6T2 = 16,
  40   FT_ARMV6K = 32,
  41   FT_SINGLE_CORE = 64,
  42   FT_AdvSIMD = 128,
  43   FT_CRC32 = 256,
  44   FT_ALL = 0xffff
  45 };
  46 
  47 class VM_Version : public Abstract_VM_Version {
  48  public:
  49   // Processor feature lookup.
  50 
  51   enum {
  52     CPU_ARM       = 'A',
  53     CPU_BROADCOM  = 'B',
  54     CPU_CAVIUM    = 'C',
  55     CPU_DEC       = 'D',
  56     CPU_INFINEON  = 'I',
  57     CPU_MOTOROLA  = 'M',
  58     CPU_NVIDIA    = 'N',
  59     CPU_AMCC      = 'P',
  60     CPU_QUALCOM   = 'Q',
  61     CPU_MARVELL   = 'V',
  62     CPU_INTEL     = 'i',
  63   } cpuFamily;
  64 
  65   // Initialization
  66   static void initialize();
  67 
  68  private:
  69   static enum ProcessorFeatures _features;
  70   static const char* _cpu_features;
  71     static volatile bool _is_determine_features_test_running;
  72 
  73   static void get_processor_features();
  74   static bool identify_procline(const char *tag, char **line);
  75 
  76  public:
  77   static enum ProcessorFeatures features() {
  78     return _features;
  79   }
  80     static void features(ProcessorFeatures f) {
  81       _features = f;
  82     }
  83   static const char* cpu_features() { return _cpu_features; }
  84 
  85     static bool is_determine_features_test_running() { return _is_determine_features_test_running; }
  86 };
  87 
  88 #ifdef HARD_FLOAT_CC
  89 inline const bool hasFPU(void) { return true; }
  90 #else
  91 inline bool hasFPU(void) { return (UseFPU); }
  92 #endif
  93 
  94 
  95 #endif // CPU_AARCH32_VM_VM_VERSION_AARCH32_HPP