blob: d9daadad0bdd9d30cb556289813517282b5a1435 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
/* Copyright (c) 2013, Linaro Limited
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
/**
* @file
*
* ODP synchronisation
*/
#ifndef ODP_SYNC_H_
#define ODP_SYNC_H_
#ifdef __cplusplus
extern "C" {
#endif
/** @addtogroup odp_synchronizers
* @{
*/
/**
* Synchronise stores
*
* Ensures that all CPU store operations that precede the odp_sync_stores()
* call are globally visible before any store operation that follows it.
*/
static inline void odp_sync_stores(void)
{
#if defined __x86_64__ || defined __i386__
__asm__ __volatile__ ("sfence\n" : : : "memory");
#elif defined(__arm__)
#if __ARM_ARCH == 6
__asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" \
: : "r" (0) : "memory");
#elif __ARM_ARCH >= 7 || defined __aarch64__
__asm__ __volatile__ ("dmb st" : : : "memory");
#else
__asm__ __volatile__ ("" : : : "memory");
#endif
#elif defined __OCTEON__
__asm__ __volatile__ ("syncws\n" : : : "memory");
#else
__sync_synchronize();
#endif
}
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif
|