summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/svc.cpp
diff options
context:
space:
mode:
authorGravatar bunnei2018-12-04 12:23:19 -0500
committerGravatar GitHub2018-12-04 12:23:19 -0500
commitda5659fb87bbcb0fd3f77679f2573476b0140860 (patch)
tree31fac2779ca1799a321445ebd2143a60b7d8647f /src/core/hle/kernel/svc.cpp
parentMerge pull request #1854 from Subv/old_command_processor (diff)
parentkernel/handle_table: Amend reference to CTR-OS in Create() (diff)
downloadyuzu-da5659fb87bbcb0fd3f77679f2573476b0140860.tar.gz
yuzu-da5659fb87bbcb0fd3f77679f2573476b0140860.tar.xz
yuzu-da5659fb87bbcb0fd3f77679f2573476b0140860.zip
Merge pull request #1857 from lioncash/res-info
kernel/svc: Implement the resource limit svcGetInfo option
Diffstat (limited to 'src/core/hle/kernel/svc.cpp')
-rw-r--r--src/core/hle/kernel/svc.cpp29
1 files changed, 28 insertions, 1 deletions
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp
index 948989b31..b022a7bc5 100644
--- a/src/core/hle/kernel/svc.cpp
+++ b/src/core/hle/kernel/svc.cpp
@@ -663,7 +663,7 @@ static ResultCode GetInfo(u64* result, u64 info_id, u64 handle, u64 info_sub_id)
663 TotalMemoryUsage = 6, 663 TotalMemoryUsage = 6,
664 TotalHeapUsage = 7, 664 TotalHeapUsage = 7,
665 IsCurrentProcessBeingDebugged = 8, 665 IsCurrentProcessBeingDebugged = 8,
666 ResourceHandleLimit = 9, 666 RegisterResourceLimit = 9,
667 IdleTickCount = 10, 667 IdleTickCount = 10,
668 RandomEntropy = 11, 668 RandomEntropy = 11,
669 PerformanceCounter = 0xF0000002, 669 PerformanceCounter = 0xF0000002,
@@ -787,6 +787,33 @@ static ResultCode GetInfo(u64* result, u64 info_id, u64 handle, u64 info_sub_id)
787 *result = 0; 787 *result = 0;
788 return RESULT_SUCCESS; 788 return RESULT_SUCCESS;
789 789
790 case GetInfoType::RegisterResourceLimit: {
791 if (handle != 0) {
792 return ERR_INVALID_HANDLE;
793 }
794
795 if (info_sub_id != 0) {
796 return ERR_INVALID_COMBINATION;
797 }
798
799 Process* const current_process = Core::CurrentProcess();
800 HandleTable& handle_table = current_process->GetHandleTable();
801 const auto resource_limit = current_process->GetResourceLimit();
802 if (!resource_limit) {
803 *result = KernelHandle::InvalidHandle;
804 // Yes, the kernel considers this a successful operation.
805 return RESULT_SUCCESS;
806 }
807
808 const auto table_result = handle_table.Create(resource_limit);
809 if (table_result.Failed()) {
810 return table_result.Code();
811 }
812
813 *result = *table_result;
814 return RESULT_SUCCESS;
815 }
816
790 case GetInfoType::RandomEntropy: 817 case GetInfoType::RandomEntropy:
791 if (handle != 0) { 818 if (handle != 0) {
792 LOG_ERROR(Kernel_SVC, "Process Handle is non zero, expected 0 result but got {:016X}", 819 LOG_ERROR(Kernel_SVC, "Process Handle is non zero, expected 0 result but got {:016X}",