31 lines · c
1/* SPDX-License-Identifier: LGPL-2.1-only OR MIT */2/*3 * rseq-ppc-thread-pointer.h4 *5 * (C) Copyright 2021 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>6 */7 8#ifndef _RSEQ_PPC_THREAD_POINTER9#define _RSEQ_PPC_THREAD_POINTER10 11#ifdef __cplusplus12extern "C" {13#endif14 15static inline void *rseq_thread_pointer(void)16{17#ifdef __powerpc64__18 register void *__result asm ("r13");19#else20 register void *__result asm ("r2");21#endif22 asm ("" : "=r" (__result));23 return __result;24}25 26#ifdef __cplusplus27}28#endif29 30#endif31