-
Notifications
You must be signed in to change notification settings - Fork 0
/
tls.cc
34 lines (26 loc) · 564 Bytes
/
tls.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include <stdio.h>
#include <cstdint>
#if defined(__x86_64__)
thread_local uint64_t* currentRA;
#elif defined(__i386__)
thread_local uint32_t* currentRA;
#endif
#ifdef __cplusplus
extern "C" {
#endif
void* __ret_getCurrentRA();
int __ret_setCurrentRA(void*);
void __ret_printCurrentRA(void**);
#ifdef __cplusplus
}
#endif
void* __ret_getCurrentRA() {
return ¤tRA;
}
void __ret_printCurrentRA(void** ra) {
printf("Current RA is : %p\n", currentRA);
}
int __ret_setCurrentRA(void* ra) {
currentRA = reinterpret_cast<uint64_t*>(ra);
return 0;
}