summaryrefslogtreecommitdiffstats
path: root/src/core/loader
diff options
context:
space:
mode:
authorLiam <byteslice@airmail.cc>2023-11-22 05:29:40 +0100
committert895 <clombardo169@gmail.com>2023-11-25 06:47:36 +0100
commitd040b27a35fdf520b17fe6b1cd792058172c8ccc (patch)
tree651f5b0c3297fb26511a3075a5303b728fcf63c8 /src/core/loader
parentarm_nce: skip data aborts for crash handling parity (diff)
downloadyuzu-d040b27a35fdf520b17fe6b1cd792058172c8ccc.tar
yuzu-d040b27a35fdf520b17fe6b1cd792058172c8ccc.tar.gz
yuzu-d040b27a35fdf520b17fe6b1cd792058172c8ccc.tar.bz2
yuzu-d040b27a35fdf520b17fe6b1cd792058172c8ccc.tar.lz
yuzu-d040b27a35fdf520b17fe6b1cd792058172c8ccc.tar.xz
yuzu-d040b27a35fdf520b17fe6b1cd792058172c8ccc.tar.zst
yuzu-d040b27a35fdf520b17fe6b1cd792058172c8ccc.zip
Diffstat (limited to '')
-rw-r--r--src/core/loader/nso.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/core/loader/nso.cpp b/src/core/loader/nso.cpp
index 878c1c6cb..e310c8f0f 100644
--- a/src/core/loader/nso.cpp
+++ b/src/core/loader/nso.cpp
@@ -145,14 +145,16 @@ std::optional<VAddr> AppLoader_NSO::LoadModule(Kernel::KProcess& process, Core::
// Apply patches if necessary
const auto name = nso_file.GetName();
if (pm && (pm->HasNSOPatch(nso_header.build_id, name) || Settings::values.dump_nso)) {
- std::vector<u8> pi_header(sizeof(NSOHeader) + program_image.size());
+ std::span<u8> patchable_section(program_image.data() + module_start,
+ program_image.size() - module_start);
+ std::vector<u8> pi_header(sizeof(NSOHeader) + patchable_section.size());
std::memcpy(pi_header.data(), &nso_header, sizeof(NSOHeader));
- std::memcpy(pi_header.data() + sizeof(NSOHeader), program_image.data(),
- program_image.size());
+ std::memcpy(pi_header.data() + sizeof(NSOHeader), patchable_section.data(),
+ patchable_section.size());
pi_header = pm->PatchNSO(pi_header, name);
- std::copy(pi_header.begin() + sizeof(NSOHeader), pi_header.end(), program_image.data());
+ std::copy(pi_header.begin() + sizeof(NSOHeader), pi_header.end(), patchable_section.data());
}
#ifdef HAS_NCE