2018-01-13 21:22:39 +00:00
|
|
|
// Copyright 2018 yuzu emulator team
|
2014-12-17 05:38:14 +00:00
|
|
|
// Licensed under GPLv2 or any later version
|
2014-06-07 03:31:29 +00:00
|
|
|
// Refer to the license.txt file included.
|
2014-04-10 23:58:28 +00:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "common/common_types.h"
|
2014-12-22 06:30:09 +00:00
|
|
|
#include "core/arm/arm_interface.h"
|
2016-09-20 15:21:23 +00:00
|
|
|
#include "core/core.h"
|
2020-12-30 09:14:02 +00:00
|
|
|
#include "core/hle/kernel/svc_types.h"
|
2015-06-08 03:39:37 +00:00
|
|
|
#include "core/hle/result.h"
|
2014-04-10 23:58:28 +00:00
|
|
|
|
2018-01-03 01:40:30 +00:00
|
|
|
namespace Kernel {
|
2014-04-10 23:58:28 +00:00
|
|
|
|
2020-10-21 02:07:39 +00:00
|
|
|
static inline u64 Param(const Core::System& system, int n) {
|
2019-04-06 22:46:18 +00:00
|
|
|
return system.CurrentArmInterface().GetReg(n);
|
2018-09-18 08:25:35 +00:00
|
|
|
}
|
2014-08-15 00:01:02 +00:00
|
|
|
|
2020-10-21 02:07:39 +00:00
|
|
|
static inline u32 Param32(const Core::System& system, int n) {
|
2020-03-02 05:06:41 +00:00
|
|
|
return static_cast<u32>(system.CurrentArmInterface().GetReg(n));
|
|
|
|
}
|
|
|
|
|
2014-08-15 00:01:02 +00:00
|
|
|
/**
|
2017-12-31 20:46:30 +00:00
|
|
|
* HLE a function return from the current ARM userland process
|
2019-04-06 22:46:18 +00:00
|
|
|
* @param system System context
|
|
|
|
* @param result Result to return
|
2014-08-15 00:01:02 +00:00
|
|
|
*/
|
2019-04-06 22:46:18 +00:00
|
|
|
static inline void FuncReturn(Core::System& system, u64 result) {
|
|
|
|
system.CurrentArmInterface().SetReg(0, result);
|
2014-08-15 00:01:02 +00:00
|
|
|
}
|
|
|
|
|
2020-03-02 05:06:41 +00:00
|
|
|
static inline void FuncReturn32(Core::System& system, u32 result) {
|
2020-10-21 02:07:39 +00:00
|
|
|
system.CurrentArmInterface().SetReg(0, (u64)result);
|
2020-03-02 05:06:41 +00:00
|
|
|
}
|
|
|
|
|
2014-06-07 03:31:29 +00:00
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
2015-01-23 05:36:58 +00:00
|
|
|
// Function wrappers that return type ResultCode
|
2014-04-10 23:58:28 +00:00
|
|
|
|
2019-04-06 22:46:18 +00:00
|
|
|
template <ResultCode func(Core::System&, u64)>
|
2020-03-02 05:06:41 +00:00
|
|
|
void SvcWrap64(Core::System& system) {
|
2019-04-06 22:46:18 +00:00
|
|
|
FuncReturn(system, func(system, Param(system, 0)).raw);
|
2017-10-10 03:56:20 +00:00
|
|
|
}
|
|
|
|
|
2019-07-07 16:42:54 +00:00
|
|
|
template <ResultCode func(Core::System&, u64, u64)>
|
2020-03-02 05:06:41 +00:00
|
|
|
void SvcWrap64(Core::System& system) {
|
2019-07-07 16:42:54 +00:00
|
|
|
FuncReturn(system, func(system, Param(system, 0), Param(system, 1)).raw);
|
|
|
|
}
|
|
|
|
|
2019-04-06 22:46:18 +00:00
|
|
|
template <ResultCode func(Core::System&, u32)>
|
2020-03-02 05:06:41 +00:00
|
|
|
void SvcWrap64(Core::System& system) {
|
2019-04-06 22:46:18 +00:00
|
|
|
FuncReturn(system, func(system, static_cast<u32>(Param(system, 0))).raw);
|
2017-12-29 02:38:38 +00:00
|
|
|
}
|
|
|
|
|
2019-04-06 22:46:18 +00:00
|
|
|
template <ResultCode func(Core::System&, u32, u32)>
|
2020-03-02 05:06:41 +00:00
|
|
|
void SvcWrap64(Core::System& system) {
|
2019-04-06 22:46:18 +00:00
|
|
|
FuncReturn(
|
|
|
|
system,
|
|
|
|
func(system, static_cast<u32>(Param(system, 0)), static_cast<u32>(Param(system, 1))).raw);
|
2017-12-28 20:29:52 +00:00
|
|
|
}
|
|
|
|
|
2021-01-20 21:42:27 +00:00
|
|
|
// Used by SetThreadActivity
|
|
|
|
template <ResultCode func(Core::System&, Handle, Svc::ThreadActivity)>
|
|
|
|
void SvcWrap64(Core::System& system) {
|
|
|
|
FuncReturn(system, func(system, static_cast<u32>(Param(system, 0)),
|
|
|
|
static_cast<Svc::ThreadActivity>(Param(system, 1)))
|
|
|
|
.raw);
|
|
|
|
}
|
|
|
|
|
2019-04-12 03:21:13 +00:00
|
|
|
template <ResultCode func(Core::System&, u32, u64, u64, u64)>
|
2020-03-02 05:06:41 +00:00
|
|
|
void SvcWrap64(Core::System& system) {
|
2019-04-12 03:21:13 +00:00
|
|
|
FuncReturn(system, func(system, static_cast<u32>(Param(system, 0)), Param(system, 1),
|
|
|
|
Param(system, 2), Param(system, 3))
|
|
|
|
.raw);
|
|
|
|
}
|
|
|
|
|
2019-04-06 22:46:18 +00:00
|
|
|
template <ResultCode func(Core::System&, u32*)>
|
2020-03-02 05:06:41 +00:00
|
|
|
void SvcWrap64(Core::System& system) {
|
2018-11-26 23:23:12 +00:00
|
|
|
u32 param = 0;
|
2019-04-06 22:46:18 +00:00
|
|
|
const u32 retval = func(system, ¶m).raw;
|
|
|
|
system.CurrentArmInterface().SetReg(1, param);
|
|
|
|
FuncReturn(system, retval);
|
2018-11-26 23:23:12 +00:00
|
|
|
}
|
|
|
|
|
2019-04-06 22:46:18 +00:00
|
|
|
template <ResultCode func(Core::System&, u32*, u32)>
|
2020-03-02 05:06:41 +00:00
|
|
|
void SvcWrap64(Core::System& system) {
|
2017-12-31 20:46:30 +00:00
|
|
|
u32 param_1 = 0;
|
2019-04-06 22:46:18 +00:00
|
|
|
const u32 retval = func(system, ¶m_1, static_cast<u32>(Param(system, 1))).raw;
|
|
|
|
system.CurrentArmInterface().SetReg(1, param_1);
|
|
|
|
FuncReturn(system, retval);
|
2017-10-10 03:56:20 +00:00
|
|
|
}
|
|
|
|
|
2019-04-06 22:46:18 +00:00
|
|
|
template <ResultCode func(Core::System&, u32*, u32*)>
|
2020-03-02 05:06:41 +00:00
|
|
|
void SvcWrap64(Core::System& system) {
|
2018-12-04 20:11:18 +00:00
|
|
|
u32 param_1 = 0;
|
|
|
|
u32 param_2 = 0;
|
2019-04-06 22:46:18 +00:00
|
|
|
const u32 retval = func(system, ¶m_1, ¶m_2).raw;
|
2018-12-04 20:11:18 +00:00
|
|
|
|
2019-04-06 22:46:18 +00:00
|
|
|
auto& arm_interface = system.CurrentArmInterface();
|
2018-12-04 20:11:18 +00:00
|
|
|
arm_interface.SetReg(1, param_1);
|
|
|
|
arm_interface.SetReg(2, param_2);
|
|
|
|
|
2019-04-06 22:46:18 +00:00
|
|
|
FuncReturn(system, retval);
|
2018-12-04 20:11:18 +00:00
|
|
|
}
|
|
|
|
|
2019-04-06 22:46:18 +00:00
|
|
|
template <ResultCode func(Core::System&, u32*, u64)>
|
2020-03-02 05:06:41 +00:00
|
|
|
void SvcWrap64(Core::System& system) {
|
2017-12-31 20:46:30 +00:00
|
|
|
u32 param_1 = 0;
|
2019-04-06 22:46:18 +00:00
|
|
|
const u32 retval = func(system, ¶m_1, Param(system, 1)).raw;
|
|
|
|
system.CurrentArmInterface().SetReg(1, param_1);
|
|
|
|
FuncReturn(system, retval);
|
2018-12-19 03:30:53 +00:00
|
|
|
}
|
|
|
|
|
2019-04-06 22:46:18 +00:00
|
|
|
template <ResultCode func(Core::System&, u32*, u64, u32)>
|
2020-03-02 05:06:41 +00:00
|
|
|
void SvcWrap64(Core::System& system) {
|
2019-03-20 19:03:52 +00:00
|
|
|
u32 param_1 = 0;
|
2019-04-06 22:46:18 +00:00
|
|
|
const u32 retval =
|
|
|
|
func(system, ¶m_1, Param(system, 1), static_cast<u32>(Param(system, 2))).raw;
|
|
|
|
|
|
|
|
system.CurrentArmInterface().SetReg(1, param_1);
|
|
|
|
FuncReturn(system, retval);
|
2019-03-20 19:03:52 +00:00
|
|
|
}
|
|
|
|
|
2019-04-06 22:46:18 +00:00
|
|
|
template <ResultCode func(Core::System&, u64*, u32)>
|
2020-03-02 05:06:41 +00:00
|
|
|
void SvcWrap64(Core::System& system) {
|
2018-12-19 03:30:53 +00:00
|
|
|
u64 param_1 = 0;
|
2019-04-06 22:46:18 +00:00
|
|
|
const u32 retval = func(system, ¶m_1, static_cast<u32>(Param(system, 1))).raw;
|
|
|
|
|
|
|
|
system.CurrentArmInterface().SetReg(1, param_1);
|
|
|
|
FuncReturn(system, retval);
|
2017-10-10 03:56:20 +00:00
|
|
|
}
|
|
|
|
|
2019-04-06 22:46:18 +00:00
|
|
|
template <ResultCode func(Core::System&, u64, u32)>
|
2020-03-02 05:06:41 +00:00
|
|
|
void SvcWrap64(Core::System& system) {
|
2019-04-06 22:46:18 +00:00
|
|
|
FuncReturn(system, func(system, Param(system, 0), static_cast<u32>(Param(system, 1))).raw);
|
2018-09-29 23:58:21 +00:00
|
|
|
}
|
|
|
|
|
2019-04-06 22:46:18 +00:00
|
|
|
template <ResultCode func(Core::System&, u64*, u64)>
|
2020-03-02 05:06:41 +00:00
|
|
|
void SvcWrap64(Core::System& system) {
|
2017-12-31 20:46:30 +00:00
|
|
|
u64 param_1 = 0;
|
2019-04-06 22:46:18 +00:00
|
|
|
const u32 retval = func(system, ¶m_1, Param(system, 1)).raw;
|
|
|
|
|
|
|
|
system.CurrentArmInterface().SetReg(1, param_1);
|
|
|
|
FuncReturn(system, retval);
|
2015-03-24 03:55:21 +00:00
|
|
|
}
|
|
|
|
|
2019-04-06 22:46:18 +00:00
|
|
|
template <ResultCode func(Core::System&, u64*, u32, u32)>
|
2020-03-02 05:06:41 +00:00
|
|
|
void SvcWrap64(Core::System& system) {
|
2018-10-13 18:31:46 +00:00
|
|
|
u64 param_1 = 0;
|
2019-04-06 22:46:18 +00:00
|
|
|
const u32 retval = func(system, ¶m_1, static_cast<u32>(Param(system, 1)),
|
|
|
|
static_cast<u32>(Param(system, 2)))
|
|
|
|
.raw;
|
|
|
|
|
|
|
|
system.CurrentArmInterface().SetReg(1, param_1);
|
|
|
|
FuncReturn(system, retval);
|
2018-10-13 18:31:46 +00:00
|
|
|
}
|
|
|
|
|
2021-04-21 04:28:11 +00:00
|
|
|
// Used by GetResourceLimitLimitValue.
|
|
|
|
template <ResultCode func(Core::System&, u64*, Handle, LimitableResource)>
|
|
|
|
void SvcWrap64(Core::System& system) {
|
|
|
|
u64 param_1 = 0;
|
|
|
|
const u32 retval = func(system, ¶m_1, static_cast<Handle>(Param(system, 1)),
|
|
|
|
static_cast<LimitableResource>(Param(system, 2)))
|
|
|
|
.raw;
|
|
|
|
|
|
|
|
system.CurrentArmInterface().SetReg(1, param_1);
|
|
|
|
FuncReturn(system, retval);
|
|
|
|
}
|
|
|
|
|
2019-04-06 22:46:18 +00:00
|
|
|
template <ResultCode func(Core::System&, u32, u64)>
|
2020-03-02 05:06:41 +00:00
|
|
|
void SvcWrap64(Core::System& system) {
|
2019-04-06 22:46:18 +00:00
|
|
|
FuncReturn(system, func(system, static_cast<u32>(Param(system, 0)), Param(system, 1)).raw);
|
2018-04-03 03:50:17 +00:00
|
|
|
}
|
|
|
|
|
2021-04-21 04:28:11 +00:00
|
|
|
// Used by SetResourceLimitLimitValue
|
|
|
|
template <ResultCode func(Core::System&, Handle, LimitableResource, u64)>
|
2020-03-02 05:06:41 +00:00
|
|
|
void SvcWrap64(Core::System& system) {
|
2021-04-21 04:28:11 +00:00
|
|
|
FuncReturn(system, func(system, static_cast<Handle>(Param(system, 0)),
|
|
|
|
static_cast<LimitableResource>(Param(system, 1)), Param(system, 2))
|
2019-04-06 22:46:18 +00:00
|
|
|
.raw);
|
2018-03-30 01:07:49 +00:00
|
|
|
}
|
|
|
|
|
2021-01-20 21:42:27 +00:00
|
|
|
// Used by SetThreadCoreMask
|
|
|
|
template <ResultCode func(Core::System&, Handle, s32, u64)>
|
2020-03-02 05:06:41 +00:00
|
|
|
void SvcWrap64(Core::System& system) {
|
2021-01-20 21:42:27 +00:00
|
|
|
FuncReturn(system, func(system, static_cast<u32>(Param(system, 0)),
|
|
|
|
static_cast<s32>(Param(system, 1)), Param(system, 2))
|
|
|
|
.raw);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Used by GetThreadCoreMask
|
|
|
|
template <ResultCode func(Core::System&, Handle, s32*, u64*)>
|
|
|
|
void SvcWrap64(Core::System& system) {
|
|
|
|
s32 param_1 = 0;
|
2018-03-30 01:07:49 +00:00
|
|
|
u64 param_2 = 0;
|
2019-04-06 22:46:18 +00:00
|
|
|
const ResultCode retval = func(system, static_cast<u32>(Param(system, 2)), ¶m_1, ¶m_2);
|
2018-03-30 01:07:49 +00:00
|
|
|
|
2019-04-06 22:46:18 +00:00
|
|
|
system.CurrentArmInterface().SetReg(1, param_1);
|
|
|
|
system.CurrentArmInterface().SetReg(2, param_2);
|
|
|
|
FuncReturn(system, retval.raw);
|
2018-01-08 02:23:42 +00:00
|
|
|
}
|
|
|
|
|
2019-04-06 22:46:18 +00:00
|
|
|
template <ResultCode func(Core::System&, u64, u64, u32, u32)>
|
2020-03-02 05:06:41 +00:00
|
|
|
void SvcWrap64(Core::System& system) {
|
2019-04-06 22:46:18 +00:00
|
|
|
FuncReturn(system, func(system, Param(system, 0), Param(system, 1),
|
|
|
|
static_cast<u32>(Param(system, 2)), static_cast<u32>(Param(system, 3)))
|
|
|
|
.raw);
|
2018-12-12 18:42:21 +00:00
|
|
|
}
|
|
|
|
|
2019-04-06 22:46:18 +00:00
|
|
|
template <ResultCode func(Core::System&, u64, u64, u32, u64)>
|
2020-03-02 05:06:41 +00:00
|
|
|
void SvcWrap64(Core::System& system) {
|
2019-04-06 22:46:18 +00:00
|
|
|
FuncReturn(system, func(system, Param(system, 0), Param(system, 1),
|
|
|
|
static_cast<u32>(Param(system, 2)), Param(system, 3))
|
|
|
|
.raw);
|
2017-06-21 00:27:20 +00:00
|
|
|
}
|
|
|
|
|
2019-04-06 22:46:18 +00:00
|
|
|
template <ResultCode func(Core::System&, u32, u64, u32)>
|
2020-03-02 05:06:41 +00:00
|
|
|
void SvcWrap64(Core::System& system) {
|
2019-04-06 22:46:18 +00:00
|
|
|
FuncReturn(system, func(system, static_cast<u32>(Param(system, 0)), Param(system, 1),
|
|
|
|
static_cast<u32>(Param(system, 2)))
|
|
|
|
.raw);
|
2014-04-10 23:58:28 +00:00
|
|
|
}
|
|
|
|
|
2019-04-06 22:46:18 +00:00
|
|
|
template <ResultCode func(Core::System&, u64, u64, u64)>
|
2020-03-02 05:06:41 +00:00
|
|
|
void SvcWrap64(Core::System& system) {
|
2019-04-06 22:46:18 +00:00
|
|
|
FuncReturn(system, func(system, Param(system, 0), Param(system, 1), Param(system, 2)).raw);
|
2018-11-03 15:01:34 +00:00
|
|
|
}
|
|
|
|
|
2019-04-06 22:46:18 +00:00
|
|
|
template <ResultCode func(Core::System&, u64, u64, u32)>
|
2020-03-02 05:06:41 +00:00
|
|
|
void SvcWrap64(Core::System& system) {
|
2018-10-10 01:49:08 +00:00
|
|
|
FuncReturn(
|
2019-04-06 22:46:18 +00:00
|
|
|
system,
|
|
|
|
func(system, Param(system, 0), Param(system, 1), static_cast<u32>(Param(system, 2))).raw);
|
|
|
|
}
|
|
|
|
|
2021-04-30 21:53:22 +00:00
|
|
|
// Used by MapSharedMemory
|
|
|
|
template <ResultCode func(Core::System&, Handle, u64, u64, Svc::MemoryPermission)>
|
2020-03-02 05:06:41 +00:00
|
|
|
void SvcWrap64(Core::System& system) {
|
2021-04-30 21:53:22 +00:00
|
|
|
FuncReturn(system, func(system, static_cast<Handle>(Param(system, 0)), Param(system, 1),
|
|
|
|
Param(system, 2), static_cast<Svc::MemoryPermission>(Param(system, 3)))
|
2019-04-06 22:46:18 +00:00
|
|
|
.raw);
|
2018-01-14 22:15:31 +00:00
|
|
|
}
|
|
|
|
|
2019-04-06 22:46:18 +00:00
|
|
|
template <ResultCode func(Core::System&, u32, u64, u64)>
|
2020-03-02 05:06:41 +00:00
|
|
|
void SvcWrap64(Core::System& system) {
|
2019-04-06 22:46:18 +00:00
|
|
|
FuncReturn(
|
|
|
|
system,
|
|
|
|
func(system, static_cast<u32>(Param(system, 0)), Param(system, 1), Param(system, 2)).raw);
|
2018-02-22 19:16:43 +00:00
|
|
|
}
|
|
|
|
|
2020-12-22 06:36:53 +00:00
|
|
|
// Used by WaitSynchronization
|
|
|
|
template <ResultCode func(Core::System&, s32*, u64, u64, s64)>
|
2020-03-02 05:06:41 +00:00
|
|
|
void SvcWrap64(Core::System& system) {
|
2020-12-22 06:36:53 +00:00
|
|
|
s32 param_1 = 0;
|
2019-04-06 22:46:18 +00:00
|
|
|
const u32 retval = func(system, ¶m_1, Param(system, 1), static_cast<u32>(Param(system, 2)),
|
|
|
|
static_cast<s64>(Param(system, 3)))
|
|
|
|
.raw;
|
|
|
|
|
|
|
|
system.CurrentArmInterface().SetReg(1, param_1);
|
|
|
|
FuncReturn(system, retval);
|
2014-07-07 02:17:34 +00:00
|
|
|
}
|
|
|
|
|
2019-04-06 22:46:18 +00:00
|
|
|
template <ResultCode func(Core::System&, u64, u64, u32, s64)>
|
2020-03-02 05:06:41 +00:00
|
|
|
void SvcWrap64(Core::System& system) {
|
2019-04-06 22:46:18 +00:00
|
|
|
FuncReturn(system, func(system, Param(system, 0), Param(system, 1),
|
|
|
|
static_cast<u32>(Param(system, 2)), static_cast<s64>(Param(system, 3)))
|
|
|
|
.raw);
|
2018-01-06 21:14:12 +00:00
|
|
|
}
|
|
|
|
|
2021-04-18 05:21:59 +00:00
|
|
|
// Used by GetInfo
|
|
|
|
template <ResultCode func(Core::System&, u64*, u64, Handle, u64)>
|
2020-03-02 05:06:41 +00:00
|
|
|
void SvcWrap64(Core::System& system) {
|
2017-10-10 03:56:20 +00:00
|
|
|
u64 param_1 = 0;
|
2021-04-18 05:21:59 +00:00
|
|
|
const u32 retval = func(system, ¶m_1, Param(system, 1),
|
|
|
|
static_cast<Handle>(Param(system, 2)), Param(system, 3))
|
|
|
|
.raw;
|
2019-04-06 22:46:18 +00:00
|
|
|
|
|
|
|
system.CurrentArmInterface().SetReg(1, param_1);
|
|
|
|
FuncReturn(system, retval);
|
2017-10-10 03:56:20 +00:00
|
|
|
}
|
|
|
|
|
2019-04-06 22:46:18 +00:00
|
|
|
template <ResultCode func(Core::System&, u32*, u64, u64, u64, u32, s32)>
|
2020-03-02 05:06:41 +00:00
|
|
|
void SvcWrap64(Core::System& system) {
|
2014-07-07 02:17:34 +00:00
|
|
|
u32 param_1 = 0;
|
2019-04-06 22:46:18 +00:00
|
|
|
const u32 retval = func(system, ¶m_1, Param(system, 1), Param(system, 2), Param(system, 3),
|
|
|
|
static_cast<u32>(Param(system, 4)), static_cast<s32>(Param(system, 5)))
|
|
|
|
.raw;
|
|
|
|
|
|
|
|
system.CurrentArmInterface().SetReg(1, param_1);
|
|
|
|
FuncReturn(system, retval);
|
2014-04-10 23:58:28 +00:00
|
|
|
}
|
|
|
|
|
2021-04-17 07:52:53 +00:00
|
|
|
// Used by CreateTransferMemory
|
|
|
|
template <ResultCode func(Core::System&, Handle*, u64, u64, Svc::MemoryPermission)>
|
2020-03-02 05:06:41 +00:00
|
|
|
void SvcWrap64(Core::System& system) {
|
2018-01-08 02:24:19 +00:00
|
|
|
u32 param_1 = 0;
|
2019-04-06 22:46:18 +00:00
|
|
|
const u32 retval = func(system, ¶m_1, Param(system, 1), Param(system, 2),
|
2021-04-17 07:52:53 +00:00
|
|
|
static_cast<Svc::MemoryPermission>(Param(system, 3)))
|
2019-04-06 22:46:18 +00:00
|
|
|
.raw;
|
|
|
|
|
|
|
|
system.CurrentArmInterface().SetReg(1, param_1);
|
|
|
|
FuncReturn(system, retval);
|
2018-01-20 00:35:25 +00:00
|
|
|
}
|
|
|
|
|
2019-04-06 22:46:18 +00:00
|
|
|
template <ResultCode func(Core::System&, Handle*, u64, u32, u32)>
|
2020-03-02 05:06:41 +00:00
|
|
|
void SvcWrap64(Core::System& system) {
|
2018-01-20 00:35:25 +00:00
|
|
|
u32 param_1 = 0;
|
2019-04-06 22:46:18 +00:00
|
|
|
const u32 retval = func(system, ¶m_1, Param(system, 1), static_cast<u32>(Param(system, 2)),
|
|
|
|
static_cast<u32>(Param(system, 3)))
|
|
|
|
.raw;
|
|
|
|
|
|
|
|
system.CurrentArmInterface().SetReg(1, param_1);
|
|
|
|
FuncReturn(system, retval);
|
2018-01-08 02:24:19 +00:00
|
|
|
}
|
|
|
|
|
2020-12-30 09:14:02 +00:00
|
|
|
// Used by WaitForAddress
|
|
|
|
template <ResultCode func(Core::System&, u64, Svc::ArbitrationType, s32, s64)>
|
2020-03-02 05:06:41 +00:00
|
|
|
void SvcWrap64(Core::System& system) {
|
2020-12-30 09:14:02 +00:00
|
|
|
FuncReturn(system,
|
|
|
|
func(system, Param(system, 0), static_cast<Svc::ArbitrationType>(Param(system, 1)),
|
|
|
|
static_cast<s32>(Param(system, 2)), static_cast<s64>(Param(system, 3)))
|
|
|
|
.raw);
|
2018-06-21 06:49:43 +00:00
|
|
|
}
|
|
|
|
|
2020-12-30 09:14:02 +00:00
|
|
|
// Used by SignalToAddress
|
|
|
|
template <ResultCode func(Core::System&, u64, Svc::SignalType, s32, s32)>
|
2020-03-02 05:06:41 +00:00
|
|
|
void SvcWrap64(Core::System& system) {
|
2020-12-30 09:14:02 +00:00
|
|
|
FuncReturn(system,
|
|
|
|
func(system, Param(system, 0), static_cast<Svc::SignalType>(Param(system, 1)),
|
|
|
|
static_cast<s32>(Param(system, 2)), static_cast<s32>(Param(system, 3)))
|
|
|
|
.raw);
|
2018-06-21 06:49:43 +00:00
|
|
|
}
|
|
|
|
|
2014-06-07 03:31:29 +00:00
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Function wrappers that return type u32
|
2014-04-10 23:58:28 +00:00
|
|
|
|
2019-04-06 22:46:18 +00:00
|
|
|
template <u32 func(Core::System&)>
|
2020-03-02 05:06:41 +00:00
|
|
|
void SvcWrap64(Core::System& system) {
|
2019-04-06 22:46:18 +00:00
|
|
|
FuncReturn(system, func(system));
|
2014-08-15 00:01:02 +00:00
|
|
|
}
|
|
|
|
|
2018-01-12 02:59:31 +00:00
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Function wrappers that return type u64
|
|
|
|
|
2019-04-06 22:46:18 +00:00
|
|
|
template <u64 func(Core::System&)>
|
2020-03-02 05:06:41 +00:00
|
|
|
void SvcWrap64(Core::System& system) {
|
2019-04-06 22:46:18 +00:00
|
|
|
FuncReturn(system, func(system));
|
2018-01-12 02:59:31 +00:00
|
|
|
}
|
|
|
|
|
2014-08-15 00:01:02 +00:00
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
2017-12-31 20:46:30 +00:00
|
|
|
/// Function wrappers that return type void
|
2014-08-15 00:01:02 +00:00
|
|
|
|
2019-04-06 22:46:18 +00:00
|
|
|
template <void func(Core::System&)>
|
2020-03-02 05:06:41 +00:00
|
|
|
void SvcWrap64(Core::System& system) {
|
2019-04-06 22:46:18 +00:00
|
|
|
func(system);
|
2014-04-10 23:58:28 +00:00
|
|
|
}
|
|
|
|
|
2019-12-08 02:12:14 +00:00
|
|
|
template <void func(Core::System&, u32)>
|
2020-03-02 05:06:41 +00:00
|
|
|
void SvcWrap64(Core::System& system) {
|
2019-12-08 02:12:14 +00:00
|
|
|
func(system, static_cast<u32>(Param(system, 0)));
|
|
|
|
}
|
|
|
|
|
|
|
|
template <void func(Core::System&, u32, u64, u64, u64)>
|
2020-03-02 05:06:41 +00:00
|
|
|
void SvcWrap64(Core::System& system) {
|
2019-12-08 02:12:14 +00:00
|
|
|
func(system, static_cast<u32>(Param(system, 0)), Param(system, 1), Param(system, 2),
|
|
|
|
Param(system, 3));
|
|
|
|
}
|
|
|
|
|
2019-04-06 22:46:18 +00:00
|
|
|
template <void func(Core::System&, s64)>
|
2020-03-02 05:06:41 +00:00
|
|
|
void SvcWrap64(Core::System& system) {
|
2019-04-06 22:46:18 +00:00
|
|
|
func(system, static_cast<s64>(Param(system, 0)));
|
2014-06-01 14:41:41 +00:00
|
|
|
}
|
|
|
|
|
2019-12-11 12:11:47 +00:00
|
|
|
template <void func(Core::System&, u64, s32)>
|
2020-03-02 05:06:41 +00:00
|
|
|
void SvcWrap64(Core::System& system) {
|
2019-12-11 12:11:47 +00:00
|
|
|
func(system, Param(system, 0), static_cast<s32>(Param(system, 1)));
|
|
|
|
}
|
|
|
|
|
2019-04-06 22:46:18 +00:00
|
|
|
template <void func(Core::System&, u64, u64)>
|
2020-03-02 05:06:41 +00:00
|
|
|
void SvcWrap64(Core::System& system) {
|
2019-04-06 22:46:18 +00:00
|
|
|
func(system, Param(system, 0), Param(system, 1));
|
2014-05-18 03:37:25 +00:00
|
|
|
}
|
|
|
|
|
2019-04-06 22:46:18 +00:00
|
|
|
template <void func(Core::System&, u64, u64, u64)>
|
2020-03-02 05:06:41 +00:00
|
|
|
void SvcWrap64(Core::System& system) {
|
2019-04-06 22:46:18 +00:00
|
|
|
func(system, Param(system, 0), Param(system, 1), Param(system, 2));
|
2015-05-17 05:06:59 +00:00
|
|
|
}
|
|
|
|
|
2019-04-06 22:46:18 +00:00
|
|
|
template <void func(Core::System&, u32, u64, u64)>
|
2020-03-02 05:06:41 +00:00
|
|
|
void SvcWrap64(Core::System& system) {
|
2019-04-06 22:46:18 +00:00
|
|
|
func(system, static_cast<u32>(Param(system, 0)), Param(system, 1), Param(system, 2));
|
2018-10-10 01:23:50 +00:00
|
|
|
}
|
|
|
|
|
2020-06-19 23:40:07 +00:00
|
|
|
// Used by QueryMemory32, ArbitrateLock32
|
2020-03-02 05:06:41 +00:00
|
|
|
template <ResultCode func(Core::System&, u32, u32, u32)>
|
|
|
|
void SvcWrap32(Core::System& system) {
|
|
|
|
FuncReturn32(system,
|
|
|
|
func(system, Param32(system, 0), Param32(system, 1), Param32(system, 2)).raw);
|
|
|
|
}
|
|
|
|
|
2020-06-19 23:40:07 +00:00
|
|
|
// Used by Break32
|
|
|
|
template <void func(Core::System&, u32, u32, u32)>
|
|
|
|
void SvcWrap32(Core::System& system) {
|
|
|
|
func(system, Param32(system, 0), Param32(system, 1), Param32(system, 2));
|
|
|
|
}
|
|
|
|
|
|
|
|
// Used by ExitProcess32, ExitThread32
|
|
|
|
template <void func(Core::System&)>
|
|
|
|
void SvcWrap32(Core::System& system) {
|
|
|
|
func(system);
|
|
|
|
}
|
|
|
|
|
2020-06-19 00:33:04 +00:00
|
|
|
// Used by GetCurrentProcessorNumber32
|
|
|
|
template <u32 func(Core::System&)>
|
|
|
|
void SvcWrap32(Core::System& system) {
|
2020-06-19 23:40:07 +00:00
|
|
|
FuncReturn32(system, func(system));
|
|
|
|
}
|
|
|
|
|
|
|
|
// Used by SleepThread32
|
|
|
|
template <void func(Core::System&, u32, u32)>
|
|
|
|
void SvcWrap32(Core::System& system) {
|
|
|
|
func(system, Param32(system, 0), Param32(system, 1));
|
|
|
|
}
|
|
|
|
|
|
|
|
// Used by CreateThread32
|
|
|
|
template <ResultCode func(Core::System&, Handle*, u32, u32, u32, u32, s32)>
|
|
|
|
void SvcWrap32(Core::System& system) {
|
|
|
|
Handle param_1 = 0;
|
|
|
|
|
2020-10-21 02:07:39 +00:00
|
|
|
const u32 retval = func(system, ¶m_1, Param32(system, 0), Param32(system, 1),
|
|
|
|
Param32(system, 2), Param32(system, 3), Param32(system, 4))
|
|
|
|
.raw;
|
2020-06-19 23:40:07 +00:00
|
|
|
|
|
|
|
system.CurrentArmInterface().SetReg(1, param_1);
|
|
|
|
FuncReturn(system, retval);
|
2020-06-19 00:33:04 +00:00
|
|
|
}
|
|
|
|
|
2020-03-02 05:06:41 +00:00
|
|
|
// Used by GetInfo32
|
|
|
|
template <ResultCode func(Core::System&, u32*, u32*, u32, u32, u32, u32)>
|
|
|
|
void SvcWrap32(Core::System& system) {
|
|
|
|
u32 param_1 = 0;
|
|
|
|
u32 param_2 = 0;
|
|
|
|
|
|
|
|
const u32 retval = func(system, ¶m_1, ¶m_2, Param32(system, 0), Param32(system, 1),
|
|
|
|
Param32(system, 2), Param32(system, 3))
|
|
|
|
.raw;
|
|
|
|
|
|
|
|
system.CurrentArmInterface().SetReg(1, param_1);
|
|
|
|
system.CurrentArmInterface().SetReg(2, param_2);
|
|
|
|
FuncReturn(system, retval);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Used by GetThreadPriority32, ConnectToNamedPort32
|
|
|
|
template <ResultCode func(Core::System&, u32*, u32)>
|
|
|
|
void SvcWrap32(Core::System& system) {
|
|
|
|
u32 param_1 = 0;
|
|
|
|
const u32 retval = func(system, ¶m_1, Param32(system, 1)).raw;
|
|
|
|
system.CurrentArmInterface().SetReg(1, param_1);
|
|
|
|
FuncReturn(system, retval);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Used by GetThreadId32
|
|
|
|
template <ResultCode func(Core::System&, u32*, u32*, u32)>
|
|
|
|
void SvcWrap32(Core::System& system) {
|
|
|
|
u32 param_1 = 0;
|
|
|
|
u32 param_2 = 0;
|
|
|
|
|
|
|
|
const u32 retval = func(system, ¶m_1, ¶m_2, Param32(system, 1)).raw;
|
|
|
|
system.CurrentArmInterface().SetReg(1, param_1);
|
|
|
|
system.CurrentArmInterface().SetReg(2, param_2);
|
|
|
|
FuncReturn(system, retval);
|
|
|
|
}
|
|
|
|
|
2020-06-19 23:40:07 +00:00
|
|
|
// Used by GetSystemTick32
|
|
|
|
template <void func(Core::System&, u32*, u32*)>
|
|
|
|
void SvcWrap32(Core::System& system) {
|
|
|
|
u32 param_1 = 0;
|
|
|
|
u32 param_2 = 0;
|
|
|
|
|
|
|
|
func(system, ¶m_1, ¶m_2);
|
|
|
|
system.CurrentArmInterface().SetReg(0, param_1);
|
|
|
|
system.CurrentArmInterface().SetReg(1, param_2);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Used by CreateEvent32
|
|
|
|
template <ResultCode func(Core::System&, Handle*, Handle*)>
|
|
|
|
void SvcWrap32(Core::System& system) {
|
|
|
|
Handle param_1 = 0;
|
|
|
|
Handle param_2 = 0;
|
|
|
|
|
|
|
|
const u32 retval = func(system, ¶m_1, ¶m_2).raw;
|
|
|
|
system.CurrentArmInterface().SetReg(1, param_1);
|
|
|
|
system.CurrentArmInterface().SetReg(2, param_2);
|
|
|
|
FuncReturn(system, retval);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Used by GetThreadId32
|
|
|
|
template <ResultCode func(Core::System&, Handle, u32*, u32*, u32*)>
|
|
|
|
void SvcWrap32(Core::System& system) {
|
|
|
|
u32 param_1 = 0;
|
|
|
|
u32 param_2 = 0;
|
|
|
|
u32 param_3 = 0;
|
|
|
|
|
|
|
|
const u32 retval = func(system, Param32(system, 2), ¶m_1, ¶m_2, ¶m_3).raw;
|
|
|
|
system.CurrentArmInterface().SetReg(1, param_1);
|
|
|
|
system.CurrentArmInterface().SetReg(2, param_2);
|
|
|
|
system.CurrentArmInterface().SetReg(3, param_3);
|
|
|
|
FuncReturn(system, retval);
|
|
|
|
}
|
|
|
|
|
2021-01-20 21:42:27 +00:00
|
|
|
// Used by GetThreadCoreMask32
|
|
|
|
template <ResultCode func(Core::System&, Handle, s32*, u32*, u32*)>
|
|
|
|
void SvcWrap32(Core::System& system) {
|
|
|
|
s32 param_1 = 0;
|
|
|
|
u32 param_2 = 0;
|
|
|
|
u32 param_3 = 0;
|
|
|
|
|
|
|
|
const u32 retval = func(system, Param32(system, 2), ¶m_1, ¶m_2, ¶m_3).raw;
|
|
|
|
system.CurrentArmInterface().SetReg(1, param_1);
|
|
|
|
system.CurrentArmInterface().SetReg(2, param_2);
|
|
|
|
system.CurrentArmInterface().SetReg(3, param_3);
|
|
|
|
FuncReturn(system, retval);
|
|
|
|
}
|
|
|
|
|
2020-03-02 05:06:41 +00:00
|
|
|
// Used by SignalProcessWideKey32
|
|
|
|
template <void func(Core::System&, u32, s32)>
|
|
|
|
void SvcWrap32(Core::System& system) {
|
|
|
|
func(system, static_cast<u32>(Param(system, 0)), static_cast<s32>(Param(system, 1)));
|
|
|
|
}
|
|
|
|
|
2021-01-20 21:42:27 +00:00
|
|
|
// Used by SetThreadActivity32
|
|
|
|
template <ResultCode func(Core::System&, Handle, Svc::ThreadActivity)>
|
|
|
|
void SvcWrap32(Core::System& system) {
|
|
|
|
const u32 retval = func(system, static_cast<Handle>(Param(system, 0)),
|
|
|
|
static_cast<Svc::ThreadActivity>(Param(system, 1)))
|
|
|
|
.raw;
|
|
|
|
FuncReturn(system, retval);
|
|
|
|
}
|
|
|
|
|
2020-06-18 22:15:19 +00:00
|
|
|
// Used by SetThreadPriority32
|
|
|
|
template <ResultCode func(Core::System&, Handle, u32)>
|
|
|
|
void SvcWrap32(Core::System& system) {
|
|
|
|
const u32 retval =
|
|
|
|
func(system, static_cast<Handle>(Param(system, 0)), static_cast<u32>(Param(system, 1))).raw;
|
|
|
|
FuncReturn(system, retval);
|
|
|
|
}
|
|
|
|
|
2021-01-20 21:42:27 +00:00
|
|
|
// Used by SetMemoryAttribute32
|
2020-06-18 22:15:19 +00:00
|
|
|
template <ResultCode func(Core::System&, Handle, u32, u32, u32)>
|
|
|
|
void SvcWrap32(Core::System& system) {
|
|
|
|
const u32 retval =
|
|
|
|
func(system, static_cast<Handle>(Param(system, 0)), static_cast<u32>(Param(system, 1)),
|
|
|
|
static_cast<u32>(Param(system, 2)), static_cast<u32>(Param(system, 3)))
|
|
|
|
.raw;
|
|
|
|
FuncReturn(system, retval);
|
|
|
|
}
|
|
|
|
|
2021-04-30 21:53:22 +00:00
|
|
|
// Used by MapSharedMemory32
|
|
|
|
template <ResultCode func(Core::System&, Handle, u32, u32, Svc::MemoryPermission)>
|
|
|
|
void SvcWrap32(Core::System& system) {
|
2021-05-01 19:17:11 +00:00
|
|
|
const u32 retval = func(system, static_cast<Handle>(Param(system, 0)),
|
|
|
|
static_cast<u32>(Param(system, 1)), static_cast<u32>(Param(system, 2)),
|
2021-04-30 21:53:22 +00:00
|
|
|
static_cast<Svc::MemoryPermission>(Param(system, 3)))
|
2021-05-01 19:17:11 +00:00
|
|
|
.raw;
|
2021-04-30 21:53:22 +00:00
|
|
|
FuncReturn(system, retval);
|
|
|
|
}
|
|
|
|
|
2021-01-20 21:42:27 +00:00
|
|
|
// Used by SetThreadCoreMask32
|
|
|
|
template <ResultCode func(Core::System&, Handle, s32, u32, u32)>
|
|
|
|
void SvcWrap32(Core::System& system) {
|
|
|
|
const u32 retval =
|
|
|
|
func(system, static_cast<Handle>(Param(system, 0)), static_cast<s32>(Param(system, 1)),
|
|
|
|
static_cast<u32>(Param(system, 2)), static_cast<u32>(Param(system, 3)))
|
|
|
|
.raw;
|
|
|
|
FuncReturn(system, retval);
|
|
|
|
}
|
|
|
|
|
2020-06-19 23:40:07 +00:00
|
|
|
// Used by WaitProcessWideKeyAtomic32
|
|
|
|
template <ResultCode func(Core::System&, u32, u32, Handle, u32, u32)>
|
|
|
|
void SvcWrap32(Core::System& system) {
|
|
|
|
const u32 retval =
|
|
|
|
func(system, static_cast<u32>(Param(system, 0)), static_cast<u32>(Param(system, 1)),
|
|
|
|
static_cast<Handle>(Param(system, 2)), static_cast<u32>(Param(system, 3)),
|
|
|
|
static_cast<u32>(Param(system, 4)))
|
|
|
|
.raw;
|
|
|
|
FuncReturn(system, retval);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Used by WaitForAddress32
|
2020-12-30 09:14:02 +00:00
|
|
|
template <ResultCode func(Core::System&, u32, Svc::ArbitrationType, s32, u32, u32)>
|
2020-06-19 23:40:07 +00:00
|
|
|
void SvcWrap32(Core::System& system) {
|
|
|
|
const u32 retval = func(system, static_cast<u32>(Param(system, 0)),
|
2020-12-30 09:14:02 +00:00
|
|
|
static_cast<Svc::ArbitrationType>(Param(system, 1)),
|
|
|
|
static_cast<s32>(Param(system, 2)), static_cast<u32>(Param(system, 3)),
|
|
|
|
static_cast<u32>(Param(system, 4)))
|
2020-06-19 23:40:07 +00:00
|
|
|
.raw;
|
|
|
|
FuncReturn(system, retval);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Used by SignalToAddress32
|
2020-12-30 09:14:02 +00:00
|
|
|
template <ResultCode func(Core::System&, u32, Svc::SignalType, s32, s32)>
|
2020-06-19 23:40:07 +00:00
|
|
|
void SvcWrap32(Core::System& system) {
|
2020-12-30 09:14:02 +00:00
|
|
|
const u32 retval = func(system, static_cast<u32>(Param(system, 0)),
|
|
|
|
static_cast<Svc::SignalType>(Param(system, 1)),
|
|
|
|
static_cast<s32>(Param(system, 2)), static_cast<s32>(Param(system, 3)))
|
|
|
|
.raw;
|
2020-06-19 23:40:07 +00:00
|
|
|
FuncReturn(system, retval);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Used by SendSyncRequest32, ArbitrateUnlock32
|
2020-03-02 05:06:41 +00:00
|
|
|
template <ResultCode func(Core::System&, u32)>
|
|
|
|
void SvcWrap32(Core::System& system) {
|
|
|
|
FuncReturn(system, func(system, static_cast<u32>(Param(system, 0))).raw);
|
|
|
|
}
|
|
|
|
|
2020-06-19 00:33:04 +00:00
|
|
|
// Used by CreateTransferMemory32
|
2021-04-17 07:52:53 +00:00
|
|
|
template <ResultCode func(Core::System&, Handle*, u32, u32, Svc::MemoryPermission)>
|
2020-06-19 00:33:04 +00:00
|
|
|
void SvcWrap32(Core::System& system) {
|
|
|
|
Handle handle = 0;
|
2021-04-17 07:52:53 +00:00
|
|
|
const u32 retval = func(system, &handle, Param32(system, 1), Param32(system, 2),
|
|
|
|
static_cast<Svc::MemoryPermission>(Param32(system, 3)))
|
|
|
|
.raw;
|
2020-06-19 00:33:04 +00:00
|
|
|
system.CurrentArmInterface().SetReg(1, handle);
|
|
|
|
FuncReturn(system, retval);
|
|
|
|
}
|
|
|
|
|
2020-03-02 05:06:41 +00:00
|
|
|
// Used by WaitSynchronization32
|
2020-12-22 06:36:53 +00:00
|
|
|
template <ResultCode func(Core::System&, u32, u32, s32, u32, s32*)>
|
2020-03-02 05:06:41 +00:00
|
|
|
void SvcWrap32(Core::System& system) {
|
2020-12-22 06:36:53 +00:00
|
|
|
s32 param_1 = 0;
|
2020-10-21 02:07:39 +00:00
|
|
|
const u32 retval = func(system, Param32(system, 0), Param32(system, 1), Param32(system, 2),
|
|
|
|
Param32(system, 3), ¶m_1)
|
2020-03-02 05:06:41 +00:00
|
|
|
.raw;
|
|
|
|
system.CurrentArmInterface().SetReg(1, param_1);
|
|
|
|
FuncReturn(system, retval);
|
|
|
|
}
|
|
|
|
|
2018-01-03 01:40:30 +00:00
|
|
|
} // namespace Kernel
|