Gcc allows you to inline assembly within C source code. The assembly instruction can have input and output parameters to interact with the C code. An inline assembly without arguments is written as follows:

  asm volatile ("cli");  

The volatile keyword is optional. It tells Gcc not to optimize the instruction by not removing or changing its place within the code. It is more than recommended to use it.

Input and output parameters are specified by constraints. The constraint is a string that indicates the characteristics of the operand in terms of constant, register, memory and so on. The output operands are listed first and introduced by =. The following instruction:

  asm volatile ("tpa\n\tsei" : "=d"(mask));  

defines an output operand that is read from register d and put in the local variable named mask.

A more complete description about the asm mechanisms is presented in the following sections: