SVC: Add GetThreadPriority32 & SetThreadPriority32

This commit is contained in:
Fernando Sahmkow 2020-06-18 18:15:19 -04:00
parent ec11918323
commit 22ceaca2f4
2 changed files with 30 additions and 2 deletions

View File

@ -1135,6 +1135,10 @@ static ResultCode SetThreadPriority(Core::System& system, Handle handle, u32 pri
return RESULT_SUCCESS; return RESULT_SUCCESS;
} }
static ResultCode SetThreadPriority32(Core::System& system, Handle handle, u32 priority) {
return SetThreadPriority(system, handle, priority);
}
/// Get which CPU core is executing the current thread /// Get which CPU core is executing the current thread
static u32 GetCurrentProcessorNumber(Core::System& system) { static u32 GetCurrentProcessorNumber(Core::System& system) {
LOG_TRACE(Kernel_SVC, "called"); LOG_TRACE(Kernel_SVC, "called");
@ -1933,6 +1937,12 @@ static ResultCode SetThreadCoreMask(Core::System& system, Handle thread_handle,
return thread->SetCoreAndAffinityMask(core, affinity_mask); return thread->SetCoreAndAffinityMask(core, affinity_mask);
} }
static ResultCode SetThreadCoreMask32(Core::System& system, Handle thread_handle, u32 core,
u32 affinity_mask_low, u32 affinity_mask_high) {
const u64 affinity_mask = static_cast<u64>(affinity_mask_low) | (static_cast<u64>(affinity_mask_high) << 32);
return SetThreadCoreMask(system, thread_handle, core, affinity_mask);
}
static ResultCode CreateEvent(Core::System& system, Handle* write_handle, Handle* read_handle) { static ResultCode CreateEvent(Core::System& system, Handle* write_handle, Handle* read_handle) {
LOG_DEBUG(Kernel_SVC, "called"); LOG_DEBUG(Kernel_SVC, "called");
@ -2206,9 +2216,9 @@ static const FunctionDef SVC_Table_32[] = {
{0x0a, nullptr, "ExitThread32"}, {0x0a, nullptr, "ExitThread32"},
{0x0b, nullptr, "SleepThread32"}, {0x0b, nullptr, "SleepThread32"},
{0x0c, SvcWrap32<GetThreadPriority32>, "GetThreadPriority32"}, {0x0c, SvcWrap32<GetThreadPriority32>, "GetThreadPriority32"},
{0x0d, nullptr, "SetThreadPriority32"}, {0x0d, SvcWrap32<SetThreadPriority32>, "SetThreadPriority32"},
{0x0e, nullptr, "GetThreadCoreMask32"}, {0x0e, nullptr, "GetThreadCoreMask32"},
{0x0f, nullptr, "SetThreadCoreMask32"}, {0x0f, SvcWrap32<SetThreadCoreMask32>, "SetThreadCoreMask32"},
{0x10, nullptr, "GetCurrentProcessorNumber32"}, {0x10, nullptr, "GetCurrentProcessorNumber32"},
{0x11, nullptr, "SignalEvent32"}, {0x11, nullptr, "SignalEvent32"},
{0x12, nullptr, "ClearEvent32"}, {0x12, nullptr, "ClearEvent32"},

View File

@ -399,6 +399,24 @@ void SvcWrap32(Core::System& system) {
func(system, static_cast<u32>(Param(system, 0)), static_cast<s32>(Param(system, 1))); func(system, static_cast<u32>(Param(system, 0)), static_cast<s32>(Param(system, 1)));
} }
// 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);
}
// Used by SetThreadCoreMask32
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);
}
// Used by SendSyncRequest32 // Used by SendSyncRequest32
template <ResultCode func(Core::System&, u32)> template <ResultCode func(Core::System&, u32)>
void SvcWrap32(Core::System& system) { void SvcWrap32(Core::System& system) {