On Wed, Oct 18, 2017 at 05:17:19PM +0200, Michael Matz wrote:
> On Wed, 18 Oct 2017, Segher Boessenkool wrote:
> 
> > Certainly.  And to work around the bug, it should work to mention some
> > hard register as asm input.  Ideally something that is live anyway;
> > perhaps the stack pointer :-)  Like so:
> > 
> >   __asm volatile ("mrs %0,PRIMASK" : "=r" (status) :: "sp");
> > 
> > (I tested this, it does work around the bug).
> > 
> > Or hey, why not the program counter, that should make it even clearer
> > something is funny here:
> > 
> >   __asm volatile ("mrs %0,PRIMASK" : "=r" (status) :: "pc");
> > 
> > (also tested, works fine).
> 
> Both of these are not asm inputs but clobbers, though :)

Yeah I typed (and tested) the code after writing that first sentence.
Clobbering was easier :-)

>  And clobbering 
> "pc" could have funny effects if any of our allocators ever would produce 
> save/restore code around such asms for such clobbers.

Yeah -- but sp (and pc, if it exists) is a fixed register, so we don't
do such things :-)


Segher

Reply via email to