bin/pc: Mark non-returning function as void
[haiku.git] / headers / os / support / TLS.h
blob344e58d72edec9d6bb8d5f51128a40f0ac817614
1 /*
2 * Copyright 2003-2007 Haiku, Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
4 */
5 #ifndef _TLS_H
6 #define _TLS_H
9 #include <BeBuild.h>
10 #include <SupportDefs.h>
13 /* A maximum of 64 keys is allowed to store in TLS - the key is reserved
14 * process-wide. Note that tls_allocate() will return B_NO_MEMORY if you
15 * try to exceed this limit.
17 #define TLS_MAX_KEYS 64
20 #ifdef __cplusplus
21 extern "C" {
22 #endif /* __cplusplus */
24 extern int32 tls_allocate(void);
26 #if !_NO_INLINE_ASM && __INTEL__ && __GNUC__
28 static inline void *
29 tls_get(int32 index)
31 void *ret;
32 __asm__ __volatile__ (
33 "movl %%fs:(, %1, 4), %0"
34 : "=r" (ret) : "r" (index));
35 return ret;
38 static inline void **
39 tls_address(int32 index)
41 void **ret;
42 __asm__ __volatile__ (
43 "movl %%fs:0, %0\n\t"
44 "leal (%0, %1, 4), %0\n\t"
45 : "=&r" (ret) : "r" (index));
46 return ret;
49 static inline void
50 tls_set(int32 index, void *value)
52 __asm__ __volatile__ (
53 "movl %1, %%fs:(, %0, 4)"
54 : : "r" (index), "r" (value));
57 #else /* !_NO_INLINE_ASM && __INTEL__ && __GNUC__ */
59 extern void *tls_get(int32 index);
60 extern void **tls_address(int32 index);
61 extern void tls_set(int32 index, void *value);
63 #endif /* !_NO_INLINE_ASM && __INTEL__ && __GNUC__ */
65 #ifdef __cplusplus
67 #endif /* __cplusplus */
69 #endif /* _TLS_H */