]> git.ipfire.org Git - thirdparty/openssl.git/blame - crypto/sparc_arch.h
OPENSSL_s390xcap.pod: list msa9 facility bit (155)
[thirdparty/openssl.git] / crypto / sparc_arch.h
CommitLineData
b1322259
RS
1/*
2 * Copyright 2012-2016 The OpenSSL Project Authors. All Rights Reserved.
3 *
0e9725bc 4 * Licensed under the Apache License 2.0 (the "License"). You may not use
b1322259
RS
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
8 */
9
1fda639a 10#ifndef __SPARC_ARCH_H__
0f113f3e 11# define __SPARC_ARCH_H__
1fda639a 12
0f113f3e
MC
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 */
299ccadc 17# define SPARCV9_FMADD (1<<4)
0f113f3e
MC
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)
4400f6c6 22# define SPARCV9_FJAESX (1<<9)/* Fujitsu SPARC64 X AES */
299ccadc
AP
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 */
1fda639a
AP
27
28/*
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...
32 */
0f113f3e
MC
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 */
299ccadc
AP
45# define CFR_XMPMUL 0x00001000/* Supports XMPMUL opcodes */
46# define CFR_XMONTMUL 0x00002000/* Supports XMONTMUL opcodes */
47# define CFR_XMONTSQR 0x00004000/* Supports XMONTSQR opcodes */
1fda639a 48
0f113f3e
MC
49# if defined(OPENSSL_PIC) && !defined(__PIC__)
50# define __PIC__
51# endif
b460c8f8 52
0f113f3e
MC
53# if defined(__SUNPRO_C) && defined(__sparcv9) && !defined(__arch64__)
54# define __arch64__
55# endif
1efd5830 56
0f113f3e
MC
57# define SPARC_PIC_THUNK(reg) \
58 .align 32; \
59.Lpic_thunk: \
60 jmp %o7 + 8; \
61 add %o7, reg, reg;
b460c8f8 62
0f113f3e
MC
63# define SPARC_PIC_THUNK_CALL(reg) \
64 sethi %hi(_GLOBAL_OFFSET_TABLE_-4), reg; \
65 call .Lpic_thunk; \
66 or reg, %lo(_GLOBAL_OFFSET_TABLE_+4), reg;
b460c8f8 67
0f113f3e
MC
68# if 1
69# define SPARC_SETUP_GOT_REG(reg) SPARC_PIC_THUNK_CALL(reg)
70# else
71# define SPARC_SETUP_GOT_REG(reg) \
72 sethi %hi(_GLOBAL_OFFSET_TABLE_-4), reg; \
73 call .+8; \
74 or reg,%lo(_GLOBAL_OFFSET_TABLE_+4), reg; \
75 add %o7, reg, reg
76# endif
b460c8f8 77
0f113f3e 78# if defined(__arch64__)
b460c8f8 79
0f113f3e
MC
80# define SPARC_LOAD_ADDRESS(SYM, reg) \
81 setx SYM, %o7, reg;
82# define LDPTR ldx
83# define SIZE_T_CC %xcc
84# define STACK_FRAME 192
85# define STACK_BIAS 2047
86# define STACK_7thARG (STACK_BIAS+176)
b460c8f8 87
0f113f3e 88# else
b460c8f8 89
0f113f3e
MC
90# define SPARC_LOAD_ADDRESS(SYM, reg) \
91 set SYM, reg;
92# define LDPTR ld
93# define SIZE_T_CC %icc
94# define STACK_FRAME 112
95# define STACK_BIAS 0
96# define STACK_7thARG 92
97# define SPARC_LOAD_ADDRESS_LEAF(SYM,reg,tmp) SPARC_LOAD_ADDRESS(SYM,reg)
b460c8f8 98
0f113f3e 99# endif
b460c8f8 100
0f113f3e
MC
101# ifdef __PIC__
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;
109# endif
b460c8f8 110
0f113f3e
MC
111# ifndef SPARC_LOAD_ADDRESS_LEAF
112# define SPARC_LOAD_ADDRESS_LEAF(SYM, reg, tmp) \
113 mov %o7, tmp; \
114 SPARC_LOAD_ADDRESS(SYM, reg) \
115 mov tmp, %o7;
116# endif
b460c8f8 117
0f113f3e 118#endif /* __SPARC_ARCH_H__ */