Question

I've been searching through the entire manuals and I can't find a single mention of the Instruction Pointer. I need this for a SPU program that I'm writing. Maybe it has a different name? Can anyone tell me how I can access the address of the instruction that is to be executed? Thanks in advance for your help. UPDATE: Apperantly it's called the Program Counter, but how can I access it from within my SPU Program?

Was it helpful?

Solution

If you just want to get the instruction pointer, you can do it in assembly:

brsl r<n>, .+4

This loads the address of the next instruction into register r<n>.

OTHER TIPS

Seems like you can get the next instruction by executing a spe_context_run operation:

int spe_context_run(spe_context_ptr_t spe, unsigned int *entry, unsigned int runflags, void *argp, void *envp, spe_stop_info_t *stopinfo)

entry

Input: The entry point, that is, the initial value of the SPU instruction pointer, at which the SPE program should start executing. If the value of entry is SPE_DEFAULT_ENTRY, the entry point for the SPU main program is obtained from the loaded SPE image. This is usually the local store address of the initialization function crt0 (see Cell Broadband Engine Programming Handbook, Objects, Executables, and SPE Loading).

Output: The SPU instruction pointer at the moment the SPU stopped execution, that is, the local store address of the next instruction that would be have been executed.

This parameter can be used, for example, to allow the SPE program to "pause" and request some action from the PPE thread, for example, performing an I/O operation. After this PPE-side action has been completed, you can continue the SPE program calling spe_context_run again without changing entry.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top