[U-Boot] [RFC PATCH v2] ARM: Avoid compiler optimization for usages of readb, writeb and friends.
Albert ARIBAUD
albert.aribaud at free.fr
Tue Dec 21 13:51:51 CET 2010
Le 21/12/2010 13:35, Alexander Holler a écrit :
> Hmm, is there actual somethinbg which should forbid the compiler to
> generate such code which rereads something? It might not be nice, but I
> don't think that it is forbidden for a compiler to do so. So the proper
> way to handle such, might be to use asm to avoid that the compiler
> touches that register.
Yes there is something that should prevent a compiler from inserting
reads: these accesses are to hardware, not memory, and may cause side
effects even on read (these could be acknowledges, for instance; I've
seen instances of that myself on some HW).
Another way to look at it is that the semantics of " *ptr = value " is a
pure write and should not result in a write-then-read.
> Regards,
>
> Alexander
Amicalement,
--
Albert.
More information about the U-Boot
mailing list