ARM inline Assembler
来自个人维基
2019年11月8日 (五) 11:46free6d1823(讨论 | 贡献)的版本
asm(code : output operand list : input operand list : clobber list);
example: Rotating bits example
int x;
int y;
y= (x>>1);
asm("mov %[result], %[value], ror #1" : [result] "=r" (y) : [value] "r" (x));
register value (r1) = x
register result (r2) = y
result = (value >> 1)
example: sets the current program status register of the ARM CPU.
asm("msr cpsr,%[ps]" : : [ps]"r"(status));
int status;
ps (r2) = status
cpsr = ps
Referernce: http://www.ethernut.de/en/documents/arm-inline-asm.html