1 | #ifndef __XEN_SYNCH_BITOPS_H__ |
---|
2 | #define __XEN_SYNCH_BITOPS_H__ |
---|
3 | |
---|
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 | */ |
---|
9 | |
---|
10 | #define ADDR (*(volatile long *) addr) |
---|
11 | |
---|
12 | static __inline__ void synch_set_bit(int nr, volatile void * addr) |
---|
13 | { |
---|
14 | set_bit(nr, addr); |
---|
15 | } |
---|
16 | |
---|
17 | static __inline__ void synch_clear_bit(int nr, volatile void * addr) |
---|
18 | { |
---|
19 | clear_bit(nr, addr); |
---|
20 | } |
---|
21 | |
---|
22 | static __inline__ void synch_change_bit(int nr, volatile void * addr) |
---|
23 | { |
---|
24 | change_bit(nr, addr); |
---|
25 | } |
---|
26 | |
---|
27 | static __inline__ int synch_test_and_set_bit(int nr, volatile void * addr) |
---|
28 | { |
---|
29 | return test_and_set_bit(nr, addr); |
---|
30 | } |
---|
31 | |
---|
32 | static __inline__ int synch_test_and_clear_bit(int nr, volatile void * addr) |
---|
33 | { |
---|
34 | return test_and_clear_bit(nr, addr); |
---|
35 | } |
---|
36 | |
---|
37 | static __inline__ int synch_test_and_change_bit(int nr, volatile void * addr) |
---|
38 | { |
---|
39 | return test_and_change_bit(nr, addr); |
---|
40 | } |
---|
41 | |
---|
42 | static __inline__ int synch_const_test_bit(int nr, const volatile void * addr) |
---|
43 | { |
---|
44 | return test_bit(nr, addr); |
---|
45 | } |
---|
46 | |
---|
47 | static __inline__ int synch_var_test_bit(int nr, volatile void * addr) |
---|
48 | { |
---|
49 | return test_bit(nr, addr); |
---|
50 | } |
---|
51 | |
---|
52 | #define synch_cmpxchg ia64_cmpxchg4_acq |
---|
53 | |
---|
54 | #define synch_test_bit(nr,addr) \ |
---|
55 | (__builtin_constant_p(nr) ? \ |
---|
56 | synch_const_test_bit((nr),(addr)) : \ |
---|
57 | synch_var_test_bit((nr),(addr))) |
---|
58 | |
---|
59 | #define synch_cmpxchg_subword synch_cmpxchg |
---|
60 | |
---|
61 | #endif /* __XEN_SYNCH_BITOPS_H__ */ |
---|