aboutsummaryrefslogtreecommitdiff
path: root/platform/linux-generic/include/odp_spin_internal.h
blob: 29c524fb157036162a75651015905d7ff249a385 (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
/* Copyright (c) 2013, Linaro Limited
 * All rights reserved.
 *
 * SPDX-License-Identifier:     BSD-3-Clause
 */



#ifndef ODP_SPIN_INTERNAL_H_
#define ODP_SPIN_INTERNAL_H_

#ifdef __cplusplus
extern "C" {
#endif


/**
 * Spin loop for ODP internal use
 */
static inline void odp_spin(void)
{
#if defined __x86_64__ || defined __i386__

#ifdef __SSE2__
	__asm__ __volatile__ ("pause");
#else
	__asm__ __volatile__ ("rep; nop");
#endif

#elif defined __arm__

#if __ARM_ARCH == 7
	__asm__ __volatile__ ("nop");
	__asm__ __volatile__ ("nop");
	__asm__ __volatile__ ("nop");
	__asm__ __volatile__ ("nop");
#endif

#elif defined __OCTEON__

	__asm__ __volatile__ ("nop");
	__asm__ __volatile__ ("nop");
	__asm__ __volatile__ ("nop");
	__asm__ __volatile__ ("nop");
	__asm__ __volatile__ ("nop");
	__asm__ __volatile__ ("nop");
	__asm__ __volatile__ ("nop");
	__asm__ __volatile__ ("nop");

#endif
}


#ifdef __cplusplus
}
#endif

#endif