gcc inline asm

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

 



  In studying the kernel I find many gcc inline 'asm' statements,
like so.
	
        asm ( assembler template
	    : output operands			 	(optional)
	    : input operands			 	(optional)
	    : list of clobbered registers 	  	(optional)
	    );	


  I have read all the docs and I still can't clearly understand when it is
required to specify a clobberlist - a register or memory that will be modified
and must be preserved by gcc.

  In searching the kernel source there were very few clobbers given
and most of those were for memory.

For example in arch/i386/lib/delay.c:

71         __asm__("mull %0"
72         :"=d" (xloops), "=&a" (d0)
73         :"1" (xloops),"" (current_cpu_data.loops_per_jiffy));
74         __delay(xloops * HZ);

  It's pretty obvious that eax gets clobbered.  Why is it unlisted?
Does the answer to this question apply in all cases? What about memory 
clobbers - how do they happen?


__________________________________________________
Do You Yahoo!?
Yahoo! Sports - live college hoops coverage
http://sports.yahoo.com/
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux