Restore ASMABI and other Unify work

Make sure all SHA2 transform function has wrappers

For ASMABI to work, it is required the calling convention
is consistent.

Reviewed-by: Tino Reichardt <milky-zfs@mcmilk.de>
Reviewed-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Signed-off-by: Joergen Lundman <lundman@lundman.net>
Closes #14569
This commit is contained in:
Jorgen Lundman
2023-03-07 08:24:05 +09:00
committed by GitHub
parent 620a977f22
commit 47119d60ef
5 changed files with 56 additions and 37 deletions
+13 -3
View File
@@ -29,9 +29,10 @@
#include <sys/simd.h>
#include <sha2/sha2_impl.h>
#include <sys/asm_linkage.h>
#define TF(E, N) \
extern void E(uint32_t s[8], const void *, size_t); \
extern void ASMABI E(uint32_t s[8], const void *, size_t); \
static inline void N(uint32_t s[8], const void *d, size_t b) { \
kfpu_begin(); E(s, d, b); kfpu_end(); \
}
@@ -44,10 +45,19 @@ static inline boolean_t sha2_is_supported(void)
#if defined(__x86_64)
extern void zfs_sha256_transform_x64(uint32_t s[8], const void *, size_t);
/* Users of ASMABI requires all calls to be from wrappers */
extern void ASMABI
zfs_sha256_transform_x64(uint32_t s[8], const void *, size_t);
static inline void
tf_sha256_transform_x64(uint32_t s[8], const void *d, size_t b)
{
zfs_sha256_transform_x64(s, d, b);
}
const sha256_ops_t sha256_x64_impl = {
.is_supported = sha2_is_supported,
.transform = zfs_sha256_transform_x64,
.transform = tf_sha256_transform_x64,
.name = "x64"
};
+12 -3
View File
@@ -29,9 +29,10 @@
#include <sys/simd.h>
#include <sha2/sha2_impl.h>
#include <sys/asm_linkage.h>
#define TF(E, N) \
extern void E(uint64_t s[8], const void *, size_t); \
extern void ASMABI E(uint64_t s[8], const void *, size_t); \
static inline void N(uint64_t s[8], const void *d, size_t b) { \
kfpu_begin(); E(s, d, b); kfpu_end(); \
}
@@ -44,10 +45,18 @@ static inline boolean_t sha2_is_supported(void)
#if defined(__x86_64)
extern void zfs_sha512_transform_x64(uint64_t s[8], const void *, size_t);
/* Users of ASMABI requires all calls to be from wrappers */
extern void ASMABI
zfs_sha512_transform_x64(uint64_t s[8], const void *, size_t);
static inline void
tf_sha512_transform_x64(uint64_t s[8], const void *d, size_t b)
{
zfs_sha512_transform_x64(s, d, b);
}
const sha512_ops_t sha512_x64_impl = {
.is_supported = sha2_is_supported,
.transform = zfs_sha512_transform_x64,
.transform = tf_sha512_transform_x64,
.name = "x64"
};