TLS.h: Drop inline assembly from the header.
This was a holdover from BeOS, which did this as inline assembly. We do not on any platform other than 32-bit x86, and even there we may have preferred to do things a little differently on non-BeOS ABIs. Most things ported from other systems, or even native apps, are going to use _Thread_local variables anyway, which will bypass this system altogether.
This commit is contained in:
@@ -1,12 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2003-2007 Haiku, Inc. All rights reserved.
|
* Copyright 2003-2021, Haiku, Inc. All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
#ifndef _TLS_H
|
#ifndef _TLS_H
|
||||||
#define _TLS_H
|
#define _TLS_H
|
||||||
|
|
||||||
|
|
||||||
#include <BeBuild.h>
|
|
||||||
#include <SupportDefs.h>
|
#include <SupportDefs.h>
|
||||||
|
|
||||||
|
|
||||||
@@ -22,46 +21,10 @@ extern "C" {
|
|||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
extern int32 tls_allocate(void);
|
extern int32 tls_allocate(void);
|
||||||
|
|
||||||
#if !_NO_INLINE_ASM && __i386__ && __GNUC__
|
|
||||||
|
|
||||||
static inline void *
|
|
||||||
tls_get(int32 index)
|
|
||||||
{
|
|
||||||
void *ret;
|
|
||||||
__asm__ __volatile__ (
|
|
||||||
"movl %%fs:(, %1, 4), %0"
|
|
||||||
: "=r" (ret) : "r" (index));
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void **
|
|
||||||
tls_address(int32 index)
|
|
||||||
{
|
|
||||||
void **ret;
|
|
||||||
__asm__ __volatile__ (
|
|
||||||
"movl %%fs:0, %0\n\t"
|
|
||||||
"leal (%0, %1, 4), %0\n\t"
|
|
||||||
: "=&r" (ret) : "r" (index));
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void
|
|
||||||
tls_set(int32 index, void *value)
|
|
||||||
{
|
|
||||||
__asm__ __volatile__ (
|
|
||||||
"movl %1, %%fs:(, %0, 4)"
|
|
||||||
: : "r" (index), "r" (value));
|
|
||||||
}
|
|
||||||
|
|
||||||
#else /* !_NO_INLINE_ASM && __i386__ && __GNUC__ */
|
|
||||||
|
|
||||||
extern void *tls_get(int32 index);
|
extern void *tls_get(int32 index);
|
||||||
extern void **tls_address(int32 index);
|
extern void **tls_address(int32 index);
|
||||||
extern void tls_set(int32 index, void *value);
|
extern void tls_set(int32 index, void *value);
|
||||||
|
|
||||||
#endif /* !_NO_INLINE_ASM && __i386__ && __GNUC__ */
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|||||||
@@ -1,15 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2019-2022, Haiku, Inc. All Rights Reserved.
|
* Copyright 2019-2022, Haiku, Inc. All Rights Reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
|
||||||
*
|
|
||||||
* Copyright 2003, Axel Dörfler, [email protected]. All rights reserved.
|
* Copyright 2003, Axel Dörfler, [email protected]. All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _NO_INLINE_ASM
|
|
||||||
# define _NO_INLINE_ASM 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <runtime_loader/runtime_loader.h>
|
#include <runtime_loader/runtime_loader.h>
|
||||||
|
|
||||||
#include <support/TLS.h>
|
#include <support/TLS.h>
|
||||||
@@ -71,4 +65,3 @@ __tls_get_addr(struct tls_index *ti)
|
|||||||
{
|
{
|
||||||
return __gRuntimeLoader->get_tls_address(ti->ti_module, ti->ti_offset);
|
return __gRuntimeLoader->get_tls_address(ti->ti_module, ti->ti_offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,11 +9,6 @@
|
|||||||
|
|
||||||
#warning FIXME: M68K
|
#warning FIXME: M68K
|
||||||
|
|
||||||
// we don't want to have the inline assembly included here
|
|
||||||
#ifndef _NO_INLINE_ASM
|
|
||||||
# define _NO_INLINE_ASM 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <runtime_loader/runtime_loader.h>
|
#include <runtime_loader/runtime_loader.h>
|
||||||
|
|
||||||
#include "support/TLS.h"
|
#include "support/TLS.h"
|
||||||
|
|||||||
@@ -7,11 +7,6 @@
|
|||||||
// to decide how this should be done, so it's just broken now (okay for single
|
// to decide how this should be done, so it's just broken now (okay for single
|
||||||
// threaded apps, though).
|
// threaded apps, though).
|
||||||
|
|
||||||
// we don't want to have the inline assembly included here
|
|
||||||
#ifndef _NO_INLINE_ASM
|
|
||||||
# define _NO_INLINE_ASM 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "support/TLS.h"
|
#include "support/TLS.h"
|
||||||
#include "tls.h"
|
#include "tls.h"
|
||||||
|
|
||||||
|
|||||||
@@ -7,11 +7,6 @@
|
|||||||
// to decide how this should be done, so it's just broken now (okay for single
|
// to decide how this should be done, so it's just broken now (okay for single
|
||||||
// threaded apps, though).
|
// threaded apps, though).
|
||||||
|
|
||||||
// we don't want to have the inline assembly included here
|
|
||||||
#ifndef _NO_INLINE_ASM
|
|
||||||
# define _NO_INLINE_ASM 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "support/TLS.h"
|
#include "support/TLS.h"
|
||||||
#include "tls.h"
|
#include "tls.h"
|
||||||
|
|
||||||
|
|||||||
@@ -5,11 +5,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
// we don't want to have the inline assembly included here
|
|
||||||
#ifndef _NO_INLINE_ASM
|
|
||||||
# define _NO_INLINE_ASM 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <runtime_loader/runtime_loader.h>
|
#include <runtime_loader/runtime_loader.h>
|
||||||
|
|
||||||
#include "support/TLS.h"
|
#include "support/TLS.h"
|
||||||
|
|||||||
@@ -5,10 +5,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef _NO_INLINE_ASM
|
|
||||||
# define _NO_INLINE_ASM 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
|
|
||||||
#include <runtime_loader/runtime_loader.h>
|
#include <runtime_loader/runtime_loader.h>
|
||||||
|
|||||||
Reference in New Issue
Block a user