summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/process.cpp
diff options
context:
space:
mode:
authorGravatar Lioncash2019-03-22 14:51:36 -0400
committerGravatar Lioncash2019-03-22 18:43:46 -0400
commitc0a01f3adc466d07fc27020048e82cca60988970 (patch)
tree4bf8428709b8a55210a9591841c0dde623386ad1 /src/core/hle/kernel/process.cpp
parentMerge pull request #2234 from lioncash/mutex (diff)
downloadyuzu-c0a01f3adc466d07fc27020048e82cca60988970.tar.gz
yuzu-c0a01f3adc466d07fc27020048e82cca60988970.tar.xz
yuzu-c0a01f3adc466d07fc27020048e82cca60988970.zip
kernel/codeset: Make CodeSet's memory data member a regular std::vector
The use of a shared_ptr is an implementation detail of the VMManager itself when mapping memory. Because of that, we shouldn't require all users of the CodeSet to have to allocate the shared_ptr ahead of time. It's intended that CodeSet simply pass in the required direct data, and that the memory manager takes care of it from that point on. This means we just do the shared pointer allocation in a single place, when loading modules, as opposed to in each loader.
Diffstat (limited to 'src/core/hle/kernel/process.cpp')
-rw-r--r--src/core/hle/kernel/process.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/core/hle/kernel/process.cpp b/src/core/hle/kernel/process.cpp
index 0d782e4ba..87779a71c 100644
--- a/src/core/hle/kernel/process.cpp
+++ b/src/core/hle/kernel/process.cpp
@@ -210,11 +210,13 @@ void Process::FreeTLSSlot(VAddr tls_address) {
210} 210}
211 211
212void Process::LoadModule(CodeSet module_, VAddr base_addr) { 212void Process::LoadModule(CodeSet module_, VAddr base_addr) {
213 const auto memory = std::make_shared<std::vector<u8>>(std::move(module_.memory));
214
213 const auto MapSegment = [&](const CodeSet::Segment& segment, VMAPermission permissions, 215 const auto MapSegment = [&](const CodeSet::Segment& segment, VMAPermission permissions,
214 MemoryState memory_state) { 216 MemoryState memory_state) {
215 const auto vma = vm_manager 217 const auto vma = vm_manager
216 .MapMemoryBlock(segment.addr + base_addr, module_.memory, 218 .MapMemoryBlock(segment.addr + base_addr, memory, segment.offset,
217 segment.offset, segment.size, memory_state) 219 segment.size, memory_state)
218 .Unwrap(); 220 .Unwrap();
219 vm_manager.Reprotect(vma, permissions); 221 vm_manager.Reprotect(vma, permissions);
220 }; 222 };