xref: /haiku/src/system/libroot/os/arch/arm64/tls.c (revision 1a3518cf757c2da8006753f83962da5935bbc82b)
1 /*
2  * Copyright 2019 Haiku, Inc. All Rights Reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 
6 #include <runtime_loader/runtime_loader.h>
7 
8 #include "support/TLS.h"
9 #include "tls.h"
10 
11 struct tls_index {
12 	unsigned long ti_module;
13 	unsigned long ti_offset;
14 };
15 
16 void* __tls_get_addr(struct tls_index* ti);
17 
18 static int32 gNextSlot = TLS_FIRST_FREE_SLOT;
19 
20 
21 int32
22 tls_allocate(void)
23 {
24 	int32 next = atomic_add(&gNextSlot, 1);
25 	if (next >= TLS_MAX_KEYS)
26 		return B_NO_MEMORY;
27 
28 	return next;
29 }
30 
31 
32 void *
33 tls_get(int32 index)
34 {
35 	return NULL;
36 }
37 
38 
39 void **
40 tls_address(int32 index)
41 {
42 	return NULL;
43 }
44 
45 
46 void
47 tls_set(int32 index, void *value)
48 {
49 
50 }
51 
52 
53 void*
54 __tls_get_addr(struct tls_index* ti)
55 {
56 	return __gRuntimeLoader->get_tls_address(ti->ti_module, ti->ti_offset);
57 }
58