[Cbe-oss-dev] libspe2: RUN_USER_REGS without DEFAULT_ENTRY

David Mirabito davidm at ok-labs.com
Mon Sep 8 12:10:50 EST 2008


Hi,

I think this is mostly a documentation clarification, so hopefully  
this is the right place for that.

Assuming nothing else, a straight reading of libspe-2.0.pdf seems to  
imply that I can call spe_context_run with arbitrary entrypoints and  
also specify SPE_RUN_USER_REGS to preload r3-r5. Whilst coming to  
terms with the architecture, I was using spe_context_run to jump to  
different functions (which return with a 'stop') and was attempting to  
set the arguments this way, and from reading the PDF, expected this to  
work.

Now looking at spebase/run.c it's clear what's going on:  the check  
for user regs and associated set_regs only occur when entry is the  
ELF's entrypoint. Which makes sense if it is only ever intended to be  
an initialiser for _start.

So now I wonder:
   1. Should perhaps the doc make this clearer, or am I just being a  
little thick?
   2. Is the ability to jump to any PC at will and set r3-r5 a valid  
use case in the first place?

There are plenty of workarounds for (2) (stashing the argument to  
_start and using that as a pointer to per-function arguments, for  
instance) but I suppose I'm just curious now.

Thanks,
   - David Mirabito



More information about the cbe-oss-dev mailing list