this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

[mldr] Implement __darling_thread_get_tsd & __darling_thread_set_tsd

It turns out that Linux relies on TPIDR_EL0, so we can't use that register to store the TPIDRRO_EL0. Instead, we will have a variable in mdlr that represents TPIDRRO_EL0.

+18
+3
src/startup/mldr/elfcalls/elfcalls.c
··· 123 123 calls->dserver_per_thread_socket_refresh = __darling_thread_rpc_socket_refresh; 124 124 calls->dserver_close_socket = __mldr_close_rpc_socket; 125 125 126 + calls->get_tsd = __darling_thread_get_tsd; 127 + calls->set_tsd = __darling_thread_set_tsd; 128 + 126 129 calls->dserver_get_process_lifetime_pipe = __dserver_get_process_lifetime_pipe; 127 130 calls->dserver_process_lifetime_pipe_refresh = __dserver_process_lifetime_pipe_refresh; 128 131 calls->dserver_close_process_lifetime_pipe = __mldr_close_process_lifetime_pipe;
+4
src/startup/mldr/elfcalls/elfcalls.h
··· 67 67 void (*dserver_per_thread_socket_refresh)(void); 68 68 void (*dserver_close_socket)(int socket); 69 69 70 + // TSD (ex: TPIDRRO_EL0) 71 + void* (*get_tsd)(void); 72 + void (*set_tsd)(void* value); 73 + 70 74 // darlingserver process lifetime pipe info 71 75 int (*dserver_get_process_lifetime_pipe)(void); 72 76 int (*dserver_process_lifetime_pipe_refresh)(void);
+9
src/startup/mldr/elfcalls/threads.c
··· 47 47 static __thread void* t_freeaddr; 48 48 static __thread size_t t_freesize; 49 49 static __thread int t_server_socket = -1; 50 + static __thread void* tsd; 50 51 static __thread darling_thread_create_callbacks_t t_callbacks = NULL; 51 52 52 53 typedef void (*thread_ep)(void**, int, ...); ··· 430 431 __dserver_main_thread_socket_fd = t_server_socket; 431 432 } 432 433 }; 434 + 435 + void* __darling_thread_get_tsd() { 436 + return tsd; 437 + } 438 + 439 + void __darling_thread_set_tsd(void* value) { 440 + tsd = value; 441 + }
+2
src/startup/mldr/elfcalls/threads.h
··· 35 35 void* __darling_thread_get_stack(void); 36 36 int __darling_thread_rpc_socket(void); 37 37 void __darling_thread_rpc_socket_refresh(void); 38 + void* __darling_thread_get_tsd(); 39 + void __darling_thread_set_tsd(void* value); 38 40 39 41 #ifdef __cplusplus 40 42 }