summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel
diff options
context:
space:
mode:
authorGravatar bunnei2020-03-02 00:06:41 -0500
committerGravatar bunnei2020-03-02 21:52:03 -0500
commitdba112e51059f5e6107d02a0eb00513887d3b089 (patch)
tree774f7d1db56e1c3dbc767d50e6edcb1e89095144 /src/core/hle/kernel
parentcore: Implement separate A32/A64 ARM interfaces. (diff)
downloadyuzu-dba112e51059f5e6107d02a0eb00513887d3b089.tar.gz
yuzu-dba112e51059f5e6107d02a0eb00513887d3b089.tar.xz
yuzu-dba112e51059f5e6107d02a0eb00513887d3b089.zip
core: hle: Implement separate A32/A64 SVC interfaces.
Diffstat (limited to 'src/core/hle/kernel')
-rw-r--r--src/core/hle/kernel/svc.cpp329
-rw-r--r--src/core/hle/kernel/svc_wrap.h158
2 files changed, 380 insertions, 107 deletions
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp
index fd91779a3..4ffc113c2 100644
--- a/src/core/hle/kernel/svc.cpp
+++ b/src/core/hle/kernel/svc.cpp
@@ -187,6 +187,13 @@ static ResultCode SetHeapSize(Core::System& system, VAddr* heap_addr, u64 heap_s
187 return RESULT_SUCCESS; 187 return RESULT_SUCCESS;
188} 188}
189 189
190static ResultCode SetHeapSize32(Core::System& system, u32* heap_addr, u32 heap_size) {
191 VAddr temp_heap_addr{};
192 const ResultCode result{SetHeapSize(system, &temp_heap_addr, heap_size)};
193 *heap_addr = static_cast<u32>(temp_heap_addr);
194 return result;
195}
196
190static ResultCode SetMemoryPermission(Core::System& system, VAddr addr, u64 size, u32 prot) { 197static ResultCode SetMemoryPermission(Core::System& system, VAddr addr, u64 size, u32 prot) {
191 LOG_TRACE(Kernel_SVC, "called, addr=0x{:X}, size=0x{:X}, prot=0x{:X}", addr, size, prot); 198 LOG_TRACE(Kernel_SVC, "called, addr=0x{:X}, size=0x{:X}, prot=0x{:X}", addr, size, prot);
192 199
@@ -371,6 +378,12 @@ static ResultCode ConnectToNamedPort(Core::System& system, Handle* out_handle,
371 return RESULT_SUCCESS; 378 return RESULT_SUCCESS;
372} 379}
373 380
381static ResultCode ConnectToNamedPort32(Core::System& system, Handle* out_handle,
382 u32 port_name_address) {
383
384 return ConnectToNamedPort(system, out_handle, port_name_address);
385}
386
374/// Makes a blocking IPC call to an OS service. 387/// Makes a blocking IPC call to an OS service.
375static ResultCode SendSyncRequest(Core::System& system, Handle handle) { 388static ResultCode SendSyncRequest(Core::System& system, Handle handle) {
376 const auto& handle_table = system.Kernel().CurrentProcess()->GetHandleTable(); 389 const auto& handle_table = system.Kernel().CurrentProcess()->GetHandleTable();
@@ -390,6 +403,10 @@ static ResultCode SendSyncRequest(Core::System& system, Handle handle) {
390 return session->SendSyncRequest(SharedFrom(thread), system.Memory()); 403 return session->SendSyncRequest(SharedFrom(thread), system.Memory());
391} 404}
392 405
406static ResultCode SendSyncRequest32(Core::System& system, Handle handle) {
407 return SendSyncRequest(system, handle);
408}
409
393/// Get the ID for the specified thread. 410/// Get the ID for the specified thread.
394static ResultCode GetThreadId(Core::System& system, u64* thread_id, Handle thread_handle) { 411static ResultCode GetThreadId(Core::System& system, u64* thread_id, Handle thread_handle) {
395 LOG_TRACE(Kernel_SVC, "called thread=0x{:08X}", thread_handle); 412 LOG_TRACE(Kernel_SVC, "called thread=0x{:08X}", thread_handle);
@@ -405,6 +422,17 @@ static ResultCode GetThreadId(Core::System& system, u64* thread_id, Handle threa
405 return RESULT_SUCCESS; 422 return RESULT_SUCCESS;
406} 423}
407 424
425static ResultCode GetThreadId32(Core::System& system, u32* thread_id_low, u32* thread_id_high,
426 Handle thread_handle) {
427 u64 thread_id{};
428 const ResultCode result{GetThreadId(system, &thread_id, thread_handle)};
429
430 *thread_id_low = static_cast<u32>(thread_id >> 32);
431 *thread_id_high = static_cast<u32>(thread_id & std::numeric_limits<u32>::max());
432
433 return result;
434}
435
408/// Gets the ID of the specified process or a specified thread's owning process. 436/// Gets the ID of the specified process or a specified thread's owning process.
409static ResultCode GetProcessId(Core::System& system, u64* process_id, Handle handle) { 437static ResultCode GetProcessId(Core::System& system, u64* process_id, Handle handle) {
410 LOG_DEBUG(Kernel_SVC, "called handle=0x{:08X}", handle); 438 LOG_DEBUG(Kernel_SVC, "called handle=0x{:08X}", handle);
@@ -479,6 +507,12 @@ static ResultCode WaitSynchronization(Core::System& system, Handle* index, VAddr
479 return result; 507 return result;
480} 508}
481 509
510static ResultCode WaitSynchronization32(Core::System& system, u32 timeout_low, u32 handles_address,
511 s32 handle_count, u32 timeout_high, Handle* index) {
512 const s64 nano_seconds{(static_cast<s64>(timeout_high) << 32) | static_cast<s64>(timeout_low)};
513 return WaitSynchronization(system, index, handles_address, handle_count, nano_seconds);
514}
515
482/// Resumes a thread waiting on WaitSynchronization 516/// Resumes a thread waiting on WaitSynchronization
483static ResultCode CancelSynchronization(Core::System& system, Handle thread_handle) { 517static ResultCode CancelSynchronization(Core::System& system, Handle thread_handle) {
484 LOG_TRACE(Kernel_SVC, "called thread=0x{:X}", thread_handle); 518 LOG_TRACE(Kernel_SVC, "called thread=0x{:X}", thread_handle);
@@ -917,6 +951,18 @@ static ResultCode GetInfo(Core::System& system, u64* result, u64 info_id, u64 ha
917 } 951 }
918} 952}
919 953
954static ResultCode GetInfo32(Core::System& system, u32* result_low, u32* result_high, u32 sub_id_low,
955 u32 info_id, u32 handle, u32 sub_id_high) {
956 const u64 sub_id{static_cast<u64>(sub_id_low | (static_cast<u64>(sub_id_high) << 32))};
957 u64 res_value{};
958
959 const ResultCode result{GetInfo(system, &res_value, info_id, handle, sub_id)};
960 *result_high = static_cast<u32>(res_value >> 32);
961 *result_low = static_cast<u32>(res_value & std::numeric_limits<u32>::max());
962
963 return result;
964}
965
920/// Maps memory at a desired address 966/// Maps memory at a desired address
921static ResultCode MapPhysicalMemory(Core::System& system, VAddr addr, u64 size) { 967static ResultCode MapPhysicalMemory(Core::System& system, VAddr addr, u64 size) {
922 LOG_DEBUG(Kernel_SVC, "called, addr=0x{:016X}, size=0x{:X}", addr, size); 968 LOG_DEBUG(Kernel_SVC, "called, addr=0x{:016X}, size=0x{:X}", addr, size);
@@ -1058,7 +1104,7 @@ static ResultCode GetThreadContext(Core::System& system, VAddr thread_context, H
1058 return ERR_BUSY; 1104 return ERR_BUSY;
1059 } 1105 }
1060 1106
1061 Core::ARM_Interface::ThreadContext ctx = thread->GetContext(); 1107 Core::ARM_Interface::ThreadContext64 ctx = thread->GetContext64();
1062 // Mask away mode bits, interrupt bits, IL bit, and other reserved bits. 1108 // Mask away mode bits, interrupt bits, IL bit, and other reserved bits.
1063 ctx.pstate &= 0xFF0FFE20; 1109 ctx.pstate &= 0xFF0FFE20;
1064 1110
@@ -1088,6 +1134,10 @@ static ResultCode GetThreadPriority(Core::System& system, u32* priority, Handle
1088 return RESULT_SUCCESS; 1134 return RESULT_SUCCESS;
1089} 1135}
1090 1136
1137static ResultCode GetThreadPriority32(Core::System& system, u32* priority, Handle handle) {
1138 return GetThreadPriority(system, priority, handle);
1139}
1140
1091/// Sets the priority for the specified thread 1141/// Sets the priority for the specified thread
1092static ResultCode SetThreadPriority(Core::System& system, Handle handle, u32 priority) { 1142static ResultCode SetThreadPriority(Core::System& system, Handle handle, u32 priority) {
1093 LOG_TRACE(Kernel_SVC, "called"); 1143 LOG_TRACE(Kernel_SVC, "called");
@@ -1259,6 +1309,11 @@ static ResultCode QueryMemory(Core::System& system, VAddr memory_info_address,
1259 query_address); 1309 query_address);
1260} 1310}
1261 1311
1312static ResultCode QueryMemory32(Core::System& system, u32 memory_info_address,
1313 u32 page_info_address, u32 query_address) {
1314 return QueryMemory(system, memory_info_address, page_info_address, query_address);
1315}
1316
1262static ResultCode MapProcessCodeMemory(Core::System& system, Handle process_handle, u64 dst_address, 1317static ResultCode MapProcessCodeMemory(Core::System& system, Handle process_handle, u64 dst_address,
1263 u64 src_address, u64 size) { 1318 u64 src_address, u64 size) {
1264 LOG_DEBUG(Kernel_SVC, 1319 LOG_DEBUG(Kernel_SVC,
@@ -1675,6 +1730,10 @@ static void SignalProcessWideKey(Core::System& system, VAddr condition_variable_
1675 } 1730 }
1676} 1731}
1677 1732
1733static void SignalProcessWideKey32(Core::System& system, u32 condition_variable_addr, s32 target) {
1734 SignalProcessWideKey(system, condition_variable_addr, target);
1735}
1736
1678// Wait for an address (via Address Arbiter) 1737// Wait for an address (via Address Arbiter)
1679static ResultCode WaitForAddress(Core::System& system, VAddr address, u32 type, s32 value, 1738static ResultCode WaitForAddress(Core::System& system, VAddr address, u32 type, s32 value,
1680 s64 timeout) { 1739 s64 timeout) {
@@ -1760,6 +1819,10 @@ static ResultCode CloseHandle(Core::System& system, Handle handle) {
1760 return handle_table.Close(handle); 1819 return handle_table.Close(handle);
1761} 1820}
1762 1821
1822static ResultCode CloseHandle32(Core::System& system, Handle handle) {
1823 return CloseHandle(system, handle);
1824}
1825
1763/// Clears the signaled state of an event or process. 1826/// Clears the signaled state of an event or process.
1764static ResultCode ResetSignal(Core::System& system, Handle handle) { 1827static ResultCode ResetSignal(Core::System& system, Handle handle) {
1765 LOG_DEBUG(Kernel_SVC, "called handle 0x{:08X}", handle); 1828 LOG_DEBUG(Kernel_SVC, "called handle 0x{:08X}", handle);
@@ -2317,69 +2380,196 @@ struct FunctionDef {
2317}; 2380};
2318} // namespace 2381} // namespace
2319 2382
2320static const FunctionDef SVC_Table[] = { 2383static const FunctionDef SVC_Table_32[] = {
2321 {0x00, nullptr, "Unknown"}, 2384 {0x00, nullptr, "Unknown"},
2322 {0x01, SvcWrap<SetHeapSize>, "SetHeapSize"}, 2385 {0x01, SvcWrap32<SetHeapSize32>, "SetHeapSize32"},
2323 {0x02, SvcWrap<SetMemoryPermission>, "SetMemoryPermission"}, 2386 {0x02, nullptr, "Unknown"},
2324 {0x03, SvcWrap<SetMemoryAttribute>, "SetMemoryAttribute"}, 2387 {0x03, nullptr, "SetMemoryAttribute32"},
2325 {0x04, SvcWrap<MapMemory>, "MapMemory"}, 2388 {0x04, nullptr, "MapMemory32"},
2326 {0x05, SvcWrap<UnmapMemory>, "UnmapMemory"}, 2389 {0x05, nullptr, "UnmapMemory32"},
2327 {0x06, SvcWrap<QueryMemory>, "QueryMemory"}, 2390 {0x06, SvcWrap32<QueryMemory32>, "QueryMemory32"},
2328 {0x07, SvcWrap<ExitProcess>, "ExitProcess"}, 2391 {0x07, nullptr, "ExitProcess32"},
2329 {0x08, SvcWrap<CreateThread>, "CreateThread"}, 2392 {0x08, nullptr, "CreateThread32"},
2330 {0x09, SvcWrap<StartThread>, "StartThread"}, 2393 {0x09, nullptr, "StartThread32"},
2331 {0x0A, SvcWrap<ExitThread>, "ExitThread"}, 2394 {0x0a, nullptr, "ExitThread32"},
2332 {0x0B, SvcWrap<SleepThread>, "SleepThread"}, 2395 {0x0b, nullptr, "SleepThread32"},
2333 {0x0C, SvcWrap<GetThreadPriority>, "GetThreadPriority"}, 2396 {0x0c, SvcWrap32<GetThreadPriority32>, "GetThreadPriority32"},
2334 {0x0D, SvcWrap<SetThreadPriority>, "SetThreadPriority"}, 2397 {0x0d, nullptr, "SetThreadPriority32"},
2335 {0x0E, SvcWrap<GetThreadCoreMask>, "GetThreadCoreMask"}, 2398 {0x0e, nullptr, "GetThreadCoreMask32"},
2336 {0x0F, SvcWrap<SetThreadCoreMask>, "SetThreadCoreMask"}, 2399 {0x0f, nullptr, "SetThreadCoreMask32"},
2337 {0x10, SvcWrap<GetCurrentProcessorNumber>, "GetCurrentProcessorNumber"}, 2400 {0x10, nullptr, "GetCurrentProcessorNumber32"},
2338 {0x11, SvcWrap<SignalEvent>, "SignalEvent"}, 2401 {0x11, nullptr, "SignalEvent32"},
2339 {0x12, SvcWrap<ClearEvent>, "ClearEvent"}, 2402 {0x12, nullptr, "ClearEvent32"},
2340 {0x13, SvcWrap<MapSharedMemory>, "MapSharedMemory"}, 2403 {0x13, nullptr, "MapSharedMemory32"},
2341 {0x14, SvcWrap<UnmapSharedMemory>, "UnmapSharedMemory"}, 2404 {0x14, nullptr, "UnmapSharedMemory32"},
2342 {0x15, SvcWrap<CreateTransferMemory>, "CreateTransferMemory"}, 2405 {0x15, nullptr, "CreateTransferMemory32"},
2343 {0x16, SvcWrap<CloseHandle>, "CloseHandle"}, 2406 {0x16, SvcWrap32<CloseHandle32>, "CloseHandle32"},
2344 {0x17, SvcWrap<ResetSignal>, "ResetSignal"}, 2407 {0x17, nullptr, "ResetSignal32"},
2345 {0x18, SvcWrap<WaitSynchronization>, "WaitSynchronization"}, 2408 {0x18, SvcWrap32<WaitSynchronization32>, "WaitSynchronization32"},
2346 {0x19, SvcWrap<CancelSynchronization>, "CancelSynchronization"}, 2409 {0x19, nullptr, "CancelSynchronization32"},
2347 {0x1A, SvcWrap<ArbitrateLock>, "ArbitrateLock"}, 2410 {0x1a, nullptr, "ArbitrateLock32"},
2348 {0x1B, SvcWrap<ArbitrateUnlock>, "ArbitrateUnlock"}, 2411 {0x1b, nullptr, "ArbitrateUnlock32"},
2349 {0x1C, SvcWrap<WaitProcessWideKeyAtomic>, "WaitProcessWideKeyAtomic"}, 2412 {0x1c, nullptr, "WaitProcessWideKeyAtomic32"},
2350 {0x1D, SvcWrap<SignalProcessWideKey>, "SignalProcessWideKey"}, 2413 {0x1d, SvcWrap32<SignalProcessWideKey32>, "SignalProcessWideKey32"},
2351 {0x1E, SvcWrap<GetSystemTick>, "GetSystemTick"}, 2414 {0x1e, nullptr, "GetSystemTick32"},
2352 {0x1F, SvcWrap<ConnectToNamedPort>, "ConnectToNamedPort"}, 2415 {0x1f, SvcWrap32<ConnectToNamedPort32>, "ConnectToNamedPort32"},
2416 {0x20, nullptr, "Unknown"},
2417 {0x21, SvcWrap32<SendSyncRequest32>, "SendSyncRequest32"},
2418 {0x22, nullptr, "SendSyncRequestWithUserBuffer32"},
2419 {0x23, nullptr, "Unknown"},
2420 {0x24, nullptr, "GetProcessId32"},
2421 {0x25, SvcWrap32<GetThreadId32>, "GetThreadId32"},
2422 {0x26, nullptr, "Break32"},
2423 {0x27, nullptr, "OutputDebugString32"},
2424 {0x28, nullptr, "Unknown"},
2425 {0x29, SvcWrap32<GetInfo32>, "GetInfo32"},
2426 {0x2a, nullptr, "Unknown"},
2427 {0x2b, nullptr, "Unknown"},
2428 {0x2c, nullptr, "MapPhysicalMemory32"},
2429 {0x2d, nullptr, "UnmapPhysicalMemory32"},
2430 {0x2e, nullptr, "Unknown"},
2431 {0x2f, nullptr, "Unknown"},
2432 {0x30, nullptr, "Unknown"},
2433 {0x31, nullptr, "Unknown"},
2434 {0x32, nullptr, "SetThreadActivity32"},
2435 {0x33, nullptr, "GetThreadContext32"},
2436 {0x34, nullptr, "WaitForAddress32"},
2437 {0x35, nullptr, "SignalToAddress32"},
2438 {0x36, nullptr, "Unknown"},
2439 {0x37, nullptr, "Unknown"},
2440 {0x38, nullptr, "Unknown"},
2441 {0x39, nullptr, "Unknown"},
2442 {0x3a, nullptr, "Unknown"},
2443 {0x3b, nullptr, "Unknown"},
2444 {0x3c, nullptr, "Unknown"},
2445 {0x3d, nullptr, "Unknown"},
2446 {0x3e, nullptr, "Unknown"},
2447 {0x3f, nullptr, "Unknown"},
2448 {0x40, nullptr, "CreateSession32"},
2449 {0x41, nullptr, "AcceptSession32"},
2450 {0x42, nullptr, "Unknown"},
2451 {0x43, nullptr, "ReplyAndReceive32"},
2452 {0x44, nullptr, "Unknown"},
2453 {0x45, nullptr, "CreateEvent32"},
2454 {0x46, nullptr, "Unknown"},
2455 {0x47, nullptr, "Unknown"},
2456 {0x48, nullptr, "Unknown"},
2457 {0x49, nullptr, "Unknown"},
2458 {0x4a, nullptr, "Unknown"},
2459 {0x4b, nullptr, "Unknown"},
2460 {0x4c, nullptr, "Unknown"},
2461 {0x4d, nullptr, "Unknown"},
2462 {0x4e, nullptr, "Unknown"},
2463 {0x4f, nullptr, "Unknown"},
2464 {0x50, nullptr, "Unknown"},
2465 {0x51, nullptr, "Unknown"},
2466 {0x52, nullptr, "Unknown"},
2467 {0x53, nullptr, "Unknown"},
2468 {0x54, nullptr, "Unknown"},
2469 {0x55, nullptr, "Unknown"},
2470 {0x56, nullptr, "Unknown"},
2471 {0x57, nullptr, "Unknown"},
2472 {0x58, nullptr, "Unknown"},
2473 {0x59, nullptr, "Unknown"},
2474 {0x5a, nullptr, "Unknown"},
2475 {0x5b, nullptr, "Unknown"},
2476 {0x5c, nullptr, "Unknown"},
2477 {0x5d, nullptr, "Unknown"},
2478 {0x5e, nullptr, "Unknown"},
2479 {0x5F, nullptr, "FlushProcessDataCache32"},
2480 {0x60, nullptr, "Unknown"},
2481 {0x61, nullptr, "Unknown"},
2482 {0x62, nullptr, "Unknown"},
2483 {0x63, nullptr, "Unknown"},
2484 {0x64, nullptr, "Unknown"},
2485 {0x65, nullptr, "GetProcessList32"},
2486 {0x66, nullptr, "Unknown"},
2487 {0x67, nullptr, "Unknown"},
2488 {0x68, nullptr, "Unknown"},
2489 {0x69, nullptr, "Unknown"},
2490 {0x6A, nullptr, "Unknown"},
2491 {0x6B, nullptr, "Unknown"},
2492 {0x6C, nullptr, "Unknown"},
2493 {0x6D, nullptr, "Unknown"},
2494 {0x6E, nullptr, "Unknown"},
2495 {0x6f, nullptr, "GetSystemInfo32"},
2496 {0x70, nullptr, "CreatePort32"},
2497 {0x71, nullptr, "ManageNamedPort32"},
2498 {0x72, nullptr, "ConnectToPort32"},
2499 {0x73, nullptr, "SetProcessMemoryPermission32"},
2500 {0x74, nullptr, "Unknown"},
2501 {0x75, nullptr, "Unknown"},
2502 {0x76, nullptr, "Unknown"},
2503 {0x77, nullptr, "MapProcessCodeMemory32"},
2504 {0x78, nullptr, "UnmapProcessCodeMemory32"},
2505 {0x79, nullptr, "Unknown"},
2506 {0x7A, nullptr, "Unknown"},
2507 {0x7B, nullptr, "TerminateProcess32"},
2508};
2509
2510static const FunctionDef SVC_Table_64[] = {
2511 {0x00, nullptr, "Unknown"},
2512 {0x01, SvcWrap64<SetHeapSize>, "SetHeapSize"},
2513 {0x02, SvcWrap64<SetMemoryPermission>, "SetMemoryPermission"},
2514 {0x03, SvcWrap64<SetMemoryAttribute>, "SetMemoryAttribute"},
2515 {0x04, SvcWrap64<MapMemory>, "MapMemory"},
2516 {0x05, SvcWrap64<UnmapMemory>, "UnmapMemory"},
2517 {0x06, SvcWrap64<QueryMemory>, "QueryMemory"},
2518 {0x07, SvcWrap64<ExitProcess>, "ExitProcess"},
2519 {0x08, SvcWrap64<CreateThread>, "CreateThread"},
2520 {0x09, SvcWrap64<StartThread>, "StartThread"},
2521 {0x0A, SvcWrap64<ExitThread>, "ExitThread"},
2522 {0x0B, SvcWrap64<SleepThread>, "SleepThread"},
2523 {0x0C, SvcWrap64<GetThreadPriority>, "GetThreadPriority"},
2524 {0x0D, SvcWrap64<SetThreadPriority>, "SetThreadPriority"},
2525 {0x0E, SvcWrap64<GetThreadCoreMask>, "GetThreadCoreMask"},
2526 {0x0F, SvcWrap64<SetThreadCoreMask>, "SetThreadCoreMask"},
2527 {0x10, SvcWrap64<GetCurrentProcessorNumber>, "GetCurrentProcessorNumber"},
2528 {0x11, SvcWrap64<SignalEvent>, "SignalEvent"},
2529 {0x12, SvcWrap64<ClearEvent>, "ClearEvent"},
2530 {0x13, SvcWrap64<MapSharedMemory>, "MapSharedMemory"},
2531 {0x14, SvcWrap64<UnmapSharedMemory>, "UnmapSharedMemory"},
2532 {0x15, SvcWrap64<CreateTransferMemory>, "CreateTransferMemory"},
2533 {0x16, SvcWrap64<CloseHandle>, "CloseHandle"},
2534 {0x17, SvcWrap64<ResetSignal>, "ResetSignal"},
2535 {0x18, SvcWrap64<WaitSynchronization>, "WaitSynchronization"},
2536 {0x19, SvcWrap64<CancelSynchronization>, "CancelSynchronization"},
2537 {0x1A, SvcWrap64<ArbitrateLock>, "ArbitrateLock"},
2538 {0x1B, SvcWrap64<ArbitrateUnlock>, "ArbitrateUnlock"},
2539 {0x1C, SvcWrap64<WaitProcessWideKeyAtomic>, "WaitProcessWideKeyAtomic"},
2540 {0x1D, SvcWrap64<SignalProcessWideKey>, "SignalProcessWideKey"},
2541 {0x1E, SvcWrap64<GetSystemTick>, "GetSystemTick"},
2542 {0x1F, SvcWrap64<ConnectToNamedPort>, "ConnectToNamedPort"},
2353 {0x20, nullptr, "SendSyncRequestLight"}, 2543 {0x20, nullptr, "SendSyncRequestLight"},
2354 {0x21, SvcWrap<SendSyncRequest>, "SendSyncRequest"}, 2544 {0x21, SvcWrap64<SendSyncRequest>, "SendSyncRequest"},
2355 {0x22, nullptr, "SendSyncRequestWithUserBuffer"}, 2545 {0x22, nullptr, "SendSyncRequestWithUserBuffer"},
2356 {0x23, nullptr, "SendAsyncRequestWithUserBuffer"}, 2546 {0x23, nullptr, "SendAsyncRequestWithUserBuffer"},
2357 {0x24, SvcWrap<GetProcessId>, "GetProcessId"}, 2547 {0x24, SvcWrap64<GetProcessId>, "GetProcessId"},
2358 {0x25, SvcWrap<GetThreadId>, "GetThreadId"}, 2548 {0x25, SvcWrap64<GetThreadId>, "GetThreadId"},
2359 {0x26, SvcWrap<Break>, "Break"}, 2549 {0x26, SvcWrap64<Break>, "Break"},
2360 {0x27, SvcWrap<OutputDebugString>, "OutputDebugString"}, 2550 {0x27, SvcWrap64<OutputDebugString>, "OutputDebugString"},
2361 {0x28, nullptr, "ReturnFromException"}, 2551 {0x28, nullptr, "ReturnFromException"},
2362 {0x29, SvcWrap<GetInfo>, "GetInfo"}, 2552 {0x29, SvcWrap64<GetInfo>, "GetInfo"},
2363 {0x2A, nullptr, "FlushEntireDataCache"}, 2553 {0x2A, nullptr, "FlushEntireDataCache"},
2364 {0x2B, nullptr, "FlushDataCache"}, 2554 {0x2B, nullptr, "FlushDataCache"},
2365 {0x2C, SvcWrap<MapPhysicalMemory>, "MapPhysicalMemory"}, 2555 {0x2C, SvcWrap64<MapPhysicalMemory>, "MapPhysicalMemory"},
2366 {0x2D, SvcWrap<UnmapPhysicalMemory>, "UnmapPhysicalMemory"}, 2556 {0x2D, SvcWrap64<UnmapPhysicalMemory>, "UnmapPhysicalMemory"},
2367 {0x2E, nullptr, "GetFutureThreadInfo"}, 2557 {0x2E, nullptr, "GetFutureThreadInfo"},
2368 {0x2F, nullptr, "GetLastThreadInfo"}, 2558 {0x2F, nullptr, "GetLastThreadInfo"},
2369 {0x30, SvcWrap<GetResourceLimitLimitValue>, "GetResourceLimitLimitValue"}, 2559 {0x30, SvcWrap64<GetResourceLimitLimitValue>, "GetResourceLimitLimitValue"},
2370 {0x31, SvcWrap<GetResourceLimitCurrentValue>, "GetResourceLimitCurrentValue"}, 2560 {0x31, SvcWrap64<GetResourceLimitCurrentValue>, "GetResourceLimitCurrentValue"},
2371 {0x32, SvcWrap<SetThreadActivity>, "SetThreadActivity"}, 2561 {0x32, SvcWrap64<SetThreadActivity>, "SetThreadActivity"},
2372 {0x33, SvcWrap<GetThreadContext>, "GetThreadContext"}, 2562 {0x33, SvcWrap64<GetThreadContext>, "GetThreadContext"},
2373 {0x34, SvcWrap<WaitForAddress>, "WaitForAddress"}, 2563 {0x34, SvcWrap64<WaitForAddress>, "WaitForAddress"},
2374 {0x35, SvcWrap<SignalToAddress>, "SignalToAddress"}, 2564 {0x35, SvcWrap64<SignalToAddress>, "SignalToAddress"},
2375 {0x36, nullptr, "SynchronizePreemptionState"}, 2565 {0x36, nullptr, "SynchronizePreemptionState"},
2376 {0x37, nullptr, "Unknown"}, 2566 {0x37, nullptr, "Unknown"},
2377 {0x38, nullptr, "Unknown"}, 2567 {0x38, nullptr, "Unknown"},
2378 {0x39, nullptr, "Unknown"}, 2568 {0x39, nullptr, "Unknown"},
2379 {0x3A, nullptr, "Unknown"}, 2569 {0x3A, nullptr, "Unknown"},
2380 {0x3B, nullptr, "Unknown"}, 2570 {0x3B, nullptr, "Unknown"},
2381 {0x3C, SvcWrap<KernelDebug>, "KernelDebug"}, 2571 {0x3C, SvcWrap64<KernelDebug>, "KernelDebug"},
2382 {0x3D, SvcWrap<ChangeKernelTraceState>, "ChangeKernelTraceState"}, 2572 {0x3D, SvcWrap64<ChangeKernelTraceState>, "ChangeKernelTraceState"},
2383 {0x3E, nullptr, "Unknown"}, 2573 {0x3E, nullptr, "Unknown"},
2384 {0x3F, nullptr, "Unknown"}, 2574 {0x3F, nullptr, "Unknown"},
2385 {0x40, nullptr, "CreateSession"}, 2575 {0x40, nullptr, "CreateSession"},
@@ -2387,7 +2577,7 @@ static const FunctionDef SVC_Table[] = {
2387 {0x42, nullptr, "ReplyAndReceiveLight"}, 2577 {0x42, nullptr, "ReplyAndReceiveLight"},
2388 {0x43, nullptr, "ReplyAndReceive"}, 2578 {0x43, nullptr, "ReplyAndReceive"},
2389 {0x44, nullptr, "ReplyAndReceiveWithUserBuffer"}, 2579 {0x44, nullptr, "ReplyAndReceiveWithUserBuffer"},
2390 {0x45, SvcWrap<CreateEvent>, "CreateEvent"}, 2580 {0x45, SvcWrap64<CreateEvent>, "CreateEvent"},
2391 {0x46, nullptr, "Unknown"}, 2581 {0x46, nullptr, "Unknown"},
2392 {0x47, nullptr, "Unknown"}, 2582 {0x47, nullptr, "Unknown"},
2393 {0x48, nullptr, "MapPhysicalMemoryUnsafe"}, 2583 {0x48, nullptr, "MapPhysicalMemoryUnsafe"},
@@ -2398,9 +2588,9 @@ static const FunctionDef SVC_Table[] = {
2398 {0x4D, nullptr, "SleepSystem"}, 2588 {0x4D, nullptr, "SleepSystem"},
2399 {0x4E, nullptr, "ReadWriteRegister"}, 2589 {0x4E, nullptr, "ReadWriteRegister"},
2400 {0x4F, nullptr, "SetProcessActivity"}, 2590 {0x4F, nullptr, "SetProcessActivity"},
2401 {0x50, SvcWrap<CreateSharedMemory>, "CreateSharedMemory"}, 2591 {0x50, SvcWrap64<CreateSharedMemory>, "CreateSharedMemory"},
2402 {0x51, SvcWrap<MapTransferMemory>, "MapTransferMemory"}, 2592 {0x51, SvcWrap64<MapTransferMemory>, "MapTransferMemory"},
2403 {0x52, SvcWrap<UnmapTransferMemory>, "UnmapTransferMemory"}, 2593 {0x52, SvcWrap64<UnmapTransferMemory>, "UnmapTransferMemory"},
2404 {0x53, nullptr, "CreateInterruptEvent"}, 2594 {0x53, nullptr, "CreateInterruptEvent"},
2405 {0x54, nullptr, "QueryPhysicalAddress"}, 2595 {0x54, nullptr, "QueryPhysicalAddress"},
2406 {0x55, nullptr, "QueryIoMapping"}, 2596 {0x55, nullptr, "QueryIoMapping"},
@@ -2419,8 +2609,8 @@ static const FunctionDef SVC_Table[] = {
2419 {0x62, nullptr, "TerminateDebugProcess"}, 2609 {0x62, nullptr, "TerminateDebugProcess"},
2420 {0x63, nullptr, "GetDebugEvent"}, 2610 {0x63, nullptr, "GetDebugEvent"},
2421 {0x64, nullptr, "ContinueDebugEvent"}, 2611 {0x64, nullptr, "ContinueDebugEvent"},
2422 {0x65, SvcWrap<GetProcessList>, "GetProcessList"}, 2612 {0x65, SvcWrap64<GetProcessList>, "GetProcessList"},
2423 {0x66, SvcWrap<GetThreadList>, "GetThreadList"}, 2613 {0x66, SvcWrap64<GetThreadList>, "GetThreadList"},
2424 {0x67, nullptr, "GetDebugThreadContext"}, 2614 {0x67, nullptr, "GetDebugThreadContext"},
2425 {0x68, nullptr, "SetDebugThreadContext"}, 2615 {0x68, nullptr, "SetDebugThreadContext"},
2426 {0x69, nullptr, "QueryDebugProcessMemory"}, 2616 {0x69, nullptr, "QueryDebugProcessMemory"},
@@ -2436,24 +2626,32 @@ static const FunctionDef SVC_Table[] = {
2436 {0x73, nullptr, "SetProcessMemoryPermission"}, 2626 {0x73, nullptr, "SetProcessMemoryPermission"},
2437 {0x74, nullptr, "MapProcessMemory"}, 2627 {0x74, nullptr, "MapProcessMemory"},
2438 {0x75, nullptr, "UnmapProcessMemory"}, 2628 {0x75, nullptr, "UnmapProcessMemory"},
2439 {0x76, SvcWrap<QueryProcessMemory>, "QueryProcessMemory"}, 2629 {0x76, SvcWrap64<QueryProcessMemory>, "QueryProcessMemory"},
2440 {0x77, SvcWrap<MapProcessCodeMemory>, "MapProcessCodeMemory"}, 2630 {0x77, SvcWrap64<MapProcessCodeMemory>, "MapProcessCodeMemory"},
2441 {0x78, SvcWrap<UnmapProcessCodeMemory>, "UnmapProcessCodeMemory"}, 2631 {0x78, SvcWrap64<UnmapProcessCodeMemory>, "UnmapProcessCodeMemory"},
2442 {0x79, nullptr, "CreateProcess"}, 2632 {0x79, nullptr, "CreateProcess"},
2443 {0x7A, nullptr, "StartProcess"}, 2633 {0x7A, nullptr, "StartProcess"},
2444 {0x7B, nullptr, "TerminateProcess"}, 2634 {0x7B, nullptr, "TerminateProcess"},
2445 {0x7C, SvcWrap<GetProcessInfo>, "GetProcessInfo"}, 2635 {0x7C, SvcWrap64<GetProcessInfo>, "GetProcessInfo"},
2446 {0x7D, SvcWrap<CreateResourceLimit>, "CreateResourceLimit"}, 2636 {0x7D, SvcWrap64<CreateResourceLimit>, "CreateResourceLimit"},
2447 {0x7E, SvcWrap<SetResourceLimitLimitValue>, "SetResourceLimitLimitValue"}, 2637 {0x7E, SvcWrap64<SetResourceLimitLimitValue>, "SetResourceLimitLimitValue"},
2448 {0x7F, nullptr, "CallSecureMonitor"}, 2638 {0x7F, nullptr, "CallSecureMonitor"},
2449}; 2639};
2450 2640
2451static const FunctionDef* GetSVCInfo(u32 func_num) { 2641static const FunctionDef* GetSVCInfo32(u32 func_num) {
2452 if (func_num >= std::size(SVC_Table)) { 2642 if (func_num >= std::size(SVC_Table_32)) {
2643 LOG_ERROR(Kernel_SVC, "Unknown svc=0x{:02X}", func_num);
2644 return nullptr;
2645 }
2646 return &SVC_Table_32[func_num];
2647}
2648
2649static const FunctionDef* GetSVCInfo64(u32 func_num) {
2650 if (func_num >= std::size(SVC_Table_64)) {
2453 LOG_ERROR(Kernel_SVC, "Unknown svc=0x{:02X}", func_num); 2651 LOG_ERROR(Kernel_SVC, "Unknown svc=0x{:02X}", func_num);
2454 return nullptr; 2652 return nullptr;
2455 } 2653 }
2456 return &SVC_Table[func_num]; 2654 return &SVC_Table_64[func_num];
2457} 2655}
2458 2656
2459MICROPROFILE_DEFINE(Kernel_SVC, "Kernel", "SVC", MP_RGB(70, 200, 70)); 2657MICROPROFILE_DEFINE(Kernel_SVC, "Kernel", "SVC", MP_RGB(70, 200, 70));
@@ -2464,7 +2662,8 @@ void CallSVC(Core::System& system, u32 immediate) {
2464 // Lock the global kernel mutex when we enter the kernel HLE. 2662 // Lock the global kernel mutex when we enter the kernel HLE.
2465 std::lock_guard lock{HLE::g_hle_lock}; 2663 std::lock_guard lock{HLE::g_hle_lock};
2466 2664
2467 const FunctionDef* info = GetSVCInfo(immediate); 2665 const FunctionDef* info = system.CurrentProcess()->Is64BitProcess() ? GetSVCInfo64(immediate)
2666 : GetSVCInfo32(immediate);
2468 if (info) { 2667 if (info) {
2469 if (info->func) { 2668 if (info->func) {
2470 info->func(system); 2669 info->func(system);
diff --git a/src/core/hle/kernel/svc_wrap.h b/src/core/hle/kernel/svc_wrap.h
index 29a2cfa9d..7d735e3fa 100644
--- a/src/core/hle/kernel/svc_wrap.h
+++ b/src/core/hle/kernel/svc_wrap.h
@@ -15,6 +15,10 @@ static inline u64 Param(const Core::System& system, int n) {
15 return system.CurrentArmInterface().GetReg(n); 15 return system.CurrentArmInterface().GetReg(n);
16} 16}
17 17
18static inline u32 Param32(const Core::System& system, int n) {
19 return static_cast<u32>(system.CurrentArmInterface().GetReg(n));
20}
21
18/** 22/**
19 * HLE a function return from the current ARM userland process 23 * HLE a function return from the current ARM userland process
20 * @param system System context 24 * @param system System context
@@ -24,40 +28,44 @@ static inline void FuncReturn(Core::System& system, u64 result) {
24 system.CurrentArmInterface().SetReg(0, result); 28 system.CurrentArmInterface().SetReg(0, result);
25} 29}
26 30
31static inline void FuncReturn32(Core::System& system, u32 result) {
32 system.CurrentArmInterface().SetReg(0, (u64)result);
33}
34
27//////////////////////////////////////////////////////////////////////////////////////////////////// 35////////////////////////////////////////////////////////////////////////////////////////////////////
28// Function wrappers that return type ResultCode 36// Function wrappers that return type ResultCode
29 37
30template <ResultCode func(Core::System&, u64)> 38template <ResultCode func(Core::System&, u64)>
31void SvcWrap(Core::System& system) { 39void SvcWrap64(Core::System& system) {
32 FuncReturn(system, func(system, Param(system, 0)).raw); 40 FuncReturn(system, func(system, Param(system, 0)).raw);
33} 41}
34 42
35template <ResultCode func(Core::System&, u64, u64)> 43template <ResultCode func(Core::System&, u64, u64)>
36void SvcWrap(Core::System& system) { 44void SvcWrap64(Core::System& system) {
37 FuncReturn(system, func(system, Param(system, 0), Param(system, 1)).raw); 45 FuncReturn(system, func(system, Param(system, 0), Param(system, 1)).raw);
38} 46}
39 47
40template <ResultCode func(Core::System&, u32)> 48template <ResultCode func(Core::System&, u32)>
41void SvcWrap(Core::System& system) { 49void SvcWrap64(Core::System& system) {
42 FuncReturn(system, func(system, static_cast<u32>(Param(system, 0))).raw); 50 FuncReturn(system, func(system, static_cast<u32>(Param(system, 0))).raw);
43} 51}
44 52
45template <ResultCode func(Core::System&, u32, u32)> 53template <ResultCode func(Core::System&, u32, u32)>
46void SvcWrap(Core::System& system) { 54void SvcWrap64(Core::System& system) {
47 FuncReturn( 55 FuncReturn(
48 system, 56 system,
49 func(system, static_cast<u32>(Param(system, 0)), static_cast<u32>(Param(system, 1))).raw); 57 func(system, static_cast<u32>(Param(system, 0)), static_cast<u32>(Param(system, 1))).raw);
50} 58}
51 59
52template <ResultCode func(Core::System&, u32, u64, u64, u64)> 60template <ResultCode func(Core::System&, u32, u64, u64, u64)>
53void SvcWrap(Core::System& system) { 61void SvcWrap64(Core::System& system) {
54 FuncReturn(system, func(system, static_cast<u32>(Param(system, 0)), Param(system, 1), 62 FuncReturn(system, func(system, static_cast<u32>(Param(system, 0)), Param(system, 1),
55 Param(system, 2), Param(system, 3)) 63 Param(system, 2), Param(system, 3))
56 .raw); 64 .raw);
57} 65}
58 66
59template <ResultCode func(Core::System&, u32*)> 67template <ResultCode func(Core::System&, u32*)>
60void SvcWrap(Core::System& system) { 68void SvcWrap64(Core::System& system) {
61 u32 param = 0; 69 u32 param = 0;
62 const u32 retval = func(system, &param).raw; 70 const u32 retval = func(system, &param).raw;
63 system.CurrentArmInterface().SetReg(1, param); 71 system.CurrentArmInterface().SetReg(1, param);
@@ -65,7 +73,7 @@ void SvcWrap(Core::System& system) {
65} 73}
66 74
67template <ResultCode func(Core::System&, u32*, u32)> 75template <ResultCode func(Core::System&, u32*, u32)>
68void SvcWrap(Core::System& system) { 76void SvcWrap64(Core::System& system) {
69 u32 param_1 = 0; 77 u32 param_1 = 0;
70 const u32 retval = func(system, &param_1, static_cast<u32>(Param(system, 1))).raw; 78 const u32 retval = func(system, &param_1, static_cast<u32>(Param(system, 1))).raw;
71 system.CurrentArmInterface().SetReg(1, param_1); 79 system.CurrentArmInterface().SetReg(1, param_1);
@@ -73,7 +81,7 @@ void SvcWrap(Core::System& system) {
73} 81}
74 82
75template <ResultCode func(Core::System&, u32*, u32*)> 83template <ResultCode func(Core::System&, u32*, u32*)>
76void SvcWrap(Core::System& system) { 84void SvcWrap64(Core::System& system) {
77 u32 param_1 = 0; 85 u32 param_1 = 0;
78 u32 param_2 = 0; 86 u32 param_2 = 0;
79 const u32 retval = func(system, &param_1, &param_2).raw; 87 const u32 retval = func(system, &param_1, &param_2).raw;
@@ -86,7 +94,7 @@ void SvcWrap(Core::System& system) {
86} 94}
87 95
88template <ResultCode func(Core::System&, u32*, u64)> 96template <ResultCode func(Core::System&, u32*, u64)>
89void SvcWrap(Core::System& system) { 97void SvcWrap64(Core::System& system) {
90 u32 param_1 = 0; 98 u32 param_1 = 0;
91 const u32 retval = func(system, &param_1, Param(system, 1)).raw; 99 const u32 retval = func(system, &param_1, Param(system, 1)).raw;
92 system.CurrentArmInterface().SetReg(1, param_1); 100 system.CurrentArmInterface().SetReg(1, param_1);
@@ -94,7 +102,7 @@ void SvcWrap(Core::System& system) {
94} 102}
95 103
96template <ResultCode func(Core::System&, u32*, u64, u32)> 104template <ResultCode func(Core::System&, u32*, u64, u32)>
97void SvcWrap(Core::System& system) { 105void SvcWrap64(Core::System& system) {
98 u32 param_1 = 0; 106 u32 param_1 = 0;
99 const u32 retval = 107 const u32 retval =
100 func(system, &param_1, Param(system, 1), static_cast<u32>(Param(system, 2))).raw; 108 func(system, &param_1, Param(system, 1), static_cast<u32>(Param(system, 2))).raw;
@@ -104,7 +112,7 @@ void SvcWrap(Core::System& system) {
104} 112}
105 113
106template <ResultCode func(Core::System&, u64*, u32)> 114template <ResultCode func(Core::System&, u64*, u32)>
107void SvcWrap(Core::System& system) { 115void SvcWrap64(Core::System& system) {
108 u64 param_1 = 0; 116 u64 param_1 = 0;
109 const u32 retval = func(system, &param_1, static_cast<u32>(Param(system, 1))).raw; 117 const u32 retval = func(system, &param_1, static_cast<u32>(Param(system, 1))).raw;
110 118
@@ -113,12 +121,12 @@ void SvcWrap(Core::System& system) {
113} 121}
114 122
115template <ResultCode func(Core::System&, u64, u32)> 123template <ResultCode func(Core::System&, u64, u32)>
116void SvcWrap(Core::System& system) { 124void SvcWrap64(Core::System& system) {
117 FuncReturn(system, func(system, Param(system, 0), static_cast<u32>(Param(system, 1))).raw); 125 FuncReturn(system, func(system, Param(system, 0), static_cast<u32>(Param(system, 1))).raw);
118} 126}
119 127
120template <ResultCode func(Core::System&, u64*, u64)> 128template <ResultCode func(Core::System&, u64*, u64)>
121void SvcWrap(Core::System& system) { 129void SvcWrap64(Core::System& system) {
122 u64 param_1 = 0; 130 u64 param_1 = 0;
123 const u32 retval = func(system, &param_1, Param(system, 1)).raw; 131 const u32 retval = func(system, &param_1, Param(system, 1)).raw;
124 132
@@ -127,7 +135,7 @@ void SvcWrap(Core::System& system) {
127} 135}
128 136
129template <ResultCode func(Core::System&, u64*, u32, u32)> 137template <ResultCode func(Core::System&, u64*, u32, u32)>
130void SvcWrap(Core::System& system) { 138void SvcWrap64(Core::System& system) {
131 u64 param_1 = 0; 139 u64 param_1 = 0;
132 const u32 retval = func(system, &param_1, static_cast<u32>(Param(system, 1)), 140 const u32 retval = func(system, &param_1, static_cast<u32>(Param(system, 1)),
133 static_cast<u32>(Param(system, 2))) 141 static_cast<u32>(Param(system, 2)))
@@ -138,19 +146,19 @@ void SvcWrap(Core::System& system) {
138} 146}
139 147
140template <ResultCode func(Core::System&, u32, u64)> 148template <ResultCode func(Core::System&, u32, u64)>
141void SvcWrap(Core::System& system) { 149void SvcWrap64(Core::System& system) {
142 FuncReturn(system, func(system, static_cast<u32>(Param(system, 0)), Param(system, 1)).raw); 150 FuncReturn(system, func(system, static_cast<u32>(Param(system, 0)), Param(system, 1)).raw);
143} 151}
144 152
145template <ResultCode func(Core::System&, u32, u32, u64)> 153template <ResultCode func(Core::System&, u32, u32, u64)>
146void SvcWrap(Core::System& system) { 154void SvcWrap64(Core::System& system) {
147 FuncReturn(system, func(system, static_cast<u32>(Param(system, 0)), 155 FuncReturn(system, func(system, static_cast<u32>(Param(system, 0)),
148 static_cast<u32>(Param(system, 1)), Param(system, 2)) 156 static_cast<u32>(Param(system, 1)), Param(system, 2))
149 .raw); 157 .raw);
150} 158}
151 159
152template <ResultCode func(Core::System&, u32, u32*, u64*)> 160template <ResultCode func(Core::System&, u32, u32*, u64*)>
153void SvcWrap(Core::System& system) { 161void SvcWrap64(Core::System& system) {
154 u32 param_1 = 0; 162 u32 param_1 = 0;
155 u64 param_2 = 0; 163 u64 param_2 = 0;
156 const ResultCode retval = func(system, static_cast<u32>(Param(system, 2)), &param_1, &param_2); 164 const ResultCode retval = func(system, static_cast<u32>(Param(system, 2)), &param_1, &param_2);
@@ -161,54 +169,54 @@ void SvcWrap(Core::System& system) {
161} 169}
162 170
163template <ResultCode func(Core::System&, u64, u64, u32, u32)> 171template <ResultCode func(Core::System&, u64, u64, u32, u32)>
164void SvcWrap(Core::System& system) { 172void SvcWrap64(Core::System& system) {
165 FuncReturn(system, func(system, Param(system, 0), Param(system, 1), 173 FuncReturn(system, func(system, Param(system, 0), Param(system, 1),
166 static_cast<u32>(Param(system, 2)), static_cast<u32>(Param(system, 3))) 174 static_cast<u32>(Param(system, 2)), static_cast<u32>(Param(system, 3)))
167 .raw); 175 .raw);
168} 176}
169 177
170template <ResultCode func(Core::System&, u64, u64, u32, u64)> 178template <ResultCode func(Core::System&, u64, u64, u32, u64)>
171void SvcWrap(Core::System& system) { 179void SvcWrap64(Core::System& system) {
172 FuncReturn(system, func(system, Param(system, 0), Param(system, 1), 180 FuncReturn(system, func(system, Param(system, 0), Param(system, 1),
173 static_cast<u32>(Param(system, 2)), Param(system, 3)) 181 static_cast<u32>(Param(system, 2)), Param(system, 3))
174 .raw); 182 .raw);
175} 183}
176 184
177template <ResultCode func(Core::System&, u32, u64, u32)> 185template <ResultCode func(Core::System&, u32, u64, u32)>
178void SvcWrap(Core::System& system) { 186void SvcWrap64(Core::System& system) {
179 FuncReturn(system, func(system, static_cast<u32>(Param(system, 0)), Param(system, 1), 187 FuncReturn(system, func(system, static_cast<u32>(Param(system, 0)), Param(system, 1),
180 static_cast<u32>(Param(system, 2))) 188 static_cast<u32>(Param(system, 2)))
181 .raw); 189 .raw);
182} 190}
183 191
184template <ResultCode func(Core::System&, u64, u64, u64)> 192template <ResultCode func(Core::System&, u64, u64, u64)>
185void SvcWrap(Core::System& system) { 193void SvcWrap64(Core::System& system) {
186 FuncReturn(system, func(system, Param(system, 0), Param(system, 1), Param(system, 2)).raw); 194 FuncReturn(system, func(system, Param(system, 0), Param(system, 1), Param(system, 2)).raw);
187} 195}
188 196
189template <ResultCode func(Core::System&, u64, u64, u32)> 197template <ResultCode func(Core::System&, u64, u64, u32)>
190void SvcWrap(Core::System& system) { 198void SvcWrap64(Core::System& system) {
191 FuncReturn( 199 FuncReturn(
192 system, 200 system,
193 func(system, Param(system, 0), Param(system, 1), static_cast<u32>(Param(system, 2))).raw); 201 func(system, Param(system, 0), Param(system, 1), static_cast<u32>(Param(system, 2))).raw);
194} 202}
195 203
196template <ResultCode func(Core::System&, u32, u64, u64, u32)> 204template <ResultCode func(Core::System&, u32, u64, u64, u32)>
197void SvcWrap(Core::System& system) { 205void SvcWrap64(Core::System& system) {
198 FuncReturn(system, func(system, static_cast<u32>(Param(system, 0)), Param(system, 1), 206 FuncReturn(system, func(system, static_cast<u32>(Param(system, 0)), Param(system, 1),
199 Param(system, 2), static_cast<u32>(Param(system, 3))) 207 Param(system, 2), static_cast<u32>(Param(system, 3)))
200 .raw); 208 .raw);
201} 209}
202 210
203template <ResultCode func(Core::System&, u32, u64, u64)> 211template <ResultCode func(Core::System&, u32, u64, u64)>
204void SvcWrap(Core::System& system) { 212void SvcWrap64(Core::System& system) {
205 FuncReturn( 213 FuncReturn(
206 system, 214 system,
207 func(system, static_cast<u32>(Param(system, 0)), Param(system, 1), Param(system, 2)).raw); 215 func(system, static_cast<u32>(Param(system, 0)), Param(system, 1), Param(system, 2)).raw);
208} 216}
209 217
210template <ResultCode func(Core::System&, u32*, u64, u64, s64)> 218template <ResultCode func(Core::System&, u32*, u64, u64, s64)>
211void SvcWrap(Core::System& system) { 219void SvcWrap64(Core::System& system) {
212 u32 param_1 = 0; 220 u32 param_1 = 0;
213 const u32 retval = func(system, &param_1, Param(system, 1), static_cast<u32>(Param(system, 2)), 221 const u32 retval = func(system, &param_1, Param(system, 1), static_cast<u32>(Param(system, 2)),
214 static_cast<s64>(Param(system, 3))) 222 static_cast<s64>(Param(system, 3)))
@@ -219,14 +227,14 @@ void SvcWrap(Core::System& system) {
219} 227}
220 228
221template <ResultCode func(Core::System&, u64, u64, u32, s64)> 229template <ResultCode func(Core::System&, u64, u64, u32, s64)>
222void SvcWrap(Core::System& system) { 230void SvcWrap64(Core::System& system) {
223 FuncReturn(system, func(system, Param(system, 0), Param(system, 1), 231 FuncReturn(system, func(system, Param(system, 0), Param(system, 1),
224 static_cast<u32>(Param(system, 2)), static_cast<s64>(Param(system, 3))) 232 static_cast<u32>(Param(system, 2)), static_cast<s64>(Param(system, 3)))
225 .raw); 233 .raw);
226} 234}
227 235
228template <ResultCode func(Core::System&, u64*, u64, u64, u64)> 236template <ResultCode func(Core::System&, u64*, u64, u64, u64)>
229void SvcWrap(Core::System& system) { 237void SvcWrap64(Core::System& system) {
230 u64 param_1 = 0; 238 u64 param_1 = 0;
231 const u32 retval = 239 const u32 retval =
232 func(system, &param_1, Param(system, 1), Param(system, 2), Param(system, 3)).raw; 240 func(system, &param_1, Param(system, 1), Param(system, 2), Param(system, 3)).raw;
@@ -236,7 +244,7 @@ void SvcWrap(Core::System& system) {
236} 244}
237 245
238template <ResultCode func(Core::System&, u32*, u64, u64, u64, u32, s32)> 246template <ResultCode func(Core::System&, u32*, u64, u64, u64, u32, s32)>
239void SvcWrap(Core::System& system) { 247void SvcWrap64(Core::System& system) {
240 u32 param_1 = 0; 248 u32 param_1 = 0;
241 const u32 retval = func(system, &param_1, Param(system, 1), Param(system, 2), Param(system, 3), 249 const u32 retval = func(system, &param_1, Param(system, 1), Param(system, 2), Param(system, 3),
242 static_cast<u32>(Param(system, 4)), static_cast<s32>(Param(system, 5))) 250 static_cast<u32>(Param(system, 4)), static_cast<s32>(Param(system, 5)))
@@ -247,7 +255,7 @@ void SvcWrap(Core::System& system) {
247} 255}
248 256
249template <ResultCode func(Core::System&, u32*, u64, u64, u32)> 257template <ResultCode func(Core::System&, u32*, u64, u64, u32)>
250void SvcWrap(Core::System& system) { 258void SvcWrap64(Core::System& system) {
251 u32 param_1 = 0; 259 u32 param_1 = 0;
252 const u32 retval = func(system, &param_1, Param(system, 1), Param(system, 2), 260 const u32 retval = func(system, &param_1, Param(system, 1), Param(system, 2),
253 static_cast<u32>(Param(system, 3))) 261 static_cast<u32>(Param(system, 3)))
@@ -258,7 +266,7 @@ void SvcWrap(Core::System& system) {
258} 266}
259 267
260template <ResultCode func(Core::System&, Handle*, u64, u32, u32)> 268template <ResultCode func(Core::System&, Handle*, u64, u32, u32)>
261void SvcWrap(Core::System& system) { 269void SvcWrap64(Core::System& system) {
262 u32 param_1 = 0; 270 u32 param_1 = 0;
263 const u32 retval = func(system, &param_1, Param(system, 1), static_cast<u32>(Param(system, 2)), 271 const u32 retval = func(system, &param_1, Param(system, 1), static_cast<u32>(Param(system, 2)),
264 static_cast<u32>(Param(system, 3))) 272 static_cast<u32>(Param(system, 3)))
@@ -269,14 +277,14 @@ void SvcWrap(Core::System& system) {
269} 277}
270 278
271template <ResultCode func(Core::System&, u64, u32, s32, s64)> 279template <ResultCode func(Core::System&, u64, u32, s32, s64)>
272void SvcWrap(Core::System& system) { 280void SvcWrap64(Core::System& system) {
273 FuncReturn(system, func(system, Param(system, 0), static_cast<u32>(Param(system, 1)), 281 FuncReturn(system, func(system, Param(system, 0), static_cast<u32>(Param(system, 1)),
274 static_cast<s32>(Param(system, 2)), static_cast<s64>(Param(system, 3))) 282 static_cast<s32>(Param(system, 2)), static_cast<s64>(Param(system, 3)))
275 .raw); 283 .raw);
276} 284}
277 285
278template <ResultCode func(Core::System&, u64, u32, s32, s32)> 286template <ResultCode func(Core::System&, u64, u32, s32, s32)>
279void SvcWrap(Core::System& system) { 287void SvcWrap64(Core::System& system) {
280 FuncReturn(system, func(system, Param(system, 0), static_cast<u32>(Param(system, 1)), 288 FuncReturn(system, func(system, Param(system, 0), static_cast<u32>(Param(system, 1)),
281 static_cast<s32>(Param(system, 2)), static_cast<s32>(Param(system, 3))) 289 static_cast<s32>(Param(system, 2)), static_cast<s32>(Param(system, 3)))
282 .raw); 290 .raw);
@@ -286,7 +294,7 @@ void SvcWrap(Core::System& system) {
286// Function wrappers that return type u32 294// Function wrappers that return type u32
287 295
288template <u32 func(Core::System&)> 296template <u32 func(Core::System&)>
289void SvcWrap(Core::System& system) { 297void SvcWrap64(Core::System& system) {
290 FuncReturn(system, func(system)); 298 FuncReturn(system, func(system));
291} 299}
292 300
@@ -294,7 +302,7 @@ void SvcWrap(Core::System& system) {
294// Function wrappers that return type u64 302// Function wrappers that return type u64
295 303
296template <u64 func(Core::System&)> 304template <u64 func(Core::System&)>
297void SvcWrap(Core::System& system) { 305void SvcWrap64(Core::System& system) {
298 FuncReturn(system, func(system)); 306 FuncReturn(system, func(system));
299} 307}
300 308
@@ -302,44 +310,110 @@ void SvcWrap(Core::System& system) {
302/// Function wrappers that return type void 310/// Function wrappers that return type void
303 311
304template <void func(Core::System&)> 312template <void func(Core::System&)>
305void SvcWrap(Core::System& system) { 313void SvcWrap64(Core::System& system) {
306 func(system); 314 func(system);
307} 315}
308 316
309template <void func(Core::System&, u32)> 317template <void func(Core::System&, u32)>
310void SvcWrap(Core::System& system) { 318void SvcWrap64(Core::System& system) {
311 func(system, static_cast<u32>(Param(system, 0))); 319 func(system, static_cast<u32>(Param(system, 0)));
312} 320}
313 321
314template <void func(Core::System&, u32, u64, u64, u64)> 322template <void func(Core::System&, u32, u64, u64, u64)>
315void SvcWrap(Core::System& system) { 323void SvcWrap64(Core::System& system) {
316 func(system, static_cast<u32>(Param(system, 0)), Param(system, 1), Param(system, 2), 324 func(system, static_cast<u32>(Param(system, 0)), Param(system, 1), Param(system, 2),
317 Param(system, 3)); 325 Param(system, 3));
318} 326}
319 327
320template <void func(Core::System&, s64)> 328template <void func(Core::System&, s64)>
321void SvcWrap(Core::System& system) { 329void SvcWrap64(Core::System& system) {
322 func(system, static_cast<s64>(Param(system, 0))); 330 func(system, static_cast<s64>(Param(system, 0)));
323} 331}
324 332
325template <void func(Core::System&, u64, s32)> 333template <void func(Core::System&, u64, s32)>
326void SvcWrap(Core::System& system) { 334void SvcWrap64(Core::System& system) {
327 func(system, Param(system, 0), static_cast<s32>(Param(system, 1))); 335 func(system, Param(system, 0), static_cast<s32>(Param(system, 1)));
328} 336}
329 337
330template <void func(Core::System&, u64, u64)> 338template <void func(Core::System&, u64, u64)>
331void SvcWrap(Core::System& system) { 339void SvcWrap64(Core::System& system) {
332 func(system, Param(system, 0), Param(system, 1)); 340 func(system, Param(system, 0), Param(system, 1));
333} 341}
334 342
335template <void func(Core::System&, u64, u64, u64)> 343template <void func(Core::System&, u64, u64, u64)>
336void SvcWrap(Core::System& system) { 344void SvcWrap64(Core::System& system) {
337 func(system, Param(system, 0), Param(system, 1), Param(system, 2)); 345 func(system, Param(system, 0), Param(system, 1), Param(system, 2));
338} 346}
339 347
340template <void func(Core::System&, u32, u64, u64)> 348template <void func(Core::System&, u32, u64, u64)>
341void SvcWrap(Core::System& system) { 349void SvcWrap64(Core::System& system) {
342 func(system, static_cast<u32>(Param(system, 0)), Param(system, 1), Param(system, 2)); 350 func(system, static_cast<u32>(Param(system, 0)), Param(system, 1), Param(system, 2));
343} 351}
344 352
353// Used by QueryMemory32
354template <ResultCode func(Core::System&, u32, u32, u32)>
355void SvcWrap32(Core::System& system) {
356 FuncReturn32(system,
357 func(system, Param32(system, 0), Param32(system, 1), Param32(system, 2)).raw);
358}
359
360// Used by GetInfo32
361template <ResultCode func(Core::System&, u32*, u32*, u32, u32, u32, u32)>
362void SvcWrap32(Core::System& system) {
363 u32 param_1 = 0;
364 u32 param_2 = 0;
365
366 const u32 retval = func(system, &param_1, &param_2, Param32(system, 0), Param32(system, 1),
367 Param32(system, 2), Param32(system, 3))
368 .raw;
369
370 system.CurrentArmInterface().SetReg(1, param_1);
371 system.CurrentArmInterface().SetReg(2, param_2);
372 FuncReturn(system, retval);
373}
374
375// Used by GetThreadPriority32, ConnectToNamedPort32
376template <ResultCode func(Core::System&, u32*, u32)>
377void SvcWrap32(Core::System& system) {
378 u32 param_1 = 0;
379 const u32 retval = func(system, &param_1, Param32(system, 1)).raw;
380 system.CurrentArmInterface().SetReg(1, param_1);
381 FuncReturn(system, retval);
382}
383
384// Used by GetThreadId32
385template <ResultCode func(Core::System&, u32*, u32*, u32)>
386void SvcWrap32(Core::System& system) {
387 u32 param_1 = 0;
388 u32 param_2 = 0;
389
390 const u32 retval = func(system, &param_1, &param_2, Param32(system, 1)).raw;
391 system.CurrentArmInterface().SetReg(1, param_1);
392 system.CurrentArmInterface().SetReg(2, param_2);
393 FuncReturn(system, retval);
394}
395
396// Used by SignalProcessWideKey32
397template <void func(Core::System&, u32, s32)>
398void SvcWrap32(Core::System& system) {
399 func(system, static_cast<u32>(Param(system, 0)), static_cast<s32>(Param(system, 1)));
400}
401
402// Used by SendSyncRequest32
403template <ResultCode func(Core::System&, u32)>
404void SvcWrap32(Core::System& system) {
405 FuncReturn(system, func(system, static_cast<u32>(Param(system, 0))).raw);
406}
407
408// Used by WaitSynchronization32
409template <ResultCode func(Core::System&, u32, u32, s32, u32, Handle*)>
410void SvcWrap32(Core::System& system) {
411 u32 param_1 = 0;
412 const u32 retval = func(system, Param32(system, 0), Param32(system, 1), Param32(system, 2),
413 Param32(system, 3), &param_1)
414 .raw;
415 system.CurrentArmInterface().SetReg(1, param_1);
416 FuncReturn(system, retval);
417}
418
345} // namespace Kernel 419} // namespace Kernel