One of the dangers of intermixing assembly language and a compiled language such as Ada is that the compiler needs to be aware of which registers are being used by the assembly code. In some cases, such as the earlier examples, the constraint string is sufficient to indicate register usage (e.g., "a" for the eax register). But more generally, the compiler needs an explicit identification of the registers that are used by the Inline Assembly statements.
Using a register that the compiler doesn't know about could be a side effect of an instruction (like mull storing its result in both eax and edx). It can also arise from explicit register usage in your assembly code; for example:
Asm ("movl %0, %%ebx" & LF & HT & "movl %%ebx, %1", Outputs => Unsigned_32'Asm_Output ("=g", Var_Out), Inputs => Unsigned_32'Asm_Input ("g", Var_In));
where the compiler (since it does not analyze the Asm template string) does not know you are using the ebx register.
In such cases you need to supply the Clobber parameter to Asm, to identify the registers that will be used by your assembly code:
Asm ("movl %0, %%ebx" & LF & HT & "movl %%ebx, %1", Outputs => Unsigned_32'Asm_Output ("=g", Var_Out), Inputs => Unsigned_32'Asm_Input ("g", Var_In), Clobber => "ebx");
The Clobber parameter is a static string expression specifying the register(s) you are using. Note that register names are `not' prefixed by a percent sign. Also, if more than one register is used then their names are separated by commas; e.g., "eax, ebx"
The Clobber parameter has several additional uses: