1 /*
   2  * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
   3  * Copyright (c) 2014, Red Hat Inc. All rights reserved.
   4  * Copyright (c) 2015, Linaro Ltd. All rights reserved.
   5  * Copyright (c) 2015-2018, Azul Systems, Inc. All rights reserved.
   6  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   7  *
   8  * This code is free software; you can redistribute it and/or modify it
   9  * under the terms of the GNU General Public License version 2 only, as
  10  * published by the Free Software Foundation.
  11  *
  12  * This code is distributed in the hope that it will be useful, but WITHOUT
  13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  14  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  15  * version 2 for more details (a copy is included in the LICENSE file that
  16  * accompanied this code).
  17  *
  18  * You should have received a copy of the GNU General Public License version
  19  * 2 along with this work; if not, write to the Free Software Foundation,
  20  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  21  *
  22  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  23  * or visit www.oracle.com if you need additional information or have any
  24  * questions.
  25  *
  26  */
  27 
  28 #ifndef CPU_AARCH32_VM_STUBROUTINES_AARCH32_HPP
  29 #define CPU_AARCH32_VM_STUBROUTINES_AARCH32_HPP
  30 
  31 // This file holds the platform specific parts of the StubRoutines
  32 // definition. See stubRoutines.hpp for a description on how to
  33 // extend it.
  34 
  35 // n.b. if we are notifying entry/exit to the simulator then the call
  36 // stub does a notify at normal return placing
  37 // call_stub_return_address one instruction beyond the notify. the
  38 // latter address is sued by the stack unwind code when doign an
  39 // exception return.
  40 static bool    returns_to_call_stub(address return_pc)   {
  41   return return_pc == _call_stub_return_address;
  42 }
  43 
  44 enum platform_dependent_constants {
  45   code_size1 = 19000,          // simply increase if too small (assembler will crash if too small)
  46   code_size2 = 22000           // simply increase if too small (assembler will crash if too small)
  47 };
  48 
  49 class aarch32 {
  50  friend class StubGenerator;
  51 
  52  private:
  53 #ifdef COMPILER2
  54   static address _idiv_entry;
  55   static address _irem_entry;
  56   static address _partial_subtype_check;
  57   static address _string_compress_neon;
  58   static address _string_inflate_neon;
  59 #endif
  60 
  61  public:
  62 
  63 #ifdef COMPILER2
  64   static address idiv_entry() {
  65     return _idiv_entry;
  66   }
  67 
  68   static address irem_entry() {
  69     return _irem_entry;
  70   }
  71 
  72   static address partial_subtype_check() {
  73     return _partial_subtype_check;
  74   }
  75 
  76   static address string_compress_neon() {
  77     return _string_compress_neon;
  78   }
  79 
  80   static address string_inflate_neon() {
  81     return _string_inflate_neon;
  82   }
  83 #endif
  84 
  85  private:
  86   static juint    _crc_table[];
  87   static juint    _crc32c_table[];
  88 
  89  private:
  90   static juint    _aes_te_table[];
  91   static juint    _aes_td_table[];
  92 
  93  private:
  94   static juint    _sha1_table[];
  95   static juint    _sha256_table[];
  96   static julong   _sha512_table[];
  97 };
  98 
  99 
 100   static address _cipherBlockChaining_encryptAESCrypt_special;
 101   static address _cipherBlockChaining_decryptAESCrypt_special;
 102 
 103   static address _aes_table_te_addr;
 104   static address _aes_table_td_addr;
 105 
 106   static address _sha1_table_addr;
 107   static address _sha256_table_addr;
 108   static address _sha512_table_addr;
 109 
 110 public:
 111   static address cipherBlockChaining_encryptAESCrypt_special()  { return _cipherBlockChaining_encryptAESCrypt_special; }
 112   static address cipherBlockChaining_decryptAESCrypt_special()  { return _cipherBlockChaining_decryptAESCrypt_special; }
 113   static address aes_table_te_addr()      { return _aes_table_te_addr; }
 114   static address aes_table_td_addr()      { return _aes_table_td_addr; }
 115 
 116   static address sha1_table_addr()       { return _sha1_table_addr; }
 117   static address sha256_table_addr()     { return _sha256_table_addr; }
 118   static address sha512_table_addr()     { return _sha512_table_addr; }
 119 
 120 #endif // CPU_AARCH32_VM_STUBROUTINES_AARCH32_HPP