View Single Post
Old Jun 24th, 2005, 8:55 AM   #3
earl
Newbie
 
Join Date: Jun 2005
Posts: 18
Rep Power: 0 earl is on a distinguished road
Thanks DaWei. This is for SPARC assembly, so the syntax is different and I'm not sure I can reference variable names within inline asm with my compiler.

But I found a similar solution:

register int tmp asm("l2");

asm(" ... "
    "mov %l0, %l2"
    " ... ");

return tmp;

I guess this allocates my local variable to the contents of register %l2, which is a local register for SPARC. I can modify that register in the asm block and the change is made to the variable as well.
earl is offline   Reply With Quote