diff options
author | Piotr Kubaj <pkubaj@FreeBSD.org> | 2021-11-22 02:28:46 +0000 |
---|---|---|
committer | Piotr Kubaj <pkubaj@FreeBSD.org> | 2021-11-23 22:26:53 +0000 |
commit | 3a60869237b8b315fe66497cf5299ec08b688533 (patch) | |
tree | 7700f03755dcc4003ad262258de6e51b08ae24ac /crypto | |
parent | 9cf1841c4aaf8fbab06132ab9f76094f34ad7c7b (diff) | |
download | src-3a60869237b8b315fe66497cf5299ec08b688533.tar.gz src-3a60869237b8b315fe66497cf5299ec08b688533.zip |
Add assembly optimized code for OpenSSL on powerpc, powerpc64 and powerpc64le
Summary:
1. https://github.com/openssl/openssl/commit/34ab13b7d8e3e723adb60be8142e38b7c9cd382a
needs to be merged for ELFv2 support on big-endian.
2. crypto/openssl/crypto/ppccap.c needs to be patched.
Same reason as in https://github.com/openssl/openssl/pull/17082.
Approved by: jkim, jhibbits
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D33076
Diffstat (limited to 'crypto')
-rwxr-xr-x | crypto/openssl/crypto/perlasm/ppc-xlate.pl | 8 | ||||
-rw-r--r-- | crypto/openssl/crypto/ppccap.c | 12 |
2 files changed, 12 insertions, 8 deletions
diff --git a/crypto/openssl/crypto/perlasm/ppc-xlate.pl b/crypto/openssl/crypto/perlasm/ppc-xlate.pl index 08668b295bf6..f1a7fa835fc2 100755 --- a/crypto/openssl/crypto/perlasm/ppc-xlate.pl +++ b/crypto/openssl/crypto/perlasm/ppc-xlate.pl @@ -49,7 +49,7 @@ my $globl = sub { /osx/ && do { $name = "_$name"; last; }; - /linux.*(32|64le)/ + /linux.*(32|64(le|v2))/ && do { $ret .= ".globl $name"; if (!$$type) { $ret .= "\n.type $name,\@function"; @@ -80,7 +80,7 @@ my $globl = sub { }; my $text = sub { my $ret = ($flavour =~ /aix/) ? ".csect\t.text[PR],7" : ".text"; - $ret = ".abiversion 2\n".$ret if ($flavour =~ /linux.*64le/); + $ret = ".abiversion 2\n".$ret if ($flavour =~ /linux.*64(le|v2)/); $ret; }; my $machine = sub { @@ -186,7 +186,7 @@ my $vmr = sub { # Some ABIs specify vrsave, special-purpose register #256, as reserved # for system use. -my $no_vrsave = ($flavour =~ /aix|linux64le/); +my $no_vrsave = ($flavour =~ /aix|linux64(le|v2)/); my $mtspr = sub { my ($f,$idx,$ra) = @_; if ($idx == 256 && $no_vrsave) { @@ -318,7 +318,7 @@ while($line=<>) { if ($label) { my $xlated = ($GLOBALS{$label} or $label); print "$xlated:"; - if ($flavour =~ /linux.*64le/) { + if ($flavour =~ /linux.*64(le|v2)/) { if ($TYPES{$label} =~ /function/) { printf "\n.localentry %s,0\n",$xlated; } diff --git a/crypto/openssl/crypto/ppccap.c b/crypto/openssl/crypto/ppccap.c index eeaa47cc6b41..23bcf1f46e2e 100644 --- a/crypto/openssl/crypto/ppccap.c +++ b/crypto/openssl/crypto/ppccap.c @@ -239,14 +239,18 @@ static unsigned long getauxval(unsigned long key) #endif /* I wish <sys/auxv.h> was universally available */ -#define HWCAP 16 /* AT_HWCAP */ +#ifndef AT_HWCAP +# define AT_HWCAP 16 /* AT_HWCAP */ +#endif #define HWCAP_PPC64 (1U << 30) #define HWCAP_ALTIVEC (1U << 28) #define HWCAP_FPU (1U << 27) #define HWCAP_POWER6_EXT (1U << 9) #define HWCAP_VSX (1U << 7) -#define HWCAP2 26 /* AT_HWCAP2 */ +#ifndef AT_HWCAP2 +# define AT_HWCAP2 26 /* AT_HWCAP2 */ +#endif #define HWCAP_VEC_CRYPTO (1U << 25) #define HWCAP_ARCH_3_00 (1U << 23) @@ -337,8 +341,8 @@ void OPENSSL_cpuid_setup(void) #ifdef OSSL_IMPLEMENT_GETAUXVAL { - unsigned long hwcap = getauxval(HWCAP); - unsigned long hwcap2 = getauxval(HWCAP2); + unsigned long hwcap = getauxval(AT_HWCAP); + unsigned long hwcap2 = getauxval(AT_HWCAP2); if (hwcap & HWCAP_FPU) { OPENSSL_ppccap_P |= PPC_FPU; |