summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel/svc/svc_light_ipc.cpp
diff options
context:
space:
mode:
authorLiam <byteslice@airmail.cc>2023-02-05 20:22:02 +0100
committerLiam <byteslice@airmail.cc>2023-02-07 05:57:44 +0100
commit2415d37ea296e8856267375989a8b95cebe2575a (patch)
tree376baf5952a8ccc15b445702d38c056ffa71dd1b /src/core/hle/kernel/svc/svc_light_ipc.cpp
parentMerge pull request #9731 from liamwhite/svc-move-only (diff)
downloadyuzu-2415d37ea296e8856267375989a8b95cebe2575a.tar
yuzu-2415d37ea296e8856267375989a8b95cebe2575a.tar.gz
yuzu-2415d37ea296e8856267375989a8b95cebe2575a.tar.bz2
yuzu-2415d37ea296e8856267375989a8b95cebe2575a.tar.lz
yuzu-2415d37ea296e8856267375989a8b95cebe2575a.tar.xz
yuzu-2415d37ea296e8856267375989a8b95cebe2575a.tar.zst
yuzu-2415d37ea296e8856267375989a8b95cebe2575a.zip
Diffstat (limited to 'src/core/hle/kernel/svc/svc_light_ipc.cpp')
-rw-r--r--src/core/hle/kernel/svc/svc_light_ipc.cpp69
1 files changed, 68 insertions, 1 deletions
diff --git a/src/core/hle/kernel/svc/svc_light_ipc.cpp b/src/core/hle/kernel/svc/svc_light_ipc.cpp
index 299e22ae6..b76ce984c 100644
--- a/src/core/hle/kernel/svc/svc_light_ipc.cpp
+++ b/src/core/hle/kernel/svc/svc_light_ipc.cpp
@@ -1,6 +1,73 @@
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
+#include "core/arm/arm_interface.h"
+#include "core/core.h"
#include "core/hle/kernel/svc.h"
+#include "core/hle/kernel/svc_results.h"
-namespace Kernel::Svc {} // namespace Kernel::Svc
+namespace Kernel::Svc {
+
+Result SendSyncRequestLight(Core::System& system, Handle session_handle, u32* args) {
+ UNIMPLEMENTED();
+ R_THROW(ResultNotImplemented);
+}
+
+Result ReplyAndReceiveLight(Core::System& system, Handle session_handle, u32* args) {
+ UNIMPLEMENTED();
+ R_THROW(ResultNotImplemented);
+}
+
+Result SendSyncRequestLight64(Core::System& system, Handle session_handle, u32* args) {
+ R_RETURN(SendSyncRequestLight(system, session_handle, args));
+}
+
+Result ReplyAndReceiveLight64(Core::System& system, Handle session_handle, u32* args) {
+ R_RETURN(ReplyAndReceiveLight(system, session_handle, args));
+}
+
+Result SendSyncRequestLight64From32(Core::System& system, Handle session_handle, u32* args) {
+ R_RETURN(SendSyncRequestLight(system, session_handle, args));
+}
+
+Result ReplyAndReceiveLight64From32(Core::System& system, Handle session_handle, u32* args) {
+ R_RETURN(ReplyAndReceiveLight(system, session_handle, args));
+}
+
+// Custom ABI implementation for light IPC.
+
+template <typename F>
+static void SvcWrap_LightIpc(Core::System& system, F&& cb) {
+ auto& core = system.CurrentArmInterface();
+ std::array<u32, 7> arguments{};
+
+ Handle session_handle = static_cast<Handle>(core.GetReg(0));
+ for (int i = 0; i < 7; i++) {
+ arguments[i] = static_cast<u32>(core.GetReg(i + 1));
+ }
+
+ Result ret = cb(system, session_handle, arguments.data());
+
+ core.SetReg(0, ret.raw);
+ for (int i = 0; i < 7; i++) {
+ core.SetReg(i + 1, arguments[i]);
+ }
+}
+
+void SvcWrap_SendSyncRequestLight64(Core::System& system) {
+ SvcWrap_LightIpc(system, SendSyncRequestLight64);
+}
+
+void SvcWrap_ReplyAndReceiveLight64(Core::System& system) {
+ SvcWrap_LightIpc(system, ReplyAndReceiveLight64);
+}
+
+void SvcWrap_SendSyncRequestLight64From32(Core::System& system) {
+ SvcWrap_LightIpc(system, SendSyncRequestLight64From32);
+}
+
+void SvcWrap_ReplyAndReceiveLight64From32(Core::System& system) {
+ SvcWrap_LightIpc(system, ReplyAndReceiveLight64From32);
+}
+
+} // namespace Kernel::Svc