A question about register constraint of inline assembly

Ian Lance Taylor ian@airs.com
Thu Jun 2 03:24:00 GMT 2005


"Lin Chun-Zhi" <lcz90@cs.ccu.edu.tw> writes:

> I got a question about register constraint in kernel source.
> Here is the cut of bios32_service()
> 
> 597         __asm__("lcall (%%edi); cld"
> 598                 : "=a" (return_code),
> 599                   "=b" (address),
> 600                   "=c" (length),
> 601                   "=d" (entry)
> 602                 : "" (service),
> 603                   "1" (0),
> 604                   "D" (&bios32_indirect));
> 
> In line 602, its register constraint is a NULL string. I can't find how
> compiler arranges the registers in gcc.info.

If there are no constraints, the compiler does not constrain the
operand.  It could be anywhere.  The statement will use "service",
though; assignments to it will not be deleted.

By the way, in linux-2.6.8.1 that statement looks like this:

	__asm__("lcall *(%%edi); cld"
		: "=a" (return_code),
		  "=b" (address),
		  "=c" (length),
		  "=d" (entry)
		: "0" (service),
		  "1" (0),
		  "D" (&bios32_indirect));

Ian



More information about the Gcc-help mailing list