Annotation of sys/arch/powerpc/include/atomic.h, Revision 1.1.1.1
1.1 nbrk 1: /* $OpenBSD: atomic.h,v 1.3 2007/03/17 22:10:04 kettenis Exp $ */
2:
3: /* Public Domain */
4:
5: #ifndef __POWERPC_ATOMIC_H__
6: #define __POWERPC_ATOMIC_H__
7:
8: #if defined(_KERNEL)
9:
10: static __inline void
11: atomic_setbits_int(__volatile unsigned int *uip, unsigned int v)
12: {
13: unsigned int tmp;
14:
15: __asm volatile (
16: "1: lwarx %0, 0, %2 \n"
17: " or %0, %1, %0 \n"
18: " stwcx. %0, 0, %2 \n"
19: " bne- 1b \n"
20: " sync" : "=&r" (tmp) : "r" (v), "r" (uip) : "memory");
21: }
22:
23: static __inline void
24: atomic_clearbits_int(__volatile unsigned int *uip, unsigned int v)
25: {
26: unsigned int tmp;
27:
28: __asm volatile (
29: "1: lwarx %0, 0, %2 \n"
30: " andc %0, %0, %1 \n"
31: " stwcx. %0, 0, %2 \n"
32: " bne- 1b \n"
33: " sync" : "=&r" (tmp) : "r" (v), "r" (uip) : "memory");
34: }
35:
36: #endif /* defined(_KERNEL) */
37: #endif /* __POWERPC_ATOMIC_H__ */
CVSweb