[U-Boot] [PATCH] ARM926: Add mb to the cache invalidate/flush

Albert ARIBAUD
2012-10-11T20:01:32Z

Hi Mark,

Thanks for your example.

> My understanding of gcc is that global memory accesses are meant to
> stay on the correct side of an asm with a "memory" clobber. The gcc
> manual states that if you use a memory clobber, the asm should also
> be volatile.

Not exactly. It states that you need to add volatile if you cannot tell
where in memory your instruction will write; if you can tell (by
specifying "m" as an output of the asm) then volatile is not
needed -- simply because the compiler can tell where in memory the
write will happen, and will thus not eliminate the asm statement as
long as the destination memory is not optimized out.

> I'm not sure if adding the memory clobber is enough, but it's certainly a help.

memory clobber can help, but I don't think it helps, and I know it does
not help enough, in the patch's case.

> Regards,
>
> Mark M.

Amicalement,
--
Albert.