Pregunta

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.

¿Fue útil?

Solución

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.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top