diff options
| author | Vonsek <45567075+Vonsek@users.noreply.github.com> | 2026-11-22 19:08:54 +0100 |
|---|---|---|
| committer | Vonsek <45567075+Vonsek@users.noreply.github.com> | 2026-11-22 19:08:54 +0100 |
| commit | 3af42c619253941610d9809e8a28a07e8dfdfdf2 (patch) | |
| tree | a675793195f8bc69c3caebb0e9614ecfb65e1c4c /runtime/src/pe_loader.h | |
| parent | e6af0a0931639ff33cdd4a28289da984f194c87e (diff) | |
| parent | ec8ec4c9a46c6623f1a9c125afd3566da97f1e0c (diff) | |
merge: preserve upstream changes alongside the asset fix
Diffstat (limited to 'runtime/src/pe_loader.h')
| -rw-r--r-- | runtime/src/pe_loader.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/runtime/src/pe_loader.h b/runtime/src/pe_loader.h index d9f89f542..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 |
| @@ -106,7 +106,7 @@ public: | |||
| 106 | 106 | ||
| 107 | // Run-time module lookup/loading used by the library_loader shim for bundled package DLLs. | 107 | // Run-time module lookup/loading used by the library_loader shim for bundled package DLLs. |
| 108 | void* find_loaded_module(const std::string& dll_lower) const; | 108 | void* find_loaded_module(const std::string& dll_lower) const; |
| 109 | void* load_runtime_module(const std::string& dll_lower, bool& handled); | 109 | void* load_runtime_module(const std::string& dll_lower, uint32_t flags, bool& handled); |
| 110 | void* resolve_module_export(void* module_handle, const std::string& sym, bool& owns_handle); | 110 | void* resolve_module_export(void* module_handle, const std::string& sym, bool& owns_handle); |
| 111 | bool owns_module_handle(void* module_handle) const; | 111 | bool owns_module_handle(void* module_handle) const; |
| 112 | 112 | ||