summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel/svc.cpp
diff options
context:
space:
mode:
authorNarr the Reg <juangerman-13@hotmail.com>2022-11-20 16:31:20 +0100
committerGitHub <noreply@github.com>2022-11-20 16:31:20 +0100
commitdb7bcd51ae09c4ef25e08096de563903f61e2380 (patch)
tree5ae9977b48e1aff118fae3ebffb215b0b4afa887 /src/core/hle/kernel/svc.cpp
parentservice: nfc: Implement nfc user (diff)
parentMerge pull request #9238 from german77/cabinet_applet (diff)
downloadyuzu-db7bcd51ae09c4ef25e08096de563903f61e2380.tar
yuzu-db7bcd51ae09c4ef25e08096de563903f61e2380.tar.gz
yuzu-db7bcd51ae09c4ef25e08096de563903f61e2380.tar.bz2
yuzu-db7bcd51ae09c4ef25e08096de563903f61e2380.tar.lz
yuzu-db7bcd51ae09c4ef25e08096de563903f61e2380.tar.xz
yuzu-db7bcd51ae09c4ef25e08096de563903f61e2380.tar.zst
yuzu-db7bcd51ae09c4ef25e08096de563903f61e2380.zip
Diffstat (limited to 'src/core/hle/kernel/svc.cpp')
-rw-r--r--src/core/hle/kernel/svc.cpp26
1 files changed, 18 insertions, 8 deletions
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp
index 9962ad171..e520cab47 100644
--- a/src/core/hle/kernel/svc.cpp
+++ b/src/core/hle/kernel/svc.cpp
@@ -2701,14 +2701,24 @@ static Result GetThreadList(Core::System& system, u32* out_num_threads, VAddr ou
return ResultSuccess;
}
-static Result FlushProcessDataCache32([[maybe_unused]] Core::System& system,
- [[maybe_unused]] Handle handle, [[maybe_unused]] u32 address,
- [[maybe_unused]] u32 size) {
- // Note(Blinkhawk): For emulation purposes of the data cache this is mostly a no-op,
- // as all emulation is done in the same cache level in host architecture, thus data cache
- // does not need flushing.
- LOG_DEBUG(Kernel_SVC, "called");
- return ResultSuccess;
+static 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 {