mirror of
https://github.com/openssl/openssl.git
synced 2024-12-15 06:01:37 +08:00
c612289b77
Running LSX instructions requires both the hardware support and the kernel support. The `cpucfg` instruction only tests the hardware support, causing a SIGILL if the hardware supports LSX but the kernel does not. Use `getauxval(AT_HWCAP)` as the ["Software Development and Build Convention for LoongArch Architectures"][1] manual suggests. The LOONGARCH_HWCAP_LSX and LOONGARCH_HWCAP_LASX bits are copied from the manual too. In Glibc 2.38 they'll be provided by <sys/auxv.h> as well, but they are unavailable in earlier Glibc versions so we cannot rely on it. The getauxval syscall and Glibc wrapper are available since day one (Linux-5.19 and Glibc-2.36) for LoongArch. Fixes #21508. [1]:https://github.com/loongson/la-softdev-convention/blob/master/la-softdev-convention.adoc#kernel-constraints Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21509)
17 lines
540 B
C
17 lines
540 B
C
/*
|
|
* Copyright 2022 The OpenSSL Project Authors. All Rights Reserved.
|
|
*
|
|
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
|
* this file except in compliance with the License. You can obtain a copy
|
|
* in the file LICENSE in the source distribution or at
|
|
* https://www.openssl.org/source/license.html
|
|
*/
|
|
#ifndef OSSL_CRYPTO_LOONGARCH_ARCH_H
|
|
# define OSSL_CRYPTO_LOONGARCH_ARCH_H
|
|
|
|
extern unsigned int OPENSSL_loongarch_hwcap_P;
|
|
# define LOONGARCH_HWCAP_LSX (1 << 4)
|
|
# define LOONGARCH_HWCAP_LASX (1 << 5)
|
|
|
|
#endif
|