Re: gnu asm help...

2001-06-19 Thread Petr Vandrovec
On 19 Jun 01 at 13:21, Richard B. Johnson wrote: > On Tue, 19 Jun 2001, Timur Tabi wrote: > > Oh, I see the problem. You could do something like this: > > > > cli > > mov %0, %%eax > > inc %%eax > > mov %%eax, %0 > > sti > > > > and then return eax, but that won't work on SMP (whereas the "lock

Re: gnu asm help...

2001-06-19 Thread Richard B. Johnson
On Tue, 19 Jun 2001, Timur Tabi wrote: > ** Reply to message from "Petr Vandrovec" <[EMAIL PROTECTED]> on Tue, 19 Jun > 2001 01:36:26 MET-1 > > > > No. Another CPU might increment value between LOCK INCL and > > fetching v->counter. On ia32 architecture you are almost out of > > luck. You can e

Re: gnu asm help...

2001-06-19 Thread Timur Tabi
** Reply to message from "Petr Vandrovec" <[EMAIL PROTECTED]> on Tue, 19 Jun 2001 01:36:26 MET-1 > No. Another CPU might increment value between LOCK INCL and > fetching v->counter. On ia32 architecture you are almost out of > luck. You can either try building atomic_inc around CMPXCHG, > using

Re: gnu asm help...

2001-06-19 Thread Alan Cox
> I need a simple (??) change to atomic_inc() functionality. so that i can > increment and return the value of the variable. Please don't blindly change atomic.h to do this. A large number of processors don't have the x86 'xadd' functionality. Create/use seperate functions instead - To unsubscri

Re: gnu asm help...

2001-06-18 Thread Bohdan Vlasyuk
On Tue, Jun 19, 2001 at 01:18:41AM +0200, Erik Mouw wrote: > I also don't know the exact meaning, but here are two nice tutorials > about inline assembly: > > http://www-106.ibm.com/developerworks/linux/library/l-ia.html > http://www.uwsg.indiana.edu/hypermail/linux/kernel/9804.2/0953.html this

Re: gnu asm help...

2001-06-18 Thread Rick Hohensee
The C-names-in-asms stuff is explained in (g?)as.info. The explanation is a bit strained, but after the third or fourth read it becomes fairly sensible. Rick Hohensee - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majo

Re: gnu asm help...

2001-06-18 Thread Petr Vandrovec
On 18 Jun 01 at 18:20, Timur Tabi wrote: > 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; > } N

Re: gnu asm help...

2001-06-18 Thread Timur Tabi
** Reply to message from "Raj, Ashok" <[EMAIL PROTECTED]> 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 mean

Re: gnu asm help...

2001-06-18 Thread Erik Mouw
On Mon, Jun 18, 2001 at 03:56:50PM -0700, Raj, Ashok wrote: > i can understand what the LOCK "incl %0 means.. but not sure what the rest > is for. > > thanks > ashokr > > static __inline__ void atomic_inc(atomic_t *v) > { > __asm__ __volatile__( > LOCK "incl %0" > :"=m" (v->c

gnu asm help...

2001-06-18 Thread Raj, Ashok
Hello asm gurus.. I need a simple (??) change to atomic_inc() functionality. so that i can increment and return the value of the variable. current implementation in linux/include/asm/atomic.h does not do this job. any help would be greatly appreciated. ashokr from atomic.h also if there is