[SLOF] [PATCH 3/4] fbuffer: Implement MRMOVE as an accelerated primitive
Benjamin Herrenschmidt
benh at au1.ibm.com
Mon Sep 14 20:43:37 AEST 2015
On Mon, 2015-09-14 at 12:27 +0200, Thomas Huth wrote:
> On 12/09/15 07:28, Benjamin Herrenschmidt wrote:
> This seems to work:
>
> static unsigned long __attribute__((noinline))
> call_c(cell arg0, cell arg1, cell arg2, cell entry)
> {
> unsigned long (*fp)(cell a0, cell a1, cell a2);
> unsigned long desc[3];
>
> desc[0] = entry.u;
> desc[1] = desc[2] = 0;
> barrier();
> fp = (unsigned long (*)(cell a0, cell a1, cell a2))desc;
>
> return fp(arg0, arg1, arg2);
> }
Should we set the TOC in the descriptor to match the caller or should
we just leave it to 0 ?
> But it also contains a small hack: I need the barrier() in between
> (which is a asm volatile("":::"memory) call) or the compiler will not
> recognize fp as being set (even though we compile with
> -fno-strict-aliasing ?!?).
Now *that* is strange. segher any idea here ?
> I also tried using a union, but that did not
> work out very well, somehow the compiler then tried to be really
> smart
> and treated entry.u as pointer to a function descriptor, not a
> pointer
> to the function code ... really strange (or I did something very
> wrong).
>
> Do you think the above code is acceptable? If yes, I'll send a proper
> patch for this, if not, I think I'll have a try with one of Segher's
> suggestions.
>
> Thomas
>
> _______________________________________________
> SLOF mailing list
> SLOF at lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/slof
More information about the SLOF
mailing list