[lkml]   [2010]   [Apr]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: in x86 architecture ,why the function atomic_sub_and_test() does not disable the interrupt?
 > static inline int atomic_sub_and_test(int i, atomic_t *v)
> {
> unsigned char c;
> asm volatile(LOCK_PREFIX "subl %2,%0; sete %1"
> : "+m" (v->counter), "=qm" (c)
> : "ir" (i) : "memory");
> return c;
> }

Why would disabling interrupts be necessary? The LOCK_PREFIX makes the
subl atomic, and the sete just operates using the flag set by subl, so
it doesn't matter if any interrupts occur or not (since returning from
an interrupt must obviously restore flags).
Roland Dreier <> || For corporate legal information go to:

 \ /
  Last update: 2010-04-06 08:09    [W:0.030 / U:10.116 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site