PR: 2124
[openssl.git] / crypto / s390xcpuid.S
1 .text
2
3 .globl  OPENSSL_cpuid_setup
4 .type   OPENSSL_cpuid_setup,@function
5 .align  16
6 OPENSSL_cpuid_setup:
7         br      %r14            # reserved for future
8 .size   OPENSSL_cpuid_setup,.-OPENSSL_cpuid_setup
9
10 .globl  OPENSSL_s390x_facilities
11 .type   OPENSSL_s390x_facilities,@function
12 .align  16
13 OPENSSL_s390x_facilities:
14         lghi    %r0,0
15         .long   0xb2b0f010      # stfle 16(%r15)
16         lg      %r2,16(%r15)
17         br      %r14
18 .size   OPENSSL_s390x_facilities,.-OPENSSL_s390x_facilities
19
20 .globl  OPENSSL_rdtsc
21 .type   OPENSSL_rdtsc,@function
22 .align  16
23 OPENSSL_rdtsc:
24         stck    16(%r15)
25         lg      %r2,16(%r15)
26         br      %r14
27 .size   OPENSSL_rdtsc,.-OPENSSL_rdtsc
28
29 .globl  OPENSSL_atomic_add
30 .type   OPENSSL_atomic_add,@function
31 .align  16
32 OPENSSL_atomic_add:
33         l       %r1,0(%r2)
34 .Lspin: lr      %r0,%r1
35         ar      %r0,%r3
36         cs      %r1,%r0,0(%r2)
37         brc     4,.Lspin
38         lgfr    %r2,%r0         # OpenSSL expects the new value
39         br      %r14
40 .size   OPENSSL_atomic_add,.-OPENSSL_atomic_add
41
42 .globl  OPENSSL_wipe_cpu
43 .type   OPENSSL_wipe_cpu,@function
44 .align  16
45 OPENSSL_wipe_cpu:
46         xgr     %r0,%r0
47         xgr     %r1,%r1
48         lgr     %r2,%r15
49         xgr     %r3,%r3
50         xgr     %r4,%r4
51         lzdr    %f0
52         lzdr    %f1
53         lzdr    %f2
54         lzdr    %f3
55         lzdr    %f4
56         lzdr    %f5
57         lzdr    %f6
58         lzdr    %f7
59         br      %r14
60 .size   OPENSSL_wipe_cpu,.-OPENSSL_wipe_cpu
61
62 .globl  OPENSSL_cleanse
63 .type   OPENSSL_cleanse,@function
64 .align  16
65 OPENSSL_cleanse:
66         lghi    %r4,15
67         lghi    %r0,0
68         clgr    %r3,%r4
69         jh      .Lot
70 .Little:
71         stc     %r0,0(%r2)
72         la      %r2,1(%r2)
73         brctg   %r3,.Little
74         br      %r14
75 .align  4
76 .Lot:   tmll    %r2,7
77         jz      .Laligned
78         stc     %r0,0(%r2)
79         la      %r2,1(%r2)
80         brctg   %r3,.Lot
81 .Laligned:
82         srlg    %r4,%r3,3
83 .Loop:  stg     %r0,0(%r2)
84         la      %r2,8(%r2)
85         brctg   %r4,.Loop
86         lghi    %r4,7
87         ngr     %r3,%r4
88         jnz     .Little
89         br      %r14
90 .size   OPENSSL_cleanse,.-OPENSSL_cleanse