diff options
Diffstat (limited to 'src/core/hle/svc.cpp')
| -rw-r--r-- | src/core/hle/svc.cpp | 47 |
1 files changed, 46 insertions, 1 deletions
diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp index 45d5f3c5d..7f63ff505 100644 --- a/src/core/hle/svc.cpp +++ b/src/core/hle/svc.cpp | |||
| @@ -778,6 +778,51 @@ static ResultCode CreateMemoryBlock(Handle* out_handle, u32 addr, u32 size, u32 | |||
| 778 | return RESULT_SUCCESS; | 778 | return RESULT_SUCCESS; |
| 779 | } | 779 | } |
| 780 | 780 | ||
| 781 | static ResultCode GetSystemInfo(s64* out, u32 type, s32 param) { | ||
| 782 | using Kernel::MemoryRegion; | ||
| 783 | |||
| 784 | LOG_TRACE(Kernel_SVC, "called process=0x%08X type=%u param=%d", process_handle, type, param); | ||
| 785 | |||
| 786 | switch ((SystemInfoType)type) { | ||
| 787 | case SystemInfoType::REGION_MEMORY_USAGE: | ||
| 788 | switch ((SystemInfoMemUsageRegion)param) { | ||
| 789 | case SystemInfoMemUsageRegion::ALL: | ||
| 790 | *out = Kernel::GetMemoryRegion(Kernel::MemoryRegion::APPLICATION)->used | ||
| 791 | + Kernel::GetMemoryRegion(Kernel::MemoryRegion::SYSTEM)->used | ||
| 792 | + Kernel::GetMemoryRegion(Kernel::MemoryRegion::BASE)->used; | ||
| 793 | break; | ||
| 794 | case SystemInfoMemUsageRegion::APPLICATION: | ||
| 795 | *out = Kernel::GetMemoryRegion(Kernel::MemoryRegion::APPLICATION)->used; | ||
| 796 | break; | ||
| 797 | case SystemInfoMemUsageRegion::SYSTEM: | ||
| 798 | *out = Kernel::GetMemoryRegion(Kernel::MemoryRegion::SYSTEM)->used; | ||
| 799 | break; | ||
| 800 | case SystemInfoMemUsageRegion::BASE: | ||
| 801 | *out = Kernel::GetMemoryRegion(Kernel::MemoryRegion::BASE)->used; | ||
| 802 | break; | ||
| 803 | default: | ||
| 804 | LOG_ERROR(Kernel_SVC, "unknown GetSystemInfo type=0 region: param=%d", param); | ||
| 805 | *out = 0; | ||
| 806 | break; | ||
| 807 | } | ||
| 808 | break; | ||
| 809 | case SystemInfoType::KERNEL_ALLOCATED_PAGES: | ||
| 810 | LOG_ERROR(Kernel_SVC, "unimplemented GetSystemInfo type=2 param=%d", type, param); | ||
| 811 | *out = 0; | ||
| 812 | break; | ||
| 813 | case SystemInfoType::KERNEL_SPAWNED_PIDS: | ||
| 814 | *out = 5; | ||
| 815 | break; | ||
| 816 | default: | ||
| 817 | LOG_ERROR(Kernel_SVC, "unknown GetSystemInfo type=%u param=%d", type, param); | ||
| 818 | *out = 0; | ||
| 819 | break; | ||
| 820 | } | ||
| 821 | |||
| 822 | // This function never returns an error, even if invalid parameters were passed. | ||
| 823 | return RESULT_SUCCESS; | ||
| 824 | } | ||
| 825 | |||
| 781 | static ResultCode GetProcessInfo(s64* out, Handle process_handle, u32 type) { | 826 | static ResultCode GetProcessInfo(s64* out, Handle process_handle, u32 type) { |
| 782 | LOG_TRACE(Kernel_SVC, "called process=0x%08X type=%u", process_handle, type); | 827 | LOG_TRACE(Kernel_SVC, "called process=0x%08X type=%u", process_handle, type); |
| 783 | 828 | ||
| @@ -877,7 +922,7 @@ static const FunctionDef SVC_Table[] = { | |||
| 877 | {0x27, HLE::Wrap<DuplicateHandle>, "DuplicateHandle"}, | 922 | {0x27, HLE::Wrap<DuplicateHandle>, "DuplicateHandle"}, |
| 878 | {0x28, HLE::Wrap<GetSystemTick>, "GetSystemTick"}, | 923 | {0x28, HLE::Wrap<GetSystemTick>, "GetSystemTick"}, |
| 879 | {0x29, nullptr, "GetHandleInfo"}, | 924 | {0x29, nullptr, "GetHandleInfo"}, |
| 880 | {0x2A, nullptr, "GetSystemInfo"}, | 925 | {0x2A, HLE::Wrap<GetSystemInfo>, "GetSystemInfo"}, |
| 881 | {0x2B, HLE::Wrap<GetProcessInfo>, "GetProcessInfo"}, | 926 | {0x2B, HLE::Wrap<GetProcessInfo>, "GetProcessInfo"}, |
| 882 | {0x2C, nullptr, "GetThreadInfo"}, | 927 | {0x2C, nullptr, "GetThreadInfo"}, |
| 883 | {0x2D, HLE::Wrap<ConnectToPort>, "ConnectToPort"}, | 928 | {0x2D, HLE::Wrap<ConnectToPort>, "ConnectToPort"}, |