Public headers: use SPDX identifiers
[urcu.git] / include / urcu / system.h
CommitLineData
d3d3857f
MJ
1// SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
2//
3// SPDX-License-Identifier: MIT
4
7e30abe3
MD
5#ifndef _URCU_SYSTEM_H
6#define _URCU_SYSTEM_H
7
8/*
7e30abe3 9 * System definitions.
7e30abe3
MD
10 */
11
12#include <urcu/compiler.h>
13#include <urcu/arch.h>
14
15/*
d0bbd9c2
MD
16 * Identify a shared load. A cmm_smp_rmc() or cmm_smp_mc() should come
17 * before the load.
7e30abe3 18 */
f5ee48a3 19#define _CMM_LOAD_SHARED(p) CMM_ACCESS_ONCE(p)
7e30abe3
MD
20
21/*
22 * Load a data from shared memory, doing a cache flush if required.
23 */
6cf3827c 24#define CMM_LOAD_SHARED(p) \
1b85da85 25 __extension__ \
7e30abe3 26 ({ \
5481ddb3 27 cmm_smp_rmc(); \
6cf3827c 28 _CMM_LOAD_SHARED(p); \
7e30abe3
MD
29 })
30
31/*
d0bbd9c2
MD
32 * Identify a shared store. A cmm_smp_wmc() or cmm_smp_mc() should
33 * follow the store.
7e30abe3 34 */
1b85da85 35#define _CMM_STORE_SHARED(x, v) __extension__ ({ CMM_ACCESS_ONCE(x) = (v); })
7e30abe3
MD
36
37/*
d0bbd9c2
MD
38 * Store v into x, where x is located in shared memory. Performs the
39 * required cache flush after writing. Returns v.
7e30abe3 40 */
79a8e6c3 41#define CMM_STORE_SHARED(x, v) \
1b85da85 42 __extension__ \
79a8e6c3
MD
43 ({ \
44 __typeof__(x) _v = _CMM_STORE_SHARED(x, v); \
45 cmm_smp_wmc(); \
46 _v = _v; /* Work around clang "unused result" */ \
7e30abe3
MD
47 })
48
49#endif /* _URCU_SYSTEM_H */
This page took 0.049134 seconds and 4 git commands to generate.