Re: in x86 architecture ,why the function atomic_sub_and_test() does not disable the interrupt?

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Roland Dreier
Date: Monday, April 5, 2010 - 11:07 pm

> 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 <rolandd@cisco.com> || For corporate legal information go to:
http://www.cisco.com/web/about/doing_business/legal/cri/index.html
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
in x86 architecture ,why the function atomic_sub_and_test( ..., =?UTF-8?B?5p2o56GV?=, (Mon Apr 5, 10:13 pm)
Re: in x86 architecture ,why the function atomic_sub_and_t ..., Roland Dreier, (Mon Apr 5, 11:07 pm)