1
0
Fork 0
forked from suyu/suyu

Merge pull request #6287 from lioncash/ldr-copy

ldr: Simplify memory copy within LoadNro()
This commit is contained in:
bunnei 2021-05-07 09:46:31 -07:00 committed by GitHub
commit 8acf739b3f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -387,11 +387,9 @@ public:
const VAddr bss_end_addr{ const VAddr bss_end_addr{
Common::AlignUp(bss_start + nro_header.bss_size, Kernel::PageSize)}; Common::AlignUp(bss_start + nro_header.bss_size, Kernel::PageSize)};
auto CopyCode{[&](VAddr src_addr, VAddr dst_addr, u64 size) { const auto CopyCode = [this, process](VAddr src_addr, VAddr dst_addr, u64 size) {
std::vector<u8> source_data(size); system.Memory().CopyBlock(*process, dst_addr, src_addr, size);
system.Memory().ReadBlock(src_addr, source_data.data(), source_data.size()); };
system.Memory().WriteBlock(dst_addr, source_data.data(), source_data.size());
}};
CopyCode(nro_addr + nro_header.segment_headers[TEXT_INDEX].memory_offset, text_start, CopyCode(nro_addr + nro_header.segment_headers[TEXT_INDEX].memory_offset, text_start,
nro_header.segment_headers[TEXT_INDEX].memory_size); nro_header.segment_headers[TEXT_INDEX].memory_size);
CopyCode(nro_addr + nro_header.segment_headers[RO_INDEX].memory_offset, ro_start, CopyCode(nro_addr + nro_header.segment_headers[RO_INDEX].memory_offset, ro_start,