summaryrefslogtreecommitdiffstats
path: root/src/core/hle/svc.cpp
diff options
context:
space:
mode:
authorYuri Kunde Schlesner <yuriks@yuriks.net>2015-08-06 02:39:53 +0200
committerYuri Kunde Schlesner <yuriks@yuriks.net>2015-08-16 06:03:48 +0200
commit14eca982f4da2bfd4d2c105bc33722e88e59da5f (patch)
treed812de676c6e2d056ac43abec89251aa36162165 /src/core/hle/svc.cpp
parentKernel: Add more infrastructure to support different memory layouts (diff)
downloadyuzu-14eca982f4da2bfd4d2c105bc33722e88e59da5f.tar
yuzu-14eca982f4da2bfd4d2c105bc33722e88e59da5f.tar.gz
yuzu-14eca982f4da2bfd4d2c105bc33722e88e59da5f.tar.bz2
yuzu-14eca982f4da2bfd4d2c105bc33722e88e59da5f.tar.lz
yuzu-14eca982f4da2bfd4d2c105bc33722e88e59da5f.tar.xz
yuzu-14eca982f4da2bfd4d2c105bc33722e88e59da5f.tar.zst
yuzu-14eca982f4da2bfd4d2c105bc33722e88e59da5f.zip
Diffstat (limited to 'src/core/hle/svc.cpp')
-rw-r--r--src/core/hle/svc.cpp48
1 files changed, 47 insertions, 1 deletions
diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp
index e1a416def..89ac45a6f 100644
--- a/src/core/hle/svc.cpp
+++ b/src/core/hle/svc.cpp
@@ -774,6 +774,52 @@ static ResultCode CreateMemoryBlock(Handle* out_handle, u32 addr, u32 size, u32
return RESULT_SUCCESS;
}
+static ResultCode GetProcessInfo(s64* out, Handle process_handle, u32 type) {
+ LOG_TRACE(Kernel_SVC, "called process=0x%08X type=%u", process_handle, type);
+
+ using Kernel::Process;
+ Kernel::SharedPtr<Process> process = Kernel::g_handle_table.Get<Process>(process_handle);
+ if (process == nullptr)
+ return ERR_INVALID_HANDLE;
+
+ switch (type) {
+ case 0:
+ case 2:
+ // TODO(yuriks): Type 0 returns a slightly higher number than type 2, but I'm not sure
+ // what's the difference between them.
+ *out = process->heap_used + process->linear_heap_used + process->misc_memory_used;
+ break;
+ case 1:
+ case 3:
+ case 4:
+ case 5:
+ case 6:
+ case 7:
+ case 8:
+ // These are valid, but not implemented yet
+ LOG_ERROR(Kernel_SVC, "unimplemented GetProcessInfo type=%u", type);
+ break;
+ case 20:
+ *out = Memory::FCRAM_PADDR - process->GetLinearHeapBase();
+ break;
+ default:
+ LOG_ERROR(Kernel_SVC, "unknown GetProcessInfo type=%u", type);
+
+ if (type >= 21 && type <= 23) {
+ return ResultCode( // 0xE0E01BF4
+ ErrorDescription::NotImplemented, ErrorModule::OS,
+ ErrorSummary::InvalidArgument, ErrorLevel::Usage);
+ } else {
+ return ResultCode( // 0xD8E007ED
+ ErrorDescription::InvalidEnumValue, ErrorModule::Kernel,
+ ErrorSummary::InvalidArgument, ErrorLevel::Permanent);
+ }
+ break;
+ }
+
+ return RESULT_SUCCESS;
+}
+
namespace {
struct FunctionDef {
using Func = void();
@@ -828,7 +874,7 @@ static const FunctionDef SVC_Table[] = {
{0x28, HLE::Wrap<GetSystemTick>, "GetSystemTick"},
{0x29, nullptr, "GetHandleInfo"},
{0x2A, nullptr, "GetSystemInfo"},
- {0x2B, nullptr, "GetProcessInfo"},
+ {0x2B, HLE::Wrap<GetProcessInfo>, "GetProcessInfo"},
{0x2C, nullptr, "GetThreadInfo"},
{0x2D, HLE::Wrap<ConnectToPort>, "ConnectToPort"},
{0x2E, nullptr, "SendSyncRequest1"},