mirror of
https://git.h3cjp.net/H3cJP/citra.git
synced 2024-12-27 05:36:42 +00:00
Merge pull request #2281 from lioncash/memory
kernel/codeset: Make CodeSet's memory data member a regular std::vector
This commit is contained in:
commit
29df6bbbd3
|
@ -5,7 +5,6 @@
|
|||
#pragma once
|
||||
|
||||
#include <cstddef>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "common/common_types.h"
|
||||
|
@ -78,7 +77,7 @@ struct CodeSet final {
|
|||
}
|
||||
|
||||
/// The overall data that backs this code set.
|
||||
std::shared_ptr<std::vector<u8>> memory;
|
||||
std::vector<u8> memory;
|
||||
|
||||
/// The segments that comprise this code set.
|
||||
std::array<Segment, 3> segments;
|
||||
|
|
|
@ -218,11 +218,13 @@ void Process::FreeTLSSlot(VAddr tls_address) {
|
|||
}
|
||||
|
||||
void Process::LoadModule(CodeSet module_, VAddr base_addr) {
|
||||
const auto memory = std::make_shared<std::vector<u8>>(std::move(module_.memory));
|
||||
|
||||
const auto MapSegment = [&](const CodeSet::Segment& segment, VMAPermission permissions,
|
||||
MemoryState memory_state) {
|
||||
const auto vma = vm_manager
|
||||
.MapMemoryBlock(segment.addr + base_addr, module_.memory,
|
||||
segment.offset, segment.size, memory_state)
|
||||
.MapMemoryBlock(segment.addr + base_addr, memory, segment.offset,
|
||||
segment.size, memory_state)
|
||||
.Unwrap();
|
||||
vm_manager.Reprotect(vma, permissions);
|
||||
};
|
||||
|
|
|
@ -341,7 +341,7 @@ Kernel::CodeSet ElfReader::LoadInto(VAddr vaddr) {
|
|||
}
|
||||
|
||||
codeset.entrypoint = base_addr + header->e_entry;
|
||||
codeset.memory = std::make_shared<std::vector<u8>>(std::move(program_image));
|
||||
codeset.memory = std::move(program_image);
|
||||
|
||||
LOG_DEBUG(Loader, "Done loading.");
|
||||
|
||||
|
|
|
@ -187,7 +187,7 @@ static bool LoadNroImpl(Kernel::Process& process, const std::vector<u8>& data,
|
|||
program_image.resize(static_cast<u32>(program_image.size()) + bss_size);
|
||||
|
||||
// Load codeset for current process
|
||||
codeset.memory = std::make_shared<std::vector<u8>>(std::move(program_image));
|
||||
codeset.memory = std::move(program_image);
|
||||
process.LoadModule(std::move(codeset), load_base);
|
||||
|
||||
// Register module with GDBStub
|
||||
|
|
|
@ -161,7 +161,7 @@ std::optional<VAddr> AppLoader_NSO::LoadModule(Kernel::Process& process,
|
|||
}
|
||||
|
||||
// Load codeset for current process
|
||||
codeset.memory = std::make_shared<std::vector<u8>>(std::move(program_image));
|
||||
codeset.memory = std::move(program_image);
|
||||
process.LoadModule(std::move(codeset), load_base);
|
||||
|
||||
// Register module with GDBStub
|
||||
|
|
Loading…
Reference in a new issue