diff options
Diffstat (limited to 'src/core/hle/kernel')
-rw-r--r-- | src/core/hle/kernel/object.cpp | 1 | ||||
-rw-r--r-- | src/core/hle/kernel/object.h | 1 | ||||
-rw-r--r-- | src/core/hle/kernel/process.cpp | 24 | ||||
-rw-r--r-- | src/core/hle/kernel/process.h | 28 |
4 files changed, 14 insertions, 40 deletions
diff --git a/src/core/hle/kernel/object.cpp b/src/core/hle/kernel/object.cpp index d51562d92..d87a62bb9 100644 --- a/src/core/hle/kernel/object.cpp +++ b/src/core/hle/kernel/object.cpp @@ -25,7 +25,6 @@ bool Object::IsWaitable() const { case HandleType::Process: case HandleType::AddressArbiter: case HandleType::ResourceLimit: - case HandleType::CodeSet: case HandleType::ClientPort: case HandleType::ClientSession: return false; diff --git a/src/core/hle/kernel/object.h b/src/core/hle/kernel/object.h index 9eb72315c..c9f4d0bb3 100644 --- a/src/core/hle/kernel/object.h +++ b/src/core/hle/kernel/object.h @@ -26,7 +26,6 @@ enum class HandleType : u32 { AddressArbiter, Timer, ResourceLimit, - CodeSet, ClientPort, ServerPort, ClientSession, diff --git a/src/core/hle/kernel/process.cpp b/src/core/hle/kernel/process.cpp index fb0027a71..c80b2c507 100644 --- a/src/core/hle/kernel/process.cpp +++ b/src/core/hle/kernel/process.cpp @@ -20,13 +20,7 @@ namespace Kernel { -SharedPtr<CodeSet> CodeSet::Create(KernelCore& kernel, std::string name) { - SharedPtr<CodeSet> codeset(new CodeSet(kernel)); - codeset->name = std::move(name); - return codeset; -} - -CodeSet::CodeSet(KernelCore& kernel) : Object{kernel} {} +CodeSet::CodeSet() = default; CodeSet::~CodeSet() = default; SharedPtr<Process> Process::Create(KernelCore& kernel, std::string&& name) { @@ -224,20 +218,20 @@ void Process::FreeTLSSlot(VAddr tls_address) { tls_slots[tls_page].reset(tls_slot); } -void Process::LoadModule(SharedPtr<CodeSet> module_, VAddr base_addr) { +void Process::LoadModule(CodeSet module_, VAddr base_addr) { const auto MapSegment = [&](CodeSet::Segment& segment, VMAPermission permissions, MemoryState memory_state) { - auto vma = vm_manager - .MapMemoryBlock(segment.addr + base_addr, module_->memory, segment.offset, - segment.size, memory_state) - .Unwrap(); + const auto vma = vm_manager + .MapMemoryBlock(segment.addr + base_addr, module_.memory, + segment.offset, segment.size, memory_state) + .Unwrap(); vm_manager.Reprotect(vma, permissions); }; // Map CodeSet segments - MapSegment(module_->CodeSegment(), VMAPermission::ReadExecute, MemoryState::CodeStatic); - MapSegment(module_->RODataSegment(), VMAPermission::Read, MemoryState::CodeMutable); - MapSegment(module_->DataSegment(), VMAPermission::ReadWrite, MemoryState::CodeMutable); + MapSegment(module_.CodeSegment(), VMAPermission::ReadExecute, MemoryState::CodeStatic); + MapSegment(module_.RODataSegment(), VMAPermission::Read, MemoryState::CodeMutable); + MapSegment(module_.DataSegment(), VMAPermission::ReadWrite, MemoryState::CodeMutable); } ResultVal<VAddr> Process::HeapAllocate(VAddr target, u64 size, VMAPermission perms) { diff --git a/src/core/hle/kernel/process.h b/src/core/hle/kernel/process.h index 590e0c73d..73ec01e11 100644 --- a/src/core/hle/kernel/process.h +++ b/src/core/hle/kernel/process.h @@ -61,26 +61,15 @@ enum class ProcessStatus { Created, Running, Exited }; class ResourceLimit; -struct CodeSet final : public Object { +struct CodeSet final { struct Segment { std::size_t offset = 0; VAddr addr = 0; u32 size = 0; }; - static SharedPtr<CodeSet> Create(KernelCore& kernel, std::string name); - - std::string GetTypeName() const override { - return "CodeSet"; - } - std::string GetName() const override { - return name; - } - - static const HandleType HANDLE_TYPE = HandleType::CodeSet; - HandleType GetHandleType() const override { - return HANDLE_TYPE; - } + explicit CodeSet(); + ~CodeSet(); Segment& CodeSegment() { return segments[0]; @@ -109,14 +98,7 @@ struct CodeSet final : public Object { std::shared_ptr<std::vector<u8>> memory; std::array<Segment, 3> segments; - VAddr entrypoint; - - /// Name of the process - std::string name; - -private: - explicit CodeSet(KernelCore& kernel); - ~CodeSet() override; + VAddr entrypoint = 0; }; class Process final : public Object { @@ -219,7 +201,7 @@ public: */ void PrepareForTermination(); - void LoadModule(SharedPtr<CodeSet> module_, VAddr base_addr); + void LoadModule(CodeSet module_, VAddr base_addr); /////////////////////////////////////////////////////////////////////////////////////////////// // Memory Management |