mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-22 02:41:49 -05:00
Merge pull request #6287 from lioncash/ldr-copy
ldr: Simplify memory copy within LoadNro()
This commit is contained in:
commit
8acf739b3f
1 changed files with 3 additions and 5 deletions
|
@ -387,11 +387,9 @@ public:
|
|||
const VAddr bss_end_addr{
|
||||
Common::AlignUp(bss_start + nro_header.bss_size, Kernel::PageSize)};
|
||||
|
||||
auto CopyCode{[&](VAddr src_addr, VAddr dst_addr, u64 size) {
|
||||
std::vector<u8> source_data(size);
|
||||
system.Memory().ReadBlock(src_addr, source_data.data(), source_data.size());
|
||||
system.Memory().WriteBlock(dst_addr, source_data.data(), source_data.size());
|
||||
}};
|
||||
const auto CopyCode = [this, process](VAddr src_addr, VAddr dst_addr, u64 size) {
|
||||
system.Memory().CopyBlock(*process, dst_addr, src_addr, size);
|
||||
};
|
||||
CopyCode(nro_addr + nro_header.segment_headers[TEXT_INDEX].memory_offset, text_start,
|
||||
nro_header.segment_headers[TEXT_INDEX].memory_size);
|
||||
CopyCode(nro_addr + nro_header.segment_headers[RO_INDEX].memory_offset, ro_start,
|
||||
|
|
Loading…
Reference in a new issue