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

Annotation of sys/arch/sh/include/atomic.h, Revision 1.1.1.1

1.1       nbrk        1: /*     $OpenBSD: atomic.h,v 1.3 2007/04/05 17:35:11 miod Exp $ */
                      2:
                      3: /* Public Domain */
                      4:
                      5: #ifndef __SH_ATOMIC_H__
                      6: #define __SH_ATOMIC_H__
                      7:
                      8: #if defined(_KERNEL)
                      9:
                     10: #include <sh/psl.h>
                     11:
                     12: static __inline void
                     13: atomic_setbits_int(__volatile unsigned int *uip, unsigned int v)
                     14: {
                     15:        unsigned int sr;
                     16:
                     17:        __asm__ __volatile__ ("stc sr, %0" : "=r"(sr));
                     18:        __asm__ __volatile__ ("ldc %0, sr" : : "r"(sr | PSL_IMASK));
                     19:        *uip |= v;
                     20:        __asm__ __volatile__ ("ldc %0, sr" : : "r"(sr));
                     21: }
                     22:
                     23: static __inline void
                     24: atomic_clearbits_int(__volatile unsigned int *uip, unsigned int v)
                     25: {
                     26:        unsigned int sr;
                     27:
                     28:        __asm__ __volatile__ ("stc sr, %0" : "=r"(sr));
                     29:        __asm__ __volatile__ ("ldc %0, sr" : : "r"(sr | PSL_IMASK));
                     30:        *uip &= ~v;
                     31:        __asm__ __volatile__ ("ldc %0, sr" : : "r"(sr));
                     32: }
                     33:
                     34: #endif /* defined(_KERNEL) */
                     35: #endif /* __SH_ATOMIC_H__ */

CVSweb