2022-10-04 20:15:40 -04:00
|
|
|
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
2022-04-23 04:59:50 -04:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2014-04-10 19:58:28 -04:00
|
|
|
|
2022-10-04 20:15:40 -04:00
|
|
|
#include "common/common_types.h"
|
2021-04-24 01:04:28 -04:00
|
|
|
#include "core/hle/kernel/k_process.h"
|
2020-12-31 02:01:08 -05:00
|
|
|
#include "core/hle/kernel/k_thread.h"
|
2018-01-02 20:40:30 -05:00
|
|
|
#include "core/hle/kernel/svc.h"
|
|
|
|
#include "core/hle/kernel/svc_wrap.h"
|
2014-10-22 23:20:01 -04:00
|
|
|
#include "core/hle/result.h"
|
2014-04-10 19:58:28 -04:00
|
|
|
|
2020-03-26 20:00:30 -04:00
|
|
|
namespace Kernel::Svc {
|
2018-09-13 19:14:50 -04:00
|
|
|
namespace {
|
2018-10-10 14:18:27 -04:00
|
|
|
|
2022-10-04 20:15:40 -04:00
|
|
|
struct FunctionDef {
|
|
|
|
using Func = void(Core::System&);
|
2018-11-26 19:14:29 -05:00
|
|
|
|
2022-10-04 20:15:40 -04:00
|
|
|
u32 id;
|
|
|
|
Func* func;
|
|
|
|
const char* name;
|
2018-11-26 19:14:29 -05:00
|
|
|
};
|
|
|
|
|
2017-10-14 17:30:07 -04:00
|
|
|
} // namespace
|
2015-05-05 23:04:25 -04:00
|
|
|
|
2020-03-02 00:06:41 -05:00
|
|
|
static const FunctionDef SVC_Table_32[] = {
|
2022-02-08 22:02:51 -05:00
|
|
|
{0x00, nullptr, "Unknown0"},
|
2020-03-02 00:06:41 -05:00
|
|
|
{0x01, SvcWrap32<SetHeapSize32>, "SetHeapSize32"},
|
2022-02-08 22:02:51 -05:00
|
|
|
{0x02, nullptr, "SetMemoryPermission32"},
|
2020-06-18 20:33:04 -04:00
|
|
|
{0x03, SvcWrap32<SetMemoryAttribute32>, "SetMemoryAttribute32"},
|
2020-06-19 19:40:07 -04:00
|
|
|
{0x04, SvcWrap32<MapMemory32>, "MapMemory32"},
|
|
|
|
{0x05, SvcWrap32<UnmapMemory32>, "UnmapMemory32"},
|
2020-03-02 00:06:41 -05:00
|
|
|
{0x06, SvcWrap32<QueryMemory32>, "QueryMemory32"},
|
2020-06-19 19:40:07 -04:00
|
|
|
{0x07, SvcWrap32<ExitProcess32>, "ExitProcess32"},
|
|
|
|
{0x08, SvcWrap32<CreateThread32>, "CreateThread32"},
|
|
|
|
{0x09, SvcWrap32<StartThread32>, "StartThread32"},
|
|
|
|
{0x0a, SvcWrap32<ExitThread32>, "ExitThread32"},
|
|
|
|
{0x0b, SvcWrap32<SleepThread32>, "SleepThread32"},
|
2020-03-02 00:06:41 -05:00
|
|
|
{0x0c, SvcWrap32<GetThreadPriority32>, "GetThreadPriority32"},
|
2020-06-18 18:15:19 -04:00
|
|
|
{0x0d, SvcWrap32<SetThreadPriority32>, "SetThreadPriority32"},
|
2020-06-19 19:40:07 -04:00
|
|
|
{0x0e, SvcWrap32<GetThreadCoreMask32>, "GetThreadCoreMask32"},
|
2020-06-18 18:15:19 -04:00
|
|
|
{0x0f, SvcWrap32<SetThreadCoreMask32>, "SetThreadCoreMask32"},
|
2020-06-18 20:33:04 -04:00
|
|
|
{0x10, SvcWrap32<GetCurrentProcessorNumber32>, "GetCurrentProcessorNumber32"},
|
2020-06-19 19:40:07 -04:00
|
|
|
{0x11, SvcWrap32<SignalEvent32>, "SignalEvent32"},
|
|
|
|
{0x12, SvcWrap32<ClearEvent32>, "ClearEvent32"},
|
|
|
|
{0x13, SvcWrap32<MapSharedMemory32>, "MapSharedMemory32"},
|
2021-04-30 17:53:22 -04:00
|
|
|
{0x14, SvcWrap32<UnmapSharedMemory32>, "UnmapSharedMemory32"},
|
2020-06-18 20:33:04 -04:00
|
|
|
{0x15, SvcWrap32<CreateTransferMemory32>, "CreateTransferMemory32"},
|
2020-03-02 00:06:41 -05:00
|
|
|
{0x16, SvcWrap32<CloseHandle32>, "CloseHandle32"},
|
2020-06-19 19:40:07 -04:00
|
|
|
{0x17, SvcWrap32<ResetSignal32>, "ResetSignal32"},
|
2020-03-02 00:06:41 -05:00
|
|
|
{0x18, SvcWrap32<WaitSynchronization32>, "WaitSynchronization32"},
|
2020-06-19 19:40:07 -04:00
|
|
|
{0x19, SvcWrap32<CancelSynchronization32>, "CancelSynchronization32"},
|
|
|
|
{0x1a, SvcWrap32<ArbitrateLock32>, "ArbitrateLock32"},
|
|
|
|
{0x1b, SvcWrap32<ArbitrateUnlock32>, "ArbitrateUnlock32"},
|
|
|
|
{0x1c, SvcWrap32<WaitProcessWideKeyAtomic32>, "WaitProcessWideKeyAtomic32"},
|
2020-03-02 00:06:41 -05:00
|
|
|
{0x1d, SvcWrap32<SignalProcessWideKey32>, "SignalProcessWideKey32"},
|
2020-06-19 19:40:07 -04:00
|
|
|
{0x1e, SvcWrap32<GetSystemTick32>, "GetSystemTick32"},
|
2020-03-02 00:06:41 -05:00
|
|
|
{0x1f, SvcWrap32<ConnectToNamedPort32>, "ConnectToNamedPort32"},
|
2022-02-08 22:02:51 -05:00
|
|
|
{0x20, nullptr, "SendSyncRequestLight32"},
|
2020-03-02 00:06:41 -05:00
|
|
|
{0x21, SvcWrap32<SendSyncRequest32>, "SendSyncRequest32"},
|
|
|
|
{0x22, nullptr, "SendSyncRequestWithUserBuffer32"},
|
2022-02-08 22:02:51 -05:00
|
|
|
{0x23, nullptr, "SendAsyncRequestWithUserBuffer32"},
|
2020-06-19 19:40:07 -04:00
|
|
|
{0x24, SvcWrap32<GetProcessId32>, "GetProcessId32"},
|
2020-03-02 00:06:41 -05:00
|
|
|
{0x25, SvcWrap32<GetThreadId32>, "GetThreadId32"},
|
2020-06-19 19:40:07 -04:00
|
|
|
{0x26, SvcWrap32<Break32>, "Break32"},
|
2022-02-08 13:46:45 -05:00
|
|
|
{0x27, SvcWrap32<OutputDebugString32>, "OutputDebugString32"},
|
2022-02-08 22:02:51 -05:00
|
|
|
{0x28, nullptr, "ReturnFromException32"},
|
2020-03-02 00:06:41 -05:00
|
|
|
{0x29, SvcWrap32<GetInfo32>, "GetInfo32"},
|
2022-02-08 22:02:51 -05:00
|
|
|
{0x2a, nullptr, "FlushEntireDataCache32"},
|
|
|
|
{0x2b, nullptr, "FlushDataCache32"},
|
2020-06-19 19:40:07 -04:00
|
|
|
{0x2c, SvcWrap32<MapPhysicalMemory32>, "MapPhysicalMemory32"},
|
|
|
|
{0x2d, SvcWrap32<UnmapPhysicalMemory32>, "UnmapPhysicalMemory32"},
|
2022-02-08 22:02:51 -05:00
|
|
|
{0x2e, nullptr, "GetDebugFutureThreadInfo32"},
|
|
|
|
{0x2f, nullptr, "GetLastThreadInfo32"},
|
|
|
|
{0x30, nullptr, "GetResourceLimitLimitValue32"},
|
|
|
|
{0x31, nullptr, "GetResourceLimitCurrentValue32"},
|
2020-06-19 19:40:07 -04:00
|
|
|
{0x32, SvcWrap32<SetThreadActivity32>, "SetThreadActivity32"},
|
|
|
|
{0x33, SvcWrap32<GetThreadContext32>, "GetThreadContext32"},
|
|
|
|
{0x34, SvcWrap32<WaitForAddress32>, "WaitForAddress32"},
|
|
|
|
{0x35, SvcWrap32<SignalToAddress32>, "SignalToAddress32"},
|
2022-01-31 20:02:12 -05:00
|
|
|
{0x36, SvcWrap32<SynchronizePreemptionState>, "SynchronizePreemptionState32"},
|
2022-02-08 22:02:51 -05:00
|
|
|
{0x37, nullptr, "GetResourceLimitPeakValue32"},
|
|
|
|
{0x38, nullptr, "Unknown38"},
|
|
|
|
{0x39, nullptr, "CreateIoPool32"},
|
|
|
|
{0x3a, nullptr, "CreateIoRegion32"},
|
|
|
|
{0x3b, nullptr, "Unknown3b"},
|
|
|
|
{0x3c, nullptr, "KernelDebug32"},
|
|
|
|
{0x3d, nullptr, "ChangeKernelTraceState32"},
|
|
|
|
{0x3e, nullptr, "Unknown3e"},
|
|
|
|
{0x3f, nullptr, "Unknown3f"},
|
2020-03-02 00:06:41 -05:00
|
|
|
{0x40, nullptr, "CreateSession32"},
|
|
|
|
{0x41, nullptr, "AcceptSession32"},
|
2022-02-08 22:02:51 -05:00
|
|
|
{0x42, nullptr, "ReplyAndReceiveLight32"},
|
2020-03-02 00:06:41 -05:00
|
|
|
{0x43, nullptr, "ReplyAndReceive32"},
|
2022-02-08 22:02:51 -05:00
|
|
|
{0x44, nullptr, "ReplyAndReceiveWithUserBuffer32"},
|
2020-06-19 19:40:07 -04:00
|
|
|
{0x45, SvcWrap32<CreateEvent32>, "CreateEvent32"},
|
2022-02-08 22:02:51 -05:00
|
|
|
{0x46, nullptr, "MapIoRegion32"},
|
|
|
|
{0x47, nullptr, "UnmapIoRegion32"},
|
|
|
|
{0x48, nullptr, "MapPhysicalMemoryUnsafe32"},
|
|
|
|
{0x49, nullptr, "UnmapPhysicalMemoryUnsafe32"},
|
|
|
|
{0x4a, nullptr, "SetUnsafeLimit32"},
|
2022-02-08 13:46:45 -05:00
|
|
|
{0x4b, SvcWrap32<CreateCodeMemory32>, "CreateCodeMemory32"},
|
|
|
|
{0x4c, SvcWrap32<ControlCodeMemory32>, "ControlCodeMemory32"},
|
2022-02-08 22:02:51 -05:00
|
|
|
{0x4d, nullptr, "SleepSystem32"},
|
|
|
|
{0x4e, nullptr, "ReadWriteRegister32"},
|
|
|
|
{0x4f, nullptr, "SetProcessActivity32"},
|
|
|
|
{0x50, nullptr, "CreateSharedMemory32"},
|
|
|
|
{0x51, nullptr, "MapTransferMemory32"},
|
|
|
|
{0x52, nullptr, "UnmapTransferMemory32"},
|
|
|
|
{0x53, nullptr, "CreateInterruptEvent32"},
|
|
|
|
{0x54, nullptr, "QueryPhysicalAddress32"},
|
|
|
|
{0x55, nullptr, "QueryIoMapping32"},
|
|
|
|
{0x56, nullptr, "CreateDeviceAddressSpace32"},
|
|
|
|
{0x57, nullptr, "AttachDeviceAddressSpace32"},
|
|
|
|
{0x58, nullptr, "DetachDeviceAddressSpace32"},
|
|
|
|
{0x59, nullptr, "MapDeviceAddressSpaceByForce32"},
|
|
|
|
{0x5a, nullptr, "MapDeviceAddressSpaceAligned32"},
|
|
|
|
{0x5b, nullptr, "MapDeviceAddressSpace32"},
|
|
|
|
{0x5c, nullptr, "UnmapDeviceAddressSpace32"},
|
|
|
|
{0x5d, nullptr, "InvalidateProcessDataCache32"},
|
|
|
|
{0x5e, nullptr, "StoreProcessDataCache32"},
|
2020-06-19 19:40:07 -04:00
|
|
|
{0x5F, SvcWrap32<FlushProcessDataCache32>, "FlushProcessDataCache32"},
|
2022-02-08 22:02:51 -05:00
|
|
|
{0x60, nullptr, "StoreProcessDataCache32"},
|
|
|
|
{0x61, nullptr, "BreakDebugProcess32"},
|
|
|
|
{0x62, nullptr, "TerminateDebugProcess32"},
|
|
|
|
{0x63, nullptr, "GetDebugEvent32"},
|
|
|
|
{0x64, nullptr, "ContinueDebugEvent32"},
|
2020-03-02 00:06:41 -05:00
|
|
|
{0x65, nullptr, "GetProcessList32"},
|
2022-02-08 22:02:51 -05:00
|
|
|
{0x66, nullptr, "GetThreadList"},
|
|
|
|
{0x67, nullptr, "GetDebugThreadContext32"},
|
|
|
|
{0x68, nullptr, "SetDebugThreadContext32"},
|
|
|
|
{0x69, nullptr, "QueryDebugProcessMemory32"},
|
|
|
|
{0x6A, nullptr, "ReadDebugProcessMemory32"},
|
|
|
|
{0x6B, nullptr, "WriteDebugProcessMemory32"},
|
|
|
|
{0x6C, nullptr, "SetHardwareBreakPoint32"},
|
|
|
|
{0x6D, nullptr, "GetDebugThreadParam32"},
|
|
|
|
{0x6E, nullptr, "Unknown6E"},
|
2020-03-02 00:06:41 -05:00
|
|
|
{0x6f, nullptr, "GetSystemInfo32"},
|
|
|
|
{0x70, nullptr, "CreatePort32"},
|
|
|
|
{0x71, nullptr, "ManageNamedPort32"},
|
|
|
|
{0x72, nullptr, "ConnectToPort32"},
|
|
|
|
{0x73, nullptr, "SetProcessMemoryPermission32"},
|
2022-02-08 22:02:51 -05:00
|
|
|
{0x74, nullptr, "MapProcessMemory32"},
|
|
|
|
{0x75, nullptr, "UnmapProcessMemory32"},
|
|
|
|
{0x76, nullptr, "QueryProcessMemory32"},
|
2020-03-02 00:06:41 -05:00
|
|
|
{0x77, nullptr, "MapProcessCodeMemory32"},
|
|
|
|
{0x78, nullptr, "UnmapProcessCodeMemory32"},
|
2022-02-08 22:02:51 -05:00
|
|
|
{0x79, nullptr, "CreateProcess32"},
|
|
|
|
{0x7A, nullptr, "StartProcess32"},
|
2020-03-02 00:06:41 -05:00
|
|
|
{0x7B, nullptr, "TerminateProcess32"},
|
2021-04-07 00:55:31 -04:00
|
|
|
{0x7C, nullptr, "GetProcessInfo32"},
|
|
|
|
{0x7D, nullptr, "CreateResourceLimit32"},
|
|
|
|
{0x7E, nullptr, "SetResourceLimitLimitValue32"},
|
|
|
|
{0x7F, nullptr, "CallSecureMonitor32"},
|
|
|
|
{0x80, nullptr, "Unknown"},
|
|
|
|
{0x81, nullptr, "Unknown"},
|
|
|
|
{0x82, nullptr, "Unknown"},
|
|
|
|
{0x83, nullptr, "Unknown"},
|
|
|
|
{0x84, nullptr, "Unknown"},
|
|
|
|
{0x85, nullptr, "Unknown"},
|
|
|
|
{0x86, nullptr, "Unknown"},
|
|
|
|
{0x87, nullptr, "Unknown"},
|
|
|
|
{0x88, nullptr, "Unknown"},
|
|
|
|
{0x89, nullptr, "Unknown"},
|
|
|
|
{0x8A, nullptr, "Unknown"},
|
|
|
|
{0x8B, nullptr, "Unknown"},
|
|
|
|
{0x8C, nullptr, "Unknown"},
|
|
|
|
{0x8D, nullptr, "Unknown"},
|
|
|
|
{0x8E, nullptr, "Unknown"},
|
|
|
|
{0x8F, nullptr, "Unknown"},
|
|
|
|
{0x90, nullptr, "Unknown"},
|
|
|
|
{0x91, nullptr, "Unknown"},
|
|
|
|
{0x92, nullptr, "Unknown"},
|
|
|
|
{0x93, nullptr, "Unknown"},
|
|
|
|
{0x94, nullptr, "Unknown"},
|
|
|
|
{0x95, nullptr, "Unknown"},
|
|
|
|
{0x96, nullptr, "Unknown"},
|
|
|
|
{0x97, nullptr, "Unknown"},
|
|
|
|
{0x98, nullptr, "Unknown"},
|
|
|
|
{0x99, nullptr, "Unknown"},
|
|
|
|
{0x9A, nullptr, "Unknown"},
|
|
|
|
{0x9B, nullptr, "Unknown"},
|
|
|
|
{0x9C, nullptr, "Unknown"},
|
|
|
|
{0x9D, nullptr, "Unknown"},
|
|
|
|
{0x9E, nullptr, "Unknown"},
|
|
|
|
{0x9F, nullptr, "Unknown"},
|
|
|
|
{0xA0, nullptr, "Unknown"},
|
|
|
|
{0xA1, nullptr, "Unknown"},
|
|
|
|
{0xA2, nullptr, "Unknown"},
|
|
|
|
{0xA3, nullptr, "Unknown"},
|
|
|
|
{0xA4, nullptr, "Unknown"},
|
|
|
|
{0xA5, nullptr, "Unknown"},
|
|
|
|
{0xA6, nullptr, "Unknown"},
|
|
|
|
{0xA7, nullptr, "Unknown"},
|
|
|
|
{0xA8, nullptr, "Unknown"},
|
|
|
|
{0xA9, nullptr, "Unknown"},
|
|
|
|
{0xAA, nullptr, "Unknown"},
|
|
|
|
{0xAB, nullptr, "Unknown"},
|
|
|
|
{0xAC, nullptr, "Unknown"},
|
|
|
|
{0xAD, nullptr, "Unknown"},
|
|
|
|
{0xAE, nullptr, "Unknown"},
|
|
|
|
{0xAF, nullptr, "Unknown"},
|
|
|
|
{0xB0, nullptr, "Unknown"},
|
|
|
|
{0xB1, nullptr, "Unknown"},
|
|
|
|
{0xB2, nullptr, "Unknown"},
|
|
|
|
{0xB3, nullptr, "Unknown"},
|
|
|
|
{0xB4, nullptr, "Unknown"},
|
|
|
|
{0xB5, nullptr, "Unknown"},
|
|
|
|
{0xB6, nullptr, "Unknown"},
|
|
|
|
{0xB7, nullptr, "Unknown"},
|
|
|
|
{0xB8, nullptr, "Unknown"},
|
|
|
|
{0xB9, nullptr, "Unknown"},
|
|
|
|
{0xBA, nullptr, "Unknown"},
|
|
|
|
{0xBB, nullptr, "Unknown"},
|
|
|
|
{0xBC, nullptr, "Unknown"},
|
|
|
|
{0xBD, nullptr, "Unknown"},
|
|
|
|
{0xBE, nullptr, "Unknown"},
|
|
|
|
{0xBF, nullptr, "Unknown"},
|
2020-03-02 00:06:41 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
static const FunctionDef SVC_Table_64[] = {
|
2022-02-08 22:02:51 -05:00
|
|
|
{0x00, nullptr, "Unknown0"},
|
2020-03-02 00:06:41 -05:00
|
|
|
{0x01, SvcWrap64<SetHeapSize>, "SetHeapSize"},
|
2021-12-23 04:10:36 -05:00
|
|
|
{0x02, SvcWrap64<SetMemoryPermission>, "SetMemoryPermission"},
|
2020-03-02 00:06:41 -05:00
|
|
|
{0x03, SvcWrap64<SetMemoryAttribute>, "SetMemoryAttribute"},
|
|
|
|
{0x04, SvcWrap64<MapMemory>, "MapMemory"},
|
|
|
|
{0x05, SvcWrap64<UnmapMemory>, "UnmapMemory"},
|
|
|
|
{0x06, SvcWrap64<QueryMemory>, "QueryMemory"},
|
|
|
|
{0x07, SvcWrap64<ExitProcess>, "ExitProcess"},
|
|
|
|
{0x08, SvcWrap64<CreateThread>, "CreateThread"},
|
|
|
|
{0x09, SvcWrap64<StartThread>, "StartThread"},
|
|
|
|
{0x0A, SvcWrap64<ExitThread>, "ExitThread"},
|
|
|
|
{0x0B, SvcWrap64<SleepThread>, "SleepThread"},
|
|
|
|
{0x0C, SvcWrap64<GetThreadPriority>, "GetThreadPriority"},
|
|
|
|
{0x0D, SvcWrap64<SetThreadPriority>, "SetThreadPriority"},
|
|
|
|
{0x0E, SvcWrap64<GetThreadCoreMask>, "GetThreadCoreMask"},
|
|
|
|
{0x0F, SvcWrap64<SetThreadCoreMask>, "SetThreadCoreMask"},
|
|
|
|
{0x10, SvcWrap64<GetCurrentProcessorNumber>, "GetCurrentProcessorNumber"},
|
|
|
|
{0x11, SvcWrap64<SignalEvent>, "SignalEvent"},
|
|
|
|
{0x12, SvcWrap64<ClearEvent>, "ClearEvent"},
|
|
|
|
{0x13, SvcWrap64<MapSharedMemory>, "MapSharedMemory"},
|
2021-04-30 17:53:22 -04:00
|
|
|
{0x14, SvcWrap64<UnmapSharedMemory>, "UnmapSharedMemory"},
|
2020-03-02 00:06:41 -05:00
|
|
|
{0x15, SvcWrap64<CreateTransferMemory>, "CreateTransferMemory"},
|
|
|
|
{0x16, SvcWrap64<CloseHandle>, "CloseHandle"},
|
|
|
|
{0x17, SvcWrap64<ResetSignal>, "ResetSignal"},
|
|
|
|
{0x18, SvcWrap64<WaitSynchronization>, "WaitSynchronization"},
|
|
|
|
{0x19, SvcWrap64<CancelSynchronization>, "CancelSynchronization"},
|
|
|
|
{0x1A, SvcWrap64<ArbitrateLock>, "ArbitrateLock"},
|
|
|
|
{0x1B, SvcWrap64<ArbitrateUnlock>, "ArbitrateUnlock"},
|
|
|
|
{0x1C, SvcWrap64<WaitProcessWideKeyAtomic>, "WaitProcessWideKeyAtomic"},
|
|
|
|
{0x1D, SvcWrap64<SignalProcessWideKey>, "SignalProcessWideKey"},
|
|
|
|
{0x1E, SvcWrap64<GetSystemTick>, "GetSystemTick"},
|
|
|
|
{0x1F, SvcWrap64<ConnectToNamedPort>, "ConnectToNamedPort"},
|
2018-01-02 20:47:26 -05:00
|
|
|
{0x20, nullptr, "SendSyncRequestLight"},
|
2020-03-02 00:06:41 -05:00
|
|
|
{0x21, SvcWrap64<SendSyncRequest>, "SendSyncRequest"},
|
2018-01-02 20:47:26 -05:00
|
|
|
{0x22, nullptr, "SendSyncRequestWithUserBuffer"},
|
|
|
|
{0x23, nullptr, "SendAsyncRequestWithUserBuffer"},
|
2020-03-02 00:06:41 -05:00
|
|
|
{0x24, SvcWrap64<GetProcessId>, "GetProcessId"},
|
|
|
|
{0x25, SvcWrap64<GetThreadId>, "GetThreadId"},
|
|
|
|
{0x26, SvcWrap64<Break>, "Break"},
|
|
|
|
{0x27, SvcWrap64<OutputDebugString>, "OutputDebugString"},
|
2018-01-02 20:47:26 -05:00
|
|
|
{0x28, nullptr, "ReturnFromException"},
|
2020-03-02 00:06:41 -05:00
|
|
|
{0x29, SvcWrap64<GetInfo>, "GetInfo"},
|
2018-01-02 20:47:26 -05:00
|
|
|
{0x2A, nullptr, "FlushEntireDataCache"},
|
|
|
|
{0x2B, nullptr, "FlushDataCache"},
|
2020-03-02 00:06:41 -05:00
|
|
|
{0x2C, SvcWrap64<MapPhysicalMemory>, "MapPhysicalMemory"},
|
|
|
|
{0x2D, SvcWrap64<UnmapPhysicalMemory>, "UnmapPhysicalMemory"},
|
2018-09-23 20:03:38 -04:00
|
|
|
{0x2E, nullptr, "GetFutureThreadInfo"},
|
2018-01-02 20:47:26 -05:00
|
|
|
{0x2F, nullptr, "GetLastThreadInfo"},
|
2020-03-02 00:06:41 -05:00
|
|
|
{0x30, SvcWrap64<GetResourceLimitLimitValue>, "GetResourceLimitLimitValue"},
|
|
|
|
{0x31, SvcWrap64<GetResourceLimitCurrentValue>, "GetResourceLimitCurrentValue"},
|
|
|
|
{0x32, SvcWrap64<SetThreadActivity>, "SetThreadActivity"},
|
|
|
|
{0x33, SvcWrap64<GetThreadContext>, "GetThreadContext"},
|
|
|
|
{0x34, SvcWrap64<WaitForAddress>, "WaitForAddress"},
|
|
|
|
{0x35, SvcWrap64<SignalToAddress>, "SignalToAddress"},
|
2021-12-30 00:40:38 -05:00
|
|
|
{0x36, SvcWrap64<SynchronizePreemptionState>, "SynchronizePreemptionState"},
|
2022-02-08 22:02:51 -05:00
|
|
|
{0x37, nullptr, "GetResourceLimitPeakValue"},
|
|
|
|
{0x38, nullptr, "Unknown38"},
|
|
|
|
{0x39, nullptr, "CreateIoPool"},
|
|
|
|
{0x3A, nullptr, "CreateIoRegion"},
|
|
|
|
{0x3B, nullptr, "Unknown3B"},
|
2020-03-02 00:06:41 -05:00
|
|
|
{0x3C, SvcWrap64<KernelDebug>, "KernelDebug"},
|
|
|
|
{0x3D, SvcWrap64<ChangeKernelTraceState>, "ChangeKernelTraceState"},
|
2022-02-08 22:02:51 -05:00
|
|
|
{0x3E, nullptr, "Unknown3e"},
|
|
|
|
{0x3F, nullptr, "Unknown3f"},
|
2022-10-03 22:52:52 -04:00
|
|
|
{0x40, SvcWrap64<CreateSession>, "CreateSession"},
|
2018-01-02 20:47:26 -05:00
|
|
|
{0x41, nullptr, "AcceptSession"},
|
|
|
|
{0x42, nullptr, "ReplyAndReceiveLight"},
|
2022-10-11 18:16:56 -04:00
|
|
|
{0x43, SvcWrap64<ReplyAndReceive>, "ReplyAndReceive"},
|
2018-01-02 20:47:26 -05:00
|
|
|
{0x44, nullptr, "ReplyAndReceiveWithUserBuffer"},
|
2020-03-02 00:06:41 -05:00
|
|
|
{0x45, SvcWrap64<CreateEvent>, "CreateEvent"},
|
2022-02-08 22:02:51 -05:00
|
|
|
{0x46, nullptr, "MapIoRegion"},
|
|
|
|
{0x47, nullptr, "UnmapIoRegion"},
|
2018-09-23 20:03:38 -04:00
|
|
|
{0x48, nullptr, "MapPhysicalMemoryUnsafe"},
|
|
|
|
{0x49, nullptr, "UnmapPhysicalMemoryUnsafe"},
|
|
|
|
{0x4A, nullptr, "SetUnsafeLimit"},
|
2021-12-05 15:04:08 -05:00
|
|
|
{0x4B, SvcWrap64<CreateCodeMemory>, "CreateCodeMemory"},
|
|
|
|
{0x4C, SvcWrap64<ControlCodeMemory>, "ControlCodeMemory"},
|
2018-01-02 20:47:26 -05:00
|
|
|
{0x4D, nullptr, "SleepSystem"},
|
|
|
|
{0x4E, nullptr, "ReadWriteRegister"},
|
|
|
|
{0x4F, nullptr, "SetProcessActivity"},
|
2020-04-08 23:14:18 -04:00
|
|
|
{0x50, nullptr, "CreateSharedMemory"},
|
|
|
|
{0x51, nullptr, "MapTransferMemory"},
|
|
|
|
{0x52, nullptr, "UnmapTransferMemory"},
|
2018-01-02 20:47:26 -05:00
|
|
|
{0x53, nullptr, "CreateInterruptEvent"},
|
|
|
|
{0x54, nullptr, "QueryPhysicalAddress"},
|
|
|
|
{0x55, nullptr, "QueryIoMapping"},
|
|
|
|
{0x56, nullptr, "CreateDeviceAddressSpace"},
|
|
|
|
{0x57, nullptr, "AttachDeviceAddressSpace"},
|
|
|
|
{0x58, nullptr, "DetachDeviceAddressSpace"},
|
|
|
|
{0x59, nullptr, "MapDeviceAddressSpaceByForce"},
|
|
|
|
{0x5A, nullptr, "MapDeviceAddressSpaceAligned"},
|
|
|
|
{0x5B, nullptr, "MapDeviceAddressSpace"},
|
|
|
|
{0x5C, nullptr, "UnmapDeviceAddressSpace"},
|
|
|
|
{0x5D, nullptr, "InvalidateProcessDataCache"},
|
|
|
|
{0x5E, nullptr, "StoreProcessDataCache"},
|
|
|
|
{0x5F, nullptr, "FlushProcessDataCache"},
|
|
|
|
{0x60, nullptr, "DebugActiveProcess"},
|
|
|
|
{0x61, nullptr, "BreakDebugProcess"},
|
|
|
|
{0x62, nullptr, "TerminateDebugProcess"},
|
|
|
|
{0x63, nullptr, "GetDebugEvent"},
|
|
|
|
{0x64, nullptr, "ContinueDebugEvent"},
|
2020-03-02 00:06:41 -05:00
|
|
|
{0x65, SvcWrap64<GetProcessList>, "GetProcessList"},
|
|
|
|
{0x66, SvcWrap64<GetThreadList>, "GetThreadList"},
|
2018-01-02 20:47:26 -05:00
|
|
|
{0x67, nullptr, "GetDebugThreadContext"},
|
|
|
|
{0x68, nullptr, "SetDebugThreadContext"},
|
|
|
|
{0x69, nullptr, "QueryDebugProcessMemory"},
|
|
|
|
{0x6A, nullptr, "ReadDebugProcessMemory"},
|
|
|
|
{0x6B, nullptr, "WriteDebugProcessMemory"},
|
|
|
|
{0x6C, nullptr, "SetHardwareBreakPoint"},
|
|
|
|
{0x6D, nullptr, "GetDebugThreadParam"},
|
2022-02-08 22:02:51 -05:00
|
|
|
{0x6E, nullptr, "Unknown6E"},
|
2018-09-23 20:03:38 -04:00
|
|
|
{0x6F, nullptr, "GetSystemInfo"},
|
2018-01-02 20:47:26 -05:00
|
|
|
{0x70, nullptr, "CreatePort"},
|
|
|
|
{0x71, nullptr, "ManageNamedPort"},
|
|
|
|
{0x72, nullptr, "ConnectToPort"},
|
2021-11-20 20:23:59 -05:00
|
|
|
{0x73, SvcWrap64<SetProcessMemoryPermission>, "SetProcessMemoryPermission"},
|
2021-12-05 15:04:08 -05:00
|
|
|
{0x74, SvcWrap64<MapProcessMemory>, "MapProcessMemory"},
|
|
|
|
{0x75, SvcWrap64<UnmapProcessMemory>, "UnmapProcessMemory"},
|
2020-03-02 00:06:41 -05:00
|
|
|
{0x76, SvcWrap64<QueryProcessMemory>, "QueryProcessMemory"},
|
2020-04-23 18:05:09 -04:00
|
|
|
{0x77, SvcWrap64<MapProcessCodeMemory>, "MapProcessCodeMemory"},
|
|
|
|
{0x78, SvcWrap64<UnmapProcessCodeMemory>, "UnmapProcessCodeMemory"},
|
2018-01-02 20:47:26 -05:00
|
|
|
{0x79, nullptr, "CreateProcess"},
|
|
|
|
{0x7A, nullptr, "StartProcess"},
|
|
|
|
{0x7B, nullptr, "TerminateProcess"},
|
2020-03-02 00:06:41 -05:00
|
|
|
{0x7C, SvcWrap64<GetProcessInfo>, "GetProcessInfo"},
|
|
|
|
{0x7D, SvcWrap64<CreateResourceLimit>, "CreateResourceLimit"},
|
|
|
|
{0x7E, SvcWrap64<SetResourceLimitLimitValue>, "SetResourceLimitLimitValue"},
|
2018-01-02 20:47:26 -05:00
|
|
|
{0x7F, nullptr, "CallSecureMonitor"},
|
2021-04-07 00:55:31 -04:00
|
|
|
{0x80, nullptr, "Unknown"},
|
|
|
|
{0x81, nullptr, "Unknown"},
|
|
|
|
{0x82, nullptr, "Unknown"},
|
|
|
|
{0x83, nullptr, "Unknown"},
|
|
|
|
{0x84, nullptr, "Unknown"},
|
|
|
|
{0x85, nullptr, "Unknown"},
|
|
|
|
{0x86, nullptr, "Unknown"},
|
|
|
|
{0x87, nullptr, "Unknown"},
|
|
|
|
{0x88, nullptr, "Unknown"},
|
|
|
|
{0x89, nullptr, "Unknown"},
|
|
|
|
{0x8A, nullptr, "Unknown"},
|
|
|
|
{0x8B, nullptr, "Unknown"},
|
|
|
|
{0x8C, nullptr, "Unknown"},
|
|
|
|
{0x8D, nullptr, "Unknown"},
|
|
|
|
{0x8E, nullptr, "Unknown"},
|
|
|
|
{0x8F, nullptr, "Unknown"},
|
|
|
|
{0x90, nullptr, "Unknown"},
|
|
|
|
{0x91, nullptr, "Unknown"},
|
|
|
|
{0x92, nullptr, "Unknown"},
|
|
|
|
{0x93, nullptr, "Unknown"},
|
|
|
|
{0x94, nullptr, "Unknown"},
|
|
|
|
{0x95, nullptr, "Unknown"},
|
|
|
|
{0x96, nullptr, "Unknown"},
|
|
|
|
{0x97, nullptr, "Unknown"},
|
|
|
|
{0x98, nullptr, "Unknown"},
|
|
|
|
{0x99, nullptr, "Unknown"},
|
|
|
|
{0x9A, nullptr, "Unknown"},
|
|
|
|
{0x9B, nullptr, "Unknown"},
|
|
|
|
{0x9C, nullptr, "Unknown"},
|
|
|
|
{0x9D, nullptr, "Unknown"},
|
|
|
|
{0x9E, nullptr, "Unknown"},
|
|
|
|
{0x9F, nullptr, "Unknown"},
|
|
|
|
{0xA0, nullptr, "Unknown"},
|
|
|
|
{0xA1, nullptr, "Unknown"},
|
|
|
|
{0xA2, nullptr, "Unknown"},
|
|
|
|
{0xA3, nullptr, "Unknown"},
|
|
|
|
{0xA4, nullptr, "Unknown"},
|
|
|
|
{0xA5, nullptr, "Unknown"},
|
|
|
|
{0xA6, nullptr, "Unknown"},
|
|
|
|
{0xA7, nullptr, "Unknown"},
|
|
|
|
{0xA8, nullptr, "Unknown"},
|
|
|
|
{0xA9, nullptr, "Unknown"},
|
|
|
|
{0xAA, nullptr, "Unknown"},
|
|
|
|
{0xAB, nullptr, "Unknown"},
|
|
|
|
{0xAC, nullptr, "Unknown"},
|
|
|
|
{0xAD, nullptr, "Unknown"},
|
|
|
|
{0xAE, nullptr, "Unknown"},
|
|
|
|
{0xAF, nullptr, "Unknown"},
|
|
|
|
{0xB0, nullptr, "Unknown"},
|
|
|
|
{0xB1, nullptr, "Unknown"},
|
|
|
|
{0xB2, nullptr, "Unknown"},
|
|
|
|
{0xB3, nullptr, "Unknown"},
|
|
|
|
{0xB4, nullptr, "Unknown"},
|
|
|
|
{0xB5, nullptr, "Unknown"},
|
|
|
|
{0xB6, nullptr, "Unknown"},
|
|
|
|
{0xB7, nullptr, "Unknown"},
|
|
|
|
{0xB8, nullptr, "Unknown"},
|
|
|
|
{0xB9, nullptr, "Unknown"},
|
|
|
|
{0xBA, nullptr, "Unknown"},
|
|
|
|
{0xBB, nullptr, "Unknown"},
|
|
|
|
{0xBC, nullptr, "Unknown"},
|
|
|
|
{0xBD, nullptr, "Unknown"},
|
|
|
|
{0xBE, nullptr, "Unknown"},
|
|
|
|
{0xBF, nullptr, "Unknown"},
|
2014-04-10 19:58:28 -04:00
|
|
|
};
|
|
|
|
|
2020-03-02 00:06:41 -05:00
|
|
|
static const FunctionDef* GetSVCInfo32(u32 func_num) {
|
|
|
|
if (func_num >= std::size(SVC_Table_32)) {
|
|
|
|
LOG_ERROR(Kernel_SVC, "Unknown svc=0x{:02X}", func_num);
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
return &SVC_Table_32[func_num];
|
|
|
|
}
|
|
|
|
|
|
|
|
static const FunctionDef* GetSVCInfo64(u32 func_num) {
|
|
|
|
if (func_num >= std::size(SVC_Table_64)) {
|
2018-07-02 12:13:26 -04:00
|
|
|
LOG_ERROR(Kernel_SVC, "Unknown svc=0x{:02X}", func_num);
|
2015-05-05 23:04:25 -04:00
|
|
|
return nullptr;
|
|
|
|
}
|
2020-03-02 00:06:41 -05:00
|
|
|
return &SVC_Table_64[func_num];
|
2015-05-05 23:04:25 -04:00
|
|
|
}
|
|
|
|
|
2020-03-26 20:00:30 -04:00
|
|
|
void Call(Core::System& system, u32 immediate) {
|
2020-03-12 16:48:43 -04:00
|
|
|
auto& kernel = system.Kernel();
|
|
|
|
kernel.EnterSVCProfile();
|
2015-05-05 23:04:25 -04:00
|
|
|
|
2022-06-16 10:35:52 -04:00
|
|
|
auto* thread = GetCurrentThreadPointer(kernel);
|
2021-01-20 16:42:27 -05:00
|
|
|
thread->SetIsCallingSvc();
|
2020-11-13 14:11:12 -05:00
|
|
|
|
2020-03-02 00:06:41 -05:00
|
|
|
const FunctionDef* info = system.CurrentProcess()->Is64BitProcess() ? GetSVCInfo64(immediate)
|
|
|
|
: GetSVCInfo32(immediate);
|
2015-05-05 23:04:25 -04:00
|
|
|
if (info) {
|
|
|
|
if (info->func) {
|
2019-04-06 18:46:18 -04:00
|
|
|
info->func(system);
|
2015-05-05 23:04:25 -04:00
|
|
|
} else {
|
2018-07-02 12:13:26 -04:00
|
|
|
LOG_CRITICAL(Kernel_SVC, "Unimplemented SVC function {}(..)", info->name);
|
2015-05-05 23:04:25 -04:00
|
|
|
}
|
2017-10-14 17:30:07 -04:00
|
|
|
} else {
|
2018-07-02 12:13:26 -04:00
|
|
|
LOG_CRITICAL(Kernel_SVC, "Unknown SVC function 0x{:X}", immediate);
|
2015-05-05 23:04:25 -04:00
|
|
|
}
|
2020-03-10 18:41:11 -04:00
|
|
|
|
2020-03-12 16:48:43 -04:00
|
|
|
kernel.ExitSVCProfile();
|
2014-04-10 19:58:28 -04:00
|
|
|
}
|
2014-04-11 18:44:21 -04:00
|
|
|
|
2020-03-26 20:00:30 -04:00
|
|
|
} // namespace Kernel::Svc
|