Aarch64 support for libev

Riku Voipio riku.voipio at linaro.org
Mon Mar 24 08:37:44 CET 2014


Hi,

On 21 March 2014 18:40, Marc Lehmann <schmorp at schmorp.de> wrote:
> 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).

 __aarch64__ doesn't define __arm__, most cases where one would ifdef
__arm__
would end up wrong with aarch64.

> - I assume I got the logic in the defined __arm__ branch right :)

looks good, only now there is two matches for __arm__ and eabi in the ifdef
:)

> - 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).

Right, I think I tested with the latter one anyway, I don't know how that
ended
in the patch.

I've attached a patch to remove the duplicate arm case and adds __aarch64__,
although I'm sure you can do it as fast in editor than with applying patch
;)

> 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.

-snip- from other mail-
>safe fallback, i.e. it shuld work on every architecture, even the
> ones using ieee format in "expected" endianness.

I see, I missed that the code should work everywhere. Thanks for explaining!

> 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
>       -=====/_/_//_/\_,_/ /_/\_\
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.schmorp.de/pipermail/libev/attachments/20140324/1b843515/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libev-aarch64.patch
Type: text/x-patch
Size: 1173 bytes
Desc: not available
URL: <http://lists.schmorp.de/pipermail/libev/attachments/20140324/1b843515/attachment.bin>


More information about the libev mailing list