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