mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2026-07-06 18:10:50 +02:00
move WC_BARRIER() definition from wolfssl/wolfcrypt/types.h to wolfssl/wolfcrypt/wc_port.h, and strengthen it.
This commit is contained in:
@@ -489,12 +489,6 @@ enum {
|
||||
static WC_INLINE WARN_UNUSED_RESULT int WC_WUR_INT(int x) { return x; }
|
||||
#endif
|
||||
|
||||
/* XFENCE() is a no-op on some targets. WC_BARRIER() uses C89 intrinsics as an
|
||||
* additional portable barrier.
|
||||
*/
|
||||
#define WC_BARRIER() do { volatile byte _xfence = 0; (void)_xfence; XFENCE(); \
|
||||
} while(0)
|
||||
|
||||
#ifdef WORD64_AVAILABLE
|
||||
#define WC_MAX_UINT_OF(x) \
|
||||
((x)((((word64)1 << ((sizeof(x) * (word64)CHAR_BIT) - \
|
||||
|
||||
@@ -1808,6 +1808,18 @@ WOLFSSL_ABI WOLFSSL_API int wolfCrypt_Cleanup(void);
|
||||
#define XFENCE() WC_DO_NOTHING
|
||||
#endif
|
||||
|
||||
#ifdef WC_BARRIER
|
||||
/* use user-supplied WC_BARRIER() definition. */
|
||||
#elif defined(__GNUC__) && !defined(WOLFSSL_NO_ASM)
|
||||
#define WC_BARRIER() __asm__ __volatile__("" ::: "memory")
|
||||
#else
|
||||
/* XFENCE() is a no-op on some targets. The fallback construct uses C89
|
||||
* intrinsics as an additional (but weak) portable barrier.
|
||||
*/
|
||||
#define WC_BARRIER() do { volatile byte _xfence = 0; (void)_xfence; XFENCE(); \
|
||||
} while(0)
|
||||
#endif
|
||||
|
||||
|
||||
/* AFTER user_settings.h is loaded,
|
||||
** determine if POSIX multi-threaded: HAVE_PTHREAD */
|
||||
|
||||
Reference in New Issue
Block a user