mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-29 18:27:29 +02:00
Detect if using C99 and use correct inline asm notation
This commit is contained in:
@ -1180,15 +1180,22 @@ WOLFSSL_ABI WOLFSSL_API int wolfCrypt_Cleanup(void);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef WOLF_C99
|
||||
/* use alternate keyword for compatibility with -std=c99 */
|
||||
#define XASM_VOLATILE(a) __asm__ volatile(a)
|
||||
#else
|
||||
#define XASM_VOLATILE(a) asm volatile(a)
|
||||
#endif
|
||||
|
||||
#ifndef WOLFSSL_NO_FENCE
|
||||
#if defined (__i386__) || defined(__x86_64__)
|
||||
#define XFENCE() asm volatile("lfence")
|
||||
#define XFENCE() XASM_VOLATILE("lfence")
|
||||
#elif defined (__arm__) || defined(__aarch64__)
|
||||
#define XFENCE() asm volatile("isb")
|
||||
#define XFENCE() XASM_VOLATILE("isb")
|
||||
#elif defined(__riscv)
|
||||
#define XFENCE() asm volatile("fence")
|
||||
#define XFENCE() XASM_VOLATILE("fence")
|
||||
#elif defined(__PPC__)
|
||||
#define XFENCE() asm volatile("isync; sync")
|
||||
#define XFENCE() XASM_VOLATILE("isync; sync")
|
||||
#else
|
||||
#define XFENCE() do{}while(0)
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user