]>
Commit | Line | Data |
---|---|---|
462cda50 EC |
1 | /* |
2 | * Copyright (C) 2016, Emilio G. Cota <[email protected]> | |
3 | * | |
4 | * License: GNU GPL, version 2. | |
5 | * See the COPYING file in the top-level directory. | |
6 | */ | |
7 | #ifndef QEMU_PROCESSOR_H | |
8 | #define QEMU_PROCESSOR_H | |
9 | ||
10 | #include "qemu/atomic.h" | |
11 | ||
12 | #if defined(__i386__) || defined(__x86_64__) | |
13 | # define cpu_relax() asm volatile("rep; nop" ::: "memory") | |
14 | ||
15 | #elif defined(__ia64__) | |
16 | # define cpu_relax() asm volatile("hint @pause" ::: "memory") | |
17 | ||
18 | #elif defined(__aarch64__) | |
19 | # define cpu_relax() asm volatile("yield" ::: "memory") | |
20 | ||
21 | #elif defined(__powerpc64__) | |
22 | /* set Hardware Multi-Threading (HMT) priority to low; then back to medium */ | |
23 | # define cpu_relax() asm volatile("or 1, 1, 1;" \ | |
24 | "or 2, 2, 2;" ::: "memory") | |
25 | ||
26 | #else | |
27 | # define cpu_relax() barrier() | |
28 | #endif | |
29 | ||
30 | #endif /* QEMU_PROCESSOR_H */ |