diff options
author | GPUCode <geoster3d@gmail.com> | 2023-11-23 10:26:06 +0100 |
---|---|---|
committer | t895 <clombardo169@gmail.com> | 2023-11-25 06:47:43 +0100 |
commit | 9ff8d0f3e652fee83d9f4374d9f6e0aa1759dd88 (patch) | |
tree | d3bf69c51eab1e4c56db1615ecf5193aa76badcc /src/core/arm | |
parent | loader: apply nso patch to offset program image (diff) | |
download | yuzu-9ff8d0f3e652fee83d9f4374d9f6e0aa1759dd88.tar yuzu-9ff8d0f3e652fee83d9f4374d9f6e0aa1759dd88.tar.gz yuzu-9ff8d0f3e652fee83d9f4374d9f6e0aa1759dd88.tar.bz2 yuzu-9ff8d0f3e652fee83d9f4374d9f6e0aa1759dd88.tar.lz yuzu-9ff8d0f3e652fee83d9f4374d9f6e0aa1759dd88.tar.xz yuzu-9ff8d0f3e652fee83d9f4374d9f6e0aa1759dd88.tar.zst yuzu-9ff8d0f3e652fee83d9f4374d9f6e0aa1759dd88.zip |
Diffstat (limited to 'src/core/arm')
-rw-r--r-- | src/core/arm/nce/patch.cpp | 12 | ||||
-rw-r--r-- | src/core/arm/nce/patch.h | 1 |
2 files changed, 8 insertions, 5 deletions
diff --git a/src/core/arm/nce/patch.cpp b/src/core/arm/nce/patch.cpp index 30c3c6cdd..a08859d0b 100644 --- a/src/core/arm/nce/patch.cpp +++ b/src/core/arm/nce/patch.cpp @@ -90,6 +90,10 @@ void Patcher::PatchText(const Kernel::PhysicalMemory& program_image, WriteMsrHandler(AddRelocations(), oaknut::XReg{static_cast<int>(msr.GetRt())}); continue; } + + if (auto exclusive = Exclusive{inst}; exclusive.Verify()) { + m_exclusives.push_back(i); + } } // Determine patching mode for the final relocation step @@ -163,11 +167,9 @@ void Patcher::RelocateAndCopy(Common::ProcessAddress load_base, // Cortex-A57 seems to treat all exclusives as ordered, but newer processors do not. // Convert to ordered to preserve this assumption. - for (u32 i = ModuleCodeIndex; i < static_cast<u32>(text_words.size()); i++) { - const u32 inst = text_words[i]; - if (auto exclusive = Exclusive{inst}; exclusive.Verify()) { - text_words[i] = exclusive.AsOrdered(); - } + for (const ModuleTextAddress i : m_exclusives) { + auto exclusive = Exclusive{text_words[i]}; + text_words[i] = exclusive.AsOrdered(); } // Copy to program image diff --git a/src/core/arm/nce/patch.h b/src/core/arm/nce/patch.h index dcce1bfc6..112f839a4 100644 --- a/src/core/arm/nce/patch.h +++ b/src/core/arm/nce/patch.h @@ -93,6 +93,7 @@ private: std::vector<Relocation> m_branch_to_patch_relocations{}; std::vector<Relocation> m_branch_to_module_relocations{}; std::vector<Relocation> m_write_module_pc_relocations{}; + std::vector<ModuleTextAddress> m_exclusives{}; oaknut::Label m_save_context{}; oaknut::Label m_load_context{}; PatchMode mode{PatchMode::None}; |