upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime/src/pe_loader.cpp
diff options
context:
space:
mode:
authormariuslozo-boop <254631011+mariuslozo-boop@users.noreply.github.com>2026-11-23 18:50:27 +0100
committermariuslozo-boop <254631011+mariuslozo-boop@users.noreply.github.com>2026-11-23 18:59:39 +0100
commita9085b661c3637ce4d154dab3c0d5b4a436d90ec (patch)
tree600bde9af3d005f20874cc8e7835a2ffc4ff6a76 /runtime/src/pe_loader.cpp
parent39479dfa6c0626c2aaf60031fce2216a3fe2a5df (diff)
Loader: merge main; README matches load()'s existing-thread copy; skip the missing-TMP case under Wine
- Merged Roberto0953's rebase (main 042c5f37 + install_on_existing_threads covering kMainImageSlot, so a thread already running at load() gets the executable's slot-0 block like every other module's) and then the newest main (clean). - runtime/README.md: the index-0 paragraph said older threads get the copy through install_tls_for_thread(); since main's existing-thread install they get it from load() itself, as the limits section already says. - check_tls_index0.cmake: Wine's GetTempPathW falls back to the user's Temp folder when TMP and TEMP name a missing one, so the reservation cannot fail there; the refusal part is skipped under an emulator (jlric, isfcrctfs). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'runtime/src/pe_loader.cpp')
-rw-r--r--runtime/src/pe_loader.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/runtime/src/pe_loader.cpp b/runtime/src/pe_loader.cpp
index 78c0c394a..cfff11990 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.