Source-Changes-D archive

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

Re: CVS commit: src/sys/arch/sparc64/include



On Tue, Dec 30, 2014 at 04:34:42PM -0600, Dennis Ferguson wrote:
> 
> On 30 Dec, 2014, at 12:52 , David Laight <david%l8s.co.uk@localhost> wrote:
> > Is that the correct fix?
> > Unless the rdpr actually accesses memory (don't think it does) then
> > then problem is probably a missing 'volatile' instead.
> > 
> > Certainly the way those asm functions are defined looks to be
> > rather more obfuscated than necessary.
> 
> Or maybe just get rid of the __constfunc?  I think that, plus
> the (void) argument list to the inline, is explicitly telling the
> compiler it should feel free to move the call absolutely anywhere
> it feels like placing it.

The relevant optimisations happen after the inline, so the function
definition shouldn't affect things.
I'm guessing that __constfunc just means that the compiler can merge
multiple calls (and cache the result), not at all sure that is
valid with a "memory" clobber.

> I'm a bit surprised the "memory" clobber by itself changed anything
> at all since I thought a "memory" clobber without a 'volatile' is
> supposed to refer only to memory-based input and output arguments
> to the asm(), of which there are none.

The compiler doesn't know which args to the asm reference memory
unless you tell it with an appropriate 'clobber' - either the
global one, or a ranged one based on one if the arguments.

In this case I suspect removing __constfunc and making the
asm volatile will force correct sequencing.

	David

-- 
David Laight: david%l8s.co.uk@localhost


Home | Main Index | Thread Index | Old Index