[BACK]Return to atomic.h CVS log [TXT][DIR] Up to [local] / sys / arch / sparc / include

File: [local] / sys / arch / sparc / include / atomic.h (download)

Revision 1.1, Tue Mar 4 16:08:16 2008 UTC (16 years, 2 months ago) by nbrk
Branch point for: MAIN

Initial revision

/*	$OpenBSD: atomic.h,v 1.3 2007/04/27 19:22:47 miod Exp $	*/

/* Public Domain */

#ifndef __SPARC_ATOMIC_H__
#define __SPARC_ATOMIC_H__

#if defined(_KERNEL)

static __inline void
atomic_setbits_int(__volatile unsigned int *uip, unsigned int v)
{
	int psr;

	psr = getpsr();
	setpsr(psr | PSR_PIL);
	*uip |= v;
	setpsr(psr);
}

static __inline void
atomic_clearbits_int(__volatile unsigned int *uip, unsigned int v)
{
	int psr;

	psr = getpsr();
	setpsr(psr | PSR_PIL);
	*uip &= ~v;
	setpsr(psr);
}

#endif /* defined(_KERNEL) */
#endif /* __SPARC_ATOMIC_H__ */