Mike Frysinger wrote:
>  - next ~1k is user-space atomic code (initialized by kernel at boot)
> 
> so when userspace wants to do atomic functions (since the hardware doesnt 
> support it), it calls the functions hardcoded in this region.  when the 
> kernel 
> goes to return to userspace, it checks the PC isnt in this region.  if it is, 
> it will finish the atomic operation for userspace and update the PC.

How exactly is this done ?

I suppose it imposes some additional overhead to each interrupt, as on
entry or exit there is some code that checks whether the PC had been in
that region (this is what you say).

If it is I suppose some "interesting" code is necessary to find out if
the should-be atomic code sequence already is finished (with a write
memory instruction) or if it is not yet finished and according to that
act appropriately by - only in case of not finished - setting the return
PC to the point of restarting the atomic code sequence.

Moreover each atomic_xxx() function needs some additional overhead as it
can't be inlined but needs a far call (and thus additional cache usage)
to the special region.

Are some atomic functions predefined in the said region or do the user
space programs need to create them (in fact I suppose the region is
write protected, if that is possible with the chip ??? ) ?

Do you thinks this is an appropriate addition to the NIOS2 distribution
? (My other idea is to do a hardware "custom instruction" that creates a
dedicated Futex that can be used to protect atomic code sequences.)

Thanks for jumping in here,
-Michael
_______________________________________________
uClinux-dev mailing list
uClinux-dev@uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev@uclinux.org
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev

Reply via email to