arm inline assembly constraint for coprocessor registers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In the following inline assembly code, my input parameters need to be prefixed with "c" rather than "r". I.e. "c0" can be considered an alias for r0, and "c1" for r1, etc. I found several instances of inline assembly in the linux kernel which punted when it came to this - assuming that the function doesn't get inlined, and they
hard-code c0 and c1 in cases similar to the one below.

I've found current documentation on arm-specific constraints, which don't mention coprocessor registers, and I tried "c" as below, hoping that it would work. The "mrc" instruction syntax requires "c" registers for its
source operands, although they are actually the regular registers.

Any advice?

unsigned foo( unsigned a, unsigned b)
{
 int rc;
 __asm__( "mrc p6,0,%0,%1,%2,5": "=r"(rc): "c"(a),"c"(b));
 return( rc);
}

if not inlined, this needs to assemble as "mrc p6,0,r0,c0,c1,5", but I really don't want to hard-code c0 and c1"


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux