]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/blob - secure/lib/libcrypto/amd64/x86_64cpuid.S
- Make libcrypto.so position independent on i386.
[FreeBSD/stable/10.git] / secure / lib / libcrypto / amd64 / x86_64cpuid.S
1 # $FreeBSD$
2 # Do not modify. This file is auto-generated from x86_64cpuid.pl.
3
4 .hidden OPENSSL_cpuid_setup
5 .section        .init
6         call    OPENSSL_cpuid_setup
7
8 .hidden OPENSSL_ia32cap_P
9 .comm   OPENSSL_ia32cap_P,8,4
10
11 .text   
12
13 .globl  OPENSSL_atomic_add
14 .type   OPENSSL_atomic_add,@function
15 .align  16
16 OPENSSL_atomic_add:
17         movl    (%rdi),%eax
18 .Lspin: leaq    (%rsi,%rax,1),%r8
19 .byte   0xf0            
20         cmpxchgl        %r8d,(%rdi)
21         jne     .Lspin
22         movl    %r8d,%eax
23 .byte   0x48,0x98       
24         .byte   0xf3,0xc3
25 .size   OPENSSL_atomic_add,.-OPENSSL_atomic_add
26
27 .globl  OPENSSL_rdtsc
28 .type   OPENSSL_rdtsc,@function
29 .align  16
30 OPENSSL_rdtsc:
31         rdtsc
32         shlq    $32,%rdx
33         orq     %rdx,%rax
34         .byte   0xf3,0xc3
35 .size   OPENSSL_rdtsc,.-OPENSSL_rdtsc
36
37 .globl  OPENSSL_ia32_cpuid
38 .type   OPENSSL_ia32_cpuid,@function
39 .align  16
40 OPENSSL_ia32_cpuid:
41         movq    %rbx,%r8
42
43         xorl    %eax,%eax
44         cpuid
45         movl    %eax,%r11d
46
47         xorl    %eax,%eax
48         cmpl    $1970169159,%ebx
49         setne   %al
50         movl    %eax,%r9d
51         cmpl    $1231384169,%edx
52         setne   %al
53         orl     %eax,%r9d
54         cmpl    $1818588270,%ecx
55         setne   %al
56         orl     %eax,%r9d
57         jz      .Lintel
58
59         cmpl    $1752462657,%ebx
60         setne   %al
61         movl    %eax,%r10d
62         cmpl    $1769238117,%edx
63         setne   %al
64         orl     %eax,%r10d
65         cmpl    $1145913699,%ecx
66         setne   %al
67         orl     %eax,%r10d
68         jnz     .Lintel
69
70
71         movl    $2147483648,%eax
72         cpuid
73         cmpl    $2147483649,%eax
74         jb      .Lintel
75         movl    %eax,%r10d
76         movl    $2147483649,%eax
77         cpuid
78         orl     %ecx,%r9d
79         andl    $2049,%r9d
80
81         cmpl    $2147483656,%r10d
82         jb      .Lintel
83
84         movl    $2147483656,%eax
85         cpuid
86         movzbq  %cl,%r10
87         incq    %r10
88
89         movl    $1,%eax
90         cpuid
91         btl     $28,%edx
92         jnc     .Lgeneric
93         shrl    $16,%ebx
94         cmpb    %r10b,%bl
95         ja      .Lgeneric
96         andl    $4026531839,%edx
97         jmp     .Lgeneric
98
99 .Lintel:
100         cmpl    $4,%r11d
101         movl    $-1,%r10d
102         jb      .Lnocacheinfo
103
104         movl    $4,%eax
105         movl    $0,%ecx
106         cpuid
107         movl    %eax,%r10d
108         shrl    $14,%r10d
109         andl    $4095,%r10d
110
111 .Lnocacheinfo:
112         movl    $1,%eax
113         cpuid
114         andl    $3220176895,%edx
115         cmpl    $0,%r9d
116         jne     .Lnotintel
117         orl     $1073741824,%edx
118         andb    $15,%ah
119         cmpb    $15,%ah
120         jne     .Lnotintel
121         orl     $1048576,%edx
122 .Lnotintel:
123         btl     $28,%edx
124         jnc     .Lgeneric
125         andl    $4026531839,%edx
126         cmpl    $0,%r10d
127         je      .Lgeneric
128
129         orl     $268435456,%edx
130         shrl    $16,%ebx
131         cmpb    $1,%bl
132         ja      .Lgeneric
133         andl    $4026531839,%edx
134 .Lgeneric:
135         andl    $2048,%r9d
136         andl    $4294965247,%ecx
137         orl     %ecx,%r9d
138
139         movl    %edx,%r10d
140         btl     $27,%r9d
141         jnc     .Lclear_avx
142         xorl    %ecx,%ecx
143 .byte   0x0f,0x01,0xd0          
144         andl    $6,%eax
145         cmpl    $6,%eax
146         je      .Ldone
147 .Lclear_avx:
148         movl    $4026525695,%eax
149         andl    %eax,%r9d
150 .Ldone:
151         shlq    $32,%r9
152         movl    %r10d,%eax
153         movq    %r8,%rbx
154         orq     %r9,%rax
155         .byte   0xf3,0xc3
156 .size   OPENSSL_ia32_cpuid,.-OPENSSL_ia32_cpuid
157
158 .globl  OPENSSL_cleanse
159 .type   OPENSSL_cleanse,@function
160 .align  16
161 OPENSSL_cleanse:
162         xorq    %rax,%rax
163         cmpq    $15,%rsi
164         jae     .Lot
165         cmpq    $0,%rsi
166         je      .Lret
167 .Little:
168         movb    %al,(%rdi)
169         subq    $1,%rsi
170         leaq    1(%rdi),%rdi
171         jnz     .Little
172 .Lret:
173         .byte   0xf3,0xc3
174 .align  16
175 .Lot:
176         testq   $7,%rdi
177         jz      .Laligned
178         movb    %al,(%rdi)
179         leaq    -1(%rsi),%rsi
180         leaq    1(%rdi),%rdi
181         jmp     .Lot
182 .Laligned:
183         movq    %rax,(%rdi)
184         leaq    -8(%rsi),%rsi
185         testq   $-8,%rsi
186         leaq    8(%rdi),%rdi
187         jnz     .Laligned
188         cmpq    $0,%rsi
189         jne     .Little
190         .byte   0xf3,0xc3
191 .size   OPENSSL_cleanse,.-OPENSSL_cleanse
192 .globl  OPENSSL_wipe_cpu
193 .type   OPENSSL_wipe_cpu,@function
194 .align  16
195 OPENSSL_wipe_cpu:
196         pxor    %xmm0,%xmm0
197         pxor    %xmm1,%xmm1
198         pxor    %xmm2,%xmm2
199         pxor    %xmm3,%xmm3
200         pxor    %xmm4,%xmm4
201         pxor    %xmm5,%xmm5
202         pxor    %xmm6,%xmm6
203         pxor    %xmm7,%xmm7
204         pxor    %xmm8,%xmm8
205         pxor    %xmm9,%xmm9
206         pxor    %xmm10,%xmm10
207         pxor    %xmm11,%xmm11
208         pxor    %xmm12,%xmm12
209         pxor    %xmm13,%xmm13
210         pxor    %xmm14,%xmm14
211         pxor    %xmm15,%xmm15
212         xorq    %rcx,%rcx
213         xorq    %rdx,%rdx
214         xorq    %rsi,%rsi
215         xorq    %rdi,%rdi
216         xorq    %r8,%r8
217         xorq    %r9,%r9
218         xorq    %r10,%r10
219         xorq    %r11,%r11
220         leaq    8(%rsp),%rax
221         .byte   0xf3,0xc3
222 .size   OPENSSL_wipe_cpu,.-OPENSSL_wipe_cpu
223 .globl  OPENSSL_ia32_rdrand
224 .type   OPENSSL_ia32_rdrand,@function
225 .align  16
226 OPENSSL_ia32_rdrand:
227         movl    $8,%ecx
228 .Loop_rdrand:
229 .byte   72,15,199,240
230         jc      .Lbreak_rdrand
231         loop    .Loop_rdrand
232 .Lbreak_rdrand:
233         cmpq    $0,%rax
234         cmoveq  %rcx,%rax
235         .byte   0xf3,0xc3
236 .size   OPENSSL_ia32_rdrand,.-OPENSSL_ia32_rdrand