Fix supported autotools versions in README.md
[librseq.git] / include / rseq / rseq-x86-thread-pointer.h
CommitLineData
90702366 1/* SPDX-License-Identifier: MIT */
f2d7b530
MJ
2/* SPDX-FileCopyrightText: 2021 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> */
3
9698c399
MD
4/*
5 * rseq-x86-thread-pointer.h
9698c399
MD
6 */
7
8#ifndef _RSEQ_X86_THREAD_POINTER
9#define _RSEQ_X86_THREAD_POINTER
10
11#include <features.h>
12
5984936f
MD
13#ifdef __cplusplus
14extern "C" {
15#endif
16
9698c399
MD
17#if __GNUC_PREREQ (11, 1)
18static inline void *rseq_thread_pointer(void)
19{
20 return __builtin_thread_pointer();
21}
22#else
23static inline void *rseq_thread_pointer(void)
24{
25 void *__result;
26
27# ifdef __x86_64__
28 __asm__ ("mov %%fs:0, %0" : "=r" (__result));
29# else
30 __asm__ ("mov %%gs:0, %0" : "=r" (__result));
31# endif
32 return __result;
33}
34#endif /* !GCC 11 */
35
5984936f
MD
36#ifdef __cplusplus
37}
38#endif
39
9698c399 40#endif
This page took 0.0244 seconds and 4 git commands to generate.