M1 Support

We separate out 64-bit desktop support based on the Intel check. With
the advent of the new Apple chip, ARM can also be a desktop processor.
Detect it like we do the Intel 64-bit, and treat it similarly with
respect to fast and normal math.
This commit is contained in:
John Safranek
2021-01-06 09:18:57 -08:00
parent 54f072fd8d
commit d4e13796c2
5 changed files with 11 additions and 4 deletions

View File

@@ -4530,6 +4530,7 @@ then
# Have settings.h set FP_MAX_BITS higher if user didn't set directly # Have settings.h set FP_MAX_BITS higher if user didn't set directly
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_X86_64_BUILD" AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_X86_64_BUILD"
fi fi
AS_IF([test "x$host_cpu" = "xaarch64"],[AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AARCH64_BUILD"])
fi fi

View File

@@ -273,7 +273,8 @@ WC_STATIC WC_INLINE void ForceZero(const void* mem, word32 len)
{ {
volatile byte* z = (volatile byte*)mem; volatile byte* z = (volatile byte*)mem;
#if defined(WOLFSSL_X86_64_BUILD) && defined(WORD64_AVAILABLE) #if (defined(WOLFSSL_X86_64_BUILD) || defined(WOLFSSL_AARCH64_BUILD)) \
&& defined(WORD64_AVAILABLE)
volatile word64* w; volatile word64* w;
#ifndef WOLFSSL_UNALIGNED_64BIT_ACCESS #ifndef WOLFSSL_UNALIGNED_64BIT_ACCESS
word32 l = (sizeof(word64) - ((size_t)z & (sizeof(word64)-1))) & word32 l = (sizeof(word64) - ((size_t)z & (sizeof(word64)-1))) &

View File

@@ -72,7 +72,7 @@ extern "C" {
/* detect 64-bit mode if possible */ /* detect 64-bit mode if possible */
#if defined(__x86_64__) && !(defined (_MSC_VER) && defined(__clang__)) #if (defined(__x86_64__) || defined(__aarch64__)) && !(defined (_MSC_VER) && defined(__clang__))
#if !(defined(MP_64BIT) && defined(MP_16BIT) && defined(MP_8BIT)) #if !(defined(MP_64BIT) && defined(MP_16BIT) && defined(MP_8BIT))
#define MP_64BIT #define MP_64BIT
#endif #endif

View File

@@ -1979,7 +1979,7 @@ extern void uITRON4_free(void *p) ;
#endif #endif
/* if desktop type system and fastmath increase default max bits */ /* if desktop type system and fastmath increase default max bits */
#ifdef WOLFSSL_X86_64_BUILD #if defined(WOLFSSL_X86_64_BUILD) || defined(WOLFSSL_AARCH64_BUILD)
#if defined(USE_FAST_MATH) && !defined(FP_MAX_BITS) #if defined(USE_FAST_MATH) && !defined(FP_MAX_BITS)
#if MIN_FFDHE_FP_MAX_BITS <= 8192 #if MIN_FFDHE_FP_MAX_BITS <= 8192
#define FP_MAX_BITS 8192 #define FP_MAX_BITS 8192

View File

@@ -70,7 +70,12 @@
#define TFM_X86_64 #define TFM_X86_64
#endif #endif
#endif #endif
#if defined(TFM_X86_64) #if defined(__aarch64__)
#if !defined(TFM_AARCH_64) && !defined(TFM_NO_ASM)
#define TFM_AARCH_64
#endif
#endif
#if defined(TFM_X86_64) || defined(TFM_AARCH_64)
#if !defined(FP_64BIT) #if !defined(FP_64BIT)
#define FP_64BIT #define FP_64BIT
#endif #endif