rculfhash: merge dummy into next ptr
[urcu.git] / urcu / system.h
... / ...
CommitLineData
1#ifndef _URCU_SYSTEM_H
2#define _URCU_SYSTEM_H
3
4/*
5 * system.h
6 *
7 * System definitions.
8 *
9 * Copyright (c) 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 *
11 * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
12 * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
13 *
14 * Permission is hereby granted to use or copy this program
15 * for any purpose, provided the above notices are retained on all copies.
16 * Permission to modify the code and to distribute modified code is granted,
17 * provided the above notices are retained, and a notice that the code was
18 * modified is included with the above copyright notice.
19 */
20
21#include <urcu/compiler.h>
22#include <urcu/arch.h>
23
24/*
25 * Identify a shared load. A cmm_smp_rmc() or cmm_smp_mc() should come before the load.
26 */
27#define _CMM_LOAD_SHARED(p) CMM_ACCESS_ONCE(p)
28
29/*
30 * Load a data from shared memory, doing a cache flush if required.
31 */
32#define CMM_LOAD_SHARED(p) \
33 ({ \
34 cmm_smp_rmc(); \
35 _CMM_LOAD_SHARED(p); \
36 })
37
38/*
39 * Identify a shared store. A cmm_smp_wmc() or cmm_smp_mc() should follow the store.
40 */
41#define _CMM_STORE_SHARED(x, v) ({ CMM_ACCESS_ONCE(x) = (v); })
42
43/*
44 * Store v into x, where x is located in shared memory. Performs the required
45 * cache flush after writing. Returns v.
46 */
47#define CMM_STORE_SHARED(x, v) \
48 ({ \
49 typeof(x) _v = _CMM_STORE_SHARED(x, v); \
50 cmm_smp_wmc(); \
51 _v; \
52 })
53
54#endif /* _URCU_SYSTEM_H */
This page took 0.033696 seconds and 4 git commands to generate.