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:
authorkotorvr <332716892+kotorvr@users.noreply.github.com>2026-11-22 21:36:51 +0000
committerkotorvr <332716892+kotorvr@users.noreply.github.com>2026-11-22 21:36:51 +0000
commitb1fdafc2f32984933e10b60693b560f80cb5ab69 (patch)
tree9567cb7aaa6d9e4b1794384925dff98c440cd470 /runtime/src/pe_loader.cpp
parentf3442f6cbddbdb20b9c3a28e9bb58f30936721f5 (diff)
loader: lookups take the range table's lock shared
Concurrent throws on different threads no longer queue on it; map_image takes it exclusively for the one push. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Diffstat (limited to 'runtime/src/pe_loader.cpp')
-rw-r--r--runtime/src/pe_loader.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/runtime/src/pe_loader.cpp b/runtime/src/pe_loader.cpp
index f894fcb43..c630c9abf 100644
--- a/runtime/src/pe_loader.cpp
+++ b/runtime/src/pe_loader.cpp
@@ -630,7 +630,7 @@ void* Loader::resolve_module_export(void* module_handle, const std::string& sym,
630} 630}
631 631
632bool Loader::find_address(uint64_t address, std::string& module, uint32_t& rva) const { 632bool Loader::find_address(uint64_t address, std::string& module, uint32_t& rva) const {
633 std::lock_guard lock(ranges_mutex_); 633 std::shared_lock lock(ranges_mutex_);
634 for (const MappedRange& r : ranges_) { 634 for (const MappedRange& r : ranges_) {
635 if (address >= r.base && address - r.base < r.size) { 635 if (address >= r.base && address - r.base < r.size) {
636 module = r.name; 636 module = r.name;
@@ -772,7 +772,7 @@ Module& Loader::map_image(const std::filesystem::path& path) {
772 { 772 {
773 // From here an address inside the image names it. The memory stays until ~Loader, which unregisters the 773 // From here an address inside the image names it. The memory stays until ~Loader, which unregisters the
774 // lookup first. 774 // lookup first.
775 std::lock_guard lock(ranges_mutex_); 775 std::unique_lock lock(ranges_mutex_);
776 ranges_.push_back({reinterpret_cast<uint64_t>(m->base), m->size, m->name}); 776 ranges_.push_back({reinterpret_cast<uint64_t>(m->base), m->size, m->name});
777 } 777 }
778 778