Make setbits() SMP-safe. Eliminate the SETBITS() macro, and replace

all uses of it with the equivalent calls to setbits().

This change incidentally eliminates a problem building ELF kernels
that was caused by SETBITS.

Reviewed by:	fsmp, peter
Submitted by:	bde
This commit is contained in:
jdp 1997-05-21 22:56:05 +00:00
parent ad7a8a1b03
commit 0d42d75ea0
3 changed files with 18 additions and 19 deletions

View File

@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: cpufunc.h,v 1.65 1997/04/28 00:24:59 fsmp Exp $
* $Id: cpufunc.h,v 1.66 1997/05/07 19:51:59 peter Exp $
*/
/*
@ -356,7 +356,11 @@ rdtsc(void)
static __inline void
setbits(volatile unsigned *addr, u_int bits)
{
__asm __volatile("orl %1,%0" : "=m" (*addr) : "ir" (bits));
__asm __volatile(
#ifdef SMP
"lock; "
#endif
"orl %1,%0" : "=m" (*addr) : "ir" (bits));
}
static __inline void

View File

@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: cpufunc.h,v 1.65 1997/04/28 00:24:59 fsmp Exp $
* $Id: cpufunc.h,v 1.66 1997/05/07 19:51:59 peter Exp $
*/
/*
@ -356,7 +356,11 @@ rdtsc(void)
static __inline void
setbits(volatile unsigned *addr, u_int bits)
{
__asm __volatile("orl %1,%0" : "=m" (*addr) : "ir" (bits));
__asm __volatile(
#ifdef SMP
"lock; "
#endif
"orl %1,%0" : "=m" (*addr) : "ir" (bits));
}
static __inline void

View File

@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: spl.h,v 1.21 1997/04/29 20:05:47 peter Exp $
* $Id: spl.h,v 1.22 1997/05/07 19:50:31 peter Exp $
*/
#ifndef _MACHINE_IPL_H_
@ -93,20 +93,11 @@ extern unsigned tty_imask; /* group of interrupts masked with spltty() */
* The volatile bitmap variables must be set atomically. This normally
* involves using a machine-dependent bit-set or `or' instruction.
*/
static __inline void
SETBITS(unsigned foo)
{
#ifdef SMP
__asm __volatile("lock ; orl %0, _ipending" : : "a" (foo) );
#else
__asm __volatile("orl %0, _ipending" : : "a" (foo) );
#endif /* SMP */
}
#define setdelayed() SETBITS(loadandclear(&idelayed))
#define setsoftast() SETBITS(SWI_AST_PENDING)
#define setsoftclock() SETBITS(SWI_CLOCK_PENDING)
#define setsoftnet() SETBITS(SWI_NET_PENDING)
#define setsofttty() SETBITS(SWI_TTY_PENDING)
#define setdelayed() setbits(&ipending, loadandclear(&idelayed))
#define setsoftast() setbits(&ipending, SWI_AST_PENDING)
#define setsoftclock() setbits(&ipending, SWI_CLOCK_PENDING)
#define setsoftnet() setbits(&ipending, SWI_NET_PENDING)
#define setsofttty() setbits(&ipending, SWI_TTY_PENDING)
#define schedsofttty() setbits(&idelayed, SWI_TTY_PENDING)
#define schedsoftnet() setbits(&idelayed, SWI_NET_PENDING)