Commit | Line | Data |
---|---|---|
90702366 | 1 | /* SPDX-License-Identifier: MIT */ |
f2d7b530 MJ |
2 | /* SPDX-FileCopyrightText: 2021 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> */ |
3 | ||
9698c399 MD |
4 | /* |
5 | * rseq-ppc-thread-pointer.h | |
9698c399 MD |
6 | */ |
7 | ||
8 | #ifndef _RSEQ_PPC_THREAD_POINTER | |
9 | #define _RSEQ_PPC_THREAD_POINTER | |
10 | ||
5984936f MD |
11 | #ifdef __cplusplus |
12 | extern "C" { | |
13 | #endif | |
14 | ||
9698c399 MD |
15 | static inline void *rseq_thread_pointer(void) |
16 | { | |
17 | #ifdef __powerpc64__ | |
18 | register void *__result asm ("r13"); | |
19 | #else | |
20 | register void *__result asm ("r2"); | |
21 | #endif | |
54a9ea09 | 22 | asm ("" : "=r" (__result)); |
9698c399 MD |
23 | return __result; |
24 | } | |
25 | ||
5984936f MD |
26 | #ifdef __cplusplus |
27 | } | |
28 | #endif | |
29 | ||
9698c399 | 30 | #endif |