2 * Copyright 2012-2016 The OpenSSL Project Authors. All Rights Reserved.
4 * Licensed under the OpenSSL license (the "License"). You may not use
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
10 #ifndef __SPARC_ARCH_H__
11 # define __SPARC_ARCH_H__
13 # define SPARCV9_TICK_PRIVILEGED (1<<0)
14 # define SPARCV9_PREFER_FPU (1<<1)
15 # define SPARCV9_VIS1 (1<<2)
16 # define SPARCV9_VIS2 (1<<3)/* reserved */
17 # define SPARCV9_FMADD (1<<4)
18 # define SPARCV9_BLK (1<<5)/* VIS1 block copy */
19 # define SPARCV9_VIS3 (1<<6)
20 # define SPARCV9_RANDOM (1<<7)
21 # define SPARCV9_64BIT_STACK (1<<8)
22 # define SPARCV9_FJAESX (1<<9)/* Fujitsu SPARC64 X AES */
23 # define SPARCV9_FJDESX (1<<10)/* Fujitsu SPARC64 X DES, reserved */
24 # define SPARCV9_FJHPCACE (1<<11)/* Fujitsu HPC-ACE, reserved */
25 # define SPARCV9_IMA (1<<13)/* reserved */
26 # define SPARCV9_VIS4 (1<<14)/* reserved */
29 * OPENSSL_sparcv9cap_P[1] is copy of Compatibility Feature Register,
30 * %asr26, SPARC-T4 and later. There is no SPARCV9_CFR bit in
31 * OPENSSL_sparcv9cap_P[0], as %cfr copy is sufficient...
33 # define CFR_AES 0x00000001/* Supports AES opcodes */
34 # define CFR_DES 0x00000002/* Supports DES opcodes */
35 # define CFR_KASUMI 0x00000004/* Supports KASUMI opcodes */
36 # define CFR_CAMELLIA 0x00000008/* Supports CAMELLIA opcodes */
37 # define CFR_MD5 0x00000010/* Supports MD5 opcodes */
38 # define CFR_SHA1 0x00000020/* Supports SHA1 opcodes */
39 # define CFR_SHA256 0x00000040/* Supports SHA256 opcodes */
40 # define CFR_SHA512 0x00000080/* Supports SHA512 opcodes */
41 # define CFR_MPMUL 0x00000100/* Supports MPMUL opcodes */
42 # define CFR_MONTMUL 0x00000200/* Supports MONTMUL opcodes */
43 # define CFR_MONTSQR 0x00000400/* Supports MONTSQR opcodes */
44 # define CFR_CRC32C 0x00000800/* Supports CRC32C opcodes */
45 # define CFR_XMPMUL 0x00001000/* Supports XMPMUL opcodes */
46 # define CFR_XMONTMUL 0x00002000/* Supports XMONTMUL opcodes */
47 # define CFR_XMONTSQR 0x00004000/* Supports XMONTSQR opcodes */
49 # if defined(OPENSSL_PIC) && !defined(__PIC__)
53 # if defined(__SUNPRO_C) && defined(__sparcv9) && !defined(__arch64__)
57 # define SPARC_PIC_THUNK(reg) \
63 # define SPARC_PIC_THUNK_CALL(reg) \
64 sethi %hi(_GLOBAL_OFFSET_TABLE_-4), reg; \
66 or reg, %lo(_GLOBAL_OFFSET_TABLE_+4), reg;
69 # define SPARC_SETUP_GOT_REG(reg) SPARC_PIC_THUNK_CALL(reg)
71 # define SPARC_SETUP_GOT_REG(reg) \
72 sethi %hi(_GLOBAL_OFFSET_TABLE_-4), reg; \
74 or reg,%lo(_GLOBAL_OFFSET_TABLE_+4), reg; \
78 # if defined(__arch64__)
80 # define SPARC_LOAD_ADDRESS(SYM, reg) \
83 # define SIZE_T_CC %xcc
84 # define STACK_FRAME 192
85 # define STACK_BIAS 2047
86 # define STACK_7thARG (STACK_BIAS+176)
90 # define SPARC_LOAD_ADDRESS(SYM, reg) \
93 # define SIZE_T_CC %icc
94 # define STACK_FRAME 112
96 # define STACK_7thARG 92
97 # define SPARC_LOAD_ADDRESS_LEAF(SYM,reg,tmp) SPARC_LOAD_ADDRESS(SYM,reg)
102 # undef SPARC_LOAD_ADDRESS
103 # undef SPARC_LOAD_ADDRESS_LEAF
104 # define SPARC_LOAD_ADDRESS(SYM, reg) \
105 SPARC_SETUP_GOT_REG(reg); \
106 sethi %hi(SYM), %o7; \
107 or %o7, %lo(SYM), %o7; \
108 LDPTR [reg + %o7], reg;
111 # ifndef SPARC_LOAD_ADDRESS_LEAF
112 # define SPARC_LOAD_ADDRESS_LEAF(SYM, reg, tmp) \
114 SPARC_LOAD_ADDRESS(SYM, reg) \
118 #endif /* __SPARC_ARCH_H__ */