svc.cpp 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596
  1. // Copyright 2014 Citra Emulator Project
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #include <map>
  5. #include "common/string_util.h"
  6. #include "common/symbols.h"
  7. #include "core/arm/arm_interface.h"
  8. #include "core/mem_map.h"
  9. #include "core/hle/kernel/address_arbiter.h"
  10. #include "core/hle/kernel/event.h"
  11. #include "core/hle/kernel/mutex.h"
  12. #include "core/hle/kernel/semaphore.h"
  13. #include "core/hle/kernel/shared_memory.h"
  14. #include "core/hle/kernel/thread.h"
  15. #include "core/hle/kernel/timer.h"
  16. #include "core/hle/function_wrappers.h"
  17. #include "core/hle/result.h"
  18. #include "core/hle/service/service.h"
  19. ////////////////////////////////////////////////////////////////////////////////////////////////////
  20. // Namespace SVC
  21. using Kernel::SharedPtr;
  22. namespace SVC {
  23. enum ControlMemoryOperation {
  24. MEMORY_OPERATION_HEAP = 0x00000003,
  25. MEMORY_OPERATION_GSP_HEAP = 0x00010003,
  26. };
  27. /// Map application or GSP heap memory
  28. static Result ControlMemory(u32* out_addr, u32 operation, u32 addr0, u32 addr1, u32 size, u32 permissions) {
  29. LOG_TRACE(Kernel_SVC,"called operation=0x%08X, addr0=0x%08X, addr1=0x%08X, size=%08X, permissions=0x%08X",
  30. operation, addr0, addr1, size, permissions);
  31. switch (operation) {
  32. // Map normal heap memory
  33. case MEMORY_OPERATION_HEAP:
  34. *out_addr = Memory::MapBlock_Heap(size, operation, permissions);
  35. break;
  36. // Map GSP heap memory
  37. case MEMORY_OPERATION_GSP_HEAP:
  38. *out_addr = Memory::MapBlock_HeapLinear(size, operation, permissions);
  39. break;
  40. // Unknown ControlMemory operation
  41. default:
  42. LOG_ERROR(Kernel_SVC, "unknown operation=0x%08X", operation);
  43. }
  44. return 0;
  45. }
  46. /// Maps a memory block to specified address
  47. static Result MapMemoryBlock(Handle handle, u32 addr, u32 permissions, u32 other_permissions) {
  48. LOG_TRACE(Kernel_SVC, "called memblock=0x%08X, addr=0x%08X, mypermissions=0x%08X, otherpermission=%d",
  49. handle, addr, permissions, other_permissions);
  50. Kernel::MemoryPermission permissions_type = static_cast<Kernel::MemoryPermission>(permissions);
  51. switch (permissions_type) {
  52. case Kernel::MemoryPermission::Read:
  53. case Kernel::MemoryPermission::Write:
  54. case Kernel::MemoryPermission::ReadWrite:
  55. case Kernel::MemoryPermission::Execute:
  56. case Kernel::MemoryPermission::ReadExecute:
  57. case Kernel::MemoryPermission::WriteExecute:
  58. case Kernel::MemoryPermission::ReadWriteExecute:
  59. case Kernel::MemoryPermission::DontCare:
  60. Kernel::MapSharedMemory(handle, addr, permissions_type,
  61. static_cast<Kernel::MemoryPermission>(other_permissions));
  62. break;
  63. default:
  64. LOG_ERROR(Kernel_SVC, "unknown permissions=0x%08X", permissions);
  65. }
  66. return 0;
  67. }
  68. /// Connect to an OS service given the port name, returns the handle to the port to out
  69. static Result ConnectToPort(Handle* out, const char* port_name) {
  70. Service::Interface* service = Service::g_manager->FetchFromPortName(port_name);
  71. LOG_TRACE(Kernel_SVC, "called port_name=%s", port_name);
  72. _assert_msg_(KERNEL, (service != nullptr), "called, but service is not implemented!");
  73. *out = service->GetHandle();
  74. return 0;
  75. }
  76. /// Synchronize to an OS service
  77. static Result SendSyncRequest(Handle handle) {
  78. SharedPtr<Kernel::Session> session = Kernel::g_handle_table.Get<Kernel::Session>(handle);
  79. if (session == nullptr) {
  80. return InvalidHandle(ErrorModule::Kernel).raw;
  81. }
  82. LOG_TRACE(Kernel_SVC, "called handle=0x%08X(%s)", handle, session->GetName().c_str());
  83. ResultVal<bool> wait = session->SyncRequest();
  84. if (wait.Succeeded() && *wait) {
  85. Kernel::WaitCurrentThread(WAITTYPE_SYNCH); // TODO(bunnei): Is this correct?
  86. }
  87. return wait.Code().raw;
  88. }
  89. /// Close a handle
  90. static Result CloseHandle(Handle handle) {
  91. // ImplementMe
  92. LOG_ERROR(Kernel_SVC, "(UNIMPLEMENTED) called handle=0x%08X", handle);
  93. return 0;
  94. }
  95. /// Wait for a handle to synchronize, timeout after the specified nanoseconds
  96. static Result WaitSynchronization1(Handle handle, s64 nano_seconds) {
  97. SharedPtr<Kernel::Object> object = Kernel::g_handle_table.GetGeneric(handle);
  98. if (object == nullptr)
  99. return InvalidHandle(ErrorModule::Kernel).raw;
  100. LOG_TRACE(Kernel_SVC, "called handle=0x%08X(%s:%s), nanoseconds=%lld", handle,
  101. object->GetTypeName().c_str(), object->GetName().c_str(), nano_seconds);
  102. ResultVal<bool> wait = object->Wait(true);
  103. // Check for next thread to schedule
  104. if (wait.Succeeded() && *wait) {
  105. // Create an event to wake the thread up after the specified nanosecond delay has passed
  106. Kernel::WakeThreadAfterDelay(Kernel::GetCurrentThread(), nano_seconds);
  107. Kernel::GetCurrentThread()->SetWaitAll(false);
  108. HLE::Reschedule(__func__);
  109. } else {
  110. object->Acquire();
  111. }
  112. return wait.Code().raw;
  113. }
  114. /// Wait for the given handles to synchronize, timeout after the specified nanoseconds
  115. static Result WaitSynchronizationN(s32* out, Handle* handles, s32 handle_count, bool wait_all, s64 nano_seconds) {
  116. bool wait_thread = !wait_all;
  117. int handle_index = 0;
  118. // Handles pointer is invalid
  119. if (handles == nullptr)
  120. return ResultCode(ErrorDescription::InvalidPointer, ErrorModule::Kernel, ErrorSummary::InvalidArgument, ErrorLevel::Permanent).raw;
  121. // Negative handle_count is invalid
  122. if (handle_count < 0)
  123. return ResultCode(ErrorDescription::OutOfRange, ErrorModule::OS, ErrorSummary::InvalidArgument, ErrorLevel::Usage).raw;
  124. // If handle_count is non-zero, iterate through them and wait the current thread on the objects
  125. if (handle_count != 0) {
  126. bool selected = false; // True once an object has been selected
  127. for (int i = 0; i < handle_count; ++i) {
  128. SharedPtr<Kernel::Object> object = Kernel::g_handle_table.GetGeneric(handles[i]);
  129. if (object == nullptr)
  130. return InvalidHandle(ErrorModule::Kernel).raw;
  131. ResultVal<bool> wait = object->Wait(true);
  132. // Check if the current thread should wait on the object...
  133. if (wait.Succeeded() && *wait) {
  134. // Check we are waiting on all objects...
  135. if (wait_all)
  136. // Wait the thread
  137. wait_thread = true;
  138. } else {
  139. // Do not wait on this object, check if this object should be selected...
  140. if (!wait_all && !selected) {
  141. // Do not wait the thread
  142. wait_thread = false;
  143. handle_index = i;
  144. selected = true;
  145. }
  146. }
  147. }
  148. } else {
  149. // If no handles were passed in, put the thread to sleep only when wait_all=false
  150. // NOTE: This is supposed to deadlock the current thread if no timeout was specified
  151. if (!wait_all) {
  152. wait_thread = true;
  153. Kernel::WaitCurrentThread(WAITTYPE_SLEEP);
  154. }
  155. }
  156. // If thread should block, then set its state to waiting and then reschedule...
  157. if (wait_thread) {
  158. // Create an event to wake the thread up after the specified nanosecond delay has passed
  159. Kernel::WakeThreadAfterDelay(Kernel::GetCurrentThread(), nano_seconds);
  160. Kernel::GetCurrentThread()->SetWaitAll(wait_all);
  161. HLE::Reschedule(__func__);
  162. // NOTE: output of this SVC will be set later depending on how the thread resumes
  163. return 0xDEADBEEF;
  164. }
  165. // Acquire objects if we did not wait...
  166. for (int i = 0; i < handle_count; ++i) {
  167. auto object = Kernel::g_handle_table.GetWaitObject(handles[i]);
  168. // Acquire the object if it is not waiting...
  169. if (!object->ShouldWait()) {
  170. object->Acquire();
  171. // If this was the first non-waiting object and 'wait_all' is false, don't acquire
  172. // any other objects
  173. if (!wait_all)
  174. break;
  175. }
  176. }
  177. // TODO(bunnei): If 'wait_all' is true, this is probably wrong. However, real hardware does
  178. // not seem to set it to any meaningful value.
  179. *out = wait_all ? 0 : handle_index;
  180. return RESULT_SUCCESS.raw;
  181. }
  182. /// Create an address arbiter (to allocate access to shared resources)
  183. static Result CreateAddressArbiter(u32* arbiter) {
  184. Handle handle = Kernel::CreateAddressArbiter();
  185. *arbiter = handle;
  186. return 0;
  187. }
  188. /// Arbitrate address
  189. static Result ArbitrateAddress(Handle arbiter, u32 address, u32 type, u32 value, s64 nanoseconds) {
  190. LOG_TRACE(Kernel_SVC, "called handle=0x%08X, address=0x%08X, type=0x%08X, value=0x%08X", arbiter,
  191. address, type, value);
  192. return Kernel::ArbitrateAddress(arbiter, static_cast<Kernel::ArbitrationType>(type),
  193. address, value, nanoseconds).raw;
  194. }
  195. /// Used to output a message on a debug hardware unit - does nothing on a retail unit
  196. static void OutputDebugString(const char* string) {
  197. LOG_DEBUG(Debug_Emulated, "%s", string);
  198. }
  199. /// Get resource limit
  200. static Result GetResourceLimit(Handle* resource_limit, Handle process) {
  201. // With regards to proceess values:
  202. // 0xFFFF8001 is a handle alias for the current KProcess, and 0xFFFF8000 is a handle alias for
  203. // the current KThread.
  204. *resource_limit = 0xDEADBEEF;
  205. LOG_ERROR(Kernel_SVC, "(UNIMPLEMENTED) called process=0x%08X", process);
  206. return 0;
  207. }
  208. /// Get resource limit current values
  209. static Result GetResourceLimitCurrentValues(s64* values, Handle resource_limit, void* names,
  210. s32 name_count) {
  211. LOG_ERROR(Kernel_SVC, "(UNIMPLEMENTED) called resource_limit=%08X, names=%s, name_count=%d",
  212. resource_limit, names, name_count);
  213. Memory::Write32(Core::g_app_core->GetReg(0), 0); // Normmatt: Set used memory to 0 for now
  214. return 0;
  215. }
  216. /// Creates a new thread
  217. static Result CreateThread(u32 priority, u32 entry_point, u32 arg, u32 stack_top, u32 processor_id) {
  218. using Kernel::Thread;
  219. std::string name;
  220. if (Symbols::HasSymbol(entry_point)) {
  221. TSymbol symbol = Symbols::GetSymbol(entry_point);
  222. name = symbol.name;
  223. } else {
  224. name = Common::StringFromFormat("unknown-%08x", entry_point);
  225. }
  226. ResultVal<SharedPtr<Thread>> thread_res = Kernel::Thread::Create(
  227. name, entry_point, priority, arg, processor_id, stack_top, Kernel::DEFAULT_STACK_SIZE);
  228. if (thread_res.Failed())
  229. return thread_res.Code().raw;
  230. SharedPtr<Thread> thread = std::move(*thread_res);
  231. // TODO(yuriks): Create new handle instead of using built-in
  232. Core::g_app_core->SetReg(1, thread->GetHandle());
  233. LOG_TRACE(Kernel_SVC, "called entrypoint=0x%08X (%s), arg=0x%08X, stacktop=0x%08X, "
  234. "threadpriority=0x%08X, processorid=0x%08X : created handle=0x%08X", entry_point,
  235. name.c_str(), arg, stack_top, priority, processor_id, thread->GetHandle());
  236. if (THREADPROCESSORID_1 == processor_id) {
  237. LOG_WARNING(Kernel_SVC,
  238. "thread designated for system CPU core (UNIMPLEMENTED) will be run with app core scheduling");
  239. }
  240. return 0;
  241. }
  242. /// Called when a thread exits
  243. static void ExitThread() {
  244. LOG_TRACE(Kernel_SVC, "called, pc=0x%08X", Core::g_app_core->GetPC());
  245. Kernel::GetCurrentThread()->Stop(__func__);
  246. HLE::Reschedule(__func__);
  247. }
  248. /// Gets the priority for the specified thread
  249. static Result GetThreadPriority(s32* priority, Handle handle) {
  250. const SharedPtr<Kernel::Thread> thread = Kernel::g_handle_table.Get<Kernel::Thread>(handle);
  251. if (thread == nullptr)
  252. return InvalidHandle(ErrorModule::Kernel).raw;
  253. *priority = thread->GetPriority();
  254. return RESULT_SUCCESS.raw;
  255. }
  256. /// Sets the priority for the specified thread
  257. static Result SetThreadPriority(Handle handle, s32 priority) {
  258. SharedPtr<Kernel::Thread> thread = Kernel::g_handle_table.Get<Kernel::Thread>(handle);
  259. if (thread == nullptr)
  260. return InvalidHandle(ErrorModule::Kernel).raw;
  261. thread->SetPriority(priority);
  262. return RESULT_SUCCESS.raw;
  263. }
  264. /// Create a mutex
  265. static Result CreateMutex(Handle* mutex, u32 initial_locked) {
  266. *mutex = Kernel::CreateMutex((initial_locked != 0));
  267. LOG_TRACE(Kernel_SVC, "called initial_locked=%s : created handle=0x%08X",
  268. initial_locked ? "true" : "false", *mutex);
  269. return 0;
  270. }
  271. /// Release a mutex
  272. static Result ReleaseMutex(Handle handle) {
  273. LOG_TRACE(Kernel_SVC, "called handle=0x%08X", handle);
  274. ResultCode res = Kernel::ReleaseMutex(handle);
  275. return res.raw;
  276. }
  277. /// Get the ID for the specified thread.
  278. static Result GetThreadId(u32* thread_id, Handle handle) {
  279. LOG_TRACE(Kernel_SVC, "called thread=0x%08X", handle);
  280. const SharedPtr<Kernel::Thread> thread = Kernel::g_handle_table.Get<Kernel::Thread>(handle);
  281. if (thread == nullptr)
  282. return InvalidHandle(ErrorModule::Kernel).raw;
  283. *thread_id = thread->GetThreadId();
  284. return RESULT_SUCCESS.raw;
  285. }
  286. /// Creates a semaphore
  287. static Result CreateSemaphore(Handle* semaphore, s32 initial_count, s32 max_count) {
  288. ResultCode res = Kernel::CreateSemaphore(semaphore, initial_count, max_count);
  289. LOG_TRACE(Kernel_SVC, "called initial_count=%d, max_count=%d, created handle=0x%08X",
  290. initial_count, max_count, *semaphore);
  291. return res.raw;
  292. }
  293. /// Releases a certain number of slots in a semaphore
  294. static Result ReleaseSemaphore(s32* count, Handle semaphore, s32 release_count) {
  295. LOG_TRACE(Kernel_SVC, "called release_count=%d, handle=0x%08X", release_count, semaphore);
  296. ResultCode res = Kernel::ReleaseSemaphore(count, semaphore, release_count);
  297. return res.raw;
  298. }
  299. /// Query memory
  300. static Result QueryMemory(void* info, void* out, u32 addr) {
  301. LOG_ERROR(Kernel_SVC, "(UNIMPLEMENTED) called addr=0x%08X", addr);
  302. return 0;
  303. }
  304. /// Create an event
  305. static Result CreateEvent(Handle* evt, u32 reset_type) {
  306. *evt = Kernel::CreateEvent((ResetType)reset_type);
  307. LOG_TRACE(Kernel_SVC, "called reset_type=0x%08X : created handle=0x%08X",
  308. reset_type, *evt);
  309. return 0;
  310. }
  311. /// Duplicates a kernel handle
  312. static Result DuplicateHandle(Handle* out, Handle handle) {
  313. ResultVal<Handle> out_h = Kernel::g_handle_table.Duplicate(handle);
  314. if (out_h.Succeeded()) {
  315. *out = *out_h;
  316. LOG_TRACE(Kernel_SVC, "duplicated 0x%08X to 0x%08X", handle, *out);
  317. }
  318. return out_h.Code().raw;
  319. }
  320. /// Signals an event
  321. static Result SignalEvent(Handle evt) {
  322. LOG_TRACE(Kernel_SVC, "called event=0x%08X", evt);
  323. return Kernel::SignalEvent(evt).raw;
  324. }
  325. /// Clears an event
  326. static Result ClearEvent(Handle evt) {
  327. LOG_TRACE(Kernel_SVC, "called event=0x%08X", evt);
  328. return Kernel::ClearEvent(evt).raw;
  329. }
  330. /// Creates a timer
  331. static Result CreateTimer(Handle* handle, u32 reset_type) {
  332. ResultCode res = Kernel::CreateTimer(handle, static_cast<ResetType>(reset_type));
  333. LOG_TRACE(Kernel_SVC, "called reset_type=0x%08X : created handle=0x%08X",
  334. reset_type, *handle);
  335. return res.raw;
  336. }
  337. /// Clears a timer
  338. static Result ClearTimer(Handle handle) {
  339. LOG_TRACE(Kernel_SVC, "called timer=0x%08X", handle);
  340. return Kernel::ClearTimer(handle).raw;
  341. }
  342. /// Starts a timer
  343. static Result SetTimer(Handle handle, s64 initial, s64 interval) {
  344. LOG_TRACE(Kernel_SVC, "called timer=0x%08X", handle);
  345. return Kernel::SetTimer(handle, initial, interval).raw;
  346. }
  347. /// Cancels a timer
  348. static Result CancelTimer(Handle handle) {
  349. LOG_TRACE(Kernel_SVC, "called timer=0x%08X", handle);
  350. return Kernel::CancelTimer(handle).raw;
  351. }
  352. /// Sleep the current thread
  353. static void SleepThread(s64 nanoseconds) {
  354. LOG_TRACE(Kernel_SVC, "called nanoseconds=%lld", nanoseconds);
  355. // Sleep current thread and check for next thread to schedule
  356. Kernel::WaitCurrentThread(WAITTYPE_SLEEP);
  357. // Create an event to wake the thread up after the specified nanosecond delay has passed
  358. Kernel::WakeThreadAfterDelay(Kernel::GetCurrentThread(), nanoseconds);
  359. HLE::Reschedule(__func__);
  360. }
  361. /// This returns the total CPU ticks elapsed since the CPU was powered-on
  362. static s64 GetSystemTick() {
  363. return (s64)Core::g_app_core->GetTicks();
  364. }
  365. /// Creates a memory block at the specified address with the specified permissions and size
  366. static Result CreateMemoryBlock(Handle* memblock, u32 addr, u32 size, u32 my_permission,
  367. u32 other_permission) {
  368. // TODO(Subv): Implement this function
  369. Handle shared_memory = Kernel::CreateSharedMemory();
  370. *memblock = shared_memory;
  371. LOG_WARNING(Kernel_SVC, "(STUBBED) called addr=0x%08X", addr);
  372. return 0;
  373. }
  374. const HLE::FunctionDef SVC_Table[] = {
  375. {0x00, nullptr, "Unknown"},
  376. {0x01, HLE::Wrap<ControlMemory>, "ControlMemory"},
  377. {0x02, HLE::Wrap<QueryMemory>, "QueryMemory"},
  378. {0x03, nullptr, "ExitProcess"},
  379. {0x04, nullptr, "GetProcessAffinityMask"},
  380. {0x05, nullptr, "SetProcessAffinityMask"},
  381. {0x06, nullptr, "GetProcessIdealProcessor"},
  382. {0x07, nullptr, "SetProcessIdealProcessor"},
  383. {0x08, HLE::Wrap<CreateThread>, "CreateThread"},
  384. {0x09, ExitThread, "ExitThread"},
  385. {0x0A, HLE::Wrap<SleepThread>, "SleepThread"},
  386. {0x0B, HLE::Wrap<GetThreadPriority>, "GetThreadPriority"},
  387. {0x0C, HLE::Wrap<SetThreadPriority>, "SetThreadPriority"},
  388. {0x0D, nullptr, "GetThreadAffinityMask"},
  389. {0x0E, nullptr, "SetThreadAffinityMask"},
  390. {0x0F, nullptr, "GetThreadIdealProcessor"},
  391. {0x10, nullptr, "SetThreadIdealProcessor"},
  392. {0x11, nullptr, "GetCurrentProcessorNumber"},
  393. {0x12, nullptr, "Run"},
  394. {0x13, HLE::Wrap<CreateMutex>, "CreateMutex"},
  395. {0x14, HLE::Wrap<ReleaseMutex>, "ReleaseMutex"},
  396. {0x15, HLE::Wrap<CreateSemaphore>, "CreateSemaphore"},
  397. {0x16, HLE::Wrap<ReleaseSemaphore>, "ReleaseSemaphore"},
  398. {0x17, HLE::Wrap<CreateEvent>, "CreateEvent"},
  399. {0x18, HLE::Wrap<SignalEvent>, "SignalEvent"},
  400. {0x19, HLE::Wrap<ClearEvent>, "ClearEvent"},
  401. {0x1A, HLE::Wrap<CreateTimer>, "CreateTimer"},
  402. {0x1B, HLE::Wrap<SetTimer>, "SetTimer"},
  403. {0x1C, HLE::Wrap<CancelTimer>, "CancelTimer"},
  404. {0x1D, HLE::Wrap<ClearTimer>, "ClearTimer"},
  405. {0x1E, HLE::Wrap<CreateMemoryBlock>, "CreateMemoryBlock"},
  406. {0x1F, HLE::Wrap<MapMemoryBlock>, "MapMemoryBlock"},
  407. {0x20, nullptr, "UnmapMemoryBlock"},
  408. {0x21, HLE::Wrap<CreateAddressArbiter>, "CreateAddressArbiter"},
  409. {0x22, HLE::Wrap<ArbitrateAddress>, "ArbitrateAddress"},
  410. {0x23, HLE::Wrap<CloseHandle>, "CloseHandle"},
  411. {0x24, HLE::Wrap<WaitSynchronization1>, "WaitSynchronization1"},
  412. {0x25, HLE::Wrap<WaitSynchronizationN>, "WaitSynchronizationN"},
  413. {0x26, nullptr, "SignalAndWait"},
  414. {0x27, HLE::Wrap<DuplicateHandle>, "DuplicateHandle"},
  415. {0x28, HLE::Wrap<GetSystemTick>, "GetSystemTick"},
  416. {0x29, nullptr, "GetHandleInfo"},
  417. {0x2A, nullptr, "GetSystemInfo"},
  418. {0x2B, nullptr, "GetProcessInfo"},
  419. {0x2C, nullptr, "GetThreadInfo"},
  420. {0x2D, HLE::Wrap<ConnectToPort>, "ConnectToPort"},
  421. {0x2E, nullptr, "SendSyncRequest1"},
  422. {0x2F, nullptr, "SendSyncRequest2"},
  423. {0x30, nullptr, "SendSyncRequest3"},
  424. {0x31, nullptr, "SendSyncRequest4"},
  425. {0x32, HLE::Wrap<SendSyncRequest>, "SendSyncRequest"},
  426. {0x33, nullptr, "OpenProcess"},
  427. {0x34, nullptr, "OpenThread"},
  428. {0x35, nullptr, "GetProcessId"},
  429. {0x36, nullptr, "GetProcessIdOfThread"},
  430. {0x37, HLE::Wrap<GetThreadId>, "GetThreadId"},
  431. {0x38, HLE::Wrap<GetResourceLimit>, "GetResourceLimit"},
  432. {0x39, nullptr, "GetResourceLimitLimitValues"},
  433. {0x3A, HLE::Wrap<GetResourceLimitCurrentValues>, "GetResourceLimitCurrentValues"},
  434. {0x3B, nullptr, "GetThreadContext"},
  435. {0x3C, nullptr, "Break"},
  436. {0x3D, HLE::Wrap<OutputDebugString>, "OutputDebugString"},
  437. {0x3E, nullptr, "ControlPerformanceCounter"},
  438. {0x3F, nullptr, "Unknown"},
  439. {0x40, nullptr, "Unknown"},
  440. {0x41, nullptr, "Unknown"},
  441. {0x42, nullptr, "Unknown"},
  442. {0x43, nullptr, "Unknown"},
  443. {0x44, nullptr, "Unknown"},
  444. {0x45, nullptr, "Unknown"},
  445. {0x46, nullptr, "Unknown"},
  446. {0x47, nullptr, "CreatePort"},
  447. {0x48, nullptr, "CreateSessionToPort"},
  448. {0x49, nullptr, "CreateSession"},
  449. {0x4A, nullptr, "AcceptSession"},
  450. {0x4B, nullptr, "ReplyAndReceive1"},
  451. {0x4C, nullptr, "ReplyAndReceive2"},
  452. {0x4D, nullptr, "ReplyAndReceive3"},
  453. {0x4E, nullptr, "ReplyAndReceive4"},
  454. {0x4F, nullptr, "ReplyAndReceive"},
  455. {0x50, nullptr, "BindInterrupt"},
  456. {0x51, nullptr, "UnbindInterrupt"},
  457. {0x52, nullptr, "InvalidateProcessDataCache"},
  458. {0x53, nullptr, "StoreProcessDataCache"},
  459. {0x54, nullptr, "FlushProcessDataCache"},
  460. {0x55, nullptr, "StartInterProcessDma"},
  461. {0x56, nullptr, "StopDma"},
  462. {0x57, nullptr, "GetDmaState"},
  463. {0x58, nullptr, "RestartDma"},
  464. {0x59, nullptr, "Unknown"},
  465. {0x5A, nullptr, "Unknown"},
  466. {0x5B, nullptr, "Unknown"},
  467. {0x5C, nullptr, "Unknown"},
  468. {0x5D, nullptr, "Unknown"},
  469. {0x5E, nullptr, "Unknown"},
  470. {0x5F, nullptr, "Unknown"},
  471. {0x60, nullptr, "DebugActiveProcess"},
  472. {0x61, nullptr, "BreakDebugProcess"},
  473. {0x62, nullptr, "TerminateDebugProcess"},
  474. {0x63, nullptr, "GetProcessDebugEvent"},
  475. {0x64, nullptr, "ContinueDebugEvent"},
  476. {0x65, nullptr, "GetProcessList"},
  477. {0x66, nullptr, "GetThreadList"},
  478. {0x67, nullptr, "GetDebugThreadContext"},
  479. {0x68, nullptr, "SetDebugThreadContext"},
  480. {0x69, nullptr, "QueryDebugProcessMemory"},
  481. {0x6A, nullptr, "ReadProcessMemory"},
  482. {0x6B, nullptr, "WriteProcessMemory"},
  483. {0x6C, nullptr, "SetHardwareBreakPoint"},
  484. {0x6D, nullptr, "GetDebugThreadParam"},
  485. {0x6E, nullptr, "Unknown"},
  486. {0x6F, nullptr, "Unknown"},
  487. {0x70, nullptr, "ControlProcessMemory"},
  488. {0x71, nullptr, "MapProcessMemory"},
  489. {0x72, nullptr, "UnmapProcessMemory"},
  490. {0x73, nullptr, "Unknown"},
  491. {0x74, nullptr, "Unknown"},
  492. {0x75, nullptr, "Unknown"},
  493. {0x76, nullptr, "TerminateProcess"},
  494. {0x77, nullptr, "Unknown"},
  495. {0x78, nullptr, "CreateResourceLimit"},
  496. {0x79, nullptr, "Unknown"},
  497. {0x7A, nullptr, "Unknown"},
  498. {0x7B, nullptr, "Unknown"},
  499. {0x7C, nullptr, "KernelSetState"},
  500. {0x7D, nullptr, "QueryProcessMemory"},
  501. };
  502. void Register() {
  503. HLE::RegisterModule("SVC_Table", ARRAY_SIZE(SVC_Table), SVC_Table);
  504. }
  505. } // namespace