Fix trivial coding style nits in a_time/a_tm files
[openssl.git] / crypto / s390xcpuid.S
1 .text
2 // Copyright 2009-2016 The OpenSSL Project Authors. All Rights Reserved.
3 //
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
8
9 .globl  OPENSSL_s390x_facilities
10 .type   OPENSSL_s390x_facilities,@function
11 .align  16
12 OPENSSL_s390x_facilities:
13         lghi    %r0,0
14         larl    %r4,OPENSSL_s390xcap_P
15         stg     %r0,8(%r4)      # wipe capability vectors
16         stg     %r0,16(%r4)
17         stg     %r0,24(%r4)
18         stg     %r0,32(%r4)
19         stg     %r0,40(%r4)
20         stg     %r0,48(%r4)
21         stg     %r0,56(%r4)
22         stg     %r0,64(%r4)
23         stg     %r0,72(%r4)
24
25         .long   0xb2b04000      # stfle 0(%r4)
26         brc     8,.Ldone
27         lghi    %r0,1
28         .long   0xb2b04000      # stfle 0(%r4)
29 .Ldone:
30         lmg     %r2,%r3,0(%r4)
31         tmhl    %r2,0x4000      # check for message-security-assist
32         jz      .Lret
33
34         lghi    %r0,0           # query kimd capabilities
35         la      %r1,16(%r4)
36         .long   0xb93e0002      # kimd %r0,%r2
37
38         lghi    %r0,0           # query km capability vector
39         la      %r1,32(%r4)
40         .long   0xb92e0042      # km %r4,%r2
41
42         lghi    %r0,0           # query kmc capability vector
43         la      %r1,48(%r4)
44         .long   0xb92f0042      # kmc %r4,%r2
45
46         tmhh    %r3,0x0004      # check for message-security-assist-4
47         jz      .Lret
48
49         lghi    %r0,0           # query kmctr capability vector
50         la      %r1,64(%r4)
51         .long   0xb92d2042      # kmctr %r4,%r2,%r2
52
53 .Lret:
54         br      %r14
55 .size   OPENSSL_s390x_facilities,.-OPENSSL_s390x_facilities
56
57 .globl  OPENSSL_rdtsc
58 .type   OPENSSL_rdtsc,@function
59 .align  16
60 OPENSSL_rdtsc:
61         stck    16(%r15)
62         lg      %r2,16(%r15)
63         br      %r14
64 .size   OPENSSL_rdtsc,.-OPENSSL_rdtsc
65
66 .globl  OPENSSL_atomic_add
67 .type   OPENSSL_atomic_add,@function
68 .align  16
69 OPENSSL_atomic_add:
70         l       %r1,0(%r2)
71 .Lspin: lr      %r0,%r1
72         ar      %r0,%r3
73         cs      %r1,%r0,0(%r2)
74         brc     4,.Lspin
75         lgfr    %r2,%r0         # OpenSSL expects the new value
76         br      %r14
77 .size   OPENSSL_atomic_add,.-OPENSSL_atomic_add
78
79 .globl  OPENSSL_wipe_cpu
80 .type   OPENSSL_wipe_cpu,@function
81 .align  16
82 OPENSSL_wipe_cpu:
83         xgr     %r0,%r0
84         xgr     %r1,%r1
85         lgr     %r2,%r15
86         xgr     %r3,%r3
87         xgr     %r4,%r4
88         lzdr    %f0
89         lzdr    %f1
90         lzdr    %f2
91         lzdr    %f3
92         lzdr    %f4
93         lzdr    %f5
94         lzdr    %f6
95         lzdr    %f7
96         br      %r14
97 .size   OPENSSL_wipe_cpu,.-OPENSSL_wipe_cpu
98
99 .globl  OPENSSL_cleanse
100 .type   OPENSSL_cleanse,@function
101 .align  16
102 OPENSSL_cleanse:
103 #if !defined(__s390x__) && !defined(__s390x)
104         llgfr   %r3,%r3
105 #endif
106         lghi    %r4,15
107         lghi    %r0,0
108         clgr    %r3,%r4
109         jh      .Lot
110         clgr    %r3,%r0
111         bcr     8,%r14
112 .Little:
113         stc     %r0,0(%r2)
114         la      %r2,1(%r2)
115         brctg   %r3,.Little
116         br      %r14
117 .align  4
118 .Lot:   tmll    %r2,7
119         jz      .Laligned
120         stc     %r0,0(%r2)
121         la      %r2,1(%r2)
122         brctg   %r3,.Lot
123 .Laligned:
124         srlg    %r4,%r3,3
125 .Loop:  stg     %r0,0(%r2)
126         la      %r2,8(%r2)
127         brctg   %r4,.Loop
128         lghi    %r4,7
129         ngr     %r3,%r4
130         jnz     .Little
131         br      %r14
132 .size   OPENSSL_cleanse,.-OPENSSL_cleanse
133
134 .globl  CRYPTO_memcmp
135 .type   CRYPTO_memcmp,@function
136 .align  16
137 CRYPTO_memcmp:
138 #if !defined(__s390x__) && !defined(__s390x)
139         llgfr   %r4,%r4
140 #endif
141         lghi    %r5,0
142         clgr    %r4,%r5
143         je      .Lno_data
144
145 .Loop_cmp:
146         llgc    %r0,0(%r2)
147         la      %r2,1(%r2)
148         llgc    %r1,0(%r3)
149         la      %r3,1(%r3)
150         xr      %r1,%r0
151         or      %r5,%r1
152         brctg   %r4,.Loop_cmp
153
154         lnr     %r5,%r5
155         srl     %r5,31
156 .Lno_data:
157         lgr     %r2,%r5
158         br      %r14
159 .size   CRYPTO_memcmp,.-CRYPTO_memcmp
160
161 .globl  OPENSSL_instrument_bus
162 .type   OPENSSL_instrument_bus,@function
163 .align  16
164 OPENSSL_instrument_bus:
165         lghi    %r2,0
166         br      %r14
167 .size   OPENSSL_instrument_bus,.-OPENSSL_instrument_bus
168
169 .globl  OPENSSL_instrument_bus2
170 .type   OPENSSL_instrument_bus2,@function
171 .align  16
172 OPENSSL_instrument_bus2:
173         lghi    %r2,0
174         br      %r14
175 .size   OPENSSL_instrument_bus2,.-OPENSSL_instrument_bus2
176
177 .section        .init
178         brasl   %r14,OPENSSL_cpuid_setup
179
180 .comm   OPENSSL_s390xcap_P,80,8