Inline assembly gcc allows inline assembly in C sources or headers The code must interact with the optimizer The syntax is not trivial at all asm("code" : r-output : r-input : r-clobber); The "code" string can't use explicit register names You can use positional names ("%0") or symbolic names ("%[timeout]") The register lists (out and in) declare their C expressions The list of clobbered registers can also include memory: it means memory external to the CPU has been modified cc: it means "condition code" flags are modified by the asm code Examples: #define set_cr(x) /* arm */ \ __asm__ __volatile__( \ "mcr p15, 0, %0, c1, c0, 0 @ set CR" \ : : "r" (x) : "cc") #define mb() __asm__ __volatile__ ("" : : : "memory") #define rdtsc(low,high) /* x86 */ asm("rdtsc" : "=a" (low), "=d" (high)) All documentation is part of the gcc manual