[Cbe-oss-dev] elfspe & argument passing
Jeremy Kerr
jk at ozlabs.org
Thu Jul 5 22:33:51 EST 2007
Ulrich,
> Link with -mstd-main.
Thanks! I'll give that a go.
> > * why does it need to be done in crt0 (hence causing an extra DMA)
> > anyway? This could done in libspe instead, where we set up the
> > original registers. We'd just need to copy the argv region to the
> > top of local store, and offset the stack pointer appropriately.
>
> For a long time, crt0 would ignore the incoming stack pointer
> and always reset $1 to the top of local store.
So this problem is fixed now? Is it reasonable to assume that a user is
using a fixed crt0?
> Also, when we discussed this, it was considered more efficient
> to copy the arguments in via DMA.
This is for contexts that are context-switched out, so the writes to the
mem file are backed by PPE memory. The entire PPE LS buffer will be
DMA-ed to the SPE when the context is scheduled, so we might as well
include argv[] there, and save an extra DMA.
This also means that we can simplify crt0 a little (doesn't need to do
the DMA for argv), and maybe even remove the need for -mstd-main ?
Of course, this doesn't apply to running contexts, where the writes to
the mem file are backed to the real LS, and would possibly be slower
than the extra DMA. But if you're calling spe_program_run() on an
already-running context, slower writes will be the least of your
problems :)
Cheers,
Jeremy
More information about the cbe-oss-dev
mailing list