diff options
Diffstat (limited to 'src/core/hle/svc.cpp')
| -rw-r--r-- | src/core/hle/svc.cpp | 92 |
1 files changed, 46 insertions, 46 deletions
diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp index 5839d7230..2ca270de3 100644 --- a/src/core/hle/svc.cpp +++ b/src/core/hle/svc.cpp | |||
| @@ -166,7 +166,8 @@ 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 |
| 169 | static ResultCode MapMemoryBlock(Handle handle, u32 addr, u32 permissions, u32 other_permissions) { | 169 | static ResultCode MapMemoryBlock(Kernel::Handle handle, u32 addr, u32 permissions, |
| 170 | u32 other_permissions) { | ||
| 170 | using Kernel::SharedMemory; | 171 | using Kernel::SharedMemory; |
| 171 | using Kernel::MemoryPermission; | 172 | using Kernel::MemoryPermission; |
| 172 | 173 | ||
| @@ -198,7 +199,7 @@ static ResultCode MapMemoryBlock(Handle handle, u32 addr, u32 permissions, u32 o | |||
| 198 | ErrorSummary::InvalidArgument, ErrorLevel::Usage); | 199 | ErrorSummary::InvalidArgument, ErrorLevel::Usage); |
| 199 | } | 200 | } |
| 200 | 201 | ||
| 201 | static ResultCode UnmapMemoryBlock(Handle handle, u32 addr) { | 202 | static ResultCode UnmapMemoryBlock(Kernel::Handle handle, u32 addr) { |
| 202 | using Kernel::SharedMemory; | 203 | using Kernel::SharedMemory; |
| 203 | 204 | ||
| 204 | LOG_TRACE(Kernel_SVC, "called memblock=0x%08X, addr=0x%08X", handle, addr); | 205 | LOG_TRACE(Kernel_SVC, "called memblock=0x%08X, addr=0x%08X", handle, addr); |
| @@ -213,7 +214,7 @@ static ResultCode UnmapMemoryBlock(Handle handle, u32 addr) { | |||
| 213 | } | 214 | } |
| 214 | 215 | ||
| 215 | /// Connect to an OS service given the port name, returns the handle to the port to out | 216 | /// Connect to an OS service given the port name, returns the handle to the port to out |
| 216 | static ResultCode ConnectToPort(Handle* out_handle, const char* port_name) { | 217 | static ResultCode ConnectToPort(Kernel::Handle* out_handle, const char* port_name) { |
| 217 | if (port_name == nullptr) | 218 | if (port_name == nullptr) |
| 218 | return ERR_NOT_FOUND; | 219 | return ERR_NOT_FOUND; |
| 219 | if (std::strlen(port_name) > 11) | 220 | if (std::strlen(port_name) > 11) |
| @@ -238,7 +239,7 @@ static ResultCode ConnectToPort(Handle* out_handle, const char* port_name) { | |||
| 238 | } | 239 | } |
| 239 | 240 | ||
| 240 | /// Makes a blocking IPC call to an OS service. | 241 | /// Makes a blocking IPC call to an OS service. |
| 241 | static ResultCode SendSyncRequest(Handle handle) { | 242 | static ResultCode SendSyncRequest(Kernel::Handle handle) { |
| 242 | SharedPtr<Kernel::ClientSession> session = | 243 | SharedPtr<Kernel::ClientSession> session = |
| 243 | Kernel::g_handle_table.Get<Kernel::ClientSession>(handle); | 244 | Kernel::g_handle_table.Get<Kernel::ClientSession>(handle); |
| 244 | if (session == nullptr) { | 245 | if (session == nullptr) { |
| @@ -253,13 +254,13 @@ static ResultCode SendSyncRequest(Handle handle) { | |||
| 253 | } | 254 | } |
| 254 | 255 | ||
| 255 | /// Close a handle | 256 | /// Close a handle |
| 256 | static ResultCode CloseHandle(Handle handle) { | 257 | static ResultCode CloseHandle(Kernel::Handle handle) { |
| 257 | LOG_TRACE(Kernel_SVC, "Closing handle 0x%08X", handle); | 258 | LOG_TRACE(Kernel_SVC, "Closing handle 0x%08X", handle); |
| 258 | return Kernel::g_handle_table.Close(handle); | 259 | return Kernel::g_handle_table.Close(handle); |
| 259 | } | 260 | } |
| 260 | 261 | ||
| 261 | /// Wait for a handle to synchronize, timeout after the specified nanoseconds | 262 | /// Wait for a handle to synchronize, timeout after the specified nanoseconds |
| 262 | static ResultCode WaitSynchronization1(Handle handle, s64 nano_seconds) { | 263 | static ResultCode WaitSynchronization1(Kernel::Handle handle, s64 nano_seconds) { |
| 263 | auto object = Kernel::g_handle_table.GetWaitObject(handle); | 264 | auto object = Kernel::g_handle_table.GetWaitObject(handle); |
| 264 | Kernel::Thread* thread = Kernel::GetCurrentThread(); | 265 | Kernel::Thread* thread = Kernel::GetCurrentThread(); |
| 265 | 266 | ||
| @@ -295,8 +296,8 @@ static ResultCode WaitSynchronization1(Handle handle, s64 nano_seconds) { | |||
| 295 | } | 296 | } |
| 296 | 297 | ||
| 297 | /// Wait for the given handles to synchronize, timeout after the specified nanoseconds | 298 | /// Wait for the given handles to synchronize, timeout after the specified nanoseconds |
| 298 | static ResultCode WaitSynchronizationN(s32* out, Handle* handles, s32 handle_count, bool wait_all, | 299 | static ResultCode WaitSynchronizationN(s32* out, Kernel::Handle* handles, s32 handle_count, |
| 299 | s64 nano_seconds) { | 300 | bool wait_all, s64 nano_seconds) { |
| 300 | Kernel::Thread* thread = Kernel::GetCurrentThread(); | 301 | Kernel::Thread* thread = Kernel::GetCurrentThread(); |
| 301 | 302 | ||
| 302 | // Check if 'handles' is invalid | 303 | // Check if 'handles' is invalid |
| @@ -423,7 +424,7 @@ static ResultCode WaitSynchronizationN(s32* out, Handle* handles, s32 handle_cou | |||
| 423 | } | 424 | } |
| 424 | 425 | ||
| 425 | /// Create an address arbiter (to allocate access to shared resources) | 426 | /// Create an address arbiter (to allocate access to shared resources) |
| 426 | static ResultCode CreateAddressArbiter(Handle* out_handle) { | 427 | static ResultCode CreateAddressArbiter(Kernel::Handle* out_handle) { |
| 427 | using Kernel::AddressArbiter; | 428 | using Kernel::AddressArbiter; |
| 428 | 429 | ||
| 429 | SharedPtr<AddressArbiter> arbiter = AddressArbiter::Create(); | 430 | SharedPtr<AddressArbiter> arbiter = AddressArbiter::Create(); |
| @@ -433,7 +434,7 @@ static ResultCode CreateAddressArbiter(Handle* out_handle) { | |||
| 433 | } | 434 | } |
| 434 | 435 | ||
| 435 | /// Arbitrate address | 436 | /// Arbitrate address |
| 436 | static ResultCode ArbitrateAddress(Handle handle, u32 address, u32 type, u32 value, | 437 | static ResultCode ArbitrateAddress(Kernel::Handle handle, u32 address, u32 type, u32 value, |
| 437 | s64 nanoseconds) { | 438 | s64 nanoseconds) { |
| 438 | using Kernel::AddressArbiter; | 439 | using Kernel::AddressArbiter; |
| 439 | 440 | ||
| @@ -476,7 +477,7 @@ static void OutputDebugString(const char* string) { | |||
| 476 | } | 477 | } |
| 477 | 478 | ||
| 478 | /// Get resource limit | 479 | /// Get resource limit |
| 479 | static ResultCode GetResourceLimit(Handle* resource_limit, Handle process_handle) { | 480 | static ResultCode GetResourceLimit(Kernel::Handle* resource_limit, Kernel::Handle process_handle) { |
| 480 | LOG_TRACE(Kernel_SVC, "called process=0x%08X", process_handle); | 481 | LOG_TRACE(Kernel_SVC, "called process=0x%08X", process_handle); |
| 481 | 482 | ||
| 482 | SharedPtr<Kernel::Process> process = | 483 | SharedPtr<Kernel::Process> process = |
| @@ -490,7 +491,7 @@ static ResultCode GetResourceLimit(Handle* resource_limit, Handle process_handle | |||
| 490 | } | 491 | } |
| 491 | 492 | ||
| 492 | /// Get resource limit current values | 493 | /// Get resource limit current values |
| 493 | static ResultCode GetResourceLimitCurrentValues(s64* values, Handle resource_limit_handle, | 494 | static ResultCode GetResourceLimitCurrentValues(s64* values, Kernel::Handle resource_limit_handle, |
| 494 | u32* names, u32 name_count) { | 495 | u32* names, u32 name_count) { |
| 495 | LOG_TRACE(Kernel_SVC, "called resource_limit=%08X, names=%p, name_count=%d", | 496 | LOG_TRACE(Kernel_SVC, "called resource_limit=%08X, names=%p, name_count=%d", |
| 496 | resource_limit_handle, names, name_count); | 497 | resource_limit_handle, names, name_count); |
| @@ -507,8 +508,8 @@ static ResultCode GetResourceLimitCurrentValues(s64* values, Handle resource_lim | |||
| 507 | } | 508 | } |
| 508 | 509 | ||
| 509 | /// Get resource limit max values | 510 | /// Get resource limit max values |
| 510 | static ResultCode GetResourceLimitLimitValues(s64* values, Handle resource_limit_handle, u32* names, | 511 | static ResultCode GetResourceLimitLimitValues(s64* values, Kernel::Handle resource_limit_handle, |
| 511 | u32 name_count) { | 512 | u32* names, u32 name_count) { |
| 512 | LOG_TRACE(Kernel_SVC, "called resource_limit=%08X, names=%p, name_count=%d", | 513 | LOG_TRACE(Kernel_SVC, "called resource_limit=%08X, names=%p, name_count=%d", |
| 513 | resource_limit_handle, names, name_count); | 514 | resource_limit_handle, names, name_count); |
| 514 | 515 | ||
| @@ -524,7 +525,7 @@ static ResultCode GetResourceLimitLimitValues(s64* values, Handle resource_limit | |||
| 524 | } | 525 | } |
| 525 | 526 | ||
| 526 | /// Creates a new thread | 527 | /// Creates a new thread |
| 527 | static ResultCode CreateThread(Handle* out_handle, s32 priority, u32 entry_point, u32 arg, | 528 | static ResultCode CreateThread(Kernel::Handle* out_handle, s32 priority, u32 entry_point, u32 arg, |
| 528 | u32 stack_top, s32 processor_id) { | 529 | u32 stack_top, s32 processor_id) { |
| 529 | using Kernel::Thread; | 530 | using Kernel::Thread; |
| 530 | 531 | ||
| @@ -582,13 +583,13 @@ static ResultCode CreateThread(Handle* out_handle, s32 priority, u32 entry_point | |||
| 582 | 583 | ||
| 583 | /// Called when a thread exits | 584 | /// Called when a thread exits |
| 584 | static void ExitThread() { | 585 | static void ExitThread() { |
| 585 | LOG_TRACE(Kernel_SVC, "called, pc=0x%08X", Core::g_app_core->GetPC()); | 586 | LOG_TRACE(Kernel_SVC, "called, pc=0x%08X", Core::CPU().GetPC()); |
| 586 | 587 | ||
| 587 | Kernel::ExitCurrentThread(); | 588 | Kernel::ExitCurrentThread(); |
| 588 | } | 589 | } |
| 589 | 590 | ||
| 590 | /// Gets the priority for the specified thread | 591 | /// Gets the priority for the specified thread |
| 591 | static ResultCode GetThreadPriority(s32* priority, Handle handle) { | 592 | static ResultCode GetThreadPriority(s32* priority, Kernel::Handle handle) { |
| 592 | const SharedPtr<Kernel::Thread> thread = Kernel::g_handle_table.Get<Kernel::Thread>(handle); | 593 | const SharedPtr<Kernel::Thread> thread = Kernel::g_handle_table.Get<Kernel::Thread>(handle); |
| 593 | if (thread == nullptr) | 594 | if (thread == nullptr) |
| 594 | return ERR_INVALID_HANDLE; | 595 | return ERR_INVALID_HANDLE; |
| @@ -598,7 +599,7 @@ static ResultCode GetThreadPriority(s32* priority, Handle handle) { | |||
| 598 | } | 599 | } |
| 599 | 600 | ||
| 600 | /// Sets the priority for the specified thread | 601 | /// Sets the priority for the specified thread |
| 601 | static ResultCode SetThreadPriority(Handle handle, s32 priority) { | 602 | static ResultCode SetThreadPriority(Kernel::Handle handle, s32 priority) { |
| 602 | SharedPtr<Kernel::Thread> thread = Kernel::g_handle_table.Get<Kernel::Thread>(handle); | 603 | SharedPtr<Kernel::Thread> thread = Kernel::g_handle_table.Get<Kernel::Thread>(handle); |
| 603 | if (thread == nullptr) | 604 | if (thread == nullptr) |
| 604 | return ERR_INVALID_HANDLE; | 605 | return ERR_INVALID_HANDLE; |
| @@ -608,11 +609,11 @@ static ResultCode SetThreadPriority(Handle handle, s32 priority) { | |||
| 608 | } | 609 | } |
| 609 | 610 | ||
| 610 | /// Create a mutex | 611 | /// Create a mutex |
| 611 | static ResultCode CreateMutex(Handle* out_handle, u32 initial_locked) { | 612 | static ResultCode CreateMutex(Kernel::Handle* out_handle, u32 initial_locked) { |
| 612 | using Kernel::Mutex; | 613 | using Kernel::Mutex; |
| 613 | 614 | ||
| 614 | SharedPtr<Mutex> mutex = Mutex::Create(initial_locked != 0); | 615 | SharedPtr<Mutex> mutex = Mutex::Create(initial_locked != 0); |
| 615 | mutex->name = Common::StringFromFormat("mutex-%08x", Core::g_app_core->GetReg(14)); | 616 | mutex->name = Common::StringFromFormat("mutex-%08x", Core::CPU().GetReg(14)); |
| 616 | CASCADE_RESULT(*out_handle, Kernel::g_handle_table.Create(std::move(mutex))); | 617 | CASCADE_RESULT(*out_handle, Kernel::g_handle_table.Create(std::move(mutex))); |
| 617 | 618 | ||
| 618 | LOG_TRACE(Kernel_SVC, "called initial_locked=%s : created handle=0x%08X", | 619 | LOG_TRACE(Kernel_SVC, "called initial_locked=%s : created handle=0x%08X", |
| @@ -622,7 +623,7 @@ static ResultCode CreateMutex(Handle* out_handle, u32 initial_locked) { | |||
| 622 | } | 623 | } |
| 623 | 624 | ||
| 624 | /// Release a mutex | 625 | /// Release a mutex |
| 625 | static ResultCode ReleaseMutex(Handle handle) { | 626 | static ResultCode ReleaseMutex(Kernel::Handle handle) { |
| 626 | using Kernel::Mutex; | 627 | using Kernel::Mutex; |
| 627 | 628 | ||
| 628 | LOG_TRACE(Kernel_SVC, "called handle=0x%08X", handle); | 629 | LOG_TRACE(Kernel_SVC, "called handle=0x%08X", handle); |
| @@ -637,7 +638,7 @@ static ResultCode ReleaseMutex(Handle handle) { | |||
| 637 | } | 638 | } |
| 638 | 639 | ||
| 639 | /// Get the ID of the specified process | 640 | /// Get the ID of the specified process |
| 640 | static ResultCode GetProcessId(u32* process_id, Handle process_handle) { | 641 | static ResultCode GetProcessId(u32* process_id, Kernel::Handle process_handle) { |
| 641 | LOG_TRACE(Kernel_SVC, "called process=0x%08X", process_handle); | 642 | LOG_TRACE(Kernel_SVC, "called process=0x%08X", process_handle); |
| 642 | 643 | ||
| 643 | const SharedPtr<Kernel::Process> process = | 644 | const SharedPtr<Kernel::Process> process = |
| @@ -650,7 +651,7 @@ static ResultCode GetProcessId(u32* process_id, Handle process_handle) { | |||
| 650 | } | 651 | } |
| 651 | 652 | ||
| 652 | /// Get the ID of the process that owns the specified thread | 653 | /// Get the ID of the process that owns the specified thread |
| 653 | static ResultCode GetProcessIdOfThread(u32* process_id, Handle thread_handle) { | 654 | static ResultCode GetProcessIdOfThread(u32* process_id, Kernel::Handle thread_handle) { |
| 654 | LOG_TRACE(Kernel_SVC, "called thread=0x%08X", thread_handle); | 655 | LOG_TRACE(Kernel_SVC, "called thread=0x%08X", thread_handle); |
| 655 | 656 | ||
| 656 | const SharedPtr<Kernel::Thread> thread = | 657 | const SharedPtr<Kernel::Thread> thread = |
| @@ -667,7 +668,7 @@ static ResultCode GetProcessIdOfThread(u32* process_id, Handle thread_handle) { | |||
| 667 | } | 668 | } |
| 668 | 669 | ||
| 669 | /// Get the ID for the specified thread. | 670 | /// Get the ID for the specified thread. |
| 670 | static ResultCode GetThreadId(u32* thread_id, Handle handle) { | 671 | static ResultCode GetThreadId(u32* thread_id, Kernel::Handle handle) { |
| 671 | LOG_TRACE(Kernel_SVC, "called thread=0x%08X", handle); | 672 | LOG_TRACE(Kernel_SVC, "called thread=0x%08X", handle); |
| 672 | 673 | ||
| 673 | const SharedPtr<Kernel::Thread> thread = Kernel::g_handle_table.Get<Kernel::Thread>(handle); | 674 | const SharedPtr<Kernel::Thread> thread = Kernel::g_handle_table.Get<Kernel::Thread>(handle); |
| @@ -679,11 +680,11 @@ static ResultCode GetThreadId(u32* thread_id, Handle handle) { | |||
| 679 | } | 680 | } |
| 680 | 681 | ||
| 681 | /// Creates a semaphore | 682 | /// Creates a semaphore |
| 682 | static ResultCode CreateSemaphore(Handle* out_handle, s32 initial_count, s32 max_count) { | 683 | static ResultCode CreateSemaphore(Kernel::Handle* out_handle, s32 initial_count, s32 max_count) { |
| 683 | using Kernel::Semaphore; | 684 | using Kernel::Semaphore; |
| 684 | 685 | ||
| 685 | CASCADE_RESULT(SharedPtr<Semaphore> semaphore, Semaphore::Create(initial_count, max_count)); | 686 | CASCADE_RESULT(SharedPtr<Semaphore> semaphore, Semaphore::Create(initial_count, max_count)); |
| 686 | semaphore->name = Common::StringFromFormat("semaphore-%08x", Core::g_app_core->GetReg(14)); | 687 | semaphore->name = Common::StringFromFormat("semaphore-%08x", Core::CPU().GetReg(14)); |
| 687 | CASCADE_RESULT(*out_handle, Kernel::g_handle_table.Create(std::move(semaphore))); | 688 | CASCADE_RESULT(*out_handle, Kernel::g_handle_table.Create(std::move(semaphore))); |
| 688 | 689 | ||
| 689 | LOG_TRACE(Kernel_SVC, "called initial_count=%d, max_count=%d, created handle=0x%08X", | 690 | LOG_TRACE(Kernel_SVC, "called initial_count=%d, max_count=%d, created handle=0x%08X", |
| @@ -692,7 +693,7 @@ static ResultCode CreateSemaphore(Handle* out_handle, s32 initial_count, s32 max | |||
| 692 | } | 693 | } |
| 693 | 694 | ||
| 694 | /// Releases a certain number of slots in a semaphore | 695 | /// Releases a certain number of slots in a semaphore |
| 695 | static ResultCode ReleaseSemaphore(s32* count, Handle handle, s32 release_count) { | 696 | static ResultCode ReleaseSemaphore(s32* count, Kernel::Handle handle, s32 release_count) { |
| 696 | using Kernel::Semaphore; | 697 | using Kernel::Semaphore; |
| 697 | 698 | ||
| 698 | LOG_TRACE(Kernel_SVC, "called release_count=%d, handle=0x%08X", release_count, handle); | 699 | LOG_TRACE(Kernel_SVC, "called release_count=%d, handle=0x%08X", release_count, handle); |
| @@ -708,7 +709,7 @@ static ResultCode ReleaseSemaphore(s32* count, Handle handle, s32 release_count) | |||
| 708 | 709 | ||
| 709 | /// Query process memory | 710 | /// Query process memory |
| 710 | static ResultCode QueryProcessMemory(MemoryInfo* memory_info, PageInfo* page_info, | 711 | static ResultCode QueryProcessMemory(MemoryInfo* memory_info, PageInfo* page_info, |
| 711 | Handle process_handle, u32 addr) { | 712 | Kernel::Handle process_handle, u32 addr) { |
| 712 | using Kernel::Process; | 713 | using Kernel::Process; |
| 713 | Kernel::SharedPtr<Process> process = Kernel::g_handle_table.Get<Process>(process_handle); | 714 | Kernel::SharedPtr<Process> process = Kernel::g_handle_table.Get<Process>(process_handle); |
| 714 | if (process == nullptr) | 715 | if (process == nullptr) |
| @@ -736,11 +737,11 @@ static ResultCode QueryMemory(MemoryInfo* memory_info, PageInfo* page_info, u32 | |||
| 736 | } | 737 | } |
| 737 | 738 | ||
| 738 | /// Create an event | 739 | /// Create an event |
| 739 | static ResultCode CreateEvent(Handle* out_handle, u32 reset_type) { | 740 | static ResultCode CreateEvent(Kernel::Handle* out_handle, u32 reset_type) { |
| 740 | using Kernel::Event; | 741 | using Kernel::Event; |
| 741 | 742 | ||
| 742 | SharedPtr<Event> evt = Event::Create(static_cast<Kernel::ResetType>(reset_type)); | 743 | SharedPtr<Event> evt = Event::Create(static_cast<Kernel::ResetType>(reset_type)); |
| 743 | evt->name = Common::StringFromFormat("event-%08x", Core::g_app_core->GetReg(14)); | 744 | evt->name = Common::StringFromFormat("event-%08x", Core::CPU().GetReg(14)); |
| 744 | CASCADE_RESULT(*out_handle, Kernel::g_handle_table.Create(std::move(evt))); | 745 | CASCADE_RESULT(*out_handle, Kernel::g_handle_table.Create(std::move(evt))); |
| 745 | 746 | ||
| 746 | LOG_TRACE(Kernel_SVC, "called reset_type=0x%08X : created handle=0x%08X", reset_type, | 747 | LOG_TRACE(Kernel_SVC, "called reset_type=0x%08X : created handle=0x%08X", reset_type, |
| @@ -749,14 +750,14 @@ static ResultCode CreateEvent(Handle* out_handle, u32 reset_type) { | |||
| 749 | } | 750 | } |
| 750 | 751 | ||
| 751 | /// Duplicates a kernel handle | 752 | /// Duplicates a kernel handle |
| 752 | static ResultCode DuplicateHandle(Handle* out, Handle handle) { | 753 | static ResultCode DuplicateHandle(Kernel::Handle* out, Kernel::Handle handle) { |
| 753 | CASCADE_RESULT(*out, Kernel::g_handle_table.Duplicate(handle)); | 754 | CASCADE_RESULT(*out, Kernel::g_handle_table.Duplicate(handle)); |
| 754 | LOG_TRACE(Kernel_SVC, "duplicated 0x%08X to 0x%08X", handle, *out); | 755 | LOG_TRACE(Kernel_SVC, "duplicated 0x%08X to 0x%08X", handle, *out); |
| 755 | return RESULT_SUCCESS; | 756 | return RESULT_SUCCESS; |
| 756 | } | 757 | } |
| 757 | 758 | ||
| 758 | /// Signals an event | 759 | /// Signals an event |
| 759 | static ResultCode SignalEvent(Handle handle) { | 760 | static ResultCode SignalEvent(Kernel::Handle handle) { |
| 760 | using Kernel::Event; | 761 | using Kernel::Event; |
| 761 | LOG_TRACE(Kernel_SVC, "called event=0x%08X", handle); | 762 | LOG_TRACE(Kernel_SVC, "called event=0x%08X", handle); |
| 762 | 763 | ||
| @@ -770,7 +771,7 @@ static ResultCode SignalEvent(Handle handle) { | |||
| 770 | } | 771 | } |
| 771 | 772 | ||
| 772 | /// Clears an event | 773 | /// Clears an event |
| 773 | static ResultCode ClearEvent(Handle handle) { | 774 | static ResultCode ClearEvent(Kernel::Handle handle) { |
| 774 | using Kernel::Event; | 775 | using Kernel::Event; |
| 775 | LOG_TRACE(Kernel_SVC, "called event=0x%08X", handle); | 776 | LOG_TRACE(Kernel_SVC, "called event=0x%08X", handle); |
| 776 | 777 | ||
| @@ -783,11 +784,11 @@ static ResultCode ClearEvent(Handle handle) { | |||
| 783 | } | 784 | } |
| 784 | 785 | ||
| 785 | /// Creates a timer | 786 | /// Creates a timer |
| 786 | static ResultCode CreateTimer(Handle* out_handle, u32 reset_type) { | 787 | static ResultCode CreateTimer(Kernel::Handle* out_handle, u32 reset_type) { |
| 787 | using Kernel::Timer; | 788 | using Kernel::Timer; |
| 788 | 789 | ||
| 789 | SharedPtr<Timer> timer = Timer::Create(static_cast<Kernel::ResetType>(reset_type)); | 790 | SharedPtr<Timer> timer = Timer::Create(static_cast<Kernel::ResetType>(reset_type)); |
| 790 | timer->name = Common::StringFromFormat("timer-%08x", Core::g_app_core->GetReg(14)); | 791 | timer->name = Common::StringFromFormat("timer-%08x", Core::CPU().GetReg(14)); |
| 791 | CASCADE_RESULT(*out_handle, Kernel::g_handle_table.Create(std::move(timer))); | 792 | CASCADE_RESULT(*out_handle, Kernel::g_handle_table.Create(std::move(timer))); |
| 792 | 793 | ||
| 793 | LOG_TRACE(Kernel_SVC, "called reset_type=0x%08X : created handle=0x%08X", reset_type, | 794 | LOG_TRACE(Kernel_SVC, "called reset_type=0x%08X : created handle=0x%08X", reset_type, |
| @@ -796,7 +797,7 @@ static ResultCode CreateTimer(Handle* out_handle, u32 reset_type) { | |||
| 796 | } | 797 | } |
| 797 | 798 | ||
| 798 | /// Clears a timer | 799 | /// Clears a timer |
| 799 | static ResultCode ClearTimer(Handle handle) { | 800 | static ResultCode ClearTimer(Kernel::Handle handle) { |
| 800 | using Kernel::Timer; | 801 | using Kernel::Timer; |
| 801 | 802 | ||
| 802 | LOG_TRACE(Kernel_SVC, "called timer=0x%08X", handle); | 803 | LOG_TRACE(Kernel_SVC, "called timer=0x%08X", handle); |
| @@ -810,7 +811,7 @@ static ResultCode ClearTimer(Handle handle) { | |||
| 810 | } | 811 | } |
| 811 | 812 | ||
| 812 | /// Starts a timer | 813 | /// Starts a timer |
| 813 | static ResultCode SetTimer(Handle handle, s64 initial, s64 interval) { | 814 | static ResultCode SetTimer(Kernel::Handle handle, s64 initial, s64 interval) { |
| 814 | using Kernel::Timer; | 815 | using Kernel::Timer; |
| 815 | 816 | ||
| 816 | LOG_TRACE(Kernel_SVC, "called timer=0x%08X", handle); | 817 | LOG_TRACE(Kernel_SVC, "called timer=0x%08X", handle); |
| @@ -825,7 +826,7 @@ static ResultCode SetTimer(Handle handle, s64 initial, s64 interval) { | |||
| 825 | } | 826 | } |
| 826 | 827 | ||
| 827 | /// Cancels a timer | 828 | /// Cancels a timer |
| 828 | static ResultCode CancelTimer(Handle handle) { | 829 | static ResultCode CancelTimer(Kernel::Handle handle) { |
| 829 | using Kernel::Timer; | 830 | using Kernel::Timer; |
| 830 | 831 | ||
| 831 | LOG_TRACE(Kernel_SVC, "called timer=0x%08X", handle); | 832 | LOG_TRACE(Kernel_SVC, "called timer=0x%08X", handle); |
| @@ -854,14 +855,13 @@ static void SleepThread(s64 nanoseconds) { | |||
| 854 | static s64 GetSystemTick() { | 855 | static s64 GetSystemTick() { |
| 855 | s64 result = CoreTiming::GetTicks(); | 856 | s64 result = CoreTiming::GetTicks(); |
| 856 | // Advance time to defeat dumb games (like Cubic Ninja) that busy-wait for the frame to end. | 857 | // Advance time to defeat dumb games (like Cubic Ninja) that busy-wait for the frame to end. |
| 857 | Core::g_app_core->AddTicks( | 858 | Core::CPU().AddTicks(150); // Measured time between two calls on a 9.2 o3DS with Ninjhax 1.1b |
| 858 | 150); // Measured time between two calls on a 9.2 o3DS with Ninjhax 1.1b | ||
| 859 | return result; | 859 | return result; |
| 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 |
| 863 | static ResultCode CreateMemoryBlock(Handle* out_handle, u32 addr, u32 size, u32 my_permission, | 863 | static ResultCode CreateMemoryBlock(Kernel::Handle* out_handle, u32 addr, u32 size, |
| 864 | u32 other_permission) { | 864 | u32 my_permission, u32 other_permission) { |
| 865 | using Kernel::SharedMemory; | 865 | using Kernel::SharedMemory; |
| 866 | 866 | ||
| 867 | if (size % Memory::PAGE_SIZE != 0) | 867 | if (size % Memory::PAGE_SIZE != 0) |
| @@ -912,8 +912,8 @@ static ResultCode CreateMemoryBlock(Handle* out_handle, u32 addr, u32 size, u32 | |||
| 912 | return RESULT_SUCCESS; | 912 | return RESULT_SUCCESS; |
| 913 | } | 913 | } |
| 914 | 914 | ||
| 915 | static ResultCode CreatePort(Handle* server_port, Handle* client_port, const char* name, | 915 | static ResultCode CreatePort(Kernel::Handle* server_port, Kernel::Handle* client_port, |
| 916 | u32 max_sessions) { | 916 | const char* name, 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"); |
| 919 | 919 | ||
| @@ -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 | ||
| 981 | static ResultCode GetProcessInfo(s64* out, Handle process_handle, u32 type) { | 981 | static 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 | } |