[SLOF] [PATCH 3/4] fbuffer: Implement MRMOVE as an accelerated primitive
Segher Boessenkool
segher at kernel.crashing.org
Mon Sep 14 13:32:33 AEST 2015
On Sat, Sep 12, 2015 at 03:28:07PM +1000, Benjamin Herrenschmidt wrote:
> On Sat, 2015-09-12 at 00:41 +0200, Thomas Huth wrote:
>
> > register unsigned long r5 asm("r5") = arg2.u;
> > register unsigned long r6 = entry.u ;
> >
> > - asm volatile("mflr 31 ; mtctr %4 ; bctrl ; mtlr 31"
> > + asm volatile(" mtctr %4 ; bctrl "
> > : "=r" (r3)
> > : "r" (r3), "r" (r4), "r" (r5), "r" (r6)
> > : "ctr", "r6", "r7", "r8", "r9", "r10", "r11",
> > - "r12", "r13", "r31", "lr", "cc");
> > + "r12", "r13", "lr", "cc");
> >
> > return r3;
> > }
>
> That looks completely bogus. gcc has no idea that this is calling out
> and thus requires creation of a stack frame. Any reason why you can't
> just do a normal function pointer call ? (Maybe creating a little OPD
> on the stack).
Or write it in assembler (actual assembler, not inline). Or create a
stack frame in the inline asm (skipping the red zone of this leaf
function), if you are scared of .s files...
None of these three options will handle swapping TOC pointers at all.
Segher
More information about the SLOF
mailing list