lkml.org 
[lkml]   [2001]   [Jun]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: gnu asm help...
** Reply to message from "Petr Vandrovec" <VANDROVE@vc.cvut.cz> 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 it as conditional store (but CMPXCHG is not available
> on i386), or you can just guard your atomic variable with
> spinlock - but in that case there is no reason for using atomic_t
> at all.

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 inc" does).
Doing a global cli might work, though.


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

\
 
 \ /
  Last update: 2005-03-22 12:55    [W:0.028 / U:1.092 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site