Adds back files lost during BoringSSL roll revert

Also fixes .gitignore files

R=asiva@google.com

Review URL: https://codereview.chromium.org/1940523002 .
This commit is contained in:
Zachary Anderson 2016-04-29 13:04:27 -07:00
parent c2d18fe065
commit 3918cb071d
11 changed files with 5273 additions and 1 deletions

View file

@ -5,7 +5,7 @@
!.gitignore
!pkg
!pkg_tested
!boringssl
!/boringssl
!drt_resources
!d8
!7zip.tar.gz.sha1

View file

@ -1,2 +1,4 @@
# ignore the checkout of boringssl.
src/
*.mk
*.Makefile

View file

@ -0,0 +1,322 @@
#if defined(__i386__)
.file "crypto/cpu-x86-asm.S"
.text
.globl OPENSSL_ia32_cpuid
.hidden OPENSSL_ia32_cpuid
.type OPENSSL_ia32_cpuid,@function
.align 16
OPENSSL_ia32_cpuid:
.L_OPENSSL_ia32_cpuid_begin:
pushl %ebp
pushl %ebx
pushl %esi
pushl %edi
xorl %edx,%edx
pushfl
popl %eax
movl %eax,%ecx
xorl $2097152,%eax
pushl %eax
popfl
pushfl
popl %eax
xorl %eax,%ecx
xorl %eax,%eax
btl $21,%ecx
jnc .L000nocpuid
movl 20(%esp),%esi
movl %eax,8(%esi)
.byte 0x0f,0xa2
movl %eax,%edi
xorl %eax,%eax
cmpl $1970169159,%ebx
setne %al
movl %eax,%ebp
cmpl $1231384169,%edx
setne %al
orl %eax,%ebp
cmpl $1818588270,%ecx
setne %al
orl %eax,%ebp
jz .L001intel
cmpl $1752462657,%ebx
setne %al
movl %eax,%esi
cmpl $1769238117,%edx
setne %al
orl %eax,%esi
cmpl $1145913699,%ecx
setne %al
orl %eax,%esi
jnz .L001intel
movl $2147483648,%eax
.byte 0x0f,0xa2
cmpl $2147483649,%eax
jb .L001intel
movl %eax,%esi
movl $2147483649,%eax
.byte 0x0f,0xa2
orl %ecx,%ebp
andl $2049,%ebp
cmpl $2147483656,%esi
jb .L001intel
movl $2147483656,%eax
.byte 0x0f,0xa2
movzbl %cl,%esi
incl %esi
movl $1,%eax
xorl %ecx,%ecx
.byte 0x0f,0xa2
btl $28,%edx
jnc .L002generic
shrl $16,%ebx
andl $255,%ebx
cmpl %esi,%ebx
ja .L002generic
andl $4026531839,%edx
jmp .L002generic
.L001intel:
cmpl $7,%edi
jb .L003cacheinfo
movl 20(%esp),%esi
movl $7,%eax
xorl %ecx,%ecx
.byte 0x0f,0xa2
movl %ebx,8(%esi)
.L003cacheinfo:
cmpl $4,%edi
movl $-1,%edi
jb .L004nocacheinfo
movl $4,%eax
movl $0,%ecx
.byte 0x0f,0xa2
movl %eax,%edi
shrl $14,%edi
andl $4095,%edi
.L004nocacheinfo:
movl $1,%eax
xorl %ecx,%ecx
.byte 0x0f,0xa2
andl $3220176895,%edx
cmpl $0,%ebp
jne .L005notintel
orl $1073741824,%edx
.L005notintel:
btl $28,%edx
jnc .L002generic
andl $4026531839,%edx
cmpl $0,%edi
je .L002generic
orl $268435456,%edx
shrl $16,%ebx
cmpb $1,%bl
ja .L002generic
andl $4026531839,%edx
.L002generic:
andl $2048,%ebp
andl $4294965247,%ecx
movl %edx,%esi
orl %ecx,%ebp
btl $27,%ecx
jnc .L006clear_avx
xorl %ecx,%ecx
.byte 15,1,208
andl $6,%eax
cmpl $6,%eax
je .L007done
cmpl $2,%eax
je .L006clear_avx
.L008clear_xmm:
andl $4261412861,%ebp
andl $4278190079,%esi
.L006clear_avx:
andl $4026525695,%ebp
movl 20(%esp),%edi
andl $4294967263,8(%edi)
.L007done:
movl %esi,%eax
movl %ebp,%edx
.L000nocpuid:
popl %edi
popl %esi
popl %ebx
popl %ebp
ret
.size OPENSSL_ia32_cpuid,.-.L_OPENSSL_ia32_cpuid_begin
.globl OPENSSL_rdtsc
.hidden OPENSSL_rdtsc
.type OPENSSL_rdtsc,@function
.align 16
OPENSSL_rdtsc:
.L_OPENSSL_rdtsc_begin:
xorl %eax,%eax
xorl %edx,%edx
call .L009PIC_me_up
.L009PIC_me_up:
popl %ecx
leal OPENSSL_ia32cap_P-.L009PIC_me_up(%ecx),%ecx
btl $4,(%ecx)
jnc .L010notsc
.byte 0x0f,0x31
.L010notsc:
ret
.size OPENSSL_rdtsc,.-.L_OPENSSL_rdtsc_begin
.globl OPENSSL_instrument_halt
.hidden OPENSSL_instrument_halt
.type OPENSSL_instrument_halt,@function
.align 16
OPENSSL_instrument_halt:
.L_OPENSSL_instrument_halt_begin:
call .L011PIC_me_up
.L011PIC_me_up:
popl %ecx
leal OPENSSL_ia32cap_P-.L011PIC_me_up(%ecx),%ecx
btl $4,(%ecx)
jnc .L012nohalt
.long 2421723150
andl $3,%eax
jnz .L012nohalt
pushfl
popl %eax
btl $9,%eax
jnc .L012nohalt
.byte 0x0f,0x31
pushl %edx
pushl %eax
hlt
.byte 0x0f,0x31
subl (%esp),%eax
sbbl 4(%esp),%edx
addl $8,%esp
ret
.L012nohalt:
xorl %eax,%eax
xorl %edx,%edx
ret
.size OPENSSL_instrument_halt,.-.L_OPENSSL_instrument_halt_begin
.globl OPENSSL_far_spin
.hidden OPENSSL_far_spin
.type OPENSSL_far_spin,@function
.align 16
OPENSSL_far_spin:
.L_OPENSSL_far_spin_begin:
pushfl
popl %eax
btl $9,%eax
jnc .L013nospin
movl 4(%esp),%eax
movl 8(%esp),%ecx
.long 2430111262
xorl %eax,%eax
movl (%ecx),%edx
jmp .L014spin
.align 16
.L014spin:
incl %eax
cmpl (%ecx),%edx
je .L014spin
.long 529567888
ret
.L013nospin:
xorl %eax,%eax
xorl %edx,%edx
ret
.size OPENSSL_far_spin,.-.L_OPENSSL_far_spin_begin
.globl OPENSSL_wipe_cpu
.hidden OPENSSL_wipe_cpu
.type OPENSSL_wipe_cpu,@function
.align 16
OPENSSL_wipe_cpu:
.L_OPENSSL_wipe_cpu_begin:
xorl %eax,%eax
xorl %edx,%edx
call .L015PIC_me_up
.L015PIC_me_up:
popl %ecx
leal OPENSSL_ia32cap_P-.L015PIC_me_up(%ecx),%ecx
movl (%ecx),%ecx
btl $1,(%ecx)
jnc .L016no_x87
andl $83886080,%ecx
cmpl $83886080,%ecx
jne .L017no_sse2
pxor %xmm0,%xmm0
pxor %xmm1,%xmm1
pxor %xmm2,%xmm2
pxor %xmm3,%xmm3
pxor %xmm4,%xmm4
pxor %xmm5,%xmm5
pxor %xmm6,%xmm6
pxor %xmm7,%xmm7
.L017no_sse2:
.long 4007259865,4007259865,4007259865,4007259865,2430851995
.L016no_x87:
leal 4(%esp),%eax
ret
.size OPENSSL_wipe_cpu,.-.L_OPENSSL_wipe_cpu_begin
.globl OPENSSL_atomic_add
.hidden OPENSSL_atomic_add
.type OPENSSL_atomic_add,@function
.align 16
OPENSSL_atomic_add:
.L_OPENSSL_atomic_add_begin:
movl 4(%esp),%edx
movl 8(%esp),%ecx
pushl %ebx
nop
movl (%edx),%eax
.L018spin:
leal (%eax,%ecx,1),%ebx
nop
.long 447811568
jne .L018spin
movl %ebx,%eax
popl %ebx
ret
.size OPENSSL_atomic_add,.-.L_OPENSSL_atomic_add_begin
.globl OPENSSL_indirect_call
.hidden OPENSSL_indirect_call
.type OPENSSL_indirect_call,@function
.align 16
OPENSSL_indirect_call:
.L_OPENSSL_indirect_call_begin:
pushl %ebp
movl %esp,%ebp
subl $28,%esp
movl 12(%ebp),%ecx
movl %ecx,(%esp)
movl 16(%ebp),%edx
movl %edx,4(%esp)
movl 20(%ebp),%eax
movl %eax,8(%esp)
movl 24(%ebp),%eax
movl %eax,12(%esp)
movl 28(%ebp),%eax
movl %eax,16(%esp)
movl 32(%ebp),%eax
movl %eax,20(%esp)
movl 36(%ebp),%eax
movl %eax,24(%esp)
call *8(%ebp)
movl %ebp,%esp
popl %ebp
ret
.size OPENSSL_indirect_call,.-.L_OPENSSL_indirect_call_begin
.globl OPENSSL_ia32_rdrand
.hidden OPENSSL_ia32_rdrand
.type OPENSSL_ia32_rdrand,@function
.align 16
OPENSSL_ia32_rdrand:
.L_OPENSSL_ia32_rdrand_begin:
movl $8,%ecx
.L019loop:
.byte 15,199,240
jc .L020break
loop .L019loop
.L020break:
cmpl $0,%eax
cmovel %ecx,%eax
ret
.size OPENSSL_ia32_rdrand,.-.L_OPENSSL_ia32_rdrand_begin
.hidden OPENSSL_ia32cap_P
#endif

View file

@ -0,0 +1,143 @@
#if defined(__x86_64__)
.text
.globl OPENSSL_ia32_cpuid
.hidden OPENSSL_ia32_cpuid
.type OPENSSL_ia32_cpuid,@function
.align 16
OPENSSL_ia32_cpuid:
movq %rdi,%rdi
movq %rbx,%r8
xorl %eax,%eax
movl %eax,8(%rdi)
cpuid
movl %eax,%r11d
xorl %eax,%eax
cmpl $1970169159,%ebx
setne %al
movl %eax,%r9d
cmpl $1231384169,%edx
setne %al
orl %eax,%r9d
cmpl $1818588270,%ecx
setne %al
orl %eax,%r9d
jz .Lintel
cmpl $1752462657,%ebx
setne %al
movl %eax,%r10d
cmpl $1769238117,%edx
setne %al
orl %eax,%r10d
cmpl $1145913699,%ecx
setne %al
orl %eax,%r10d
jnz .Lintel
movl $2147483648,%eax
cpuid
cmpl $2147483649,%eax
jb .Lintel
movl %eax,%r10d
movl $2147483649,%eax
cpuid
orl %ecx,%r9d
andl $2049,%r9d
cmpl $2147483656,%r10d
jb .Lintel
movl $2147483656,%eax
cpuid
movzbq %cl,%r10
incq %r10
movl $1,%eax
cpuid
btl $28,%edx
jnc .Lgeneric
shrl $16,%ebx
cmpb %r10b,%bl
ja .Lgeneric
andl $4026531839,%edx
jmp .Lgeneric
.Lintel:
cmpl $4,%r11d
movl $-1,%r10d
jb .Lnocacheinfo
movl $4,%eax
movl $0,%ecx
cpuid
movl %eax,%r10d
shrl $14,%r10d
andl $4095,%r10d
cmpl $7,%r11d
jb .Lnocacheinfo
movl $7,%eax
xorl %ecx,%ecx
cpuid
movl %ebx,8(%rdi)
.Lnocacheinfo:
movl $1,%eax
cpuid
andl $3220176895,%edx
cmpl $0,%r9d
jne .Lnotintel
orl $1073741824,%edx
.Lnotintel:
btl $28,%edx
jnc .Lgeneric
andl $4026531839,%edx
cmpl $0,%r10d
je .Lgeneric
orl $268435456,%edx
shrl $16,%ebx
cmpb $1,%bl
ja .Lgeneric
andl $4026531839,%edx
.Lgeneric:
andl $2048,%r9d
andl $4294965247,%ecx
orl %ecx,%r9d
movl %edx,%r10d
btl $27,%r9d
jnc .Lclear_avx
xorl %ecx,%ecx
.byte 0x0f,0x01,0xd0
andl $6,%eax
cmpl $6,%eax
je .Ldone
.Lclear_avx:
movl $4026525695,%eax
andl %eax,%r9d
andl $4294967263,8(%rdi)
.Ldone:
movl %r9d,4(%rdi)
movl %r10d,0(%rdi)
movq %r8,%rbx
.byte 0xf3,0xc3
.size OPENSSL_ia32_cpuid,.-OPENSSL_ia32_cpuid
#endif

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,309 @@
#if defined(__i386__)
.file "crypto/cpu-x86-asm.S"
.text
.globl _OPENSSL_ia32_cpuid
.private_extern _OPENSSL_ia32_cpuid
.align 4
_OPENSSL_ia32_cpuid:
L_OPENSSL_ia32_cpuid_begin:
pushl %ebp
pushl %ebx
pushl %esi
pushl %edi
xorl %edx,%edx
pushfl
popl %eax
movl %eax,%ecx
xorl $2097152,%eax
pushl %eax
popfl
pushfl
popl %eax
xorl %eax,%ecx
xorl %eax,%eax
btl $21,%ecx
jnc L000nocpuid
movl 20(%esp),%esi
movl %eax,8(%esi)
.byte 0x0f,0xa2
movl %eax,%edi
xorl %eax,%eax
cmpl $1970169159,%ebx
setne %al
movl %eax,%ebp
cmpl $1231384169,%edx
setne %al
orl %eax,%ebp
cmpl $1818588270,%ecx
setne %al
orl %eax,%ebp
jz L001intel
cmpl $1752462657,%ebx
setne %al
movl %eax,%esi
cmpl $1769238117,%edx
setne %al
orl %eax,%esi
cmpl $1145913699,%ecx
setne %al
orl %eax,%esi
jnz L001intel
movl $2147483648,%eax
.byte 0x0f,0xa2
cmpl $2147483649,%eax
jb L001intel
movl %eax,%esi
movl $2147483649,%eax
.byte 0x0f,0xa2
orl %ecx,%ebp
andl $2049,%ebp
cmpl $2147483656,%esi
jb L001intel
movl $2147483656,%eax
.byte 0x0f,0xa2
movzbl %cl,%esi
incl %esi
movl $1,%eax
xorl %ecx,%ecx
.byte 0x0f,0xa2
btl $28,%edx
jnc L002generic
shrl $16,%ebx
andl $255,%ebx
cmpl %esi,%ebx
ja L002generic
andl $4026531839,%edx
jmp L002generic
L001intel:
cmpl $7,%edi
jb L003cacheinfo
movl 20(%esp),%esi
movl $7,%eax
xorl %ecx,%ecx
.byte 0x0f,0xa2
movl %ebx,8(%esi)
L003cacheinfo:
cmpl $4,%edi
movl $-1,%edi
jb L004nocacheinfo
movl $4,%eax
movl $0,%ecx
.byte 0x0f,0xa2
movl %eax,%edi
shrl $14,%edi
andl $4095,%edi
L004nocacheinfo:
movl $1,%eax
xorl %ecx,%ecx
.byte 0x0f,0xa2
andl $3220176895,%edx
cmpl $0,%ebp
jne L005notintel
orl $1073741824,%edx
L005notintel:
btl $28,%edx
jnc L002generic
andl $4026531839,%edx
cmpl $0,%edi
je L002generic
orl $268435456,%edx
shrl $16,%ebx
cmpb $1,%bl
ja L002generic
andl $4026531839,%edx
L002generic:
andl $2048,%ebp
andl $4294965247,%ecx
movl %edx,%esi
orl %ecx,%ebp
btl $27,%ecx
jnc L006clear_avx
xorl %ecx,%ecx
.byte 15,1,208
andl $6,%eax
cmpl $6,%eax
je L007done
cmpl $2,%eax
je L006clear_avx
L008clear_xmm:
andl $4261412861,%ebp
andl $4278190079,%esi
L006clear_avx:
andl $4026525695,%ebp
movl 20(%esp),%edi
andl $4294967263,8(%edi)
L007done:
movl %esi,%eax
movl %ebp,%edx
L000nocpuid:
popl %edi
popl %esi
popl %ebx
popl %ebp
ret
.globl _OPENSSL_rdtsc
.private_extern _OPENSSL_rdtsc
.align 4
_OPENSSL_rdtsc:
L_OPENSSL_rdtsc_begin:
xorl %eax,%eax
xorl %edx,%edx
call L009PIC_me_up
L009PIC_me_up:
popl %ecx
movl L_OPENSSL_ia32cap_P$non_lazy_ptr-L009PIC_me_up(%ecx),%ecx
btl $4,(%ecx)
jnc L010notsc
.byte 0x0f,0x31
L010notsc:
ret
.globl _OPENSSL_instrument_halt
.private_extern _OPENSSL_instrument_halt
.align 4
_OPENSSL_instrument_halt:
L_OPENSSL_instrument_halt_begin:
call L011PIC_me_up
L011PIC_me_up:
popl %ecx
movl L_OPENSSL_ia32cap_P$non_lazy_ptr-L011PIC_me_up(%ecx),%ecx
btl $4,(%ecx)
jnc L012nohalt
.long 2421723150
andl $3,%eax
jnz L012nohalt
pushfl
popl %eax
btl $9,%eax
jnc L012nohalt
.byte 0x0f,0x31
pushl %edx
pushl %eax
hlt
.byte 0x0f,0x31
subl (%esp),%eax
sbbl 4(%esp),%edx
addl $8,%esp
ret
L012nohalt:
xorl %eax,%eax
xorl %edx,%edx
ret
.globl _OPENSSL_far_spin
.private_extern _OPENSSL_far_spin
.align 4
_OPENSSL_far_spin:
L_OPENSSL_far_spin_begin:
pushfl
popl %eax
btl $9,%eax
jnc L013nospin
movl 4(%esp),%eax
movl 8(%esp),%ecx
.long 2430111262
xorl %eax,%eax
movl (%ecx),%edx
jmp L014spin
.align 4,0x90
L014spin:
incl %eax
cmpl (%ecx),%edx
je L014spin
.long 529567888
ret
L013nospin:
xorl %eax,%eax
xorl %edx,%edx
ret
.globl _OPENSSL_wipe_cpu
.private_extern _OPENSSL_wipe_cpu
.align 4
_OPENSSL_wipe_cpu:
L_OPENSSL_wipe_cpu_begin:
xorl %eax,%eax
xorl %edx,%edx
call L015PIC_me_up
L015PIC_me_up:
popl %ecx
movl L_OPENSSL_ia32cap_P$non_lazy_ptr-L015PIC_me_up(%ecx),%ecx
movl (%ecx),%ecx
btl $1,(%ecx)
jnc L016no_x87
andl $83886080,%ecx
cmpl $83886080,%ecx
jne L017no_sse2
pxor %xmm0,%xmm0
pxor %xmm1,%xmm1
pxor %xmm2,%xmm2
pxor %xmm3,%xmm3
pxor %xmm4,%xmm4
pxor %xmm5,%xmm5
pxor %xmm6,%xmm6
pxor %xmm7,%xmm7
L017no_sse2:
.long 4007259865,4007259865,4007259865,4007259865,2430851995
L016no_x87:
leal 4(%esp),%eax
ret
.globl _OPENSSL_atomic_add
.private_extern _OPENSSL_atomic_add
.align 4
_OPENSSL_atomic_add:
L_OPENSSL_atomic_add_begin:
movl 4(%esp),%edx
movl 8(%esp),%ecx
pushl %ebx
nop
movl (%edx),%eax
L018spin:
leal (%eax,%ecx,1),%ebx
nop
.long 447811568
jne L018spin
movl %ebx,%eax
popl %ebx
ret
.globl _OPENSSL_indirect_call
.private_extern _OPENSSL_indirect_call
.align 4
_OPENSSL_indirect_call:
L_OPENSSL_indirect_call_begin:
pushl %ebp
movl %esp,%ebp
subl $28,%esp
movl 12(%ebp),%ecx
movl %ecx,(%esp)
movl 16(%ebp),%edx
movl %edx,4(%esp)
movl 20(%ebp),%eax
movl %eax,8(%esp)
movl 24(%ebp),%eax
movl %eax,12(%esp)
movl 28(%ebp),%eax
movl %eax,16(%esp)
movl 32(%ebp),%eax
movl %eax,20(%esp)
movl 36(%ebp),%eax
movl %eax,24(%esp)
call *8(%ebp)
movl %ebp,%esp
popl %ebp
ret
.globl _OPENSSL_ia32_rdrand
.private_extern _OPENSSL_ia32_rdrand
.align 4
_OPENSSL_ia32_rdrand:
L_OPENSSL_ia32_rdrand_begin:
movl $8,%ecx
L019loop:
.byte 15,199,240
jc L020break
loop L019loop
L020break:
cmpl $0,%eax
cmovel %ecx,%eax
ret
.section __IMPORT,__pointers,non_lazy_symbol_pointers
L_OPENSSL_ia32cap_P$non_lazy_ptr:
.indirect_symbol _OPENSSL_ia32cap_P
.long 0
#endif

View file

@ -0,0 +1,143 @@
#if defined(__x86_64__)
.text
.globl _OPENSSL_ia32_cpuid
.private_extern _OPENSSL_ia32_cpuid
.p2align 4
_OPENSSL_ia32_cpuid:
movq %rdi,%rdi
movq %rbx,%r8
xorl %eax,%eax
movl %eax,8(%rdi)
cpuid
movl %eax,%r11d
xorl %eax,%eax
cmpl $1970169159,%ebx
setne %al
movl %eax,%r9d
cmpl $1231384169,%edx
setne %al
orl %eax,%r9d
cmpl $1818588270,%ecx
setne %al
orl %eax,%r9d
jz L$intel
cmpl $1752462657,%ebx
setne %al
movl %eax,%r10d
cmpl $1769238117,%edx
setne %al
orl %eax,%r10d
cmpl $1145913699,%ecx
setne %al
orl %eax,%r10d
jnz L$intel
movl $2147483648,%eax
cpuid
cmpl $2147483649,%eax
jb L$intel
movl %eax,%r10d
movl $2147483649,%eax
cpuid
orl %ecx,%r9d
andl $2049,%r9d
cmpl $2147483656,%r10d
jb L$intel
movl $2147483656,%eax
cpuid
movzbq %cl,%r10
incq %r10
movl $1,%eax
cpuid
btl $28,%edx
jnc L$generic
shrl $16,%ebx
cmpb %r10b,%bl
ja L$generic
andl $4026531839,%edx
jmp L$generic
L$intel:
cmpl $4,%r11d
movl $-1,%r10d
jb L$nocacheinfo
movl $4,%eax
movl $0,%ecx
cpuid
movl %eax,%r10d
shrl $14,%r10d
andl $4095,%r10d
cmpl $7,%r11d
jb L$nocacheinfo
movl $7,%eax
xorl %ecx,%ecx
cpuid
movl %ebx,8(%rdi)
L$nocacheinfo:
movl $1,%eax
cpuid
andl $3220176895,%edx
cmpl $0,%r9d
jne L$notintel
orl $1073741824,%edx
L$notintel:
btl $28,%edx
jnc L$generic
andl $4026531839,%edx
cmpl $0,%r10d
je L$generic
orl $268435456,%edx
shrl $16,%ebx
cmpb $1,%bl
ja L$generic
andl $4026531839,%edx
L$generic:
andl $2048,%r9d
andl $4294965247,%ecx
orl %ecx,%r9d
movl %edx,%r10d
btl $27,%r9d
jnc L$clear_avx
xorl %ecx,%ecx
.byte 0x0f,0x01,0xd0
andl $6,%eax
cmpl $6,%eax
je L$done
L$clear_avx:
movl $4026525695,%eax
andl %eax,%r9d
andl $4294967263,8(%rdi)
L$done:
movl %r9d,4(%rdi)
movl %r10d,0(%rdi)
movq %r8,%rbx
.byte 0xf3,0xc3
#endif

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,303 @@
%ifidn __OUTPUT_FORMAT__,obj
section code use32 class=code align=64
%elifidn __OUTPUT_FORMAT__,win32
%ifdef __YASM_VERSION_ID__
%if __YASM_VERSION_ID__ < 01010000h
%error yasm version 1.1.0 or later needed.
%endif
; Yasm automatically includes .00 and complains about redefining it.
; https://www.tortall.net/projects/yasm/manual/html/objfmt-win32-safeseh.html
%else
$@feat.00 equ 1
%endif
section .text code align=64
%else
section .text code
%endif
global _OPENSSL_ia32_cpuid
align 16
_OPENSSL_ia32_cpuid:
L$_OPENSSL_ia32_cpuid_begin:
push ebp
push ebx
push esi
push edi
xor edx,edx
pushfd
pop eax
mov ecx,eax
xor eax,2097152
push eax
popfd
pushfd
pop eax
xor ecx,eax
xor eax,eax
bt ecx,21
jnc NEAR L$000nocpuid
mov esi,DWORD [20+esp]
mov DWORD [8+esi],eax
cpuid
mov edi,eax
xor eax,eax
cmp ebx,1970169159
setne al
mov ebp,eax
cmp edx,1231384169
setne al
or ebp,eax
cmp ecx,1818588270
setne al
or ebp,eax
jz NEAR L$001intel
cmp ebx,1752462657
setne al
mov esi,eax
cmp edx,1769238117
setne al
or esi,eax
cmp ecx,1145913699
setne al
or esi,eax
jnz NEAR L$001intel
mov eax,2147483648
cpuid
cmp eax,2147483649
jb NEAR L$001intel
mov esi,eax
mov eax,2147483649
cpuid
or ebp,ecx
and ebp,2049
cmp esi,2147483656
jb NEAR L$001intel
mov eax,2147483656
cpuid
movzx esi,cl
inc esi
mov eax,1
xor ecx,ecx
cpuid
bt edx,28
jnc NEAR L$002generic
shr ebx,16
and ebx,255
cmp ebx,esi
ja NEAR L$002generic
and edx,4026531839
jmp NEAR L$002generic
L$001intel:
cmp edi,7
jb NEAR L$003cacheinfo
mov esi,DWORD [20+esp]
mov eax,7
xor ecx,ecx
cpuid
mov DWORD [8+esi],ebx
L$003cacheinfo:
cmp edi,4
mov edi,-1
jb NEAR L$004nocacheinfo
mov eax,4
mov ecx,0
cpuid
mov edi,eax
shr edi,14
and edi,4095
L$004nocacheinfo:
mov eax,1
xor ecx,ecx
cpuid
and edx,3220176895
cmp ebp,0
jne NEAR L$005notintel
or edx,1073741824
L$005notintel:
bt edx,28
jnc NEAR L$002generic
and edx,4026531839
cmp edi,0
je NEAR L$002generic
or edx,268435456
shr ebx,16
cmp bl,1
ja NEAR L$002generic
and edx,4026531839
L$002generic:
and ebp,2048
and ecx,4294965247
mov esi,edx
or ebp,ecx
bt ecx,27
jnc NEAR L$006clear_avx
xor ecx,ecx
db 15,1,208
and eax,6
cmp eax,6
je NEAR L$007done
cmp eax,2
je NEAR L$006clear_avx
L$008clear_xmm:
and ebp,4261412861
and esi,4278190079
L$006clear_avx:
and ebp,4026525695
mov edi,DWORD [20+esp]
and DWORD [8+edi],4294967263
L$007done:
mov eax,esi
mov edx,ebp
L$000nocpuid:
pop edi
pop esi
pop ebx
pop ebp
ret
;extern _OPENSSL_ia32cap_P
global _OPENSSL_rdtsc
align 16
_OPENSSL_rdtsc:
L$_OPENSSL_rdtsc_begin:
xor eax,eax
xor edx,edx
lea ecx,[_OPENSSL_ia32cap_P]
bt DWORD [ecx],4
jnc NEAR L$009notsc
rdtsc
L$009notsc:
ret
global _OPENSSL_instrument_halt
align 16
_OPENSSL_instrument_halt:
L$_OPENSSL_instrument_halt_begin:
lea ecx,[_OPENSSL_ia32cap_P]
bt DWORD [ecx],4
jnc NEAR L$010nohalt
dd 2421723150
and eax,3
jnz NEAR L$010nohalt
pushfd
pop eax
bt eax,9
jnc NEAR L$010nohalt
rdtsc
push edx
push eax
hlt
rdtsc
sub eax,DWORD [esp]
sbb edx,DWORD [4+esp]
add esp,8
ret
L$010nohalt:
xor eax,eax
xor edx,edx
ret
global _OPENSSL_far_spin
align 16
_OPENSSL_far_spin:
L$_OPENSSL_far_spin_begin:
pushfd
pop eax
bt eax,9
jnc NEAR L$011nospin
mov eax,DWORD [4+esp]
mov ecx,DWORD [8+esp]
dd 2430111262
xor eax,eax
mov edx,DWORD [ecx]
jmp NEAR L$012spin
align 16
L$012spin:
inc eax
cmp edx,DWORD [ecx]
je NEAR L$012spin
dd 529567888
ret
L$011nospin:
xor eax,eax
xor edx,edx
ret
global _OPENSSL_wipe_cpu
align 16
_OPENSSL_wipe_cpu:
L$_OPENSSL_wipe_cpu_begin:
xor eax,eax
xor edx,edx
lea ecx,[_OPENSSL_ia32cap_P]
mov ecx,DWORD [ecx]
bt DWORD [ecx],1
jnc NEAR L$013no_x87
and ecx,83886080
cmp ecx,83886080
jne NEAR L$014no_sse2
pxor xmm0,xmm0
pxor xmm1,xmm1
pxor xmm2,xmm2
pxor xmm3,xmm3
pxor xmm4,xmm4
pxor xmm5,xmm5
pxor xmm6,xmm6
pxor xmm7,xmm7
L$014no_sse2:
dd 4007259865,4007259865,4007259865,4007259865,2430851995
L$013no_x87:
lea eax,[4+esp]
ret
global _OPENSSL_atomic_add
align 16
_OPENSSL_atomic_add:
L$_OPENSSL_atomic_add_begin:
mov edx,DWORD [4+esp]
mov ecx,DWORD [8+esp]
push ebx
nop
mov eax,DWORD [edx]
L$015spin:
lea ebx,[ecx*1+eax]
nop
dd 447811568
jne NEAR L$015spin
mov eax,ebx
pop ebx
ret
global _OPENSSL_indirect_call
align 16
_OPENSSL_indirect_call:
L$_OPENSSL_indirect_call_begin:
push ebp
mov ebp,esp
sub esp,28
mov ecx,DWORD [12+ebp]
mov DWORD [esp],ecx
mov edx,DWORD [16+ebp]
mov DWORD [4+esp],edx
mov eax,DWORD [20+ebp]
mov DWORD [8+esp],eax
mov eax,DWORD [24+ebp]
mov DWORD [12+esp],eax
mov eax,DWORD [28+ebp]
mov DWORD [16+esp],eax
mov eax,DWORD [32+ebp]
mov DWORD [20+esp],eax
mov eax,DWORD [36+ebp]
mov DWORD [24+esp],eax
call DWORD [8+ebp]
mov esp,ebp
pop ebp
ret
global _OPENSSL_ia32_rdrand
align 16
_OPENSSL_ia32_rdrand:
L$_OPENSSL_ia32_rdrand_begin:
mov ecx,8
L$016loop:
db 15,199,240
jc NEAR L$017break
loop L$016loop
L$017break:
cmp eax,0
cmove eax,ecx
ret
segment .bss
common _OPENSSL_ia32cap_P 16

View file

@ -0,0 +1,154 @@
default rel
%define XMMWORD
%define YMMWORD
%define ZMMWORD
section .text code align=64
global OPENSSL_ia32_cpuid
ALIGN 16
OPENSSL_ia32_cpuid:
mov QWORD[8+rsp],rdi ;WIN64 prologue
mov QWORD[16+rsp],rsi
mov rax,rsp
$L$SEH_begin_OPENSSL_ia32_cpuid:
mov rdi,rcx
mov rdi,rcx
mov r8,rbx
xor eax,eax
mov DWORD[8+rdi],eax
cpuid
mov r11d,eax
xor eax,eax
cmp ebx,0x756e6547
setne al
mov r9d,eax
cmp edx,0x49656e69
setne al
or r9d,eax
cmp ecx,0x6c65746e
setne al
or r9d,eax
jz NEAR $L$intel
cmp ebx,0x68747541
setne al
mov r10d,eax
cmp edx,0x69746E65
setne al
or r10d,eax
cmp ecx,0x444D4163
setne al
or r10d,eax
jnz NEAR $L$intel
mov eax,0x80000000
cpuid
cmp eax,0x80000001
jb NEAR $L$intel
mov r10d,eax
mov eax,0x80000001
cpuid
or r9d,ecx
and r9d,0x00000801
cmp r10d,0x80000008
jb NEAR $L$intel
mov eax,0x80000008
cpuid
movzx r10,cl
inc r10
mov eax,1
cpuid
bt edx,28
jnc NEAR $L$generic
shr ebx,16
cmp bl,r10b
ja NEAR $L$generic
and edx,0xefffffff
jmp NEAR $L$generic
$L$intel:
cmp r11d,4
mov r10d,-1
jb NEAR $L$nocacheinfo
mov eax,4
mov ecx,0
cpuid
mov r10d,eax
shr r10d,14
and r10d,0xfff
cmp r11d,7
jb NEAR $L$nocacheinfo
mov eax,7
xor ecx,ecx
cpuid
mov DWORD[8+rdi],ebx
$L$nocacheinfo:
mov eax,1
cpuid
and edx,0xbfefffff
cmp r9d,0
jne NEAR $L$notintel
or edx,0x40000000
$L$notintel:
bt edx,28
jnc NEAR $L$generic
and edx,0xefffffff
cmp r10d,0
je NEAR $L$generic
or edx,0x10000000
shr ebx,16
cmp bl,1
ja NEAR $L$generic
and edx,0xefffffff
$L$generic:
and r9d,0x00000800
and ecx,0xfffff7ff
or r9d,ecx
mov r10d,edx
bt r9d,27
jnc NEAR $L$clear_avx
xor ecx,ecx
DB 0x0f,0x01,0xd0
and eax,6
cmp eax,6
je NEAR $L$done
$L$clear_avx:
mov eax,0xefffe7ff
and r9d,eax
and DWORD[8+rdi],0xffffffdf
$L$done:
mov DWORD[4+rdi],r9d
mov DWORD[rdi],r10d
mov rbx,r8
mov rdi,QWORD[8+rsp] ;WIN64 epilogue
mov rsi,QWORD[16+rsp]
DB 0F3h,0C3h ;repret
$L$SEH_end_OPENSSL_ia32_cpuid:

File diff suppressed because it is too large Load diff