When using inline assembly in GCC
(see howto posted by nini09)
the following template is defined in your c code
asm ( assembler template
: output operands /* optional */
: input operands /* optional */
: list of clobbered registers /* optional */
%0 means the first operand used, and this starts counting at the output operands
in this example only one output operand is available so this is %0
only one input operand is used so this gets %1
when there would have been two output operands these would get %0 %1 as index
and the only input operand would get %2 as index
"=r" this modifier says that it is the output operand and is write-only ("="), and use an "r" register for this value
"i" means use an i type register for this value
(don't exactly know the internals of power-pc so correct me if i'm wrong)
Hope this explanation is clear, this is also mentioned in the GCC howto.
Registers, Register names etc., And how the compiler uses them is architecture specific and you should try to search for technical reference manuals of your architecture.
Last edited by robvoo; 08-08-2011 at 07:42 AM.