summaryrefslogtreecommitdiff
path: root/src/core/hle/svc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/hle/svc.cpp')
-rw-r--r--src/core/hle/svc.cpp70
1 files changed, 35 insertions, 35 deletions
diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp
index b20f2aaa4..5a52525c6 100644
--- a/src/core/hle/svc.cpp
+++ b/src/core/hle/svc.cpp
@@ -166,7 +166,7 @@ static ResultCode ControlMemory(u32* out_addr, u32 operation, u32 addr0, u32 add
166} 166}
167 167
168/// Maps a memory block to specified address 168/// Maps a memory block to specified address
169static ResultCode MapMemoryBlock(Handle handle, u32 addr, u32 permissions, u32 other_permissions) { 169static ResultCode MapMemoryBlock(Kernel::Handle handle, u32 addr, u32 permissions, u32 other_permissions) {
170 using Kernel::SharedMemory; 170 using Kernel::SharedMemory;
171 using Kernel::MemoryPermission; 171 using Kernel::MemoryPermission;
172 172
@@ -198,7 +198,7 @@ static ResultCode MapMemoryBlock(Handle handle, u32 addr, u32 permissions, u32 o
198 ErrorSummary::InvalidArgument, ErrorLevel::Usage); 198 ErrorSummary::InvalidArgument, ErrorLevel::Usage);
199} 199}
200 200
201static ResultCode UnmapMemoryBlock(Handle handle, u32 addr) { 201static ResultCode UnmapMemoryBlock(Kernel::Handle handle, u32 addr) {
202 using Kernel::SharedMemory; 202 using Kernel::SharedMemory;
203 203
204 LOG_TRACE(Kernel_SVC, "called memblock=0x%08X, addr=0x%08X", handle, addr); 204 LOG_TRACE(Kernel_SVC, "called memblock=0x%08X, addr=0x%08X", handle, addr);
@@ -213,7 +213,7 @@ static ResultCode UnmapMemoryBlock(Handle handle, u32 addr) {
213} 213}
214 214
215/// Connect to an OS service given the port name, returns the handle to the port to out 215/// Connect to an OS service given the port name, returns the handle to the port to out
216static ResultCode ConnectToPort(Handle* out_handle, const char* port_name) { 216static ResultCode ConnectToPort(Kernel::Handle* out_handle, const char* port_name) {
217 if (port_name == nullptr) 217 if (port_name == nullptr)
218 return ERR_NOT_FOUND; 218 return ERR_NOT_FOUND;
219 if (std::strlen(port_name) > 11) 219 if (std::strlen(port_name) > 11)
@@ -238,7 +238,7 @@ static ResultCode ConnectToPort(Handle* out_handle, const char* port_name) {
238} 238}
239 239
240/// Makes a blocking IPC call to an OS service. 240/// Makes a blocking IPC call to an OS service.
241static ResultCode SendSyncRequest(Handle handle) { 241static ResultCode SendSyncRequest(Kernel::Handle handle) {
242 SharedPtr<Kernel::ClientSession> session = 242 SharedPtr<Kernel::ClientSession> session =
243 Kernel::g_handle_table.Get<Kernel::ClientSession>(handle); 243 Kernel::g_handle_table.Get<Kernel::ClientSession>(handle);
244 if (session == nullptr) { 244 if (session == nullptr) {
@@ -253,13 +253,13 @@ static ResultCode SendSyncRequest(Handle handle) {
253} 253}
254 254
255/// Close a handle 255/// Close a handle
256static ResultCode CloseHandle(Handle handle) { 256static ResultCode CloseHandle(Kernel::Handle handle) {
257 LOG_TRACE(Kernel_SVC, "Closing handle 0x%08X", handle); 257 LOG_TRACE(Kernel_SVC, "Closing handle 0x%08X", handle);
258 return Kernel::g_handle_table.Close(handle); 258 return Kernel::g_handle_table.Close(handle);
259} 259}
260 260
261/// Wait for a handle to synchronize, timeout after the specified nanoseconds 261/// Wait for a handle to synchronize, timeout after the specified nanoseconds
262static ResultCode WaitSynchronization1(Handle handle, s64 nano_seconds) { 262static ResultCode WaitSynchronization1(Kernel::Handle handle, s64 nano_seconds) {
263 auto object = Kernel::g_handle_table.GetWaitObject(handle); 263 auto object = Kernel::g_handle_table.GetWaitObject(handle);
264 Kernel::Thread* thread = Kernel::GetCurrentThread(); 264 Kernel::Thread* thread = Kernel::GetCurrentThread();
265 265
@@ -295,7 +295,7 @@ static ResultCode WaitSynchronization1(Handle handle, s64 nano_seconds) {
295} 295}
296 296
297/// Wait for the given handles to synchronize, timeout after the specified nanoseconds 297/// Wait for the given handles to synchronize, timeout after the specified nanoseconds
298static ResultCode WaitSynchronizationN(s32* out, Handle* handles, s32 handle_count, bool wait_all, 298static ResultCode WaitSynchronizationN(s32* out, Kernel::Handle* handles, s32 handle_count, bool wait_all,
299 s64 nano_seconds) { 299 s64 nano_seconds) {
300 Kernel::Thread* thread = Kernel::GetCurrentThread(); 300 Kernel::Thread* thread = Kernel::GetCurrentThread();
301 301
@@ -423,7 +423,7 @@ static ResultCode WaitSynchronizationN(s32* out, Handle* handles, s32 handle_cou
423} 423}
424 424
425/// Create an address arbiter (to allocate access to shared resources) 425/// Create an address arbiter (to allocate access to shared resources)
426static ResultCode CreateAddressArbiter(Handle* out_handle) { 426static ResultCode CreateAddressArbiter(Kernel::Handle* out_handle) {
427 using Kernel::AddressArbiter; 427 using Kernel::AddressArbiter;
428 428
429 SharedPtr<AddressArbiter> arbiter = AddressArbiter::Create(); 429 SharedPtr<AddressArbiter> arbiter = AddressArbiter::Create();
@@ -433,7 +433,7 @@ static ResultCode CreateAddressArbiter(Handle* out_handle) {
433} 433}
434 434
435/// Arbitrate address 435/// Arbitrate address
436static ResultCode ArbitrateAddress(Handle handle, u32 address, u32 type, u32 value, 436static ResultCode ArbitrateAddress(Kernel::Handle handle, u32 address, u32 type, u32 value,
437 s64 nanoseconds) { 437 s64 nanoseconds) {
438 using Kernel::AddressArbiter; 438 using Kernel::AddressArbiter;
439 439
@@ -476,7 +476,7 @@ static void OutputDebugString(const char* string) {
476} 476}
477 477
478/// Get resource limit 478/// Get resource limit
479static ResultCode GetResourceLimit(Handle* resource_limit, Handle process_handle) { 479static ResultCode GetResourceLimit(Kernel::Handle* resource_limit, Kernel::Handle process_handle) {
480 LOG_TRACE(Kernel_SVC, "called process=0x%08X", process_handle); 480 LOG_TRACE(Kernel_SVC, "called process=0x%08X", process_handle);
481 481
482 SharedPtr<Kernel::Process> process = 482 SharedPtr<Kernel::Process> process =
@@ -490,7 +490,7 @@ static ResultCode GetResourceLimit(Handle* resource_limit, Handle process_handle
490} 490}
491 491
492/// Get resource limit current values 492/// Get resource limit current values
493static ResultCode GetResourceLimitCurrentValues(s64* values, Handle resource_limit_handle, 493static ResultCode GetResourceLimitCurrentValues(s64* values, Kernel::Handle resource_limit_handle,
494 u32* names, u32 name_count) { 494 u32* names, u32 name_count) {
495 LOG_TRACE(Kernel_SVC, "called resource_limit=%08X, names=%p, name_count=%d", 495 LOG_TRACE(Kernel_SVC, "called resource_limit=%08X, names=%p, name_count=%d",
496 resource_limit_handle, names, name_count); 496 resource_limit_handle, names, name_count);
@@ -507,7 +507,7 @@ static ResultCode GetResourceLimitCurrentValues(s64* values, Handle resource_lim
507} 507}
508 508
509/// Get resource limit max values 509/// Get resource limit max values
510static ResultCode GetResourceLimitLimitValues(s64* values, Handle resource_limit_handle, u32* names, 510static ResultCode GetResourceLimitLimitValues(s64* values, Kernel::Handle resource_limit_handle, u32* names,
511 u32 name_count) { 511 u32 name_count) {
512 LOG_TRACE(Kernel_SVC, "called resource_limit=%08X, names=%p, name_count=%d", 512 LOG_TRACE(Kernel_SVC, "called resource_limit=%08X, names=%p, name_count=%d",
513 resource_limit_handle, names, name_count); 513 resource_limit_handle, names, name_count);
@@ -524,7 +524,7 @@ static ResultCode GetResourceLimitLimitValues(s64* values, Handle resource_limit
524} 524}
525 525
526/// Creates a new thread 526/// Creates a new thread
527static ResultCode CreateThread(Handle* out_handle, s32 priority, u32 entry_point, u32 arg, 527static ResultCode CreateThread(Kernel::Handle* out_handle, s32 priority, u32 entry_point, u32 arg,
528 u32 stack_top, s32 processor_id) { 528 u32 stack_top, s32 processor_id) {
529 using Kernel::Thread; 529 using Kernel::Thread;
530 530
@@ -588,7 +588,7 @@ static void ExitThread() {
588} 588}
589 589
590/// Gets the priority for the specified thread 590/// Gets the priority for the specified thread
591static ResultCode GetThreadPriority(s32* priority, Handle handle) { 591static ResultCode GetThreadPriority(s32* priority, Kernel::Handle handle) {
592 const SharedPtr<Kernel::Thread> thread = Kernel::g_handle_table.Get<Kernel::Thread>(handle); 592 const SharedPtr<Kernel::Thread> thread = Kernel::g_handle_table.Get<Kernel::Thread>(handle);
593 if (thread == nullptr) 593 if (thread == nullptr)
594 return ERR_INVALID_HANDLE; 594 return ERR_INVALID_HANDLE;
@@ -598,7 +598,7 @@ static ResultCode GetThreadPriority(s32* priority, Handle handle) {
598} 598}
599 599
600/// Sets the priority for the specified thread 600/// Sets the priority for the specified thread
601static ResultCode SetThreadPriority(Handle handle, s32 priority) { 601static ResultCode SetThreadPriority(Kernel::Handle handle, s32 priority) {
602 SharedPtr<Kernel::Thread> thread = Kernel::g_handle_table.Get<Kernel::Thread>(handle); 602 SharedPtr<Kernel::Thread> thread = Kernel::g_handle_table.Get<Kernel::Thread>(handle);
603 if (thread == nullptr) 603 if (thread == nullptr)
604 return ERR_INVALID_HANDLE; 604 return ERR_INVALID_HANDLE;
@@ -608,7 +608,7 @@ static ResultCode SetThreadPriority(Handle handle, s32 priority) {
608} 608}
609 609
610/// Create a mutex 610/// Create a mutex
611static ResultCode CreateMutex(Handle* out_handle, u32 initial_locked) { 611static ResultCode CreateMutex(Kernel::Handle* out_handle, u32 initial_locked) {
612 using Kernel::Mutex; 612 using Kernel::Mutex;
613 613
614 SharedPtr<Mutex> mutex = Mutex::Create(initial_locked != 0); 614 SharedPtr<Mutex> mutex = Mutex::Create(initial_locked != 0);
@@ -622,7 +622,7 @@ static ResultCode CreateMutex(Handle* out_handle, u32 initial_locked) {
622} 622}
623 623
624/// Release a mutex 624/// Release a mutex
625static ResultCode ReleaseMutex(Handle handle) { 625static ResultCode ReleaseMutex(Kernel::Handle handle) {
626 using Kernel::Mutex; 626 using Kernel::Mutex;
627 627
628 LOG_TRACE(Kernel_SVC, "called handle=0x%08X", handle); 628 LOG_TRACE(Kernel_SVC, "called handle=0x%08X", handle);
@@ -637,7 +637,7 @@ static ResultCode ReleaseMutex(Handle handle) {
637} 637}
638 638
639/// Get the ID of the specified process 639/// Get the ID of the specified process
640static ResultCode GetProcessId(u32* process_id, Handle process_handle) { 640static ResultCode GetProcessId(u32* process_id, Kernel::Handle process_handle) {
641 LOG_TRACE(Kernel_SVC, "called process=0x%08X", process_handle); 641 LOG_TRACE(Kernel_SVC, "called process=0x%08X", process_handle);
642 642
643 const SharedPtr<Kernel::Process> process = 643 const SharedPtr<Kernel::Process> process =
@@ -650,7 +650,7 @@ static ResultCode GetProcessId(u32* process_id, Handle process_handle) {
650} 650}
651 651
652/// Get the ID of the process that owns the specified thread 652/// Get the ID of the process that owns the specified thread
653static ResultCode GetProcessIdOfThread(u32* process_id, Handle thread_handle) { 653static ResultCode GetProcessIdOfThread(u32* process_id, Kernel::Handle thread_handle) {
654 LOG_TRACE(Kernel_SVC, "called thread=0x%08X", thread_handle); 654 LOG_TRACE(Kernel_SVC, "called thread=0x%08X", thread_handle);
655 655
656 const SharedPtr<Kernel::Thread> thread = 656 const SharedPtr<Kernel::Thread> thread =
@@ -667,7 +667,7 @@ static ResultCode GetProcessIdOfThread(u32* process_id, Handle thread_handle) {
667} 667}
668 668
669/// Get the ID for the specified thread. 669/// Get the ID for the specified thread.
670static ResultCode GetThreadId(u32* thread_id, Handle handle) { 670static ResultCode GetThreadId(u32* thread_id, Kernel::Handle handle) {
671 LOG_TRACE(Kernel_SVC, "called thread=0x%08X", handle); 671 LOG_TRACE(Kernel_SVC, "called thread=0x%08X", handle);
672 672
673 const SharedPtr<Kernel::Thread> thread = Kernel::g_handle_table.Get<Kernel::Thread>(handle); 673 const SharedPtr<Kernel::Thread> thread = Kernel::g_handle_table.Get<Kernel::Thread>(handle);
@@ -679,7 +679,7 @@ static ResultCode GetThreadId(u32* thread_id, Handle handle) {
679} 679}
680 680
681/// Creates a semaphore 681/// Creates a semaphore
682static ResultCode CreateSemaphore(Handle* out_handle, s32 initial_count, s32 max_count) { 682static ResultCode CreateSemaphore(Kernel::Handle* out_handle, s32 initial_count, s32 max_count) {
683 using Kernel::Semaphore; 683 using Kernel::Semaphore;
684 684
685 CASCADE_RESULT(SharedPtr<Semaphore> semaphore, Semaphore::Create(initial_count, max_count)); 685 CASCADE_RESULT(SharedPtr<Semaphore> semaphore, Semaphore::Create(initial_count, max_count));
@@ -692,7 +692,7 @@ static ResultCode CreateSemaphore(Handle* out_handle, s32 initial_count, s32 max
692} 692}
693 693
694/// Releases a certain number of slots in a semaphore 694/// Releases a certain number of slots in a semaphore
695static ResultCode ReleaseSemaphore(s32* count, Handle handle, s32 release_count) { 695static ResultCode ReleaseSemaphore(s32* count, Kernel::Handle handle, s32 release_count) {
696 using Kernel::Semaphore; 696 using Kernel::Semaphore;
697 697
698 LOG_TRACE(Kernel_SVC, "called release_count=%d, handle=0x%08X", release_count, handle); 698 LOG_TRACE(Kernel_SVC, "called release_count=%d, handle=0x%08X", release_count, handle);
@@ -708,7 +708,7 @@ static ResultCode ReleaseSemaphore(s32* count, Handle handle, s32 release_count)
708 708
709/// Query process memory 709/// Query process memory
710static ResultCode QueryProcessMemory(MemoryInfo* memory_info, PageInfo* page_info, 710static ResultCode QueryProcessMemory(MemoryInfo* memory_info, PageInfo* page_info,
711 Handle process_handle, u32 addr) { 711 Kernel::Handle process_handle, u32 addr) {
712 using Kernel::Process; 712 using Kernel::Process;
713 Kernel::SharedPtr<Process> process = Kernel::g_handle_table.Get<Process>(process_handle); 713 Kernel::SharedPtr<Process> process = Kernel::g_handle_table.Get<Process>(process_handle);
714 if (process == nullptr) 714 if (process == nullptr)
@@ -736,7 +736,7 @@ static ResultCode QueryMemory(MemoryInfo* memory_info, PageInfo* page_info, u32
736} 736}
737 737
738/// Create an event 738/// Create an event
739static ResultCode CreateEvent(Handle* out_handle, u32 reset_type) { 739static ResultCode CreateEvent(Kernel::Handle* out_handle, u32 reset_type) {
740 using Kernel::Event; 740 using Kernel::Event;
741 741
742 SharedPtr<Event> evt = Event::Create(static_cast<Kernel::ResetType>(reset_type)); 742 SharedPtr<Event> evt = Event::Create(static_cast<Kernel::ResetType>(reset_type));
@@ -749,14 +749,14 @@ static ResultCode CreateEvent(Handle* out_handle, u32 reset_type) {
749} 749}
750 750
751/// Duplicates a kernel handle 751/// Duplicates a kernel handle
752static ResultCode DuplicateHandle(Handle* out, Handle handle) { 752static ResultCode DuplicateHandle(Kernel::Handle* out, Kernel::Handle handle) {
753 CASCADE_RESULT(*out, Kernel::g_handle_table.Duplicate(handle)); 753 CASCADE_RESULT(*out, Kernel::g_handle_table.Duplicate(handle));
754 LOG_TRACE(Kernel_SVC, "duplicated 0x%08X to 0x%08X", handle, *out); 754 LOG_TRACE(Kernel_SVC, "duplicated 0x%08X to 0x%08X", handle, *out);
755 return RESULT_SUCCESS; 755 return RESULT_SUCCESS;
756} 756}
757 757
758/// Signals an event 758/// Signals an event
759static ResultCode SignalEvent(Handle handle) { 759static ResultCode SignalEvent(Kernel::Handle handle) {
760 using Kernel::Event; 760 using Kernel::Event;
761 LOG_TRACE(Kernel_SVC, "called event=0x%08X", handle); 761 LOG_TRACE(Kernel_SVC, "called event=0x%08X", handle);
762 762
@@ -770,7 +770,7 @@ static ResultCode SignalEvent(Handle handle) {
770} 770}
771 771
772/// Clears an event 772/// Clears an event
773static ResultCode ClearEvent(Handle handle) { 773static ResultCode ClearEvent(Kernel::Handle handle) {
774 using Kernel::Event; 774 using Kernel::Event;
775 LOG_TRACE(Kernel_SVC, "called event=0x%08X", handle); 775 LOG_TRACE(Kernel_SVC, "called event=0x%08X", handle);
776 776
@@ -783,7 +783,7 @@ static ResultCode ClearEvent(Handle handle) {
783} 783}
784 784
785/// Creates a timer 785/// Creates a timer
786static ResultCode CreateTimer(Handle* out_handle, u32 reset_type) { 786static ResultCode CreateTimer(Kernel::Handle* out_handle, u32 reset_type) {
787 using Kernel::Timer; 787 using Kernel::Timer;
788 788
789 SharedPtr<Timer> timer = Timer::Create(static_cast<Kernel::ResetType>(reset_type)); 789 SharedPtr<Timer> timer = Timer::Create(static_cast<Kernel::ResetType>(reset_type));
@@ -796,7 +796,7 @@ static ResultCode CreateTimer(Handle* out_handle, u32 reset_type) {
796} 796}
797 797
798/// Clears a timer 798/// Clears a timer
799static ResultCode ClearTimer(Handle handle) { 799static ResultCode ClearTimer(Kernel::Handle handle) {
800 using Kernel::Timer; 800 using Kernel::Timer;
801 801
802 LOG_TRACE(Kernel_SVC, "called timer=0x%08X", handle); 802 LOG_TRACE(Kernel_SVC, "called timer=0x%08X", handle);
@@ -810,7 +810,7 @@ static ResultCode ClearTimer(Handle handle) {
810} 810}
811 811
812/// Starts a timer 812/// Starts a timer
813static ResultCode SetTimer(Handle handle, s64 initial, s64 interval) { 813static ResultCode SetTimer(Kernel::Handle handle, s64 initial, s64 interval) {
814 using Kernel::Timer; 814 using Kernel::Timer;
815 815
816 LOG_TRACE(Kernel_SVC, "called timer=0x%08X", handle); 816 LOG_TRACE(Kernel_SVC, "called timer=0x%08X", handle);
@@ -825,7 +825,7 @@ static ResultCode SetTimer(Handle handle, s64 initial, s64 interval) {
825} 825}
826 826
827/// Cancels a timer 827/// Cancels a timer
828static ResultCode CancelTimer(Handle handle) { 828static ResultCode CancelTimer(Kernel::Handle handle) {
829 using Kernel::Timer; 829 using Kernel::Timer;
830 830
831 LOG_TRACE(Kernel_SVC, "called timer=0x%08X", handle); 831 LOG_TRACE(Kernel_SVC, "called timer=0x%08X", handle);
@@ -860,7 +860,7 @@ static s64 GetSystemTick() {
860} 860}
861 861
862/// Creates a memory block at the specified address with the specified permissions and size 862/// Creates a memory block at the specified address with the specified permissions and size
863static ResultCode CreateMemoryBlock(Handle* out_handle, u32 addr, u32 size, u32 my_permission, 863static ResultCode CreateMemoryBlock(Kernel::Handle* out_handle, u32 addr, u32 size, u32 my_permission,
864 u32 other_permission) { 864 u32 other_permission) {
865 using Kernel::SharedMemory; 865 using Kernel::SharedMemory;
866 866
@@ -912,7 +912,7 @@ static ResultCode CreateMemoryBlock(Handle* out_handle, u32 addr, u32 size, u32
912 return RESULT_SUCCESS; 912 return RESULT_SUCCESS;
913} 913}
914 914
915static ResultCode CreatePort(Handle* server_port, Handle* client_port, const char* name, 915static ResultCode CreatePort(Kernel::Handle* server_port, Kernel::Handle* client_port, const char* name,
916 u32 max_sessions) { 916 u32 max_sessions) {
917 // TODO(Subv): Implement named ports. 917 // TODO(Subv): Implement named ports.
918 ASSERT_MSG(name == nullptr, "Named ports are currently unimplemented"); 918 ASSERT_MSG(name == nullptr, "Named ports are currently unimplemented");
@@ -978,7 +978,7 @@ static ResultCode GetSystemInfo(s64* out, u32 type, s32 param) {
978 return RESULT_SUCCESS; 978 return RESULT_SUCCESS;
979} 979}
980 980
981static ResultCode GetProcessInfo(s64* out, Handle process_handle, u32 type) { 981static ResultCode GetProcessInfo(s64* out, Kernel::Handle process_handle, u32 type) {
982 LOG_TRACE(Kernel_SVC, "called process=0x%08X type=%u", process_handle, type); 982 LOG_TRACE(Kernel_SVC, "called process=0x%08X type=%u", process_handle, type);
983 983
984 using Kernel::Process; 984 using Kernel::Process;
@@ -1185,7 +1185,7 @@ void CallSVC(u32 immediate) {
1185 if (info->func) { 1185 if (info->func) {
1186 info->func(); 1186 info->func();
1187 // TODO(Subv): Not all service functions should cause a reschedule in all cases. 1187 // TODO(Subv): Not all service functions should cause a reschedule in all cases.
1188 HLE::Reschedule(__func__); 1188 Core::System::GetInstance().PrepareReschedule();
1189 } else { 1189 } else {
1190 LOG_ERROR(Kernel_SVC, "unimplemented SVC function %s(..)", info->name); 1190 LOG_ERROR(Kernel_SVC, "unimplemented SVC function %s(..)", info->name);
1191 } 1191 }