k_server_session: preliminary support for userspace server sessions

This commit is contained in:
Liam
2022-10-11 18:16:56 -04:00
parent 9b34afa588
commit 61a8696510
9 changed files with 346 additions and 49 deletions

View File

@ -8,6 +8,7 @@
#include "core/core.h"
#include "core/hle/kernel/svc_types.h"
#include "core/hle/result.h"
#include "core/memory.h"
namespace Kernel {
@ -360,6 +361,23 @@ void SvcWrap64(Core::System& system) {
FuncReturn(system, retval);
}
// Used by ReplyAndReceive
template <Result func(Core::System&, s32*, Handle*, s32, Handle, s64)>
void SvcWrap64(Core::System& system) {
s32 param_1 = 0;
s32 num_handles = static_cast<s32>(Param(system, 2));
std::vector<Handle> handles(num_handles);
system.Memory().ReadBlock(Param(system, 1), handles.data(), num_handles * sizeof(Handle));
const u32 retval = func(system, &param_1, handles.data(), num_handles,
static_cast<s32>(Param(system, 3)), static_cast<s64>(Param(system, 4)))
.raw;
system.CurrentArmInterface().SetReg(1, param_1);
FuncReturn(system, retval);
}
// Used by WaitForAddress
template <Result func(Core::System&, u64, Svc::ArbitrationType, s32, s64)>
void SvcWrap64(Core::System& system) {