1 /* SPDX-License-Identifier: LGPL-2.1-only OR MIT */
2 /*
3  * rseq-ppc-thread-pointer.h
4  *
5  * (C) Copyright 2021 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6  */
7 
8 #ifndef _RSEQ_PPC_THREAD_POINTER
9 #define _RSEQ_PPC_THREAD_POINTER
10 
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14 
rseq_thread_pointer(void)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
22 	asm ("" : "=r" (__result));
23 	return __result;
24 }
25 
26 #ifdef __cplusplus
27 }
28 #endif
29 
30 #endif
31