src/hotspot/cpu/s390/vm_version_s390.cpp
author mbaesken
Wed, 06 Nov 2019 14:04:07 +0100
changeset 58959 b7b170ba3ba9
parent 54960 e46fe26d7f77
child 59122 5d73255c2d52
permissions -rw-r--r--
8233328: fix minimal VM build on Linux s390x Reviewed-by: lucy, mdoerr
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
     1
/*
53789
b776653628c5 8218991: s390: Add intrinsic for GHASH algorithm
mdoerr
parents: 51034
diff changeset
     2
 * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
b776653628c5 8218991: s390: Add intrinsic for GHASH algorithm
mdoerr
parents: 51034
diff changeset
     3
 * Copyright (c) 2016, 2019 SAP SE. All rights reserved.
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
     4
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
     5
 *
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
     6
 * This code is free software; you can redistribute it and/or modify it
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
     7
 * under the terms of the GNU General Public License version 2 only, as
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
     8
 * published by the Free Software Foundation.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
     9
 *
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    10
 * This code is distributed in the hope that it will be useful, but WITHOUT
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    11
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    12
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    13
 * version 2 for more details (a copy is included in the LICENSE file that
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    14
 * accompanied this code).
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    15
 *
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    16
 * You should have received a copy of the GNU General Public License version
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    17
 * 2 along with this work; if not, write to the Free Software Foundation,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    18
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    19
 *
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    20
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    21
 * or visit www.oracle.com if you need additional information or have any
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    22
 * questions.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    23
 *
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    24
 */
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    25
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    26
#include "precompiled.hpp"
47765
b7c7428eaab9 8189610: Reconcile jvm.h and all jvm_md.h between java.base and hotspot
coleenp
parents: 47675
diff changeset
    27
#include "jvm.h"
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    28
#include "asm/assembler.inline.hpp"
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    29
#include "compiler/disassembler.hpp"
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    30
#include "code/compiledIC.hpp"
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    31
#include "memory/resourceArea.hpp"
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    32
#include "runtime/java.hpp"
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    33
#include "runtime/stubCodeGenerator.hpp"
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    34
#include "vm_version_s390.hpp"
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    35
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    36
# include <sys/sysinfo.h>
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    37
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    38
bool VM_Version::_is_determine_features_test_running  = false;
51034
9937ef7499dc 8206919: s390: add missing info to vm_version_ext_s390
ghaug
parents: 50983
diff changeset
    39
const char*   VM_Version::_model_string;
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    40
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    41
unsigned long VM_Version::_features[_features_buffer_len]           = {0, 0, 0, 0};
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    42
unsigned long VM_Version::_cipher_features[_features_buffer_len]    = {0, 0, 0, 0};
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    43
unsigned long VM_Version::_msgdigest_features[_features_buffer_len] = {0, 0, 0, 0};
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    44
unsigned int  VM_Version::_nfeatures                                = 0;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    45
unsigned int  VM_Version::_ncipher_features                         = 0;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    46
unsigned int  VM_Version::_nmsgdigest_features                      = 0;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    47
unsigned int  VM_Version::_Dcache_lineSize                          = 256;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    48
unsigned int  VM_Version::_Icache_lineSize                          = 256;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    49
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    50
static const char* z_gen[]     = {"  ",   "G1",   "G2", "G3",    "G4",     "G5",      "G6",   "G7"   };
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    51
static const char* z_machine[] = {"  ", "2064", "2084", "2094",  "2097",   "2817",    "  ",   "2964" };
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    52
static const char* z_name[]    = {"  ", "z900", "z990", "z9 EC", "z10 EC", "z196 EC", "ec12", "z13"  };
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    53
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    54
void VM_Version::initialize() {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    55
  determine_features();      // Get processor capabilities.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    56
  set_features_string();     // Set a descriptive feature indication.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    57
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    58
  if (Verbose) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    59
    print_features();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    60
  }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    61
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    62
  intx cache_line_size = Dcache_lineSize(0);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    63
58959
b7b170ba3ba9 8233328: fix minimal VM build on Linux s390x
mbaesken
parents: 54960
diff changeset
    64
#ifdef COMPILER2
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    65
  MaxVectorSize = 8;
58959
b7b170ba3ba9 8233328: fix minimal VM build on Linux s390x
mbaesken
parents: 54960
diff changeset
    66
#endif
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    67
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    68
  if (has_PrefetchRaw()) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    69
    if (FLAG_IS_DEFAULT(AllocatePrefetchStyle)) {  // not preset
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    70
      // 0 = no prefetch.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    71
      // 1 = Prefetch instructions for each allocation.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    72
      // 2 = Use TLAB watermark to gate allocation prefetch.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    73
      AllocatePrefetchStyle = 1;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    74
    }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    75
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    76
    if (AllocatePrefetchStyle > 0) {  // Prefetching turned on at all?
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    77
      // Distance to prefetch ahead of allocation pointer.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    78
      if (FLAG_IS_DEFAULT(AllocatePrefetchDistance) || (AllocatePrefetchDistance < 0)) {  // not preset
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    79
        AllocatePrefetchDistance = 0;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    80
      }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    81
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    82
      // Number of lines to prefetch ahead of allocation pointer.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    83
      if (FLAG_IS_DEFAULT(AllocatePrefetchLines) || (AllocatePrefetchLines <= 0)) {      // not preset
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    84
        AllocatePrefetchLines = 3;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    85
      }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    86
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    87
      // Step size in bytes of sequential prefetch instructions.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    88
      if (FLAG_IS_DEFAULT(AllocatePrefetchStepSize) || (AllocatePrefetchStepSize <= 0)) { // not preset
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    89
        FLAG_SET_DEFAULT(AllocatePrefetchStepSize, cache_line_size);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    90
      } else if (AllocatePrefetchStepSize < cache_line_size) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    91
        FLAG_SET_DEFAULT(AllocatePrefetchStepSize, cache_line_size);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    92
      } else {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    93
        FLAG_SET_DEFAULT(AllocatePrefetchStepSize, cache_line_size);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    94
      }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    95
    } else {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    96
      FLAG_SET_DEFAULT(AllocatePrefetchStyle, 0);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    97
      AllocatePrefetchDistance = 0;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    98
      AllocatePrefetchLines    = 0;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    99
      // Can't be zero. Will SIGFPE during constraints checking.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   100
      FLAG_SET_DEFAULT(AllocatePrefetchStepSize, cache_line_size);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   101
    }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   102
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   103
  } else {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   104
    FLAG_SET_DEFAULT(AllocatePrefetchStyle, 0);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   105
    AllocatePrefetchDistance = 0;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   106
    AllocatePrefetchLines    = 0;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   107
    // Can't be zero. Will SIGFPE during constraints checking.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   108
    FLAG_SET_DEFAULT(AllocatePrefetchStepSize, cache_line_size);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   109
  }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   110
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   111
  // TODO:
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   112
  // On z/Architecture, cache line size is significantly large (256 bytes). Do we really need
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   113
  // to keep contended members that far apart? Performance tests are required.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   114
  if (FLAG_IS_DEFAULT(ContendedPaddingWidth) && (cache_line_size > ContendedPaddingWidth)) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   115
    ContendedPaddingWidth = cache_line_size;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   116
  }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   117
46315
a796c32af782 8175368: [s390] Provide intrinsic implementation for CRC32C
lucy
parents: 42897
diff changeset
   118
  // On z/Architecture, the CRC32/CRC32C intrinsics are implemented "by hand".
a796c32af782 8175368: [s390] Provide intrinsic implementation for CRC32C
lucy
parents: 42897
diff changeset
   119
  // TODO: Provide implementation based on the vector instructions available from z13.
a796c32af782 8175368: [s390] Provide intrinsic implementation for CRC32C
lucy
parents: 42897
diff changeset
   120
  // Note: The CHECKSUM instruction, which has been there since the very beginning
a796c32af782 8175368: [s390] Provide intrinsic implementation for CRC32C
lucy
parents: 42897
diff changeset
   121
  //       (of z/Architecture), computes "some kind of" a checksum.
a796c32af782 8175368: [s390] Provide intrinsic implementation for CRC32C
lucy
parents: 42897
diff changeset
   122
  //       It has nothing to do with the CRC32 algorithm.
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   123
  if (FLAG_IS_DEFAULT(UseCRC32Intrinsics)) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   124
    FLAG_SET_DEFAULT(UseCRC32Intrinsics, true);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   125
  }
46315
a796c32af782 8175368: [s390] Provide intrinsic implementation for CRC32C
lucy
parents: 42897
diff changeset
   126
  if (FLAG_IS_DEFAULT(UseCRC32CIntrinsics)) {
a796c32af782 8175368: [s390] Provide intrinsic implementation for CRC32C
lucy
parents: 42897
diff changeset
   127
    FLAG_SET_DEFAULT(UseCRC32CIntrinsics, true);
a796c32af782 8175368: [s390] Provide intrinsic implementation for CRC32C
lucy
parents: 42897
diff changeset
   128
  }
a796c32af782 8175368: [s390] Provide intrinsic implementation for CRC32C
lucy
parents: 42897
diff changeset
   129
a796c32af782 8175368: [s390] Provide intrinsic implementation for CRC32C
lucy
parents: 42897
diff changeset
   130
  // TODO: Provide implementation.
a796c32af782 8175368: [s390] Provide intrinsic implementation for CRC32C
lucy
parents: 42897
diff changeset
   131
  if (UseAdler32Intrinsics) {
a796c32af782 8175368: [s390] Provide intrinsic implementation for CRC32C
lucy
parents: 42897
diff changeset
   132
    warning("Adler32Intrinsics not available on this CPU.");
a796c32af782 8175368: [s390] Provide intrinsic implementation for CRC32C
lucy
parents: 42897
diff changeset
   133
    FLAG_SET_DEFAULT(UseAdler32Intrinsics, false);
a796c32af782 8175368: [s390] Provide intrinsic implementation for CRC32C
lucy
parents: 42897
diff changeset
   134
  }
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   135
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   136
  // On z/Architecture, we take UseAES as the general switch to enable/disable the AES intrinsics.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   137
  // The specific, and yet to be defined, switches UseAESxxxIntrinsics will then be set
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   138
  // depending on the actual machine capabilities.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   139
  // Explicitly setting them via CmdLine option takes precedence, of course.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   140
  // TODO: UseAESIntrinsics must be made keylength specific.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   141
  // As of March 2015 and Java8, only AES128 is supported by the Java Cryptographic Extensions.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   142
  // Therefore, UseAESIntrinsics is of minimal use at the moment.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   143
  if (FLAG_IS_DEFAULT(UseAES) && has_Crypto_AES()) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   144
    FLAG_SET_DEFAULT(UseAES, true);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   145
  }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   146
  if (UseAES && !has_Crypto_AES()) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   147
    warning("AES instructions are not available on this CPU");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   148
    FLAG_SET_DEFAULT(UseAES, false);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   149
  }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   150
  if (UseAES) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   151
    if (FLAG_IS_DEFAULT(UseAESIntrinsics)) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   152
      FLAG_SET_DEFAULT(UseAESIntrinsics, true);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   153
    }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   154
  }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   155
  if (UseAESIntrinsics && !has_Crypto_AES()) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   156
    warning("AES intrinsics are not available on this CPU");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   157
    FLAG_SET_DEFAULT(UseAESIntrinsics, false);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   158
  }
46733
ff3f9838b730 8180823: [s390] Rework/optimize AES intrinsics
lucy
parents: 46560
diff changeset
   159
  if (UseAESIntrinsics && !UseAES) {
ff3f9838b730 8180823: [s390] Rework/optimize AES intrinsics
lucy
parents: 46560
diff changeset
   160
    warning("AES intrinsics require UseAES flag to be enabled. Intrinsics will be disabled.");
ff3f9838b730 8180823: [s390] Rework/optimize AES intrinsics
lucy
parents: 46560
diff changeset
   161
    FLAG_SET_DEFAULT(UseAESIntrinsics, false);
ff3f9838b730 8180823: [s390] Rework/optimize AES intrinsics
lucy
parents: 46560
diff changeset
   162
  }
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   163
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   164
  // TODO: implement AES/CTR intrinsics
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   165
  if (UseAESCTRIntrinsics) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   166
    warning("AES/CTR intrinsics are not available on this CPU");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   167
    FLAG_SET_DEFAULT(UseAESCTRIntrinsics, false);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   168
  }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   169
53789
b776653628c5 8218991: s390: Add intrinsic for GHASH algorithm
mdoerr
parents: 51034
diff changeset
   170
  if (FLAG_IS_DEFAULT(UseGHASHIntrinsics) && has_Crypto_GHASH()) {
b776653628c5 8218991: s390: Add intrinsic for GHASH algorithm
mdoerr
parents: 51034
diff changeset
   171
    FLAG_SET_DEFAULT(UseGHASHIntrinsics, true);
b776653628c5 8218991: s390: Add intrinsic for GHASH algorithm
mdoerr
parents: 51034
diff changeset
   172
  }
b776653628c5 8218991: s390: Add intrinsic for GHASH algorithm
mdoerr
parents: 51034
diff changeset
   173
  if (UseGHASHIntrinsics && !has_Crypto_GHASH()) {
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   174
    warning("GHASH intrinsics are not available on this CPU");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   175
    FLAG_SET_DEFAULT(UseGHASHIntrinsics, false);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   176
  }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   177
42897
57e7b1c75d17 8171398: s390x: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42556
diff changeset
   178
  if (FLAG_IS_DEFAULT(UseFMA)) {
57e7b1c75d17 8171398: s390x: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42556
diff changeset
   179
    FLAG_SET_DEFAULT(UseFMA, true);
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   180
  }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   181
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   182
  // On z/Architecture, we take UseSHA as the general switch to enable/disable the SHA intrinsics.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   183
  // The specific switches UseSHAxxxIntrinsics will then be set depending on the actual
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   184
  // machine capabilities.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   185
  // Explicitly setting them via CmdLine option takes precedence, of course.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   186
  if (FLAG_IS_DEFAULT(UseSHA) && has_Crypto_SHA()) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   187
    FLAG_SET_DEFAULT(UseSHA, true);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   188
  }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   189
  if (UseSHA && !has_Crypto_SHA()) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   190
    warning("SHA instructions are not available on this CPU");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   191
    FLAG_SET_DEFAULT(UseSHA, false);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   192
  }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   193
  if (UseSHA && has_Crypto_SHA1()) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   194
    if (FLAG_IS_DEFAULT(UseSHA1Intrinsics)) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   195
      FLAG_SET_DEFAULT(UseSHA1Intrinsics, true);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   196
    }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   197
  } else if (UseSHA1Intrinsics) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   198
    warning("Intrinsics for SHA-1 crypto hash functions not available on this CPU.");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   199
    FLAG_SET_DEFAULT(UseSHA1Intrinsics, false);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   200
  }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   201
  if (UseSHA && has_Crypto_SHA256()) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   202
    if (FLAG_IS_DEFAULT(UseSHA256Intrinsics)) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   203
      FLAG_SET_DEFAULT(UseSHA256Intrinsics, true);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   204
    }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   205
  } else if (UseSHA256Intrinsics) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   206
    warning("Intrinsics for SHA-224 and SHA-256 crypto hash functions not available on this CPU.");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   207
    FLAG_SET_DEFAULT(UseSHA256Intrinsics, false);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   208
  }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   209
  if (UseSHA && has_Crypto_SHA512()) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   210
    if (FLAG_IS_DEFAULT(UseSHA512Intrinsics)) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   211
      FLAG_SET_DEFAULT(UseSHA512Intrinsics, true);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   212
    }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   213
  } else if (UseSHA512Intrinsics) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   214
    warning("Intrinsics for SHA-384 and SHA-512 crypto hash functions not available on this CPU.");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   215
    FLAG_SET_DEFAULT(UseSHA512Intrinsics, false);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   216
  }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   217
50983
66a808262d3b 8206255: fix compiler/intrinsics/sha/cli/TestUseSHAOptionOnSupportedCPU.java jtreg test on linux s390x
mbaesken
parents: 47765
diff changeset
   218
  if (!(UseSHA1Intrinsics || UseSHA256Intrinsics || UseSHA512Intrinsics)) {
66a808262d3b 8206255: fix compiler/intrinsics/sha/cli/TestUseSHAOptionOnSupportedCPU.java jtreg test on linux s390x
mbaesken
parents: 47765
diff changeset
   219
    FLAG_SET_DEFAULT(UseSHA, false);
66a808262d3b 8206255: fix compiler/intrinsics/sha/cli/TestUseSHAOptionOnSupportedCPU.java jtreg test on linux s390x
mbaesken
parents: 47765
diff changeset
   220
  }
66a808262d3b 8206255: fix compiler/intrinsics/sha/cli/TestUseSHAOptionOnSupportedCPU.java jtreg test on linux s390x
mbaesken
parents: 47765
diff changeset
   221
58959
b7b170ba3ba9 8233328: fix minimal VM build on Linux s390x
mbaesken
parents: 54960
diff changeset
   222
#ifdef COMPILER2
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   223
  if (FLAG_IS_DEFAULT(UseMultiplyToLenIntrinsic)) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   224
    FLAG_SET_DEFAULT(UseMultiplyToLenIntrinsic, true);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   225
  }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   226
  if (FLAG_IS_DEFAULT(UseMontgomeryMultiplyIntrinsic)) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   227
    FLAG_SET_DEFAULT(UseMontgomeryMultiplyIntrinsic, true);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   228
  }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   229
  if (FLAG_IS_DEFAULT(UseMontgomerySquareIntrinsic)) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   230
    FLAG_SET_DEFAULT(UseMontgomerySquareIntrinsic, true);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   231
  }
58959
b7b170ba3ba9 8233328: fix minimal VM build on Linux s390x
mbaesken
parents: 54960
diff changeset
   232
#endif
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   233
  if (FLAG_IS_DEFAULT(UsePopCountInstruction)) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   234
    FLAG_SET_DEFAULT(UsePopCountInstruction, true);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   235
  }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   236
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   237
  // z/Architecture supports 8-byte compare-exchange operations
47634
6a0c42c40cd1 8188220: Remove Atomic::*_ptr() uses and overloads from hotspot
coleenp
parents: 47607
diff changeset
   238
  // (see Atomic::cmpxchg)
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   239
  // and 'atomic long memory ops' (see Unsafe_GetLongVolatile).
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   240
  _supports_cx8 = true;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   241
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   242
  _supports_atomic_getadd4 = VM_Version::has_LoadAndALUAtomicV1();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   243
  _supports_atomic_getadd8 = VM_Version::has_LoadAndALUAtomicV1();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   244
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   245
  // z/Architecture supports unaligned memory accesses.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   246
  // Performance penalty is negligible. An additional tick or so
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   247
  // is lost if the accessed data spans a cache line boundary.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   248
  // Unaligned accesses are not atomic, of course.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   249
  if (FLAG_IS_DEFAULT(UseUnalignedAccesses)) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   250
    FLAG_SET_DEFAULT(UseUnalignedAccesses, true);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   251
  }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   252
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   253
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   254
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   255
void VM_Version::set_features_string() {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   256
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   257
  unsigned int ambiguity = 0;
51034
9937ef7499dc 8206919: s390: add missing info to vm_version_ext_s390
ghaug
parents: 50983
diff changeset
   258
  _model_string = z_name[0];
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   259
  if (is_z13()) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   260
    _features_string = "System z G7-z13  (LDISP_fast, ExtImm, PCrel Load/Store, CmpB, Cond Load/Store, Interlocked Update, TxM, VectorInstr)";
51034
9937ef7499dc 8206919: s390: add missing info to vm_version_ext_s390
ghaug
parents: 50983
diff changeset
   261
    _model_string = z_name[7];
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   262
    ambiguity++;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   263
  }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   264
  if (is_ec12()) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   265
    _features_string = "System z G6-EC12 (LDISP_fast, ExtImm, PCrel Load/Store, CmpB, Cond Load/Store, Interlocked Update, TxM)";
51034
9937ef7499dc 8206919: s390: add missing info to vm_version_ext_s390
ghaug
parents: 50983
diff changeset
   266
    _model_string = z_name[6];
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   267
    ambiguity++;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   268
  }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   269
  if (is_z196()) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   270
    _features_string = "System z G5-z196 (LDISP_fast, ExtImm, PCrel Load/Store, CmpB, Cond Load/Store, Interlocked Update)";
51034
9937ef7499dc 8206919: s390: add missing info to vm_version_ext_s390
ghaug
parents: 50983
diff changeset
   271
    _model_string = z_name[5];
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   272
    ambiguity++;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   273
  }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   274
  if (is_z10()) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   275
    _features_string = "System z G4-z10  (LDISP_fast, ExtImm, PCrel Load/Store, CmpB)";
51034
9937ef7499dc 8206919: s390: add missing info to vm_version_ext_s390
ghaug
parents: 50983
diff changeset
   276
    _model_string = z_name[4];
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   277
    ambiguity++;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   278
  }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   279
  if (is_z9()) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   280
    _features_string = "System z G3-z9   (LDISP_fast, ExtImm), out-of-support as of 2016-04-01";
51034
9937ef7499dc 8206919: s390: add missing info to vm_version_ext_s390
ghaug
parents: 50983
diff changeset
   281
    _model_string = z_name[3];
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   282
    ambiguity++;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   283
  }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   284
  if (is_z990()) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   285
    _features_string = "System z G2-z990 (LDISP_fast), out-of-support as of 2014-07-01";
51034
9937ef7499dc 8206919: s390: add missing info to vm_version_ext_s390
ghaug
parents: 50983
diff changeset
   286
    _model_string = z_name[2];
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   287
    ambiguity++;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   288
  }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   289
  if (is_z900()) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   290
    _features_string = "System z G1-z900 (LDISP), out-of-support as of 2014-07-01";
51034
9937ef7499dc 8206919: s390: add missing info to vm_version_ext_s390
ghaug
parents: 50983
diff changeset
   291
    _model_string = z_name[1];
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   292
    ambiguity++;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   293
  }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   294
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   295
  if (ambiguity == 0) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   296
    _features_string = "z/Architecture (unknown generation)";
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   297
  } else if (ambiguity > 1) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   298
    tty->print_cr("*** WARNING *** Ambiguous z/Architecture detection, ambiguity = %d", ambiguity);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   299
    tty->print_cr("                oldest detected generation is %s", _features_string);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   300
    _features_string = "z/Architecture (ambiguous detection)";
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   301
  }
42556
c03d98321ad1 8169317: [s390] Various minor bug fixes and adaptions.
goetz
parents: 42065
diff changeset
   302
c03d98321ad1 8169317: [s390] Various minor bug fixes and adaptions.
goetz
parents: 42065
diff changeset
   303
  if (has_Crypto_AES()) {
c03d98321ad1 8169317: [s390] Various minor bug fixes and adaptions.
goetz
parents: 42065
diff changeset
   304
    char buf[256];
c03d98321ad1 8169317: [s390] Various minor bug fixes and adaptions.
goetz
parents: 42065
diff changeset
   305
    assert(strlen(_features_string) + 4 + 3*4 + 1 < sizeof(buf), "increase buffer size");
c03d98321ad1 8169317: [s390] Various minor bug fixes and adaptions.
goetz
parents: 42065
diff changeset
   306
    jio_snprintf(buf, sizeof(buf), "%s aes%s%s%s", // String 'aes' must be surrounded by spaces so that jtreg tests recognize it.
c03d98321ad1 8169317: [s390] Various minor bug fixes and adaptions.
goetz
parents: 42065
diff changeset
   307
                 _features_string,
c03d98321ad1 8169317: [s390] Various minor bug fixes and adaptions.
goetz
parents: 42065
diff changeset
   308
                 has_Crypto_AES128() ? " 128" : "",
c03d98321ad1 8169317: [s390] Various minor bug fixes and adaptions.
goetz
parents: 42065
diff changeset
   309
                 has_Crypto_AES192() ? " 192" : "",
c03d98321ad1 8169317: [s390] Various minor bug fixes and adaptions.
goetz
parents: 42065
diff changeset
   310
                 has_Crypto_AES256() ? " 256" : "");
c03d98321ad1 8169317: [s390] Various minor bug fixes and adaptions.
goetz
parents: 42065
diff changeset
   311
    _features_string = os::strdup(buf);
c03d98321ad1 8169317: [s390] Various minor bug fixes and adaptions.
goetz
parents: 42065
diff changeset
   312
  }
c03d98321ad1 8169317: [s390] Various minor bug fixes and adaptions.
goetz
parents: 42065
diff changeset
   313
c03d98321ad1 8169317: [s390] Various minor bug fixes and adaptions.
goetz
parents: 42065
diff changeset
   314
  if (has_Crypto_SHA()) {
c03d98321ad1 8169317: [s390] Various minor bug fixes and adaptions.
goetz
parents: 42065
diff changeset
   315
    char buf[256];
c03d98321ad1 8169317: [s390] Various minor bug fixes and adaptions.
goetz
parents: 42065
diff changeset
   316
    assert(strlen(_features_string) + 4 + 2 + 2*4 + 6 + 1 < sizeof(buf), "increase buffer size");
c03d98321ad1 8169317: [s390] Various minor bug fixes and adaptions.
goetz
parents: 42065
diff changeset
   317
    // String 'sha1' etc must be surrounded by spaces so that jtreg tests recognize it.
c03d98321ad1 8169317: [s390] Various minor bug fixes and adaptions.
goetz
parents: 42065
diff changeset
   318
    jio_snprintf(buf, sizeof(buf), "%s %s%s%s%s",
c03d98321ad1 8169317: [s390] Various minor bug fixes and adaptions.
goetz
parents: 42065
diff changeset
   319
                 _features_string,
c03d98321ad1 8169317: [s390] Various minor bug fixes and adaptions.
goetz
parents: 42065
diff changeset
   320
                 has_Crypto_SHA1()   ? " sha1"   : "",
c03d98321ad1 8169317: [s390] Various minor bug fixes and adaptions.
goetz
parents: 42065
diff changeset
   321
                 has_Crypto_SHA256() ? " sha256" : "",
c03d98321ad1 8169317: [s390] Various minor bug fixes and adaptions.
goetz
parents: 42065
diff changeset
   322
                 has_Crypto_SHA512() ? " sha512" : "",
c03d98321ad1 8169317: [s390] Various minor bug fixes and adaptions.
goetz
parents: 42065
diff changeset
   323
                 has_Crypto_GHASH()  ? " ghash"  : "");
c03d98321ad1 8169317: [s390] Various minor bug fixes and adaptions.
goetz
parents: 42065
diff changeset
   324
    if (has_Crypto_AES()) { os::free((void *)_features_string); }
c03d98321ad1 8169317: [s390] Various minor bug fixes and adaptions.
goetz
parents: 42065
diff changeset
   325
    _features_string = os::strdup(buf);
c03d98321ad1 8169317: [s390] Various minor bug fixes and adaptions.
goetz
parents: 42065
diff changeset
   326
  }
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   327
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   328
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   329
// featureBuffer - bit array indicating availability of various features
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   330
// featureNum    - bit index of feature to be tested
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   331
//                 Featurenum < 0 requests test for any nonzero bit in featureBuffer.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   332
// bufLen        - length of featureBuffer in bits
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   333
bool VM_Version::test_feature_bit(unsigned long* featureBuffer, int featureNum, unsigned int bufLen) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   334
  assert(bufLen > 0,             "buffer len must be positive");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   335
  assert((bufLen & 0x0007) == 0, "unaligned buffer len");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   336
  assert(((intptr_t)featureBuffer&0x0007) == 0, "unaligned feature buffer");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   337
  if (featureNum < 0) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   338
    // Any bit set at all?
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   339
    bool anyBit = false;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   340
    for (size_t i = 0; i < bufLen/(8*sizeof(long)); i++) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   341
      anyBit = anyBit || (featureBuffer[i] != 0);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   342
    }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   343
    return anyBit;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   344
  } else {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   345
    assert((unsigned int)featureNum < bufLen,    "feature index out of range");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   346
    unsigned char* byteBuffer = (unsigned char*)featureBuffer;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   347
    int   byteIndex  = featureNum/(8*sizeof(char));
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   348
    int   bitIndex   = featureNum%(8*sizeof(char));
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   349
    // Indexed bit set?
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   350
    return (byteBuffer[byteIndex] & (1U<<(7-bitIndex))) != 0;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   351
  }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   352
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   353
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   354
void VM_Version::print_features_internal(const char* text, bool print_anyway) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   355
  tty->print_cr("%s %s",       text, features_string());
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   356
  tty->print("%s", text);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   357
  for (unsigned int i = 0; i < _nfeatures; i++) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   358
    tty->print("  0x%16.16lx", _features[i]);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   359
  }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   360
  tty->cr();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   361
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   362
  if (Verbose || print_anyway) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   363
    // z900
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   364
    if (has_long_displacement()        ) tty->print_cr("available: %s", "LongDispFacility");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   365
    // z990
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   366
    if (has_long_displacement_fast()   ) tty->print_cr("available: %s", "LongDispFacilityHighPerf");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   367
    if (has_ETF2() && has_ETF3()       ) tty->print_cr("available: %s", "ETF2 and ETF3");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   368
    if (has_Crypto()                   ) tty->print_cr("available: %s", "CryptoFacility");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   369
    // z9
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   370
    if (has_extended_immediate()       ) tty->print_cr("available: %s", "ExtImmedFacility");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   371
    if (has_StoreFacilityListExtended()) tty->print_cr("available: %s", "StoreFacilityListExtended");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   372
    if (has_StoreClockFast()           ) tty->print_cr("available: %s", "StoreClockFast");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   373
    if (has_ETF2Enhancements()         ) tty->print_cr("available: %s", "ETF2 Enhancements");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   374
    if (has_ETF3Enhancements()         ) tty->print_cr("available: %s", "ETF3 Enhancements");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   375
    if (has_HFPUnnormalized()          ) tty->print_cr("available: %s", "HFPUnnormalizedFacility");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   376
    if (has_HFPMultiplyAndAdd()        ) tty->print_cr("available: %s", "HFPMultiplyAndAddFacility");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   377
    // z10
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   378
    if (has_ParsingEnhancements()      ) tty->print_cr("available: %s", "Parsing Enhancements");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   379
    if (has_ExtractCPUtime()           ) tty->print_cr("available: %s", "ExtractCPUTime");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   380
    if (has_CompareSwapStore()         ) tty->print_cr("available: %s", "CompareSwapStore");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   381
    if (has_GnrlInstrExtensions()      ) tty->print_cr("available: %s", "General Instruction Extensions");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   382
    if (has_CompareBranch()            ) tty->print_cr("  available: %s", "Compare and Branch");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   383
    if (has_CompareTrap()              ) tty->print_cr("  available: %s", "Compare and Trap");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   384
    if (has_RelativeLoadStore()        ) tty->print_cr("  available: %s", "Relative Load/Store");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   385
    if (has_MultiplySingleImm32()      ) tty->print_cr("  available: %s", "MultiplySingleImm32");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   386
    if (has_Prefetch()                 ) tty->print_cr("  available: %s", "Prefetch");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   387
    if (has_MoveImmToMem()             ) tty->print_cr("  available: %s", "Direct Moves Immediate to Memory");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   388
    if (has_MemWithImmALUOps()         ) tty->print_cr("  available: %s", "Direct ALU Ops Memory .op. Immediate");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   389
    if (has_ExtractCPUAttributes()     ) tty->print_cr("  available: %s", "Extract CPU Atributes");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   390
    if (has_ExecuteExtensions()        ) tty->print_cr("available: %s", "ExecuteExtensions");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   391
    if (has_FPSupportEnhancements()    ) tty->print_cr("available: %s", "FPSupportEnhancements");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   392
    if (has_DecimalFloatingPoint()     ) tty->print_cr("available: %s", "DecimalFloatingPoint");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   393
    // z196
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   394
    if (has_DistinctOpnds()            ) tty->print_cr("available: %s", "Distinct Operands");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   395
    if (has_InterlockedAccessV1()      ) tty->print_cr("  available: %s", "InterlockedAccess V1 (fast)");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   396
    if (has_PopCount()                 ) tty->print_cr("  available: %s", "PopCount");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   397
    if (has_LoadStoreConditional()     ) tty->print_cr("  available: %s", "LoadStoreConditional");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   398
    if (has_HighWordInstr()            ) tty->print_cr("  available: %s", "HighWord Instructions");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   399
    if (has_FastSync()                 ) tty->print_cr("  available: %s", "FastSync (bcr 14,0)");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   400
    if (has_AtomicMemWithImmALUOps()   ) tty->print_cr("available: %s", "Atomic Direct ALU Ops Memory .op. Immediate");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   401
    if (has_FPExtensions()             ) tty->print_cr("available: %s", "Floatingpoint Extensions");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   402
    if (has_CryptoExt3()               ) tty->print_cr("available: %s", "Crypto Extensions 3");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   403
    if (has_CryptoExt4()               ) tty->print_cr("available: %s", "Crypto Extensions 4");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   404
    // EC12
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   405
    if (has_MiscInstrExt()             ) tty->print_cr("available: %s", "Miscelaneous Instruction Extensions");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   406
    if (has_ExecutionHint()            ) tty->print_cr("  available: %s", "Execution Hints (branch prediction)");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   407
    if (has_ProcessorAssist()          ) tty->print_cr("  available: %s", "Processor Assists");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   408
    if (has_LoadAndTrap()              ) tty->print_cr("  available: %s", "Load and Trap");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   409
    if (has_TxMem()                    ) tty->print_cr("available: %s", "Transactional Memory");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   410
    if (has_InterlockedAccessV2()      ) tty->print_cr("  available: %s", "InterlockedAccess V2 (fast)");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   411
    if (has_DFPZonedConversion()       ) tty->print_cr("  available: %s", "DFP Zoned Conversions");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   412
    // z13
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   413
    if (has_LoadStoreConditional2()    ) tty->print_cr("available: %s", "Load/Store Conditional 2");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   414
    if (has_CryptoExt5()               ) tty->print_cr("available: %s", "Crypto Extensions 5");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   415
    if (has_DFPPackedConversion()      ) tty->print_cr("available: %s", "DFP Packed Conversions");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   416
    if (has_VectorFacility()           ) tty->print_cr("available: %s", "Vector Facility");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   417
    // test switches
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   418
    if (has_TestFeature1Impl()         ) tty->print_cr("available: %s", "TestFeature1Impl");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   419
    if (has_TestFeature2Impl()         ) tty->print_cr("available: %s", "TestFeature2Impl");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   420
    if (has_TestFeature4Impl()         ) tty->print_cr("available: %s", "TestFeature4Impl");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   421
    if (has_TestFeature8Impl()         ) tty->print_cr("available: %s", "TestFeature8Impl");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   422
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   423
    if (has_Crypto()) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   424
      tty->cr();
42556
c03d98321ad1 8169317: [s390] Various minor bug fixes and adaptions.
goetz
parents: 42065
diff changeset
   425
      tty->print_cr("detailed availability of %s capabilities:", "CryptoFacility");
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   426
      if (test_feature_bit(&_cipher_features[0], -1, 2*Cipher::_featureBits)) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   427
        tty->cr();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   428
        tty->print_cr("  available: %s", "Message Cipher Functions");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   429
      }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   430
      if (test_feature_bit(&_cipher_features[0], -1, (int)Cipher::_featureBits)) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   431
        tty->print_cr("    available Crypto Features of KM  (Cipher Message):");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   432
        for (unsigned int i = 0; i < Cipher::_featureBits; i++) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   433
          if (test_feature_bit(&_cipher_features[0], i, (int)Cipher::_featureBits)) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   434
            switch (i) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   435
              case Cipher::_Query:              tty->print_cr("      available: KM   Query");                  break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   436
              case Cipher::_DEA:                tty->print_cr("      available: KM   DEA");                    break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   437
              case Cipher::_TDEA128:            tty->print_cr("      available: KM   TDEA-128");               break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   438
              case Cipher::_TDEA192:            tty->print_cr("      available: KM   TDEA-192");               break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   439
              case Cipher::_EncryptedDEA:       tty->print_cr("      available: KM   Encrypted DEA");          break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   440
              case Cipher::_EncryptedDEA128:    tty->print_cr("      available: KM   Encrypted DEA-128");      break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   441
              case Cipher::_EncryptedDEA192:    tty->print_cr("      available: KM   Encrypted DEA-192");      break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   442
              case Cipher::_AES128:             tty->print_cr("      available: KM   AES-128");                break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   443
              case Cipher::_AES192:             tty->print_cr("      available: KM   AES-192");                break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   444
              case Cipher::_AES256:             tty->print_cr("      available: KM   AES-256");                break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   445
              case Cipher::_EnccryptedAES128:   tty->print_cr("      available: KM   Encrypted-AES-128");      break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   446
              case Cipher::_EnccryptedAES192:   tty->print_cr("      available: KM   Encrypted-AES-192");      break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   447
              case Cipher::_EnccryptedAES256:   tty->print_cr("      available: KM   Encrypted-AES-256");      break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   448
              case Cipher::_XTSAES128:          tty->print_cr("      available: KM   XTS-AES-128");            break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   449
              case Cipher::_XTSAES256:          tty->print_cr("      available: KM   XTS-AES-256");            break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   450
              case Cipher::_EncryptedXTSAES128: tty->print_cr("      available: KM   XTS-Encrypted-AES-128");  break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   451
              case Cipher::_EncryptedXTSAES256: tty->print_cr("      available: KM   XTS-Encrypted-AES-256");  break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   452
              default: tty->print_cr("      available: unknown KM  code %d", i);      break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   453
            }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   454
          }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   455
        }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   456
      }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   457
      if (test_feature_bit(&_cipher_features[2], -1, (int)Cipher::_featureBits)) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   458
        tty->print_cr("    available Crypto Features of KMC (Cipher Message with Chaining):");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   459
        for (unsigned int i = 0; i < Cipher::_featureBits; i++) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   460
            if (test_feature_bit(&_cipher_features[2], i, (int)Cipher::_featureBits)) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   461
            switch (i) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   462
              case Cipher::_Query:              tty->print_cr("      available: KMC  Query");                  break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   463
              case Cipher::_DEA:                tty->print_cr("      available: KMC  DEA");                    break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   464
              case Cipher::_TDEA128:            tty->print_cr("      available: KMC  TDEA-128");               break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   465
              case Cipher::_TDEA192:            tty->print_cr("      available: KMC  TDEA-192");               break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   466
              case Cipher::_EncryptedDEA:       tty->print_cr("      available: KMC  Encrypted DEA");          break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   467
              case Cipher::_EncryptedDEA128:    tty->print_cr("      available: KMC  Encrypted DEA-128");      break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   468
              case Cipher::_EncryptedDEA192:    tty->print_cr("      available: KMC  Encrypted DEA-192");      break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   469
              case Cipher::_AES128:             tty->print_cr("      available: KMC  AES-128");                break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   470
              case Cipher::_AES192:             tty->print_cr("      available: KMC  AES-192");                break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   471
              case Cipher::_AES256:             tty->print_cr("      available: KMC  AES-256");                break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   472
              case Cipher::_EnccryptedAES128:   tty->print_cr("      available: KMC  Encrypted-AES-128");      break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   473
              case Cipher::_EnccryptedAES192:   tty->print_cr("      available: KMC  Encrypted-AES-192");      break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   474
              case Cipher::_EnccryptedAES256:   tty->print_cr("      available: KMC  Encrypted-AES-256");      break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   475
              case Cipher::_PRNG:               tty->print_cr("      available: KMC  PRNG");                   break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   476
              default: tty->print_cr("      available: unknown KMC code %d", i);      break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   477
            }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   478
          }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   479
        }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   480
      }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   481
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   482
      if (test_feature_bit(&_msgdigest_features[0], -1, 2*MsgDigest::_featureBits)) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   483
        tty->cr();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   484
        tty->print_cr("  available: %s", "Message Digest Functions for SHA");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   485
      }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   486
      if (test_feature_bit(&_msgdigest_features[0], -1, (int)MsgDigest::_featureBits)) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   487
        tty->print_cr("    available Features of KIMD (Msg Digest):");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   488
        for (unsigned int i = 0; i < MsgDigest::_featureBits; i++) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   489
            if (test_feature_bit(&_msgdigest_features[0], i, (int)MsgDigest::_featureBits)) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   490
            switch (i) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   491
              case MsgDigest::_Query:  tty->print_cr("      available: KIMD Query");   break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   492
              case MsgDigest::_SHA1:   tty->print_cr("      available: KIMD SHA-1");   break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   493
              case MsgDigest::_SHA256: tty->print_cr("      available: KIMD SHA-256"); break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   494
              case MsgDigest::_SHA512: tty->print_cr("      available: KIMD SHA-512"); break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   495
              case MsgDigest::_GHASH:  tty->print_cr("      available: KIMD GHASH");   break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   496
              default: tty->print_cr("      available: unknown code %d", i);  break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   497
            }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   498
          }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   499
        }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   500
      }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   501
      if (test_feature_bit(&_msgdigest_features[2], -1, (int)MsgDigest::_featureBits)) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   502
        tty->print_cr("    available Features of KLMD (Msg Digest):");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   503
        for (unsigned int i = 0; i < MsgDigest::_featureBits; i++) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   504
          if (test_feature_bit(&_msgdigest_features[2], i, (int)MsgDigest::_featureBits)) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   505
            switch (i) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   506
              case MsgDigest::_Query:  tty->print_cr("      available: KLMD Query");   break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   507
              case MsgDigest::_SHA1:   tty->print_cr("      available: KLMD SHA-1");   break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   508
              case MsgDigest::_SHA256: tty->print_cr("      available: KLMD SHA-256"); break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   509
              case MsgDigest::_SHA512: tty->print_cr("      available: KLMD SHA-512"); break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   510
              default: tty->print_cr("      available: unknown code %d", i);  break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   511
            }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   512
          }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   513
        }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   514
      }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   515
    }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   516
    if (ContendedPaddingWidth > 0) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   517
      tty->cr();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   518
      tty->print_cr("ContendedPaddingWidth " INTX_FORMAT, ContendedPaddingWidth);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   519
    }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   520
  }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   521
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   522
54485
ddc19ea5059c 8219241: Provide basic virtualization related info in the hs_error file on linux/windows x86_64
mbaesken
parents: 53789
diff changeset
   523
void VM_Version::print_platform_virtualization_info(outputStream* st) {
ddc19ea5059c 8219241: Provide basic virtualization related info in the hs_error file on linux/windows x86_64
mbaesken
parents: 53789
diff changeset
   524
  // /proc/sysinfo contains interesting information about
ddc19ea5059c 8219241: Provide basic virtualization related info in the hs_error file on linux/windows x86_64
mbaesken
parents: 53789
diff changeset
   525
  // - LPAR
ddc19ea5059c 8219241: Provide basic virtualization related info in the hs_error file on linux/windows x86_64
mbaesken
parents: 53789
diff changeset
   526
  // - whole "Box" (CPUs )
ddc19ea5059c 8219241: Provide basic virtualization related info in the hs_error file on linux/windows x86_64
mbaesken
parents: 53789
diff changeset
   527
  // - z/VM / KVM (VM<nn>); this is not available in an LPAR-only setup
ddc19ea5059c 8219241: Provide basic virtualization related info in the hs_error file on linux/windows x86_64
mbaesken
parents: 53789
diff changeset
   528
  const char* kw[] = { "LPAR", "CPUs", "VM", NULL };
ddc19ea5059c 8219241: Provide basic virtualization related info in the hs_error file on linux/windows x86_64
mbaesken
parents: 53789
diff changeset
   529
  const char* info_file = "/proc/sysinfo";
ddc19ea5059c 8219241: Provide basic virtualization related info in the hs_error file on linux/windows x86_64
mbaesken
parents: 53789
diff changeset
   530
ddc19ea5059c 8219241: Provide basic virtualization related info in the hs_error file on linux/windows x86_64
mbaesken
parents: 53789
diff changeset
   531
  if (!print_matching_lines_from_file(info_file, st, kw)) {
ddc19ea5059c 8219241: Provide basic virtualization related info in the hs_error file on linux/windows x86_64
mbaesken
parents: 53789
diff changeset
   532
    st->print_cr("  <%s Not Available>", info_file);
ddc19ea5059c 8219241: Provide basic virtualization related info in the hs_error file on linux/windows x86_64
mbaesken
parents: 53789
diff changeset
   533
  }
ddc19ea5059c 8219241: Provide basic virtualization related info in the hs_error file on linux/windows x86_64
mbaesken
parents: 53789
diff changeset
   534
}
ddc19ea5059c 8219241: Provide basic virtualization related info in the hs_error file on linux/windows x86_64
mbaesken
parents: 53789
diff changeset
   535
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   536
void VM_Version::print_features() {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   537
  print_features_internal("Version:");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   538
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   539
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   540
void VM_Version::reset_features(bool reset) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   541
  if (reset) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   542
    for (unsigned int i = 0; i < _features_buffer_len; i++) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   543
      VM_Version::_features[i] = 0;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   544
    }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   545
  }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   546
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   547
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   548
void VM_Version::set_features_z900(bool reset) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   549
  reset_features(reset);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   550
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   551
  set_has_long_displacement();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   552
  set_has_ETF2();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   553
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   554
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   555
void VM_Version::set_features_z990(bool reset) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   556
  reset_features(reset);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   557
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   558
  set_features_z900(false);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   559
  set_has_ETF3();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   560
  set_has_long_displacement_fast();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   561
  set_has_HFPMultiplyAndAdd();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   562
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   563
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   564
void VM_Version::set_features_z9(bool reset) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   565
  reset_features(reset);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   566
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   567
  set_features_z990(false);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   568
  set_has_StoreFacilityListExtended();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   569
  // set_has_Crypto();   // Do not set, crypto features must be retrieved separately.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   570
  set_has_ETF2Enhancements();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   571
  set_has_ETF3Enhancements();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   572
  set_has_extended_immediate();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   573
  set_has_StoreClockFast();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   574
  set_has_HFPUnnormalized();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   575
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   576
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   577
void VM_Version::set_features_z10(bool reset) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   578
  reset_features(reset);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   579
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   580
  set_features_z9(false);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   581
  set_has_CompareSwapStore();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   582
  set_has_RelativeLoadStore();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   583
  set_has_CompareBranch();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   584
  set_has_CompareTrap();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   585
  set_has_MultiplySingleImm32();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   586
  set_has_Prefetch();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   587
  set_has_MoveImmToMem();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   588
  set_has_MemWithImmALUOps();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   589
  set_has_ExecuteExtensions();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   590
  set_has_FPSupportEnhancements();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   591
  set_has_DecimalFloatingPoint();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   592
  set_has_ExtractCPUtime();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   593
  set_has_CryptoExt3();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   594
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   595
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   596
void VM_Version::set_features_z196(bool reset) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   597
  reset_features(reset);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   598
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   599
  set_features_z10(false);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   600
  set_has_InterlockedAccessV1();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   601
  set_has_PopCount();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   602
  set_has_LoadStoreConditional();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   603
  set_has_HighWordInstr();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   604
  set_has_FastSync();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   605
  set_has_FPExtensions();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   606
  set_has_DistinctOpnds();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   607
  set_has_CryptoExt4();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   608
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   609
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   610
void VM_Version::set_features_ec12(bool reset) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   611
  reset_features(reset);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   612
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   613
  set_features_z196(false);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   614
  set_has_MiscInstrExt();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   615
  set_has_InterlockedAccessV2();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   616
  set_has_LoadAndALUAtomicV2();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   617
  set_has_TxMem();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   618
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   619
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   620
void VM_Version::set_features_z13(bool reset) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   621
  reset_features(reset);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   622
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   623
  set_features_ec12(false);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   624
  set_has_LoadStoreConditional2();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   625
  set_has_CryptoExt5();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   626
  set_has_VectorFacility();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   627
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   628
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   629
void VM_Version::set_features_from(const char* march) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   630
  bool err = false;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   631
  bool prt = false;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   632
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   633
  if ((march != NULL) && (march[0] != '\0')) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   634
    const int buf_len = 16;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   635
    const int hdr_len =  5;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   636
    char buf[buf_len];
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   637
    if (strlen(march) >= hdr_len) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   638
      memcpy(buf, march, hdr_len);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   639
      buf[hdr_len] = '\00';
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   640
    } else {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   641
      buf[0]       = '\00';
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   642
    }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   643
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   644
    if (!strcmp(march, "z900")) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   645
      set_features_z900();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   646
    } else if (!strcmp(march, "z990")) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   647
        set_features_z990();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   648
    } else if (!strcmp(march, "z9")) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   649
        set_features_z9();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   650
    } else if (!strcmp(march, "z10")) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   651
        set_features_z10();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   652
    } else if (!strcmp(march, "z196")) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   653
        set_features_z196();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   654
    } else if (!strcmp(march, "ec12")) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   655
        set_features_ec12();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   656
    } else if (!strcmp(march, "z13")) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   657
        set_features_z13();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   658
    } else if (!strcmp(buf, "ztest")) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   659
      assert(!has_TestFeaturesImpl(), "possible facility list flag conflict");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   660
      if (strlen(march) > hdr_len) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   661
        int itest = 0;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   662
        if ((strlen(march)-hdr_len) >= buf_len) err = true;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   663
        if (!err) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   664
          memcpy(buf, &march[hdr_len], strlen(march)-hdr_len);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   665
          buf[strlen(march)-hdr_len] = '\00';
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   666
          for (size_t i = 0; !err && (i < strlen(buf)); i++) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   667
            itest = itest*10 + buf[i]-'0';
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   668
            err   = err || ((buf[i]-'0') < 0) || ((buf[i]-'0') > 9) || (itest > 15);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   669
          }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   670
        }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   671
        if (!err) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   672
          prt = true;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   673
          if (itest & 0x01) { set_has_TestFeature1Impl(); }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   674
          if (itest & 0x02) { set_has_TestFeature2Impl(); }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   675
          if (itest & 0x04) { set_has_TestFeature4Impl(); }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   676
          if (itest & 0x08) { set_has_TestFeature8Impl(); }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   677
        }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   678
      } else {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   679
        prt = true;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   680
        set_has_TestFeature1Impl();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   681
        set_has_TestFeature2Impl();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   682
        set_has_TestFeature4Impl();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   683
        set_has_TestFeature8Impl();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   684
      }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   685
    } else {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   686
      err = true;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   687
    }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   688
    if (!err) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   689
      set_features_string();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   690
      if (prt || PrintAssembly) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   691
        print_features_internal("CPU Version as set by cmdline option:", prt);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   692
      }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   693
    } else {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   694
      tty->print_cr("***Warning: Unsupported ProcessorArchitecture: %s, internal settings left undisturbed.", march);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   695
    }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   696
  }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   697
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   698
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   699
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   700
static long (*getFeatures)(unsigned long*, int, int) = NULL;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   701
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   702
void VM_Version::set_getFeatures(address entryPoint) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   703
  if (getFeatures == NULL) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   704
    getFeatures = (long(*)(unsigned long*, int, int))entryPoint;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   705
  }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   706
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   707
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   708
long VM_Version::call_getFeatures(unsigned long* buffer, int buflen, int functionCode) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   709
  VM_Version::_is_determine_features_test_running = true;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   710
  long functionResult = (*getFeatures)(buffer, buflen, functionCode);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   711
  VM_Version::_is_determine_features_test_running = false;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   712
  return functionResult;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   713
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   714
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   715
// Helper function for "extract cache attribute" instruction.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   716
int VM_Version::calculate_ECAG_functionCode(unsigned int attributeIndication,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   717
                                            unsigned int levelIndication,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   718
                                            unsigned int typeIndication) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   719
  return (attributeIndication<<4) | (levelIndication<<1) | typeIndication;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   720
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   721
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   722
void VM_Version::determine_features() {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   723
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   724
  const int      cbuf_size = _code_buffer_len;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   725
  const int      buf_len   = _features_buffer_len;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   726
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   727
  // Allocate code buffer space for the detection code.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   728
  ResourceMark    rm;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   729
  CodeBuffer      cbuf("determine CPU features", cbuf_size, 0);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   730
  MacroAssembler* a = new MacroAssembler(&cbuf);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   731
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   732
  // Emit code.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   733
  set_getFeatures(a->pc());
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   734
  address   code = a->pc();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   735
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   736
  // Try STFLE. Possible INVOP will cause defaults to be used.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   737
  Label    getFEATURES;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   738
  Label    getCPUFEATURES;                   // fcode = -1 (cache)
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   739
  Label    getCIPHERFEATURES;                // fcode = -2 (cipher)
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   740
  Label    getMSGDIGESTFEATURES;             // fcode = -3 (SHA)
47607
c2ff34932cbd 8188857: [s390]: CPU feature detection incomplete
lucy
parents: 47216
diff changeset
   741
  Label    getVECTORFEATURES;                // fcode = -4 (OS support for vector instructions)
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   742
  Label    errRTN;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   743
  a->z_ltgfr(Z_R0, Z_ARG2);                  // Buf len to r0 and test.
47607
c2ff34932cbd 8188857: [s390]: CPU feature detection incomplete
lucy
parents: 47216
diff changeset
   744
  a->z_brl(getFEATURES);                     // negative -> Get machine features not covered by facility list.
47675
5af0dc07c0e7 8189616: [s390] Remove definition and all uses of STCK instruction
lucy
parents: 47634
diff changeset
   745
  a->z_lghi(Z_R1,0);
5af0dc07c0e7 8189616: [s390] Remove definition and all uses of STCK instruction
lucy
parents: 47634
diff changeset
   746
  a->z_brz(errRTN);                          // zero -> Function code currently not used, indicate "aborted".
5af0dc07c0e7 8189616: [s390] Remove definition and all uses of STCK instruction
lucy
parents: 47634
diff changeset
   747
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   748
  a->z_aghi(Z_R0, -1);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   749
  a->z_stfle(0, Z_ARG1);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   750
  a->z_lg(Z_R1, 0, Z_ARG1);                  // Get first DW of facility list.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   751
  a->z_lgr(Z_RET, Z_R0);                     // Calculate rtn value for success.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   752
  a->z_la(Z_RET, 1, Z_RET);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   753
  a->z_brnz(errRTN);                         // Instr failed if non-zero CC.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   754
  a->z_ltgr(Z_R1, Z_R1);                     // Instr failed if first DW == 0.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   755
  a->z_bcr(Assembler::bcondNotZero, Z_R14);  // Successful return.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   756
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   757
  a->bind(errRTN);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   758
  a->z_lngr(Z_RET, Z_RET);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   759
  a->z_ltgr(Z_R1, Z_R1);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   760
  a->z_bcr(Assembler::bcondNotZero, Z_R14);  // Return "buffer too small".
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   761
  a->z_xgr(Z_RET, Z_RET);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   762
  a->z_br(Z_R14);                            // Return "operation aborted".
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   763
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   764
  a->bind(getFEATURES);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   765
  a->z_cghi(Z_R0, -1);                       // -1: Extract CPU attributes, currently: cache layout only.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   766
  a->z_bre(getCPUFEATURES);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   767
  a->z_cghi(Z_R0, -2);                       // -2: Extract detailed crypto capabilities (cipher instructions).
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   768
  a->z_bre(getCIPHERFEATURES);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   769
  a->z_cghi(Z_R0, -3);                       // -3: Extract detailed crypto capabilities (msg digest instructions).
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   770
  a->z_bre(getMSGDIGESTFEATURES);
47607
c2ff34932cbd 8188857: [s390]: CPU feature detection incomplete
lucy
parents: 47216
diff changeset
   771
  a->z_cghi(Z_R0, -4);                       // -4: Verify vector instruction availability (OS support).
c2ff34932cbd 8188857: [s390]: CPU feature detection incomplete
lucy
parents: 47216
diff changeset
   772
  a->z_bre(getVECTORFEATURES);
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   773
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   774
  a->z_xgr(Z_RET, Z_RET);                    // Not a valid function code.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   775
  a->z_br(Z_R14);                            // Return "operation aborted".
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   776
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   777
  // Try KIMD/KLMD query function to get details about msg digest (secure hash, SHA) instructions.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   778
  a->bind(getMSGDIGESTFEATURES);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   779
  a->z_lghi(Z_R0,(int)MsgDigest::_Query);    // query function code
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   780
  a->z_lgr(Z_R1,Z_R2);                       // param block addr, 2*16 bytes min size
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   781
  a->z_kimd(Z_R2,Z_R2);                      // Get available KIMD functions (bit pattern in param blk).
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   782
  a->z_la(Z_R1,16,Z_R1);                     // next param block addr
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   783
  a->z_klmd(Z_R2,Z_R2);                      // Get available KLMD functions (bit pattern in param blk).
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   784
  a->z_lghi(Z_RET,4);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   785
  a->z_br(Z_R14);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   786
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   787
  // Try KM/KMC query function to get details about crypto instructions.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   788
  a->bind(getCIPHERFEATURES);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   789
  a->z_lghi(Z_R0,(int)Cipher::_Query);       // query function code
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   790
  a->z_lgr(Z_R1,Z_R2);                       // param block addr, 2*16 bytes min size (KIMD/KLMD output)
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   791
  a->z_km(Z_R2,Z_R2);                        // get available KM functions
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   792
  a->z_la(Z_R1,16,Z_R1);                     // next param block addr
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   793
  a->z_kmc(Z_R2,Z_R2);                       // get available KMC functions
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   794
  a->z_lghi(Z_RET,4);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   795
  a->z_br(Z_R14);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   796
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   797
  // Use EXTRACT CPU ATTRIBUTE instruction to get information about cache layout.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   798
  a->bind(getCPUFEATURES);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   799
  a->z_xgr(Z_R0,Z_R0);                       // as recommended in instruction documentation
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   800
  a->z_ecag(Z_RET,Z_R0,0,Z_ARG3);            // Extract information as requested by Z_ARG1 contents.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   801
  a->z_br(Z_R14);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   802
47607
c2ff34932cbd 8188857: [s390]: CPU feature detection incomplete
lucy
parents: 47216
diff changeset
   803
  // Use a vector instruction to verify OS support. Will fail with SIGFPE if OS support is missing.
c2ff34932cbd 8188857: [s390]: CPU feature detection incomplete
lucy
parents: 47216
diff changeset
   804
  a->bind(getVECTORFEATURES);
c2ff34932cbd 8188857: [s390]: CPU feature detection incomplete
lucy
parents: 47216
diff changeset
   805
  a->z_vtm(Z_V0,Z_V0);                       // non-destructive vector instruction. Will cause SIGFPE if not supported.
c2ff34932cbd 8188857: [s390]: CPU feature detection incomplete
lucy
parents: 47216
diff changeset
   806
  a->z_br(Z_R14);
c2ff34932cbd 8188857: [s390]: CPU feature detection incomplete
lucy
parents: 47216
diff changeset
   807
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   808
  address code_end = a->pc();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   809
  a->flush();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   810
54960
e46fe26d7f77 8213084: Rework and enhance Print[Opto]Assembly output
lucy
parents: 54485
diff changeset
   811
  cbuf.insts()->set_end(code_end);
e46fe26d7f77 8213084: Rework and enhance Print[Opto]Assembly output
lucy
parents: 54485
diff changeset
   812
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   813
  // Print the detection code.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   814
  bool printVerbose = Verbose || PrintAssembly || PrintStubCode;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   815
  if (printVerbose) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   816
    ttyLocker ttyl;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   817
    tty->print_cr("Decoding CPU feature detection stub at " INTPTR_FORMAT " before execution:", p2i(code));
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   818
    tty->print_cr("Stub length is %ld bytes, codebuffer reserves %d bytes, %ld bytes spare.",
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   819
                  code_end-code, cbuf_size, cbuf_size-(code_end-code));
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   820
54960
e46fe26d7f77 8213084: Rework and enhance Print[Opto]Assembly output
lucy
parents: 54485
diff changeset
   821
    // Use existing decode function. This enables the [MachCode] format which is needed to DecodeErrorFile.
e46fe26d7f77 8213084: Rework and enhance Print[Opto]Assembly output
lucy
parents: 54485
diff changeset
   822
    Disassembler::decode(&cbuf, code, code_end, tty);
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   823
  }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   824
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   825
  // Prepare for detection code execution and clear work buffer.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   826
  _nfeatures        = 0;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   827
  _ncipher_features = 0;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   828
  unsigned long  buffer[buf_len];
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   829
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   830
  for (int i = 0; i < buf_len; i++) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   831
    buffer[i] = 0L;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   832
  }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   833
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   834
  // execute code
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   835
  // Illegal instructions will be replaced by 0 in signal handler.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   836
  // In case of problems, call_getFeatures will return a not-positive result.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   837
  long used_len = call_getFeatures(buffer, buf_len, 0);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   838
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   839
  bool ok;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   840
  if (used_len == 1) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   841
    ok = true;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   842
  } else if (used_len > 1) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   843
    unsigned int used_lenU = (unsigned int)used_len;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   844
    ok = true;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   845
    for (unsigned int i = 1; i < used_lenU; i++) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   846
      ok = ok && (buffer[i] == 0L);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   847
    }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   848
    if (printVerbose && !ok) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   849
      bool compact = false;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   850
      tty->print_cr("Note: feature list has %d (i.e. more than one) array elements.", used_lenU);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   851
      if (compact) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   852
        tty->print("non-zero feature list elements:");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   853
        for (unsigned int i = 0; i < used_lenU; i++) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   854
          tty->print("  [%d]: 0x%16.16lx", i, buffer[i]);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   855
        }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   856
        tty->cr();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   857
      } else {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   858
        for (unsigned int i = 0; i < used_lenU; i++) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   859
          tty->print_cr("non-zero feature list[%d]: 0x%16.16lx", i, buffer[i]);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   860
        }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   861
      }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   862
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   863
      if (compact) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   864
        tty->print_cr("Active features (compact view):");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   865
        for (unsigned int k = 0; k < used_lenU; k++) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   866
          tty->print_cr("  buffer[%d]:", k);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   867
          for (unsigned int j = k*sizeof(long); j < (k+1)*sizeof(long); j++) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   868
            bool line = false;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   869
            for (unsigned int i = j*8; i < (j+1)*8; i++) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   870
              bool bit  = test_feature_bit(buffer, i, used_lenU*sizeof(long)*8);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   871
              if (bit) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   872
                if (!line) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   873
                  tty->print("    byte[%d]:", j);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   874
                  line = true;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   875
                }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   876
                tty->print("  [%3.3d]", i);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   877
              }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   878
            }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   879
            if (line) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   880
              tty->cr();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   881
            }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   882
          }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   883
        }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   884
      } else {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   885
        tty->print_cr("Active features (full view):");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   886
        for (unsigned int k = 0; k < used_lenU; k++) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   887
          tty->print_cr("  buffer[%d]:", k);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   888
          for (unsigned int j = k*sizeof(long); j < (k+1)*sizeof(long); j++) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   889
            tty->print("    byte[%d]:", j);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   890
            for (unsigned int i = j*8; i < (j+1)*8; i++) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   891
              bool bit  = test_feature_bit(buffer, i, used_lenU*sizeof(long)*8);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   892
              if (bit) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   893
                tty->print("  [%3.3d]", i);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   894
              } else {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   895
                tty->print("       ");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   896
              }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   897
            }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   898
            tty->cr();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   899
          }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   900
        }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   901
      }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   902
    }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   903
    ok = true;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   904
  } else {  // No features retrieved if we reach here. Buffer too short or instr not available.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   905
    if (used_len < 0) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   906
      ok = false;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   907
      if (printVerbose) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   908
        tty->print_cr("feature list buffer[%d] too short, required: buffer[%ld]", buf_len, -used_len);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   909
      }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   910
    } else {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   911
      if (printVerbose) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   912
        tty->print_cr("feature list could not be retrieved. Running on z900 or z990? Trying to find out...");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   913
      }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   914
      used_len = call_getFeatures(buffer, 0, 0);       // Must provide at least two DW buffer elements!!!!
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   915
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   916
      ok = used_len > 0;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   917
      if (ok) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   918
        if (buffer[1]*10 < buffer[0]) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   919
          set_features_z900();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   920
        } else {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   921
          set_features_z990();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   922
        }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   923
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   924
        if (printVerbose) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   925
          tty->print_cr("Note: high-speed long displacement test used %ld iterations.", used_len);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   926
          tty->print_cr("      Positive displacement loads took %8.8lu microseconds.", buffer[1]);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   927
          tty->print_cr("      Negative displacement loads took %8.8lu microseconds.", buffer[0]);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   928
          if (has_long_displacement_fast()) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   929
            tty->print_cr("      assuming high-speed long displacement IS     available.");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   930
          } else {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   931
            tty->print_cr("      assuming high-speed long displacement is NOT available.");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   932
          }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   933
        }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   934
      } else {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   935
        if (printVerbose) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   936
          tty->print_cr("Note: high-speed long displacement test was not successful.");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   937
          tty->print_cr("      assuming long displacement is NOT available.");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   938
        }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   939
      }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   940
      return; // Do not copy buffer to _features, no test for cipher features.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   941
    }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   942
  }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   943
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   944
  if (ok) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   945
    // Fill features buffer.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   946
    // Clear work buffer.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   947
    for (int i = 0; i < buf_len; i++) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   948
      _features[i]           = buffer[i];
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   949
      _cipher_features[i]    = 0;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   950
      _msgdigest_features[i] = 0;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   951
      buffer[i]              = 0L;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   952
    }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   953
    _nfeatures = used_len;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   954
  } else {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   955
    for (int i = 0; i < buf_len; i++) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   956
      _features[i]           = 0;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   957
      _cipher_features[i]    = 0;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   958
      _msgdigest_features[i] = 0;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   959
      buffer[i]              = 0L;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   960
    }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   961
    _nfeatures = 0;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   962
  }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   963
47607
c2ff34932cbd 8188857: [s390]: CPU feature detection incomplete
lucy
parents: 47216
diff changeset
   964
  if (has_VectorFacility()) {
c2ff34932cbd 8188857: [s390]: CPU feature detection incomplete
lucy
parents: 47216
diff changeset
   965
    // Verify that feature can actually be used. OS support required.
c2ff34932cbd 8188857: [s390]: CPU feature detection incomplete
lucy
parents: 47216
diff changeset
   966
    call_getFeatures(buffer, -4, 0);
c2ff34932cbd 8188857: [s390]: CPU feature detection incomplete
lucy
parents: 47216
diff changeset
   967
    if (printVerbose) {
c2ff34932cbd 8188857: [s390]: CPU feature detection incomplete
lucy
parents: 47216
diff changeset
   968
      ttyLocker ttyl;
c2ff34932cbd 8188857: [s390]: CPU feature detection incomplete
lucy
parents: 47216
diff changeset
   969
      if (has_VectorFacility()) {
c2ff34932cbd 8188857: [s390]: CPU feature detection incomplete
lucy
parents: 47216
diff changeset
   970
        tty->print_cr("  Vector Facility has been verified to be supported by OS");
c2ff34932cbd 8188857: [s390]: CPU feature detection incomplete
lucy
parents: 47216
diff changeset
   971
      } else {
c2ff34932cbd 8188857: [s390]: CPU feature detection incomplete
lucy
parents: 47216
diff changeset
   972
        tty->print_cr("  Vector Facility has been disabled - not supported by OS");
c2ff34932cbd 8188857: [s390]: CPU feature detection incomplete
lucy
parents: 47216
diff changeset
   973
      }
c2ff34932cbd 8188857: [s390]: CPU feature detection incomplete
lucy
parents: 47216
diff changeset
   974
    }
c2ff34932cbd 8188857: [s390]: CPU feature detection incomplete
lucy
parents: 47216
diff changeset
   975
  }
c2ff34932cbd 8188857: [s390]: CPU feature detection incomplete
lucy
parents: 47216
diff changeset
   976
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   977
  // Extract Crypto Facility details.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   978
  if (has_Crypto()) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   979
    // Get cipher features.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   980
    used_len = call_getFeatures(buffer, -2, 0);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   981
    for (int i = 0; i < buf_len; i++) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   982
      _cipher_features[i] = buffer[i];
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   983
    }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   984
    _ncipher_features = used_len;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   985
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   986
    // Get msg digest features.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   987
    used_len = call_getFeatures(buffer, -3, 0);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   988
    for (int i = 0; i < buf_len; i++) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   989
      _msgdigest_features[i] = buffer[i];
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   990
    }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   991
    _nmsgdigest_features = used_len;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   992
  }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   993
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   994
  static int   levelProperties[_max_cache_levels];     // All property indications per level.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   995
  static int   levelScope[_max_cache_levels];          // private/shared
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   996
  static const char* levelScopeText[4] = {"No cache   ",
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   997
                                          "CPU private",
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   998
                                          "shared     ",
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   999
                                          "reserved   "};
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1000
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1001
  static int   levelType[_max_cache_levels];           // D/I/mixed
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1002
  static const char* levelTypeText[4]  = {"separate D and I caches",
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1003
                                          "I cache only           ",
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1004
                                          "D-cache only           ",
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1005
                                          "combined D/I cache     "};
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1006
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1007
  static unsigned int levelReserved[_max_cache_levels];    // reserved property bits
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1008
  static unsigned int levelLineSize[_max_cache_levels];
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1009
  static unsigned int levelTotalSize[_max_cache_levels];
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1010
  static unsigned int levelAssociativity[_max_cache_levels];
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1011
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1012
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1013
  // Extract Cache Layout details.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1014
  if (has_ExtractCPUAttributes() && printVerbose) { // For information only, as of now.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1015
    bool         lineSize_mismatch;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1016
    bool         print_something;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1017
    long         functionResult;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1018
    unsigned int attributeIndication = 0; // 0..15
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1019
    unsigned int levelIndication     = 0; // 0..8
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1020
    unsigned int typeIndication      = 0; // 0..1 (D-Cache, I-Cache)
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1021
    int          functionCode        = calculate_ECAG_functionCode(attributeIndication, levelIndication, typeIndication);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1022
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1023
    // Get cache topology.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1024
    functionResult = call_getFeatures(buffer, -1, functionCode);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1025
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1026
    for (unsigned int i = 0; i < _max_cache_levels; i++) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1027
      if (functionResult > 0) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1028
        int shiftVal          = 8*(_max_cache_levels-(i+1));
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1029
        levelProperties[i]    = (functionResult & (0xffUL<<shiftVal)) >> shiftVal;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1030
        levelReserved[i]      = (levelProperties[i] & 0xf0) >> 4;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1031
        levelScope[i]         = (levelProperties[i] & 0x0c) >> 2;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1032
        levelType[i]          = (levelProperties[i] & 0x03);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1033
      } else {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1034
        levelProperties[i]    = 0;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1035
        levelReserved[i]      = 0;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1036
        levelScope[i]         = 0;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1037
        levelType[i]          = 0;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1038
      }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1039
      levelLineSize[i]      = 0;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1040
      levelTotalSize[i]     = 0;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1041
      levelAssociativity[i] = 0;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1042
    }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1043
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1044
    tty->cr();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1045
    tty->print_cr("------------------------------------");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1046
    tty->print_cr("---  Cache Topology Information  ---");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1047
    tty->print_cr("------------------------------------");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1048
    for (unsigned int i = 0; (i < _max_cache_levels) && (levelProperties[i] != 0); i++) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1049
      tty->print_cr("  Cache Level %d: <scope>  %s | <type>  %s",
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1050
                    i+1, levelScopeText[levelScope[i]], levelTypeText[levelType[i]]);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1051
    }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1052
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1053
    // Get D-cache details per level.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1054
    _Dcache_lineSize   = 0;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1055
    lineSize_mismatch  = false;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1056
    print_something    = false;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1057
    typeIndication     = 0; // 0..1 (D-Cache, I-Cache)
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1058
    for (unsigned int i = 0; (i < _max_cache_levels) && (levelProperties[i] != 0); i++) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1059
      if ((levelType[i] == 0) || (levelType[i] == 2)) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1060
        print_something     = true;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1061
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1062
        // Get cache line size of level i.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1063
        attributeIndication   = 1;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1064
        functionCode          = calculate_ECAG_functionCode(attributeIndication, i, typeIndication);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1065
        levelLineSize[i]      = (unsigned int)call_getFeatures(buffer, -1, functionCode);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1066
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1067
        // Get cache total size of level i.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1068
        attributeIndication   = 2;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1069
        functionCode          = calculate_ECAG_functionCode(attributeIndication, i, typeIndication);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1070
        levelTotalSize[i]     = (unsigned int)call_getFeatures(buffer, -1, functionCode);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1071
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1072
        // Get cache associativity of level i.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1073
        attributeIndication   = 3;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1074
        functionCode          = calculate_ECAG_functionCode(attributeIndication, i, typeIndication);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1075
        levelAssociativity[i] = (unsigned int)call_getFeatures(buffer, -1, functionCode);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1076
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1077
        _Dcache_lineSize      = _Dcache_lineSize == 0 ? levelLineSize[i] : _Dcache_lineSize;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1078
        lineSize_mismatch     = lineSize_mismatch || (_Dcache_lineSize != levelLineSize[i]);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1079
      } else {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1080
        levelLineSize[i]      = 0;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1081
      }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1082
    }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1083
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1084
    if (print_something) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1085
      tty->cr();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1086
      tty->print_cr("------------------------------------");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1087
      tty->print_cr("---  D-Cache Detail Information  ---");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1088
      tty->print_cr("------------------------------------");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1089
      if (lineSize_mismatch) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1090
        tty->print_cr("WARNING: D-Cache line size mismatch!");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1091
      }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1092
      for (unsigned int i = 0; (i < _max_cache_levels) && (levelProperties[i] != 0); i++) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1093
        if (levelLineSize[i] > 0) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1094
          tty->print_cr("  D-Cache Level %d: line size = %4d,  total size = %6dKB,  associativity = %2d",
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1095
                        i+1, levelLineSize[i], levelTotalSize[i]/(int)K, levelAssociativity[i]);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1096
        }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1097
      }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1098
    }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1099
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1100
    // Get I-cache details per level.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1101
    _Icache_lineSize   = 0;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1102
    lineSize_mismatch  = false;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1103
    print_something    = false;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1104
    typeIndication     = 1; // 0..1 (D-Cache, I-Cache)
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1105
    for (unsigned int i = 0; (i < _max_cache_levels) && (levelProperties[i] != 0); i++) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1106
      if ((levelType[i] == 0) || (levelType[i] == 1)) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1107
        print_something     = true;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1108
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1109
        // Get cache line size of level i.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1110
        attributeIndication   = 1;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1111
        functionCode          = calculate_ECAG_functionCode(attributeIndication, i, typeIndication);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1112
        levelLineSize[i]      = (unsigned int)call_getFeatures(buffer, -1, functionCode);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1113
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1114
        // Get cache total size of level i.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1115
        attributeIndication   = 2;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1116
        functionCode          = calculate_ECAG_functionCode(attributeIndication, i, typeIndication);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1117
        levelTotalSize[i]     = (unsigned int)call_getFeatures(buffer, -1, functionCode);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1118
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1119
        // Get cache associativity of level i.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1120
        attributeIndication   = 3;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1121
        functionCode          = calculate_ECAG_functionCode(attributeIndication, i, typeIndication);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1122
        levelAssociativity[i] = (unsigned int)call_getFeatures(buffer, -1, functionCode);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1123
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1124
        _Icache_lineSize      = _Icache_lineSize == 0 ? levelLineSize[i] : _Icache_lineSize;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1125
        lineSize_mismatch     = lineSize_mismatch || (_Icache_lineSize != levelLineSize[i]);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1126
      } else {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1127
        levelLineSize[i]      = 0;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1128
      }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1129
    }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1130
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1131
    if (print_something) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1132
      tty->cr();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1133
      tty->print_cr("------------------------------------");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1134
      tty->print_cr("---  I-Cache Detail Information  ---");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1135
      tty->print_cr("------------------------------------");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1136
      if (lineSize_mismatch) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1137
        tty->print_cr("WARNING: I-Cache line size mismatch!");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1138
      }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1139
      for (unsigned int i = 0; (i < _max_cache_levels) && (levelProperties[i] != 0); i++) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1140
        if (levelLineSize[i] > 0) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1141
          tty->print_cr("  I-Cache Level %d: line size = %4d,  total size = %6dKB,  associativity = %2d",
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1142
                        i+1, levelLineSize[i], levelTotalSize[i]/(int)K, levelAssociativity[i]);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1143
        }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1144
      }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1145
    }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1146
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1147
    // Get D/I-cache details per level.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1148
    lineSize_mismatch  = false;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1149
    print_something    = false;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1150
    typeIndication     = 0; // 0..1 (D-Cache, I-Cache)
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1151
    for (unsigned int i = 0; (i < _max_cache_levels) && (levelProperties[i] != 0); i++) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1152
      if (levelType[i] == 3) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1153
        print_something     = true;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1154
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1155
        // Get cache line size of level i.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1156
        attributeIndication   = 1;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1157
        functionCode          = calculate_ECAG_functionCode(attributeIndication, i, typeIndication);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1158
        levelLineSize[i]      = (unsigned int)call_getFeatures(buffer, -1, functionCode);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1159
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1160
        // Get cache total size of level i.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1161
        attributeIndication   = 2;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1162
        functionCode          = calculate_ECAG_functionCode(attributeIndication, i, typeIndication);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1163
        levelTotalSize[i]     = (unsigned int)call_getFeatures(buffer, -1, functionCode);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1164
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1165
        // Get cache associativity of level i.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1166
        attributeIndication   = 3;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1167
        functionCode          = calculate_ECAG_functionCode(attributeIndication, i, typeIndication);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1168
        levelAssociativity[i] = (unsigned int)call_getFeatures(buffer, -1, functionCode);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1169
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1170
        _Dcache_lineSize      = _Dcache_lineSize == 0 ? levelLineSize[i] : _Dcache_lineSize;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1171
        _Icache_lineSize      = _Icache_lineSize == 0 ? levelLineSize[i] : _Icache_lineSize;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1172
        lineSize_mismatch     = lineSize_mismatch || (_Dcache_lineSize != levelLineSize[i])
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1173
                                                  || (_Icache_lineSize != levelLineSize[i]);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1174
      } else {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1175
        levelLineSize[i]      = 0;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1176
      }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1177
    }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1178
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1179
    if (print_something) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1180
      tty->cr();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1181
      tty->print_cr("--------------------------------------");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1182
      tty->print_cr("---  D/I-Cache Detail Information  ---");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1183
      tty->print_cr("--------------------------------------");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1184
      if (lineSize_mismatch) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1185
        tty->print_cr("WARNING: D/I-Cache line size mismatch!");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1186
      }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1187
      for (unsigned int i = 0; (i < _max_cache_levels) && (levelProperties[i] != 0); i++) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1188
        if (levelLineSize[i] > 0) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1189
          tty->print_cr("  D/I-Cache Level %d: line size = %4d,  total size = %6dKB,  associativity = %2d",
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1190
                        i+1, levelLineSize[i], levelTotalSize[i]/(int)K, levelAssociativity[i]);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1191
        }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1192
      }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1193
    }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1194
    tty->cr();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1195
  }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1196
  return;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1197
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1198
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1199
unsigned long VM_Version::z_SIGILL() {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1200
  unsigned long   ZeroBuffer = 0;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1201
  unsigned long   work;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1202
  asm(
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1203
    "     LA      %[work],%[buffer]  \n\t"   // Load address of buffer.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1204
    "     LARL    14,+6              \n\t"   // Load address of faulting instruction.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1205
    "     BCR     15,%[work]         \n\t"   // Branch into buffer, execute whatever is in there.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1206
    : [buffer]  "+Q"  (ZeroBuffer)   /* outputs   */
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1207
    , [work]   "=&a"  (work)         /* outputs   */
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1208
    :                                /* inputs    */
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1209
    : "cc"                           /* clobbered */
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1210
 );
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1211
  return ZeroBuffer;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1212
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1213
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1214
unsigned long VM_Version::z_SIGSEGV() {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1215
  unsigned long   ZeroBuffer = 0;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1216
  unsigned long   work;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1217
  asm(
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1218
    "     LG      %[work],%[buffer]  \n\t"   // Load zero address.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1219
    "     STG     %[work],0(,%[work])\n\t"   // Store to address zero.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1220
    : [buffer]  "+Q"  (ZeroBuffer)   /* outputs   */
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1221
    , [work]   "=&a"  (work)         /* outputs   */
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1222
    :                                /* inputs    */
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1223
    : "cc"                           /* clobbered */
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1224
 );
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1225
  return ZeroBuffer;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1226
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1227