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.

有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top