[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Minios-devel] [UNIKRAFT PATCHv4 16/43] uk/arch: Implement ukarch_find_lsbit for Arm64



Hello,


On 07/13/2018 11:44 AM, Julien Grall wrote:
Hi,

On 13/07/18 10:20, Wei Chen wrote:
+#ifndef __UKARCH_ATOMIC_H__
+#error Do not include this header directly
+#endif
+

For finding the lsbit shouldn't we use the builtin function
__builtin_ffs, __builtin_ffsl?

AFAICT __builtin_ffs is GNU-ism. Do we really want to tie ourself to it?

Yes, this is a good point I had overlooked previously. On further looking into it, this builtin function is supported on gcc[1] and clang[2]. We may need to consider what other compiler tool chains do we need to be compatible with.

Also, do you know if that is supported correctly on all GCC versions we targets?
The __builitin_ffs were introduced as a part of the gcc version3.3
but the earliest documentation where it is been described is in 3.4 [1].




When I was implementing the ukarch_find_lsbit, I found both Arm32 and
X86_64 were not using the builtin-functions. X86_64 is using "bsfq",
Arm32 is using the same instructions as Arm64.

I agree in terms of consistency, we may use the current implementation.

I wanted to clarify if we made an explicit decision to provide our own implementation for the ffs.

To be honest, I would keep the implement as it is.

Cheers,


[1]gcc: https://gcc.gnu.org/onlinedocs/gcc-3.4.6/gcc/Other-Builtins.html#Other-Builtins

[2] Clang: https://github.com/llvm-mirror/clang/blob/release_26/include/clang/Basic/Builtins.def


Thanks & Regards
Sharan

_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.