diff options
| author | ItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com> | 2026-11-22 11:41:29 -0500 |
|---|---|---|
| committer | ItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com> | 2026-11-22 11:41:29 -0500 |
| commit | 61d5397910e3e0eeeb1c1b28ea2d6760d6c46cd5 (patch) | |
| tree | 6b30b358c2cd66213828f69a94a81443d63f84d8 /runtime/src/pe_loader.h | |
| parent | 74fbcc1ee82ab2955f16f9cbc4e0bb51989c20ac (diff) | |
| parent | a28493ba8f7ab85749fc2c4bdefa8091bf9085cc (diff) | |
Merge pull request #2070 from jaybeebabageyus
Diffstat (limited to 'runtime/src/pe_loader.h')
| -rw-r--r-- | runtime/src/pe_loader.h | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/runtime/src/pe_loader.h b/runtime/src/pe_loader.h index d8801bc38..7cfe7a771 100644 --- a/runtime/src/pe_loader.h +++ b/runtime/src/pe_loader.h | |||
| @@ -46,12 +46,12 @@ struct Module { | |||
| 46 | 46 | ||
| 47 | // Static TLS (IMAGE_DIRECTORY_ENTRY_TLS). load() installs tls_block in the calling thread and writes tls_index to | 47 | // Static TLS (IMAGE_DIRECTORY_ENTRY_TLS). load() installs tls_block in the calling thread and writes tls_index to |
| 48 | // the image's _tls_index. tls_index names TEB->ThreadLocalStoragePointer[tls_index], the array | 48 | // the image's _tls_index. tls_index names TEB->ThreadLocalStoragePointer[tls_index], the array |
| 49 | // __declspec(thread) reads; it is not a TlsAlloc slot. The loader reserves the index by loading | 49 | // __declspec(thread) reads; it is not a TlsAlloc slot. The loader reserves distinct indices by loading |
| 50 | // gta6rt_tls_host.dll, so only one manually mapped TLS module can be live at a time; a second one is rejected | 50 | // gta6rt_tls_host.dll (and cloning it on demand for additional simultaneous TLS modules, up to 16 at a time). |
| 51 | // rather than sharing (and corrupting) the slot. Every thread started after load() gets its own copy through the | 51 | // Every thread started after load() gets its own copy through the helper's DLL_THREAD_ATTACH, and gives it back |
| 52 | // helper's DLL_THREAD_ATTACH, and gives it back at DLL_THREAD_DETACH; install_tls_for_thread() is for threads | 52 | // at DLL_THREAD_DETACH; install_tls_for_thread() is for threads that already existed. |
| 53 | // that already existed. | ||
| 54 | uint32_t tls_index = kNoTlsIndex; | 53 | uint32_t tls_index = kNoTlsIndex; |
| 54 | uint32_t tls_slot = kNoTlsIndex; // index into the loader's reserved TLS-host slot pool | ||
| 55 | void* tls_block = nullptr; // calling thread's copy of the image's template | 55 | void* tls_block = nullptr; // calling thread's copy of the image's template |
| 56 | void* tls_saved_block = nullptr; // helper DLL block replaced in that thread, restored by ~Loader | 56 | void* tls_saved_block = nullptr; // helper DLL block replaced in that thread, restored by ~Loader |
| 57 | uint32_t tls_block_size = 0; // raw template + zero fill | 57 | uint32_t tls_block_size = 0; // raw template + zero fill |