Question

asm("stw r4, %0": "=m" (returnCode)) 

The above call is made from c to a Nios2 where return code is variable in C. I get stw stores from one register to another or from memory, but I'm not sure what the %0 or the "=m" represent.

Was it helpful?

Solution

I'm pretty sure this is GCC inline assembly, so with that in mind... And note... My GCC inline days are long behind me, but...

stw The instruction to be executed

r4 Looks like the name of a register

%0 Refers to the list of variables/registers/parameters after the colon

=m Is a constraint. =m means constrain operations on %0 to memory writes, if I'm readng the docs correctly.

See here for better explanations of GCC inline assembly.

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