diff options
| author | Mai <mai.iam2048@gmail.com> | 2023-02-05 02:26:52 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-02-05 02:26:52 -0500 |
| commit | 037300014385d7dd25029d7aac188f325f1e5bc3 (patch) | |
| tree | be79f36453a4735088d9230e02f426792077eeb4 /src/core/hle/kernel/svc/svc_cache.cpp | |
| parent | a64fc3ee77f26dc488f51e2348ef5b63ae4e8299 (diff) | |
| parent | 92eb091ddb9dfd96e59a75937e185079a63626e3 (diff) | |
Merge pull request #9731 from liamwhite/svc-move-only
kernel/svc: Split implementations into separate files
Diffstat (limited to 'src/core/hle/kernel/svc/svc_cache.cpp')
| -rw-r--r-- | src/core/hle/kernel/svc/svc_cache.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/core/hle/kernel/svc/svc_cache.cpp b/src/core/hle/kernel/svc/svc_cache.cpp new file mode 100644 index 000000000..42167d35b --- /dev/null +++ b/src/core/hle/kernel/svc/svc_cache.cpp @@ -0,0 +1,31 @@ +// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "core/core.h" +#include "core/hle/kernel/k_process.h" +#include "core/hle/kernel/svc.h" +#include "core/hle/kernel/svc_results.h" +#include "core/hle/kernel/svc_types.h" + +namespace Kernel::Svc { + +Result FlushProcessDataCache32(Core::System& system, Handle process_handle, u64 address, u64 size) { + // Validate address/size. + R_UNLESS(size > 0, ResultInvalidSize); + R_UNLESS(address == static_cast<uintptr_t>(address), ResultInvalidCurrentMemory); + R_UNLESS(size == static_cast<size_t>(size), ResultInvalidCurrentMemory); + + // Get the process from its handle. + KScopedAutoObject process = + system.Kernel().CurrentProcess()->GetHandleTable().GetObject<KProcess>(process_handle); + R_UNLESS(process.IsNotNull(), ResultInvalidHandle); + + // Verify the region is within range. + auto& page_table = process->PageTable(); + R_UNLESS(page_table.Contains(address, size), ResultInvalidCurrentMemory); + + // Perform the operation. + R_RETURN(system.Memory().FlushDataCache(*process, address, size)); +} + +} // namespace Kernel::Svc |
