Re: [Gc] libatomic-ops nios2

Chung-Lin Tang <[email protected]> Thu, 28 Jan 2016 10:06:34 +0800
Newsgroups gmane.comp.programming.garbage-collection.boehmgc
Message-ID <[email protected]>
On 2016/1/28 04:43 AM, Marek Vasut wrote:
> Hello,
> 
> I am trying to add support for nios2 CPU into libatomic-ops and gc .
> The Linux kernel exports kuser helper for cmpxchg [1], so I believe
> this might be the way to go? Or shall I somehow use the gcc atomic
> builtin ops [2] ? Note that nios2 does not have dedicated atomic
> instructions which could be used in userland, that's why the kuser
> helper.
> 
> Thank you for any input!
> 
> [1] http://lxr.free-electrons.com/source/arch/nios2/kernel/entry.S#L535
> [2] https://github.com/gcc-mirror/gcc/blob/master/libgcc/config/nios2/linux-
> atomic.c
> 
> Best regards,
> Marek Vasut
> 

The libgcc builtins still end up using the kuser interface as well, so
in a certain sense they're equivalent.

You may want to go the direct kuser route. A little bit of inline asm
should get you more performance compared to calling into libgcc, and
nios2 softcores can really use that bit of optimization. That's also
what I did in glibc.

Chung-Lin