aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/HOS/Kernel/SupervisorCall/SyscallTable.cs
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2022-05-31 16:29:35 -0300
committerGitHub <noreply@github.com>2022-05-31 16:29:35 -0300
commit0c87bf9ea4b0655fc6b90b4ab20e93f237e7549b (patch)
tree0fe100d5cd958bfb8f5974f1b614b94c09e89a26 /Ryujinx.HLE/HOS/Kernel/SupervisorCall/SyscallTable.cs
parent9827dc35e14cb704cb4adcb894e0efbac893080c (diff)
Refactor CPU interface to allow the implementation of other CPU emulators (#3362)1.1.134
* Refactor CPU interface * Use IExecutionContext interface on SVC handler, change how CPU interrupts invokes the handlers * Make CpuEngine take a ITickSource rather than returning one The previous implementation had the scenario where the CPU engine had to implement the tick source in mind, like for example, when we have a hypervisor and the game can read CNTPCT on the host directly. However given that we need to do conversion due to different frequencies anyway, it's not worth it. It's better to just let the user pass the tick source and redirect any reads to CNTPCT to the user tick source * XML docs for the public interfaces * PPTC invalidation due to NativeInterface function name changes * Fix build of the CPU tests * PR feedback
Diffstat (limited to 'Ryujinx.HLE/HOS/Kernel/SupervisorCall/SyscallTable.cs')
-rw-r--r--Ryujinx.HLE/HOS/Kernel/SupervisorCall/SyscallTable.cs40
1 files changed, 20 insertions, 20 deletions
diff --git a/Ryujinx.HLE/HOS/Kernel/SupervisorCall/SyscallTable.cs b/Ryujinx.HLE/HOS/Kernel/SupervisorCall/SyscallTable.cs
index 6e0b7010..8b7e7fb8 100644
--- a/Ryujinx.HLE/HOS/Kernel/SupervisorCall/SyscallTable.cs
+++ b/Ryujinx.HLE/HOS/Kernel/SupervisorCall/SyscallTable.cs
@@ -1,5 +1,5 @@
-using ARMeilleure.State;
using Ryujinx.Common.Logging;
+using Ryujinx.Cpu;
using Ryujinx.HLE.HOS.Kernel.Common;
using System;
using System.Collections.Generic;
@@ -14,13 +14,13 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
private const int SvcFuncMaxArguments32 = 4;
private const int SvcMax = 0x80;
- public static Action<Syscall32, ExecutionContext>[] SvcTable32 { get; }
- public static Action<Syscall64, ExecutionContext>[] SvcTable64 { get; }
+ public static Action<Syscall32, IExecutionContext>[] SvcTable32 { get; }
+ public static Action<Syscall64, IExecutionContext>[] SvcTable64 { get; }
static SyscallTable()
{
- SvcTable32 = new Action<Syscall32, ExecutionContext>[SvcMax];
- SvcTable64 = new Action<Syscall64, ExecutionContext>[SvcMax];
+ SvcTable32 = new Action<Syscall32, IExecutionContext>[SvcMax];
+ SvcTable64 = new Action<Syscall64, IExecutionContext>[SvcMax];
Dictionary<int, string> svcFuncs64 = new Dictionary<int, string>
{
@@ -182,9 +182,9 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
}
}
- private static Action<T, ExecutionContext> GenerateMethod<T>(string svcName, int registerCleanCount)
+ private static Action<T, IExecutionContext> GenerateMethod<T>(string svcName, int registerCleanCount)
{
- Type[] argTypes = new Type[] { typeof(T), typeof(ExecutionContext) };
+ Type[] argTypes = new Type[] { typeof(T), typeof(IExecutionContext) };
DynamicMethod method = new DynamicMethod(svcName, null, argTypes);
@@ -292,9 +292,9 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
generator.Emit(OpCodes.Ldarg_1);
generator.Emit(OpCodes.Ldc_I4, registerAttribute.Index);
- MethodInfo info = typeof(ExecutionContext).GetMethod(nameof(ExecutionContext.GetX));
+ MethodInfo info = typeof(IExecutionContext).GetMethod(nameof(IExecutionContext.GetX));
- generator.Emit(OpCodes.Call, info);
+ generator.Emit(OpCodes.Callvirt, info);
generator.Emit(OpCodes.Box, typeof(ulong));
@@ -339,9 +339,9 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
generator.Emit(OpCodes.Ldarg_1);
generator.Emit(OpCodes.Ldc_I4, registerAttribute.Index);
- MethodInfo info = typeof(ExecutionContext).GetMethod(nameof(ExecutionContext.GetX));
+ MethodInfo info = typeof(IExecutionContext).GetMethod(nameof(IExecutionContext.GetX));
- generator.Emit(OpCodes.Call, info);
+ generator.Emit(OpCodes.Callvirt, info);
ConvertToArgType(argType);
@@ -355,9 +355,9 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
generator.Emit(OpCodes.Ldarg_1);
generator.Emit(OpCodes.Ldc_I4, registerAttribute.Index);
- MethodInfo info = typeof(ExecutionContext).GetMethod(nameof(ExecutionContext.GetX));
+ MethodInfo info = typeof(IExecutionContext).GetMethod(nameof(IExecutionContext.GetX));
- generator.Emit(OpCodes.Call, info);
+ generator.Emit(OpCodes.Callvirt, info);
ConvertToArgType(argType);
}
@@ -393,9 +393,9 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
ConvertToFieldType(retType);
- MethodInfo info = typeof(ExecutionContext).GetMethod(nameof(ExecutionContext.SetX));
+ MethodInfo info = typeof(IExecutionContext).GetMethod(nameof(IExecutionContext.SetX));
- generator.Emit(OpCodes.Call, info);
+ generator.Emit(OpCodes.Callvirt, info);
registerInUse |= 1u << 0;
}
@@ -415,9 +415,9 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
ConvertToFieldType(local.LocalType);
- MethodInfo info = typeof(ExecutionContext).GetMethod(nameof(ExecutionContext.SetX));
+ MethodInfo info = typeof(IExecutionContext).GetMethod(nameof(IExecutionContext.SetX));
- generator.Emit(OpCodes.Call, info);
+ generator.Emit(OpCodes.Callvirt, info);
registerInUse |= 1u << attribute.Index;
}
@@ -434,14 +434,14 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
generator.Emit(OpCodes.Ldc_I4, i);
generator.Emit(OpCodes.Ldc_I8, 0L);
- MethodInfo info = typeof(ExecutionContext).GetMethod(nameof(ExecutionContext.SetX));
+ MethodInfo info = typeof(IExecutionContext).GetMethod(nameof(IExecutionContext.SetX));
- generator.Emit(OpCodes.Call, info);
+ generator.Emit(OpCodes.Callvirt, info);
}
generator.Emit(OpCodes.Ret);
- return method.CreateDelegate<Action<T, ExecutionContext>>();
+ return method.CreateDelegate<Action<T, IExecutionContext>>();
}
private static void CheckIfTypeIsSupported(Type type, string svcName)