diff options
Diffstat (limited to 'runtime/src/pe_loader.cpp')
| -rw-r--r-- | runtime/src/pe_loader.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/runtime/src/pe_loader.cpp b/runtime/src/pe_loader.cpp index fd9299517..396d362f8 100644 --- a/runtime/src/pe_loader.cpp +++ b/runtime/src/pe_loader.cpp | |||
| @@ -761,8 +761,9 @@ void run_callbacks(Module& m, uint32_t reason, bool trace = false) { | |||
| 761 | // of this process. | 761 | // of this process. |
| 762 | // | 762 | // |
| 763 | // What makes that safe: | 763 | // What makes that safe: |
| 764 | // - The slot is the helper's, and nothing reads the helper's variable, so swapping the pointer under a running | 764 | // - The slot is the helper's, and nothing reads the helper's variable; slot 0 (kMainImageSlot) holds gta6rt.exe's |
| 765 | // thread disturbs nothing; the thread cannot be in mapped code of a module whose load() has not returned. | 765 | // original block, which nothing reads after reserve_tls_index0 moved gta6rt's TLS. So swapping the pointer under a |
| 766 | // running thread disturbs nothing; the thread cannot be in mapped code of a module whose load() has not returned. | ||
| 766 | // - The swap is made with g_tls_lock held exclusively, so no thread is inside its attach or detach event meanwhile. | 767 | // - The swap is made with g_tls_lock held exclusively, so no thread is inside its attach or detach event meanwhile. |
| 767 | // - A thread whose detach event has run is skipped (`ended`), and so is one with no TLS array or no helper block: | 768 | // - A thread whose detach event has run is skipped (`ended`), and so is one with no TLS array or no helper block: |
| 768 | // Windows is about to free, or never built, what the block would go into. | 769 | // Windows is about to free, or never built, what the block would go into. |