Atomic Increment Query.

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

 



Hi, 
	I was going through atomic_inc() function for i386 platform and found the 
following code :- 
 
/** 
     99  * atomic_inc - increment atomic variable 
    100  * @v: pointer of type atomic_t 
    101  * 
    102  * Atomically increments @v by 1.  Note that the guaranteed 
    103  * useful range of an atomic_t is only 24 bits. 
    104  */ 
    105 static __inline__ void atomic_inc(atomic_t *v) 
    106 { 
    107     __asm__ __volatile__( 
    108         LOCK "incl %0" 
    109         :"=m" (v->counter) 
    110         :"m" (v->counter)); 
	} 
 
This line of code is somewhat confusing me as according to me there should be 
"incl %1" there. But I think that there is the same register being used for input and 
output thing, so for this scenario actually %0 and %1 both refer to the same 
register. Am I right or something else is there ? 
 
Thanks in advane. 
Sumit. 

[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