From e9c09c276082d95bf84cbb3b3e7b37933611285b Mon Sep 17 00:00:00 2001 From: miod Date: Tue, 17 Jan 2023 15:04:27 +0000 Subject: [PATCH] Remove non-visible and unused OPENSSL_wipe_cpu and OPENSSL_atomic_add interfaces, and remove empty assembly OPENSSL_cpuid_setup routines - the default empty C fallback will work as good. ok jsing@ --- lib/libcrypto/alphacpuid.pl | 80 --------- lib/libcrypto/arch/alpha/Makefile.inc | 9 +- lib/libcrypto/arch/arm/armv4cpuid.S | 96 ----------- lib/libcrypto/arch/hppa/Makefile.inc | 9 +- lib/libcrypto/arch/powerpc/Makefile.inc | 8 +- lib/libcrypto/arch/powerpc64/Makefile.inc | 8 +- lib/libcrypto/pariscid.pl | 86 --------- lib/libcrypto/ppccap.c | 32 +--- lib/libcrypto/ppccpuid.pl | 85 --------- lib/libcrypto/sparccpuid.S | 201 ---------------------- lib/libcrypto/x86_64cpuid.pl | 48 ------ lib/libcrypto/x86cpuid.pl | 45 ----- 12 files changed, 7 insertions(+), 700 deletions(-) delete mode 100644 lib/libcrypto/alphacpuid.pl delete mode 100644 lib/libcrypto/pariscid.pl delete mode 100755 lib/libcrypto/ppccpuid.pl diff --git a/lib/libcrypto/alphacpuid.pl b/lib/libcrypto/alphacpuid.pl deleted file mode 100644 index 0ff4ae22e33..00000000000 --- a/lib/libcrypto/alphacpuid.pl +++ /dev/null @@ -1,80 +0,0 @@ -#!/usr/bin/env perl -print <<'___'; -.text - -.set noat - -.globl OPENSSL_cpuid_setup -.ent OPENSSL_cpuid_setup -OPENSSL_cpuid_setup: - .frame $30,0,$26 - .prologue 0 - ret ($26) -.end OPENSSL_cpuid_setup - -.globl OPENSSL_wipe_cpu -.ent OPENSSL_wipe_cpu -OPENSSL_wipe_cpu: - .frame $30,0,$26 - .prologue 0 - clr $1 - clr $2 - clr $3 - clr $4 - clr $5 - clr $6 - clr $7 - clr $8 - clr $16 - clr $17 - clr $18 - clr $19 - clr $20 - clr $21 - clr $22 - clr $23 - clr $24 - clr $25 - clr $27 - clr $at - clr $29 - fclr $f0 - fclr $f1 - fclr $f10 - fclr $f11 - fclr $f12 - fclr $f13 - fclr $f14 - fclr $f15 - fclr $f16 - fclr $f17 - fclr $f18 - fclr $f19 - fclr $f20 - fclr $f21 - fclr $f22 - fclr $f23 - fclr $f24 - fclr $f25 - fclr $f26 - fclr $f27 - fclr $f28 - fclr $f29 - fclr $f30 - mov $sp,$0 - ret ($26) -.end OPENSSL_wipe_cpu - -.globl OPENSSL_atomic_add -.ent OPENSSL_atomic_add -OPENSSL_atomic_add: - .frame $30,0,$26 - .prologue 0 -1: ldl_l $0,0($16) - addl $0,$17,$1 - stl_c $1,0($16) - beq $1,1b - addl $0,$17,$0 - ret ($26) -.end OPENSSL_atomic_add -___ diff --git a/lib/libcrypto/arch/alpha/Makefile.inc b/lib/libcrypto/arch/alpha/Makefile.inc index 3b693c2ad21..9d1eab835c0 100644 --- a/lib/libcrypto/arch/alpha/Makefile.inc +++ b/lib/libcrypto/arch/alpha/Makefile.inc @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.inc,v 1.4 2019/05/11 13:05:24 tb Exp $ +# $OpenBSD: Makefile.inc,v 1.5 2023/01/17 15:04:27 miod Exp $ # alpha-specific libcrypto build rules @@ -32,10 +32,3 @@ ${f}.S: ${LCRYPTO_SRC}/${dir}/asm/${f}.pl /usr/bin/perl \ ${LCRYPTO_SRC}/${dir}/asm/${f}.pl > ${.TARGET} .endfor - -CFLAGS+= -DOPENSSL_CPUID_OBJ -SRCS+= alphacpuid.S -GENERATED+=alphacpuid.S -alphacpuid.S: ${LCRYPTO_SRC}/alphacpuid.pl - /usr/bin/perl \ - ${LCRYPTO_SRC}/alphacpuid.pl > ${.TARGET} diff --git a/lib/libcrypto/arch/arm/armv4cpuid.S b/lib/libcrypto/arch/arm/armv4cpuid.S index bb9abafebe5..db0b54e496b 100644 --- a/lib/libcrypto/arch/arm/armv4cpuid.S +++ b/lib/libcrypto/arch/arm/armv4cpuid.S @@ -9,43 +9,6 @@ #undef __thumb2__ #endif -.align 5 -.globl OPENSSL_atomic_add -.type OPENSSL_atomic_add,%function -OPENSSL_atomic_add: -#if __ARM_ARCH__>=6 -.Ladd: ldrex r2,[r0] - add r3,r2,r1 - strex r2,r3,[r0] - cmp r2,#0 - bne .Ladd - mov r0,r3 - bx lr -#else - stmdb sp!,{r4,r5,r6,lr} - ldr r2,.Lspinlock - adr r3,.Lspinlock - mov r4,r0 - mov r5,r1 - add r6,r3,r2 @ &spinlock - b .+8 -.Lspin: bl sched_yield - mov r0,#-1 - swp r0,r0,[r6] - cmp r0,#0 - bne .Lspin - - ldr r2,[r4] - add r2,r2,r5 - str r2,[r4] - str r0,[r6] @ release spinlock - ldmia sp!,{r4,r5,r6,lr} - tst lr,#1 - moveq pc,lr -.word 0xe12fff1e @ bx lr -#endif -.size OPENSSL_atomic_add,.-OPENSSL_atomic_add - #if __ARM_ARCH__>=7 .arch armv7-a .fpu neon @@ -102,64 +65,5 @@ _armv8_pmull_probe: .size _armv8_pmull_probe,.-_armv8_pmull_probe #endif -.globl OPENSSL_wipe_cpu -.type OPENSSL_wipe_cpu,%function -OPENSSL_wipe_cpu: -#if __ARM_ARCH__>=7 - ldr r0,.LOPENSSL_armcap - adr r1,.LOPENSSL_armcap - ldr r0,[r1,r0] -#ifdef __APPLE__ - ldr r0,[r0] -#endif -#endif - eor r2,r2,r2 - eor r3,r3,r3 - eor ip,ip,ip -#if __ARM_ARCH__>=7 - tst r0,#1 - beq .Lwipe_done - veor q0, q0, q0 - veor q1, q1, q1 - veor q2, q2, q2 - veor q3, q3, q3 - veor q8, q8, q8 - veor q9, q9, q9 - veor q10, q10, q10 - veor q11, q11, q11 - veor q12, q12, q12 - veor q13, q13, q13 - veor q14, q14, q14 - veor q15, q15, q15 -.Lwipe_done: -#endif - mov r0,sp -#if __ARM_ARCH__>=5 - bx lr -#else - tst lr,#1 - moveq pc,lr -.word 0xe12fff1e @ bx lr -#endif -.size OPENSSL_wipe_cpu,.-OPENSSL_wipe_cpu - -.align 5 -#if __ARM_ARCH__>=7 -.LOPENSSL_armcap: -.word OPENSSL_armcap_P-. -#endif -#if __ARM_ARCH__>=6 -.align 5 -#else -.Lspinlock: -.word atomic_add_spinlock-.Lspinlock -.align 5 - -.data -.align 2 -atomic_add_spinlock: -.word 0 -#endif - .comm OPENSSL_armcap_P,4,4 .hidden OPENSSL_armcap_P diff --git a/lib/libcrypto/arch/hppa/Makefile.inc b/lib/libcrypto/arch/hppa/Makefile.inc index eb15810f380..76affc391d9 100644 --- a/lib/libcrypto/arch/hppa/Makefile.inc +++ b/lib/libcrypto/arch/hppa/Makefile.inc @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.inc,v 1.12 2023/01/13 17:11:41 miod Exp $ +# $OpenBSD: Makefile.inc,v 1.13 2023/01/17 15:04:27 miod Exp $ # hppa-specific libcrypto build rules @@ -40,10 +40,3 @@ ${dst}.S: ${LCRYPTO_SRC}/${dir}/asm/${src}.pl /usr/bin/perl \ ${LCRYPTO_SRC}/${dir}/asm/${src}.pl 32 ${.TARGET} > ${.TARGET} .endfor - -CFLAGS+= -DOPENSSL_CPUID_OBJ -SRCS+= pariscid.S -GENERATED+=pariscid.S -pariscid.S: ${LCRYPTO_SRC}/pariscid.pl - /usr/bin/perl \ - ${LCRYPTO_SRC}/pariscid.pl 32 > ${.TARGET} diff --git a/lib/libcrypto/arch/powerpc/Makefile.inc b/lib/libcrypto/arch/powerpc/Makefile.inc index 2682fc9e210..6c168c79892 100644 --- a/lib/libcrypto/arch/powerpc/Makefile.inc +++ b/lib/libcrypto/arch/powerpc/Makefile.inc @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.inc,v 1.3 2019/05/11 13:05:25 tb Exp $ +# $OpenBSD: Makefile.inc,v 1.4 2023/01/17 15:04:27 miod Exp $ # powerpc-specific libcrypto build rules @@ -37,8 +37,4 @@ ${dst}.S: ${LCRYPTO_SRC}/${dir}/asm/${src}.pl .endfor #CFLAGS+= -DOPENSSL_CPUID_OBJ # it's commented out in ppccap.c -SRCS+= ppccpuid.S ppccap.c -GENERATED+=ppccpuid.S -ppccpuid.S: ${LCRYPTO_SRC}/ppccpuid.pl - /usr/bin/perl \ - ${LCRYPTO_SRC}/ppccpuid.pl linux32 > ${.TARGET} +SRCS+= ppccap.c diff --git a/lib/libcrypto/arch/powerpc64/Makefile.inc b/lib/libcrypto/arch/powerpc64/Makefile.inc index 0713b8cd941..51e1c569dca 100644 --- a/lib/libcrypto/arch/powerpc64/Makefile.inc +++ b/lib/libcrypto/arch/powerpc64/Makefile.inc @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.inc,v 1.4 2020/06/29 15:32:44 kettenis Exp $ +# $OpenBSD: Makefile.inc,v 1.5 2023/01/17 15:04:27 miod Exp $ # powerpc-specific libcrypto build rules @@ -38,8 +38,4 @@ ${dst}.S: ${LCRYPTO_SRC}/${dir}/asm/${src}.pl .endfor #CFLAGS+= -DOPENSSL_CPUID_OBJ # it's commented out in ppccap.c -SRCS+= ppccpuid.S ppccap.c -GENERATED+=ppccpuid.S -ppccpuid.S: ${LCRYPTO_SRC}/ppccpuid.pl - /usr/bin/perl \ - ${LCRYPTO_SRC}/ppccpuid.pl linux32 > ${.TARGET} +SRCS+= ppccap.c diff --git a/lib/libcrypto/pariscid.pl b/lib/libcrypto/pariscid.pl deleted file mode 100644 index da74a2836ce..00000000000 --- a/lib/libcrypto/pariscid.pl +++ /dev/null @@ -1,86 +0,0 @@ -#!/usr/bin/env perl - -$flavour = shift; -$output = shift; -open STDOUT,">$output"; - -if ($flavour =~ /64/) { - $LEVEL ="2.0W"; - $SIZE_T =8; - $ST ="std"; -} else { - $LEVEL ="1.1"; - $SIZE_T =4; - $ST ="stw"; -} - -$rp="%r2"; -$sp="%r30"; -$rv="%r28"; - -$code=<<___; - .LEVEL $LEVEL -#if 0 - .SPACE \$TEXT\$ - .SUBSPA \$CODE\$,QUAD=0,ALIGN=8,ACCESS=0x2C,CODE_ONLY -#else - .text -#endif - - .EXPORT OPENSSL_cpuid_setup,ENTRY - .ALIGN 8 -OPENSSL_cpuid_setup - .PROC - .CALLINFO NO_CALLS - .ENTRY - bv ($rp) - .EXIT - nop - .PROCEND - - .EXPORT OPENSSL_wipe_cpu,ENTRY - .ALIGN 8 -OPENSSL_wipe_cpu - .PROC - .CALLINFO NO_CALLS - .ENTRY - xor %r0,%r0,%r1 - fcpy,dbl %fr0,%fr4 - xor %r0,%r0,%r19 - fcpy,dbl %fr0,%fr5 - xor %r0,%r0,%r20 - fcpy,dbl %fr0,%fr6 - xor %r0,%r0,%r21 - fcpy,dbl %fr0,%fr7 - xor %r0,%r0,%r22 - fcpy,dbl %fr0,%fr8 - xor %r0,%r0,%r23 - fcpy,dbl %fr0,%fr9 - xor %r0,%r0,%r24 - fcpy,dbl %fr0,%fr10 - xor %r0,%r0,%r25 - fcpy,dbl %fr0,%fr11 - xor %r0,%r0,%r26 - fcpy,dbl %fr0,%fr22 - xor %r0,%r0,%r29 - fcpy,dbl %fr0,%fr23 - xor %r0,%r0,%r31 - fcpy,dbl %fr0,%fr24 - fcpy,dbl %fr0,%fr25 - fcpy,dbl %fr0,%fr26 - fcpy,dbl %fr0,%fr27 - fcpy,dbl %fr0,%fr28 - fcpy,dbl %fr0,%fr29 - fcpy,dbl %fr0,%fr30 - fcpy,dbl %fr0,%fr31 - bv ($rp) - .EXIT - ldo 0($sp),$rv - .PROCEND -___ -$code =~ s/cmpib,\*/comib,/gm if ($SIZE_T==4); -$code =~ s/,\*/,/gm if ($SIZE_T==4); -$code =~ s/\bbv\b/bve/gm if ($SIZE_T==8); -print $code; -close STDOUT; - diff --git a/lib/libcrypto/ppccap.c b/lib/libcrypto/ppccap.c index ce01edf6ecf..8c4565f57c7 100644 --- a/lib/libcrypto/ppccap.c +++ b/lib/libcrypto/ppccap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ppccap.c,v 1.6 2014/07/17 23:48:24 deraadt Exp $ */ +/* $OpenBSD: ppccap.c,v 1.7 2023/01/17 15:04:27 miod Exp $ */ #include #include @@ -8,13 +8,6 @@ #include #include -#ifdef unused -#define PPC_FPU64 (1<<0) -#define PPC_ALTIVEC (1<<1) - -static int OPENSSL_ppccap_P = 0; -#endif - #ifdef OPENSSL_BN_ASM_MONT extern int bn_mul_mont_int(BN_ULONG *, const BN_ULONG *, const BN_ULONG *, const BN_ULONG *, const BN_ULONG *, int); @@ -25,26 +18,3 @@ bn_mul_mont(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp, return bn_mul_mont_int(rp, ap, bp, np, n0, num); } #endif - -#ifdef unused -void OPENSSL_cpuid_setup(void) __attribute__((constructor)); - -void -OPENSSL_cpuid_setup(void) -{ - static const int mib[2] = { CTL_MACHDEP, CPU_ALTIVEC }; - static int trigger = 0; - int altivec = 0; - size_t size; - - if (trigger) - return; - trigger = 1; - - size = sizeof altivec; - if (sysctl(mib, 2, &altivec, &size, NULL, 0) != -1) { - if (altivec != 0) - OPENSSL_ppccap_P |= PPC_ALTIVEC; - } -} -#endif diff --git a/lib/libcrypto/ppccpuid.pl b/lib/libcrypto/ppccpuid.pl deleted file mode 100755 index 0cef7014b6e..00000000000 --- a/lib/libcrypto/ppccpuid.pl +++ /dev/null @@ -1,85 +0,0 @@ -#!/usr/bin/env perl - -$flavour = shift; - -$0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; -( $xlate="${dir}ppc-xlate.pl" and -f $xlate ) or -( $xlate="${dir}perlasm/ppc-xlate.pl" and -f $xlate) or -die "can't locate ppc-xlate.pl"; - -open STDOUT,"| $^X $xlate $flavour ".shift || die "can't call $xlate: $!"; - -if ($flavour=~/64/) { - $CMPLI="cmpldi"; - $SHRLI="srdi"; - $SIGNX="extsw"; -} else { - $CMPLI="cmplwi"; - $SHRLI="srwi"; - $SIGNX="mr"; -} - -$code=<<___; -.machine "any" -.text - -#if 0 -.globl .OPENSSL_ppc64_probe -.align 4 -.OPENSSL_ppc64_probe: - fcfid f1,f1 - extrdi r0,r0,32,0 - blr - .long 0 - .byte 0,12,0x14,0,0,0,0,0 -#endif - -.globl .OPENSSL_wipe_cpu -.align 4 -.OPENSSL_wipe_cpu: - xor r0,r0,r0 - fmr f0,f31 - fmr f1,f31 - fmr f2,f31 - mr r3,r1 - fmr f3,f31 - xor r4,r4,r4 - fmr f4,f31 - xor r5,r5,r5 - fmr f5,f31 - xor r6,r6,r6 - fmr f6,f31 - xor r7,r7,r7 - fmr f7,f31 - xor r8,r8,r8 - fmr f8,f31 - xor r9,r9,r9 - fmr f9,f31 - xor r10,r10,r10 - fmr f10,f31 - xor r11,r11,r11 - fmr f11,f31 - xor r12,r12,r12 - fmr f12,f31 - fmr f13,f31 - blr - .long 0 - .byte 0,12,0x14,0,0,0,0,0 - -.globl .OPENSSL_atomic_add -.align 4 -.OPENSSL_atomic_add: -Ladd: lwarx r5,0,r3 - add r0,r4,r5 - stwcx. r0,0,r3 - bne- Ladd - $SIGNX r3,r0 - blr - .long 0 - .byte 0,12,0x14,0,0,0,2,0 - .long 0 -___ - -$code =~ s/\`([^\`]*)\`/eval $1/gem; -print $code; -close STDOUT; diff --git a/lib/libcrypto/sparccpuid.S b/lib/libcrypto/sparccpuid.S index 757e015704d..5d314d5d88d 100644 --- a/lib/libcrypto/sparccpuid.S +++ b/lib/libcrypto/sparccpuid.S @@ -14,207 +14,6 @@ # define BIAS 0 #endif -.text -.align 32 -.global OPENSSL_wipe_cpu -.type OPENSSL_wipe_cpu,#function -! Keep in mind that this does not excuse us from wiping the stack! -! This routine wipes registers, but not the backing store [which -! resides on the stack, toward lower addresses]. To facilitate for -! stack wiping I return pointer to the top of stack of the *caller*. -OPENSSL_wipe_cpu: - save %sp,FRAME,%sp - nop -#ifdef __sun -#include - ta ST_CLEAN_WINDOWS -#else - call .walk.reg.wins -#endif - nop - call .PIC.zero.up - mov .zero-(.-4),%o0 - ld [%o0],%f0 - ld [%o0],%f1 - - subcc %g0,1,%o0 - ! Following is V9 "rd %ccr,%o0" instruction. However! V8 - ! specification says that it ("rd %asr2,%o0" in V8 terms) does - ! not cause illegal_instruction trap. It therefore can be used - ! to determine if the CPU the code is executing on is V8- or - ! V9-compliant, as V9 returns a distinct value of 0x99, - ! "negative" and "borrow" bits set in both %icc and %xcc. - .word 0x91408000 !rd %ccr,%o0 - cmp %o0,0x99 - bne .v8 - nop - ! Even though we do not use %fp register bank, - ! we wipe it as memcpy might have used it... - .word 0xbfa00040 !fmovd %f0,%f62 - .word 0xbba00040 !... - .word 0xb7a00040 - .word 0xb3a00040 - .word 0xafa00040 - .word 0xaba00040 - .word 0xa7a00040 - .word 0xa3a00040 - .word 0x9fa00040 - .word 0x9ba00040 - .word 0x97a00040 - .word 0x93a00040 - .word 0x8fa00040 - .word 0x8ba00040 - .word 0x87a00040 - .word 0x83a00040 !fmovd %f0,%f32 -.v8: fmovs %f1,%f31 - clr %o0 - fmovs %f0,%f30 - clr %o1 - fmovs %f1,%f29 - clr %o2 - fmovs %f0,%f28 - clr %o3 - fmovs %f1,%f27 - clr %o4 - fmovs %f0,%f26 - clr %o5 - fmovs %f1,%f25 - clr %o7 - fmovs %f0,%f24 - clr %l0 - fmovs %f1,%f23 - clr %l1 - fmovs %f0,%f22 - clr %l2 - fmovs %f1,%f21 - clr %l3 - fmovs %f0,%f20 - clr %l4 - fmovs %f1,%f19 - clr %l5 - fmovs %f0,%f18 - clr %l6 - fmovs %f1,%f17 - clr %l7 - fmovs %f0,%f16 - clr %i0 - fmovs %f1,%f15 - clr %i1 - fmovs %f0,%f14 - clr %i2 - fmovs %f1,%f13 - clr %i3 - fmovs %f0,%f12 - clr %i4 - fmovs %f1,%f11 - clr %i5 - fmovs %f0,%f10 - clr %g1 - fmovs %f1,%f9 - clr %g2 - fmovs %f0,%f8 - clr %g3 - fmovs %f1,%f7 - clr %g4 - fmovs %f0,%f6 - clr %g5 - fmovs %f1,%f5 - fmovs %f0,%f4 - fmovs %f1,%f3 - fmovs %f0,%f2 - - add %fp,BIAS,%i0 ! return pointer to callerĀ“s top of stack - - ret - restore - -.zero: .long 0x0,0x0 -.PIC.zero.up: - retl - add %o0,%o7,%o0 -#ifdef DEBUG -.global walk_reg_wins -.type walk_reg_wins,#function -walk_reg_wins: -#endif -.walk.reg.wins: - save %sp,FRAME,%sp - cmp %i7,%o7 - be 2f - clr %o0 - cmp %o7,0 ! compiler never cleans %o7... - be 1f ! could have been a leaf function... - clr %o1 - call .walk.reg.wins - nop -1: clr %o2 - clr %o3 - clr %o4 - clr %o5 - clr %o7 - clr %l0 - clr %l1 - clr %l2 - clr %l3 - clr %l4 - clr %l5 - clr %l6 - clr %l7 - add %o0,1,%i0 ! used for debugging -2: ret - restore -.size OPENSSL_wipe_cpu,.-OPENSSL_wipe_cpu - -.global OPENSSL_atomic_add -.type OPENSSL_atomic_add,#function -.align 32 -OPENSSL_atomic_add: -#ifndef ABI64 - subcc %g0,1,%o2 - .word 0x95408000 !rd %ccr,%o2, see comment above - cmp %o2,0x99 - be .v9 - nop - save %sp,FRAME,%sp - ba .enter - nop -#ifdef __sun -! Note that you do not have to link with libthread to call thr_yield, -! as libc provides a stub, which is overloaded the moment you link -! with *either* libpthread or libthread... -#define YIELD_CPU thr_yield -#else -! applies at least to Linux and FreeBSD... Feedback expected... -#define YIELD_CPU sched_yield -#endif -.spin: call YIELD_CPU - nop -.enter: ld [%i0],%i2 - cmp %i2,-4096 - be .spin - mov -1,%i2 - swap [%i0],%i2 - cmp %i2,-1 - be .spin - add %i2,%i1,%i2 - stbar - st %i2,[%i0] - sra %i2,%g0,%i0 - ret - restore -.v9: -#endif - ld [%o0],%o2 -1: add %o1,%o2,%o3 - .word 0xd7e2100a !cas [%o0],%o2,%o3, compare [%o0] with %o2 and swap %o3 - cmp %o2,%o3 - bne 1b - mov %o3,%o2 ! cas is always fetching to dest. register - add %o1,%o2,%o0 ! OpenSSL expects the new value - retl - sra %o0,%g0,%o0 ! we return signed int, remember? -.size OPENSSL_atomic_add,.-OPENSSL_atomic_add - .global _sparcv9_vis1_probe .align 8 _sparcv9_vis1_probe: diff --git a/lib/libcrypto/x86_64cpuid.pl b/lib/libcrypto/x86_64cpuid.pl index 6558dedb6be..2780b0f8cec 100644 --- a/lib/libcrypto/x86_64cpuid.pl +++ b/lib/libcrypto/x86_64cpuid.pl @@ -25,20 +25,6 @@ print<<___; .text -.globl OPENSSL_atomic_add -.type OPENSSL_atomic_add,\@abi-omnipotent -.align 16 -OPENSSL_atomic_add: - movl ($arg1),%eax -.Lspin: leaq ($arg2,%rax),%r8 - .byte 0xf0 # lock - cmpxchgl %r8d,($arg1) - jne .Lspin - movl %r8d,%eax - .byte 0x48,0x98 # cltq/cdqe - ret -.size OPENSSL_atomic_add,.-OPENSSL_atomic_add - .globl OPENSSL_ia32_cpuid .type OPENSSL_ia32_cpuid,\@abi-omnipotent .align 16 @@ -165,38 +151,4 @@ OPENSSL_ia32_cpuid: .size OPENSSL_ia32_cpuid,.-OPENSSL_ia32_cpuid ___ -print<<___; -.globl OPENSSL_wipe_cpu -.type OPENSSL_wipe_cpu,\@abi-omnipotent -.align 16 -OPENSSL_wipe_cpu: - pxor %xmm0,%xmm0 - pxor %xmm1,%xmm1 - pxor %xmm2,%xmm2 - pxor %xmm3,%xmm3 - pxor %xmm4,%xmm4 - pxor %xmm5,%xmm5 - pxor %xmm6,%xmm6 - pxor %xmm7,%xmm7 - pxor %xmm8,%xmm8 - pxor %xmm9,%xmm9 - pxor %xmm10,%xmm10 - pxor %xmm11,%xmm11 - pxor %xmm12,%xmm12 - pxor %xmm13,%xmm13 - pxor %xmm14,%xmm14 - pxor %xmm15,%xmm15 - xorq %rcx,%rcx - xorq %rdx,%rdx - xorq %rsi,%rsi - xorq %rdi,%rdi - xorq %r8,%r8 - xorq %r9,%r9 - xorq %r10,%r10 - xorq %r11,%r11 - leaq 8(%rsp),%rax - ret -.size OPENSSL_wipe_cpu,.-OPENSSL_wipe_cpu -___ - close STDOUT; # flush diff --git a/lib/libcrypto/x86cpuid.pl b/lib/libcrypto/x86cpuid.pl index 0fc906a3e95..d6ebede0f83 100644 --- a/lib/libcrypto/x86cpuid.pl +++ b/lib/libcrypto/x86cpuid.pl @@ -152,51 +152,6 @@ for (@ARGV) { $sse2=1 if (/-DOPENSSL_IA32_SSE2/); } &external_label("OPENSSL_ia32cap_P"); -&function_begin_B("OPENSSL_wipe_cpu",""); - &xor ("eax","eax"); - &xor ("edx","edx"); - &picmeup("ecx","OPENSSL_ia32cap_P"); - &mov ("ecx",&DWP(0,"ecx")); - &bt (&DWP(0,"ecx"),"\$IA32CAP_BIT0_FPU"); - &jnc (&label("no_x87")); - if ($sse2) { - # Check SSE2 and FXSR bits. - &and ("ecx", "\$(IA32CAP_MASK0_FXSR | IA32CAP_MASK0_SSE2)"); - &cmp ("ecx", "\$(IA32CAP_MASK0_FXSR | IA32CAP_MASK0_SSE2)"); - &jne (&label("no_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"); - &set_label("no_sse2"); - } - # just a bunch of fldz to zap the fp/mm bank followed by finit... - &data_word(0xeed9eed9,0xeed9eed9,0xeed9eed9,0xeed9eed9,0x90e3db9b); -&set_label("no_x87"); - &lea ("eax",&DWP(4,"esp")); - &ret (); -&function_end_B("OPENSSL_wipe_cpu"); - -&function_begin_B("OPENSSL_atomic_add"); - &mov ("edx",&DWP(4,"esp")); # fetch the pointer, 1st arg - &mov ("ecx",&DWP(8,"esp")); # fetch the increment, 2nd arg - &push ("ebx"); - &nop (); - &mov ("eax",&DWP(0,"edx")); -&set_label("spin"); - &lea ("ebx",&DWP(0,"eax","ecx")); - &nop (); - &data_word(0x1ab10ff0); # lock; cmpxchg %ebx,(%edx) # %eax is involved and is always reloaded - &jne (&label("spin")); - &mov ("eax","ebx"); # OpenSSL expects the new value - &pop ("ebx"); - &ret (); -&function_end_B("OPENSSL_atomic_add"); - &initseg("OPENSSL_cpuid_setup"); &asm_finish(); -- 2.20.1