Aarch64 support for libev

Marc Lehmann schmorp at schmorp.de
Fri Mar 21 17:40:24 CET 2014


On Fri, Mar 21, 2014 at 05:23:11PM +0100, Marc Lehmann <schmorp at schmorp.de> wrote:
> I can synthesize this from your first patch, and your second patch (so you
> already gave me all the precious information I need). It would be nice if
> you could test it when it is finished, though :)

Below is the patch I applied to ecb.h (I also updated ev.c in CVS). I have
a few questions, to get it right:

- I assume aarch64 always defines __arm__ (otherwise I cna just add
  an explicit defined __arch64__, too).
- I assume I got the logic in the defined __arm__ branch right :)
- changing ANDROID to __ANDROID__ is ok (the former isn't allowed in iso c,
  and predef says the latter is the right one to test for).

The effect should be that all arm platforms except the unknown ones (which
presumably are all the old ones only) get the memcpy implementation, which
would be a great improvement.

Thanks a lot for your input!

@@ -144,6 +144,8 @@
     #elif defined __ARM_ARCH_7__  || defined __ARM_ARCH_7A__  \
        || defined __ARM_ARCH_7M__ || defined __ARM_ARCH_7R__
       #define ECB_MEMORY_FENCE         __asm__ __volatile__ ("dmb"      : : : "memory")
+    #elif __aarch64__
+      #define ECB_MEMORY_FENCE         __asm__ __volatile__ ("dmb ish"  : : : "memory")
     #elif (__sparc || __sparc__) && !__sparcv8
       #define ECB_MEMORY_FENCE         __asm__ __volatile__ ("membar #LoadStore | #LoadLoad | #StoreStore | #StoreLoad" : : : "memory")
       #define ECB_MEMORY_FENCE_ACQUIRE __asm__ __volatile__ ("membar #LoadStore | #LoadLoad"                            : : : "memory")
@@ -603,7 +605,8 @@ ecb_inline ecb_bool ecb_little_endian (v
     || defined __m68k__ \
     || defined __m88k__ \
     || defined __sh__ \
-    || defined _M_IX86 || defined _M_AMD64 || defined _M_IA64
+    || defined _M_IX86 || defined _M_AMD64 || defined _M_IA64 \
+    || (defined __arm__ && (defined __ARM_EABI__ || defined __EABI__ || defined __VFP_FP__ || defined _WIN32_WCE || defined __ANDROID__))
   #define ECB_STDFP 1
   #include <string.h> /* for memcpy */
 #else

-- 
                The choice of a       Deliantra, the free code+content MORPG
      -----==-     _GNU_              http://www.deliantra.net
      ----==-- _       generation
      ---==---(_)__  __ ____  __      Marc Lehmann
      --==---/ / _ \/ // /\ \/ /      schmorp at schmorp.de
      -=====/_/_//_/\_,_/ /_/\_\



More information about the libev mailing list