Re: gnu asm help...

From: Timur Tabi (ttabi@interactivesi.com)
Date: Mon Jun 18 2001 - 18:20:52 EST


** Reply to message from "Raj, Ashok" <ashok.raj@intel.com> on Mon, 18 Jun 2001
15:56:50 -0700

> also if there is any reference to the gnu asm symtax, please send me a
> pointer..

There's lots

> i can understand what the LOCK "incl %0 means.. but not sure what the rest
> is for.

LOCK just means the x86 "lock" prefix.

incl is the 32-bit version of "inc" (incremement)

You want to return the variable? Try this:

static __inline__ unsigned long atomic_inc(atomic_t *v)
{
    __asm__ __volatile__(
        LOCK "incl %0"
        :"=m" (v->counter)
        :"m" (v->counter));

    return v->counter;
}

-- 
Timur Tabi - ttabi@interactivesi.com
Interactive Silicon - http://www.interactivesi.com

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Jun 23 2001 - 21:00:22 EST