xref: /haiku/src/system/libroot/os/atomic.c (revision aff60bb217827097c13d643275fdf1f1c66e7f17)
1 /*
2 ** Copyright 2003, Marcus Overhagen. All rights reserved.
3 ** Distributed under the terms of the Haiku License.
4 */
5 
6 
7 #include <SupportDefs.h>
8 
9 #include <arch_config.h>
10 #include <syscalls.h>
11 
12 
13 #ifdef ATOMIC_FUNCS_ARE_SYSCALLS
14 
15 int32
16 atomic_set(vint32 *value, int32 newValue)
17 {
18 	return _kern_atomic_set(value, newValue);
19 }
20 
21 int32
22 atomic_test_and_set(vint32 *value, int32 newValue, int32 testAgainst)
23 {
24 	return _kern_atomic_test_and_set(value, newValue, testAgainst);
25 }
26 
27 int32
28 atomic_add(vint32 *value, int32 addValue)
29 {
30 	return _kern_atomic_add(value, addValue);
31 }
32 
33 int32
34 atomic_and(vint32 *value, int32 andValue)
35 {
36 	return _kern_atomic_and(value, andValue);
37 }
38 
39 int32
40 atomic_or(vint32 *value, int32 orValue)
41 {
42 	return _kern_atomic_or(value, orValue);
43 }
44 
45 int32
46 atomic_get(vint32 *value)
47 {
48 	return _kern_atomic_get(value);
49 }
50 
51 #endif	/* ATOMIC_FUNCS_ARE_SYSCALLS */
52 
53 #ifdef ATOMIC64_FUNCS_ARE_SYSCALLS
54 
55 int64
56 atomic_set64(vint64 *value, int64 newValue)
57 {
58 	return _kern_atomic_set64(value, newValue);
59 }
60 
61 int64
62 atomic_test_and_set64(vint64 *value, int64 newValue, int64 testAgainst)
63 {
64 	return _kern_atomic_test_and_set64(value, newValue, testAgainst);
65 }
66 
67 int64
68 atomic_add64(vint64 *value, int64 addValue)
69 {
70 	return _kern_atomic_add64(value, addValue);
71 }
72 
73 int64
74 atomic_and64(vint64 *value, int64 andValue)
75 {
76 	return _kern_atomic_and64(value, andValue);
77 }
78 
79 int64
80 atomic_or64(vint64 *value, int64 orValue)
81 {
82 	return _kern_atomic_or64(value, orValue);
83 }
84 
85 int64
86 atomic_get64(vint64 *value)
87 {
88 	return _kern_atomic_get64(value);
89 }
90 
91 #endif	/* ATOMIC64_FUNCS_ARE_SYSCALLS */
92