diff options
Diffstat (limited to 'src/core/loader/nso.cpp')
| -rw-r--r-- | src/core/loader/nso.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/core/loader/nso.cpp b/src/core/loader/nso.cpp index 34b10ef2e..1ad2e917c 100644 --- a/src/core/loader/nso.cpp +++ b/src/core/loader/nso.cpp | |||
| @@ -94,8 +94,8 @@ std::optional<VAddr> AppLoader_NSO::LoadModule(Kernel::KProcess& process, Core:: | |||
| 94 | // Allocate some space at the beginning if we are patching in PreText mode. | 94 | // Allocate some space at the beginning if we are patching in PreText mode. |
| 95 | const size_t module_start = [&]() -> size_t { | 95 | const size_t module_start = [&]() -> size_t { |
| 96 | #ifdef ARCHITECTURE_arm64 | 96 | #ifdef ARCHITECTURE_arm64 |
| 97 | if (patch && patch->Mode() == Core::NCE::PatchMode::PreText) { | 97 | if (patch && patch->GetPatchMode() == Core::NCE::PatchMode::PreText) { |
| 98 | return patch->SectionSize(); | 98 | return patch->GetSectionSize(); |
| 99 | } | 99 | } |
| 100 | #endif | 100 | #endif |
| 101 | return 0; | 101 | return 0; |
| @@ -158,24 +158,25 @@ std::optional<VAddr> AppLoader_NSO::LoadModule(Kernel::KProcess& process, Core:: | |||
| 158 | #ifdef ARCHITECTURE_arm64 | 158 | #ifdef ARCHITECTURE_arm64 |
| 159 | // If we are computing the process code layout and using nce backend, patch. | 159 | // If we are computing the process code layout and using nce backend, patch. |
| 160 | const auto& code = codeset.CodeSegment(); | 160 | const auto& code = codeset.CodeSegment(); |
| 161 | if (patch && patch->Mode() == Core::NCE::PatchMode::None) { | 161 | if (patch && patch->GetPatchMode() == Core::NCE::PatchMode::None) { |
| 162 | // Patch SVCs and MRS calls in the guest code | 162 | // Patch SVCs and MRS calls in the guest code |
| 163 | patch->PatchText(program_image, code); | 163 | patch->PatchText(program_image, code); |
| 164 | 164 | ||
| 165 | // Add patch section size to the module size. | 165 | // Add patch section size to the module size. |
| 166 | image_size += patch->SectionSize(); | 166 | image_size += patch->GetSectionSize(); |
| 167 | } else if (patch) { | 167 | } else if (patch) { |
| 168 | // Relocate code patch and copy to the program_image. | 168 | // Relocate code patch and copy to the program_image. |
| 169 | patch->RelocateAndCopy(load_base, code, program_image, &process.GetPostHandlers()); | 169 | patch->RelocateAndCopy(load_base, code, program_image, &process.GetPostHandlers()); |
| 170 | 170 | ||
| 171 | // Update patch section. | 171 | // Update patch section. |
| 172 | auto& patch_segment = codeset.PatchSegment(); | 172 | auto& patch_segment = codeset.PatchSegment(); |
| 173 | patch_segment.addr = patch->Mode() == Core::NCE::PatchMode::PreText ? 0 : image_size; | 173 | patch_segment.addr = |
| 174 | patch_segment.size = static_cast<u32>(patch->SectionSize()); | 174 | patch->GetPatchMode() == Core::NCE::PatchMode::PreText ? 0 : image_size; |
| 175 | patch_segment.size = static_cast<u32>(patch->GetSectionSize()); | ||
| 175 | 176 | ||
| 176 | // Add patch section size to the module size. In PreText mode image_size | 177 | // Add patch section size to the module size. In PreText mode image_size |
| 177 | // already contains the patch segment as part of module_start. | 178 | // already contains the patch segment as part of module_start. |
| 178 | if (patch->Mode() == Core::NCE::PatchMode::PostData) { | 179 | if (patch->GetPatchMode() == Core::NCE::PatchMode::PostData) { |
| 179 | image_size += patch_segment.size; | 180 | image_size += patch_segment.size; |
| 180 | } | 181 | } |
| 181 | } | 182 | } |