crypto/ppccap.c: fix missing declaration warning.
[openssl.git] / crypto / sparc_arch.h
1 #ifndef __SPARC_ARCH_H__
2 # define __SPARC_ARCH_H__
3
4 # define SPARCV9_TICK_PRIVILEGED (1<<0)
5 # define SPARCV9_PREFER_FPU      (1<<1)
6 # define SPARCV9_VIS1            (1<<2)
7 # define SPARCV9_VIS2            (1<<3)/* reserved */
8 # define SPARCV9_FMADD           (1<<4)
9 # define SPARCV9_BLK             (1<<5)/* VIS1 block copy */
10 # define SPARCV9_VIS3            (1<<6)
11 # define SPARCV9_RANDOM          (1<<7)
12 # define SPARCV9_64BIT_STACK     (1<<8)
13 # define SPARCV9_FJAESX          (1<<9)/* Fujitsu SPARC64 X AES */
14 # define SPARCV9_FJDESX          (1<<10)/* Fujitsu SPARC64 X DES, reserved */
15 # define SPARCV9_FJHPCACE        (1<<11)/* Fujitsu HPC-ACE, reserved */
16 # define SPARCV9_IMA             (1<<13)/* reserved */
17 # define SPARCV9_VIS4            (1<<14)/* reserved */
18
19 /*
20  * OPENSSL_sparcv9cap_P[1] is copy of Compatibility Feature Register,
21  * %asr26, SPARC-T4 and later. There is no SPARCV9_CFR bit in
22  * OPENSSL_sparcv9cap_P[0], as %cfr copy is sufficient...
23  */
24 # define CFR_AES         0x00000001/* Supports AES opcodes */
25 # define CFR_DES         0x00000002/* Supports DES opcodes */
26 # define CFR_KASUMI      0x00000004/* Supports KASUMI opcodes */
27 # define CFR_CAMELLIA    0x00000008/* Supports CAMELLIA opcodes */
28 # define CFR_MD5         0x00000010/* Supports MD5 opcodes */
29 # define CFR_SHA1        0x00000020/* Supports SHA1 opcodes */
30 # define CFR_SHA256      0x00000040/* Supports SHA256 opcodes */
31 # define CFR_SHA512      0x00000080/* Supports SHA512 opcodes */
32 # define CFR_MPMUL       0x00000100/* Supports MPMUL opcodes */
33 # define CFR_MONTMUL     0x00000200/* Supports MONTMUL opcodes */
34 # define CFR_MONTSQR     0x00000400/* Supports MONTSQR opcodes */
35 # define CFR_CRC32C      0x00000800/* Supports CRC32C opcodes */
36 # define CFR_XMPMUL      0x00001000/* Supports XMPMUL opcodes */
37 # define CFR_XMONTMUL    0x00002000/* Supports XMONTMUL opcodes */
38 # define CFR_XMONTSQR    0x00004000/* Supports XMONTSQR opcodes */
39
40 # if defined(OPENSSL_PIC) && !defined(__PIC__)
41 #  define __PIC__
42 # endif
43
44 # if defined(__SUNPRO_C) && defined(__sparcv9) && !defined(__arch64__)
45 #  define __arch64__
46 # endif
47
48 # define SPARC_PIC_THUNK(reg)    \
49         .align  32;             \
50 .Lpic_thunk:                    \
51         jmp     %o7 + 8;        \
52          add    %o7, reg, reg;
53
54 # define SPARC_PIC_THUNK_CALL(reg)                       \
55         sethi   %hi(_GLOBAL_OFFSET_TABLE_-4), reg;      \
56         call    .Lpic_thunk;                            \
57          or     reg, %lo(_GLOBAL_OFFSET_TABLE_+4), reg;
58
59 # if 1
60 #  define SPARC_SETUP_GOT_REG(reg)       SPARC_PIC_THUNK_CALL(reg)
61 # else
62 #  define SPARC_SETUP_GOT_REG(reg)       \
63         sethi   %hi(_GLOBAL_OFFSET_TABLE_-4), reg;      \
64         call    .+8;                                    \
65         or      reg,%lo(_GLOBAL_OFFSET_TABLE_+4), reg;  \
66         add     %o7, reg, reg
67 # endif
68
69 # if defined(__arch64__)
70
71 #  define SPARC_LOAD_ADDRESS(SYM, reg)   \
72         setx    SYM, %o7, reg;
73 #  define LDPTR          ldx
74 #  define SIZE_T_CC      %xcc
75 #  define STACK_FRAME    192
76 #  define STACK_BIAS     2047
77 #  define STACK_7thARG   (STACK_BIAS+176)
78
79 # else
80
81 #  define SPARC_LOAD_ADDRESS(SYM, reg)   \
82         set     SYM, reg;
83 #  define LDPTR          ld
84 #  define SIZE_T_CC      %icc
85 #  define STACK_FRAME    112
86 #  define STACK_BIAS     0
87 #  define STACK_7thARG   92
88 #  define SPARC_LOAD_ADDRESS_LEAF(SYM,reg,tmp) SPARC_LOAD_ADDRESS(SYM,reg)
89
90 # endif
91
92 # ifdef __PIC__
93 #  undef SPARC_LOAD_ADDRESS
94 #  undef SPARC_LOAD_ADDRESS_LEAF
95 #  define SPARC_LOAD_ADDRESS(SYM, reg)   \
96         SPARC_SETUP_GOT_REG(reg);       \
97         sethi   %hi(SYM), %o7;          \
98         or      %o7, %lo(SYM), %o7;     \
99         LDPTR   [reg + %o7], reg;
100 # endif
101
102 # ifndef SPARC_LOAD_ADDRESS_LEAF
103 #  define SPARC_LOAD_ADDRESS_LEAF(SYM, reg, tmp) \
104         mov     %o7, tmp;                       \
105         SPARC_LOAD_ADDRESS(SYM, reg)            \
106         mov     tmp, %o7;
107 # endif
108
109 #endif                          /* __SPARC_ARCH_H__ */