Re: Atomic Increment Query.

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

 



No register is being used in this code. The constraint is "m", which means
variable is in memory. %0 means, first argument.

Regards
Mohanlal

----- Original Message -----
From: "matrix reloaded" <matrix_reloaded18@xxxxxxxxxxxxxx>
To: <kernelnewbies@xxxxxxxxxxxx>
Sent: Monday, August 09, 2004 7:52 PM
Subject: Atomic Increment Query.


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__
olatile__( 
    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.



--
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