summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJoel Sing <jsing@cvs.openbsd.org>2024-10-19 11:55:33 +0000
committerJoel Sing <jsing@cvs.openbsd.org>2024-10-19 11:55:33 +0000
commit048c089830ea45f36f95288a319c5ee2cecc14db (patch)
tree6c643dbd4622c7509b64e86bbe9911178589e685 /lib
parent12ad3a3734efd0758129e7b1581d0ebd70faf6ad (diff)
Remove unused sparc CPU capability detection code.
This has been unused for a long time - it can be found in the attic if someone wants to clean it up and enable it in the future. ok tb@
Diffstat (limited to 'lib')
-rw-r--r--lib/libcrypto/arch/sparc64/Makefile.inc6
-rw-r--r--lib/libcrypto/sparccpuid.S101
-rw-r--r--lib/libcrypto/sparcv9cap.c98
3 files changed, 1 insertions, 204 deletions
diff --git a/lib/libcrypto/arch/sparc64/Makefile.inc b/lib/libcrypto/arch/sparc64/Makefile.inc
index 9101d8a89d0..43b4b199cd0 100644
--- a/lib/libcrypto/arch/sparc64/Makefile.inc
+++ b/lib/libcrypto/arch/sparc64/Makefile.inc
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile.inc,v 1.19 2024/08/11 13:02:39 jsing Exp $
+# $OpenBSD: Makefile.inc,v 1.20 2024/10/19 11:55:32 jsing Exp $
# sparc64-specific libcrypto build rules
@@ -24,7 +24,3 @@ ${dst}.S: ${LCRYPTO_SRC}/${dir}/asm/${src}.pl
/usr/bin/env CC=${CC} /usr/bin/perl \
${LCRYPTO_SRC}/${dir}/asm/${src}.pl ${.TARGET} -m64 > ${.TARGET}
.endfor
-
-# not until Montgomery code enabled
-#CFLAGS+= -DOPENSSL_CPUID_OBJ
-#SRCS+= sparccpuid.S sparcv9cap.c
diff --git a/lib/libcrypto/sparccpuid.S b/lib/libcrypto/sparccpuid.S
deleted file mode 100644
index 5d314d5d88d..00000000000
--- a/lib/libcrypto/sparccpuid.S
+++ /dev/null
@@ -1,101 +0,0 @@
-#if defined(__SUNPRO_C) && defined(__sparcv9)
-# define ABI64 /* They've said -xarch=v9 at command line */
-#elif defined(__GNUC__) && defined(__arch64__)
-# define ABI64 /* They've said -m64 at command line */
-#endif
-
-#ifdef ABI64
- .register %g2,#scratch
- .register %g3,#scratch
-# define FRAME -192
-# define BIAS 2047
-#else
-# define FRAME -96
-# define BIAS 0
-#endif
-
-.global _sparcv9_vis1_probe
-.align 8
-_sparcv9_vis1_probe:
- add %sp,BIAS+2,%o1
- .word 0xc19a5a40 !ldda [%o1]ASI_FP16_P,%f0
- retl
- .word 0x81b00d80 !fxor %f0,%f0,%f0
-.type _sparcv9_vis1_probe,#function
-.size _sparcv9_vis1_probe,.-_sparcv9_vis1_probe
-
-! Probe and instrument VIS1 instruction. Output is number of cycles it
-! takes to execute rdtick and pair of VIS1 instructions. US-Tx VIS unit
-! is slow (documented to be 6 cycles on T2) and the core is in-order
-! single-issue, it should be possible to distinguish Tx reliably...
-! Observed return values are:
-!
-! UltraSPARC IIe 7
-! UltraSPARC III 7
-! UltraSPARC T1 24
-!
-! Numbers for T2 and SPARC64 V-VII are more than welcomed.
-!
-! It would be possible to detect specifically US-T1 by instrumenting
-! fmul8ulx16, which is emulated on T1 and as such accounts for quite
-! a lot of %tick-s, couple of thousand on Linux...
-.global _sparcv9_vis1_instrument
-.align 8
-_sparcv9_vis1_instrument:
- .word 0x91410000 !rd %tick,%o0
- .word 0x81b00d80 !fxor %f0,%f0,%f0
- .word 0x85b08d82 !fxor %f2,%f2,%f2
- .word 0x93410000 !rd %tick,%o1
- .word 0x81b00d80 !fxor %f0,%f0,%f0
- .word 0x85b08d82 !fxor %f2,%f2,%f2
- .word 0x95410000 !rd %tick,%o2
- .word 0x81b00d80 !fxor %f0,%f0,%f0
- .word 0x85b08d82 !fxor %f2,%f2,%f2
- .word 0x97410000 !rd %tick,%o3
- .word 0x81b00d80 !fxor %f0,%f0,%f0
- .word 0x85b08d82 !fxor %f2,%f2,%f2
- .word 0x99410000 !rd %tick,%o4
-
- ! calculate intervals
- sub %o1,%o0,%o0
- sub %o2,%o1,%o1
- sub %o3,%o2,%o2
- sub %o4,%o3,%o3
-
- ! find minimum value
- cmp %o0,%o1
- .word 0x38680002 !bgu,a %xcc,.+8
- mov %o1,%o0
- cmp %o0,%o2
- .word 0x38680002 !bgu,a %xcc,.+8
- mov %o2,%o0
- cmp %o0,%o3
- .word 0x38680002 !bgu,a %xcc,.+8
- mov %o3,%o0
-
- retl
- nop
-.type _sparcv9_vis1_instrument,#function
-.size _sparcv9_vis1_instrument,.-_sparcv9_vis1_instrument
-
-.global _sparcv9_vis2_probe
-.align 8
-_sparcv9_vis2_probe:
- retl
- .word 0x81b00980 !bshuffle %f0,%f0,%f0
-.type _sparcv9_vis2_probe,#function
-.size _sparcv9_vis2_probe,.-_sparcv9_vis2_probe
-
-.global _sparcv9_fmadd_probe
-.align 8
-_sparcv9_fmadd_probe:
- .word 0x81b00d80 !fxor %f0,%f0,%f0
- .word 0x85b08d82 !fxor %f2,%f2,%f2
- retl
- .word 0x81b80440 !fmaddd %f0,%f0,%f2,%f0
-.type _sparcv9_fmadd_probe,#function
-.size _sparcv9_fmadd_probe,.-_sparcv9_fmadd_probe
-
-.section ".init",#alloc,#execinstr
- call OPENSSL_cpuid_setup
- nop
diff --git a/lib/libcrypto/sparcv9cap.c b/lib/libcrypto/sparcv9cap.c
deleted file mode 100644
index cc39c1bf453..00000000000
--- a/lib/libcrypto/sparcv9cap.c
+++ /dev/null
@@ -1,98 +0,0 @@
-/* $OpenBSD: sparcv9cap.c,v 1.7 2014/06/20 21:00:46 deraadt Exp $ */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <setjmp.h>
-#include <signal.h>
-#include <sys/time.h>
-#include <openssl/bn.h>
-
-#define SPARCV9_PREFER_FPU (1<<1)
-#define SPARCV9_VIS1 (1<<2)
-#define SPARCV9_VIS2 (1<<3) /* reserved */
-#define SPARCV9_FMADD (1<<4) /* reserved for SPARC64 V */
-
-static int OPENSSL_sparcv9cap_P = 0;
-
-int
-bn_mul_mont(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp,
- const BN_ULONG *np, const BN_ULONG *n0, int num)
-{
- int bn_mul_mont_fpu(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp, const BN_ULONG *np, const BN_ULONG *n0, int num);
- int bn_mul_mont_int(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp, const BN_ULONG *np, const BN_ULONG *n0, int num);
-
- if (num >= 8 && !(num & 1) &&
- (OPENSSL_sparcv9cap_P & (SPARCV9_PREFER_FPU|SPARCV9_VIS1)) ==
- (SPARCV9_PREFER_FPU|SPARCV9_VIS1))
- return bn_mul_mont_fpu(rp, ap, bp, np, n0, num);
- else
- return bn_mul_mont_int(rp, ap, bp, np, n0, num);
-}
-
-void _sparcv9_vis1_probe(void);
-unsigned long _sparcv9_vis1_instrument(void);
-void _sparcv9_vis2_probe(void);
-void _sparcv9_fmadd_probe(void);
-
-static sigjmp_buf common_jmp;
-static void
-common_handler(int sig)
-{
- siglongjmp(common_jmp, sig);
-}
-
-void
-OPENSSL_cpuid_setup(void)
-{
- char *e;
- struct sigaction common_act, ill_oact, bus_oact;
- sigset_t all_masked, oset;
- static int trigger = 0;
-
- if (trigger)
- return;
- trigger = 1;
-
- /* Initial value, fits UltraSPARC-I&II... */
- OPENSSL_sparcv9cap_P = SPARCV9_PREFER_FPU;
-
- sigfillset(&all_masked);
- sigdelset(&all_masked, SIGILL);
- sigdelset(&all_masked, SIGTRAP);
-#ifdef SIGEMT
- sigdelset(&all_masked, SIGEMT);
-#endif
- sigdelset(&all_masked, SIGFPE);
- sigdelset(&all_masked, SIGBUS);
- sigdelset(&all_masked, SIGSEGV);
- sigprocmask(SIG_SETMASK, &all_masked, &oset);
-
- memset(&common_act, 0, sizeof(common_act));
- common_act.sa_handler = common_handler;
- common_act.sa_mask = all_masked;
-
- sigaction(SIGILL, &common_act, &ill_oact);
- sigaction(SIGBUS,&common_act,&bus_oact);/* T1 fails 16-bit ldda [on Linux] */
-
- if (sigsetjmp(common_jmp, 1) == 0) {
- _sparcv9_vis1_probe();
- OPENSSL_sparcv9cap_P |= SPARCV9_VIS1;
- /* detect UltraSPARC-Tx, see sparccpud.S for details... */
- if (_sparcv9_vis1_instrument() >= 12)
- OPENSSL_sparcv9cap_P &= ~(SPARCV9_VIS1|SPARCV9_PREFER_FPU);
- else {
- _sparcv9_vis2_probe();
- OPENSSL_sparcv9cap_P |= SPARCV9_VIS2;
- }
- }
-
- if (sigsetjmp(common_jmp, 1) == 0) {
- _sparcv9_fmadd_probe();
- OPENSSL_sparcv9cap_P |= SPARCV9_FMADD;
- }
-
- sigaction(SIGBUS, &bus_oact, NULL);
- sigaction(SIGILL, &ill_oact, NULL);
-
- sigprocmask(SIG_SETMASK, &oset, NULL);
-}