ia64/xen-unstable

view linux-2.6-xen-sparse/include/asm-ia64/synch_bitops.h @ 10614:86cae321e707

Use explicit accessors to handle unusually-sized atomic operations in grant table code.
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
author kaf24@firebug.cl.cam.ac.uk
date Fri Jun 30 10:10:39 2006 +0100 (2006-06-30)
parents fd9b2c1bb577
children e47738923a05
line source
1 #ifndef __XEN_SYNCH_BITOPS_H__
2 #define __XEN_SYNCH_BITOPS_H__
4 /*
5 * Copyright 1992, Linus Torvalds.
6 * Heavily modified to provide guaranteed strong synchronisation
7 * when communicating with Xen or other guest OSes running on other CPUs.
8 */
10 #include <linux/config.h>
12 #define ADDR (*(volatile long *) addr)
14 static __inline__ void synch_set_bit(int nr, volatile void * addr)
15 {
16 set_bit(nr, addr);
17 }
19 static __inline__ void synch_clear_bit(int nr, volatile void * addr)
20 {
21 clear_bit(nr, addr);
22 }
24 static __inline__ void synch_change_bit(int nr, volatile void * addr)
25 {
26 change_bit(nr, addr);
27 }
29 static __inline__ int synch_test_and_set_bit(int nr, volatile void * addr)
30 {
31 return test_and_set_bit(nr, addr);
32 }
34 static __inline__ int synch_test_and_clear_bit(int nr, volatile void * addr)
35 {
36 return test_and_clear_bit(nr, addr);
37 }
39 static __inline__ int synch_test_and_change_bit(int nr, volatile void * addr)
40 {
41 return test_and_change_bit(nr, addr);
42 }
44 static __inline__ int synch_const_test_bit(int nr, const volatile void * addr)
45 {
46 return test_bit(nr, addr);
47 }
49 static __inline__ int synch_var_test_bit(int nr, volatile void * addr)
50 {
51 return test_bit(nr, addr);
52 }
54 #define synch_cmpxchg ia64_cmpxchg4_acq
56 #define synch_test_bit(nr,addr) \
57 (__builtin_constant_p(nr) ? \
58 synch_const_test_bit((nr),(addr)) : \
59 synch_var_test_bit((nr),(addr)))
61 #define synch_cmpxchg_subword synch_cmpxchg
63 #endif /* __XEN_SYNCH_BITOPS_H__ */