linux-mips
[Top] [All Lists]

__asm__ C code in mips-Linux

To: linux-mips@linux-mips.org
Subject: __asm__ C code in mips-Linux
From: "Mike K." <linux_linux_2003@hotmail.com>
Date: Wed, 02 Apr 2003 17:02:08 -0800
Original-recipient: rfc822;linux-mips@linux-mips.org
Sender: linux-mips-bounce@linux-mips.org
extern __inline__ void atomic_add(int i, atomic_t * v)
{
        unsigned long temp;

        __asm__ __volatile__(
                "1:   ll      %0, %1      # atomic_add\n"
                "     addu    %0, %2                  \n"
                "     sc      %0, %1                  \n"
                "     beqz    %0, 1b                  \n"
                : "=&r" (temp), "=m" (v->counter)
                : "Ir" (i), "m" (v->counter));
}


Beginner questions on the above code:
1. what is %0 %1 %2?
2. what is the details meaning of the last two line of the above code?
3. Very thanksful if you can comment each line with detail description for me, thanks a lot!


_________________________________________________________________
The new MSN 8: advanced junk mail protection and 2 months FREE* http://join.msn.com/?page=features/junkmail


<Prev in Thread] Current Thread [Next in Thread>