diff options
| author | Nolan Cotter <186326284+NolanCotter@users.noreply.github.com> | 2026-11-22 20:39:59 -0700 |
|---|---|---|
| committer | Nolan Cotter <186326284+NolanCotter@users.noreply.github.com> | 2026-11-22 20:39:59 -0700 |
| commit | fa5f26db8eafd2cc27f627b68c0a5a5949bcf2ff (patch) | |
| tree | fc57e238be829295fc216dff89a6d93e64c16b50 /runtime/src/pe_loader.h | |
| parent | 9b693ecd8a2f90799f6c47f8f06cf062feb9820c (diff) | |
| parent | 7b7d73f890f9fbbf5967bbb694390bbc99e33ba6 (diff) | |
Merge origin/main: DXGI device fields coexist with the console-ABI device state
Diffstat (limited to 'runtime/src/pe_loader.h')
| -rw-r--r-- | runtime/src/pe_loader.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/runtime/src/pe_loader.h b/runtime/src/pe_loader.h index e73c36339..d7e5be91c 100644 --- a/runtime/src/pe_loader.h +++ b/runtime/src/pe_loader.h | |||
| @@ -9,6 +9,7 @@ | |||
| 9 | #include <filesystem> | 9 | #include <filesystem> |
| 10 | #include <map> | 10 | #include <map> |
| 11 | #include <mutex> | 11 | #include <mutex> |
| 12 | #include <shared_mutex> | ||
| 12 | #include <string> | 13 | #include <string> |
| 13 | #include <vector> | 14 | #include <vector> |
| 14 | 15 | ||
| @@ -79,6 +80,11 @@ public: | |||
| 79 | 80 | ||
| 80 | const std::vector<Module*>& modules() const { return order_; } | 81 | const std::vector<Module*>& modules() const { return order_; } |
| 81 | 82 | ||
| 83 | // The mapped module `address` lies in, with its RVA there. Safe from any thread at any time, also while another | ||
| 84 | // thread is in load(): it is what the shim registry asks for a caller's module (rt::shims::mapped_image_base on | ||
| 85 | // every C++ throw from a mapped image, and the trace and stop lines), and it reads its own table, not modules(). | ||
| 86 | bool find_address(uint64_t address, std::string& module, uint32_t& rva) const; | ||
| 87 | |||
| 82 | // The order initialise() runs modules in: each module after every module it imports (a cycle is broken at the | 88 | // The order initialise() runs modules in: each module after every module it imports (a cycle is broken at the |
| 83 | // module that closed it). modules() is mapping order, which puts an importer before its imports. | 89 | // module that closed it). modules() is mapping order, which puts an importer before its imports. |
| 84 | const std::vector<Module*>& initialisation_order() const { return init_order_; } | 90 | const std::vector<Module*>& initialisation_order() const { return init_order_; } |
| @@ -133,6 +139,17 @@ private: | |||
| 133 | std::map<std::string, Module*> by_name_; // lower-case file name | 139 | std::map<std::string, Module*> by_name_; // lower-case file name |
| 134 | std::vector<Module*> order_; // mapping order; owns the modules | 140 | std::vector<Module*> order_; // mapping order; owns the modules |
| 135 | std::vector<Module*> init_order_; // dependencies first, see initialisation_order() | 141 | std::vector<Module*> init_order_; // dependencies first, see initialisation_order() |
| 142 | |||
| 143 | // What find_address reads: one entry per mapped image, added once its memory exists. Under ranges_mutex_, a leaf | ||
| 144 | // lock: mutex_ is held while image code runs and the registry holds its own lock around the lookup, so the | ||
| 145 | // lookup must not wait for either. | ||
| 146 | struct MappedRange { | ||
| 147 | uint64_t base = 0; | ||
| 148 | uint32_t size = 0; | ||
| 149 | std::string name; | ||
| 150 | }; | ||
| 151 | mutable std::shared_mutex ranges_mutex_; // shared in find_address: lookups on different threads do not queue | ||
| 152 | std::vector<MappedRange> ranges_; | ||
| 136 | }; | 153 | }; |
| 137 | 154 | ||
| 138 | // Frees the TLS helper clones load() created and deletes their files (Module::tls_index background). load() | 155 | // Frees the TLS helper clones load() created and deletes their files (Module::tls_index background). load() |