소스 검색

svc: Implement `ref` parameters (#798)

Allows passing data into and out of the same registers when calling via the Kernel ABI. This allows implementing specific supervisor calls like "CallSecureMonitor", that expect their args and results in the same registers.
jduncanator 6 년 전
부모
커밋
86b42f176a
1개의 변경된 파일10개의 추가작업 그리고 1개의 파일을 삭제
  1. 10 1
      Ryujinx.HLE/HOS/Kernel/SupervisorCall/SvcTable.cs

+ 10 - 1
Ryujinx.HLE/HOS/Kernel/SupervisorCall/SvcTable.cs

@@ -231,7 +231,16 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
 
                     if (!methodArgs[index].IsOut)
                     {
-                        throw new InvalidOperationException($"Method \"{svcName}\" has a invalid ref type \"{argType.Name}\".");
+                        generator.Emit(OpCodes.Ldarg_1);
+                        generator.Emit(OpCodes.Ldc_I4, index);
+
+                        MethodInfo info = typeof(IExecutionContext).GetMethod(nameof(IExecutionContext.GetX));
+
+                        generator.Emit(OpCodes.Call, info);
+
+                        ConvertToArgType(argType);
+
+                        generator.Emit(OpCodes.Stloc, local);
                     }
 
                     generator.Emit(OpCodes.Ldloca, local);