diff options
author | liamwhite <liamwhite@users.noreply.github.com> | 2023-02-15 23:42:45 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-15 23:42:45 +0100 |
commit | 6d77de96dae4763ef78fdea1918b582e5e181653 (patch) | |
tree | 0c131de68a68c23f62a8a253b3cf69d3bfc91ee7 /src/core/hle/kernel/svc/svc_code_memory.cpp | |
parent | Merge pull request #9782 from arades79/fix-consexpr-value-declaration-usage (diff) | |
parent | general: rename CurrentProcess to ApplicationProcess (diff) | |
download | yuzu-6d77de96dae4763ef78fdea1918b582e5e181653.tar yuzu-6d77de96dae4763ef78fdea1918b582e5e181653.tar.gz yuzu-6d77de96dae4763ef78fdea1918b582e5e181653.tar.bz2 yuzu-6d77de96dae4763ef78fdea1918b582e5e181653.tar.lz yuzu-6d77de96dae4763ef78fdea1918b582e5e181653.tar.xz yuzu-6d77de96dae4763ef78fdea1918b582e5e181653.tar.zst yuzu-6d77de96dae4763ef78fdea1918b582e5e181653.zip |
Diffstat (limited to 'src/core/hle/kernel/svc/svc_code_memory.cpp')
-rw-r--r-- | src/core/hle/kernel/svc/svc_code_memory.cpp | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/core/hle/kernel/svc/svc_code_memory.cpp b/src/core/hle/kernel/svc/svc_code_memory.cpp index ec256b757..538ff1c71 100644 --- a/src/core/hle/kernel/svc/svc_code_memory.cpp +++ b/src/core/hle/kernel/svc/svc_code_memory.cpp @@ -46,7 +46,7 @@ Result CreateCodeMemory(Core::System& system, Handle* out, VAddr address, size_t R_UNLESS(code_mem != nullptr, ResultOutOfResource); // Verify that the region is in range. - R_UNLESS(system.CurrentProcess()->PageTable().Contains(address, size), + R_UNLESS(GetCurrentProcess(system.Kernel()).PageTable().Contains(address, size), ResultInvalidCurrentMemory); // Initialize the code memory. @@ -56,7 +56,7 @@ Result CreateCodeMemory(Core::System& system, Handle* out, VAddr address, size_t KCodeMemory::Register(kernel, code_mem); // Add the code memory to the handle table. - R_TRY(system.CurrentProcess()->GetHandleTable().Add(out, code_mem)); + R_TRY(GetCurrentProcess(system.Kernel()).GetHandleTable().Add(out, code_mem)); code_mem->Close(); @@ -79,8 +79,9 @@ Result ControlCodeMemory(Core::System& system, Handle code_memory_handle, R_UNLESS((address < address + size), ResultInvalidCurrentMemory); // Get the code memory from its handle. - KScopedAutoObject code_mem = - system.CurrentProcess()->GetHandleTable().GetObject<KCodeMemory>(code_memory_handle); + KScopedAutoObject code_mem = GetCurrentProcess(system.Kernel()) + .GetHandleTable() + .GetObject<KCodeMemory>(code_memory_handle); R_UNLESS(code_mem.IsNotNull(), ResultInvalidHandle); // NOTE: Here, Atmosphere extends the SVC to allow code memory operations on one's own process. @@ -90,9 +91,10 @@ Result ControlCodeMemory(Core::System& system, Handle code_memory_handle, switch (operation) { case CodeMemoryOperation::Map: { // Check that the region is in range. - R_UNLESS( - system.CurrentProcess()->PageTable().CanContain(address, size, KMemoryState::CodeOut), - ResultInvalidMemoryRegion); + R_UNLESS(GetCurrentProcess(system.Kernel()) + .PageTable() + .CanContain(address, size, KMemoryState::CodeOut), + ResultInvalidMemoryRegion); // Check the memory permission. R_UNLESS(IsValidMapCodeMemoryPermission(perm), ResultInvalidNewMemoryPermission); @@ -102,9 +104,10 @@ Result ControlCodeMemory(Core::System& system, Handle code_memory_handle, } break; case CodeMemoryOperation::Unmap: { // Check that the region is in range. - R_UNLESS( - system.CurrentProcess()->PageTable().CanContain(address, size, KMemoryState::CodeOut), - ResultInvalidMemoryRegion); + R_UNLESS(GetCurrentProcess(system.Kernel()) + .PageTable() + .CanContain(address, size, KMemoryState::CodeOut), + ResultInvalidMemoryRegion); // Check the memory permission. R_UNLESS(IsValidUnmapCodeMemoryPermission(perm), ResultInvalidNewMemoryPermission); |