Commit | Line | Data |
---|---|---|
7e38dc2e MD |
1 | // SPDX-License-Identifier: MIT |
2 | /* | |
3 | * Copyright (C) 2024 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> | |
4 | */ | |
5 | ||
6 | #ifndef _SIDE_COMPILER_H | |
7 | #define _SIDE_COMPILER_H | |
8 | ||
538bc2f2 MD |
9 | #if defined(__x86_64__) || defined(__i386__) |
10 | static inline | |
11 | void side_cpu_relax(void) | |
12 | { | |
13 | asm volatile ("rep; nop" : : : "memory"); | |
14 | } | |
15 | #else | |
7e38dc2e MD |
16 | //TODO: implement per-architecture busy loop "pause"/"rep; nop;" instruction. |
17 | static inline | |
18 | void side_cpu_relax(void) | |
19 | { | |
20 | asm volatile ("" : : : "memory"); | |
21 | } | |
538bc2f2 | 22 | #endif |
7e38dc2e MD |
23 | |
24 | #endif /* _SIDE_COMPILER_H */ |