aboutsummaryrefslogtreecommitdiff
path: root/ARMeilleure/State
diff options
context:
space:
mode:
authorriperiperi <rhy3756547@hotmail.com>2023-04-11 07:55:04 +0100
committerGitHub <noreply@github.com>2023-04-11 08:55:04 +0200
commit9ef94c8292beda825fa76e05ad2e561c6d571c95 (patch)
treee535eef49837759f9947bac48a8cbf0b91512d9e /ARMeilleure/State
parent915d6d044cbf8c89935f14b8c7e085ad729f0e28 (diff)
ARMeilleure: Move TPIDR_EL0 and TPIDRRO_EL0 to NativeContext (#4661)
* ARMeilleure: Move TPIDR_EL0 and TPIDRRO_EL0 to NativeContext Some games access these system registers several tens of thousands of times in a second from many different threads. While this isn't really crippling, it is a lot of wasted time spent in a reverse pinvoke transition. Example games are Pokemon Scarlet/Violet and BOTW. These games have a lot of different potential bottlenecks so it's unlikely you will see a consistent improvement, but it definitely disappears from the cpu profile. * Remove unreachable code. * Add ulong conversion for offsets * Nit
Diffstat (limited to 'ARMeilleure/State')
-rw-r--r--ARMeilleure/State/ExecutionContext.cs13
-rw-r--r--ARMeilleure/State/NativeContext.cs18
2 files changed, 29 insertions, 2 deletions
diff --git a/ARMeilleure/State/ExecutionContext.cs b/ARMeilleure/State/ExecutionContext.cs
index 5d18e6ed..859fb3a5 100644
--- a/ARMeilleure/State/ExecutionContext.cs
+++ b/ARMeilleure/State/ExecutionContext.cs
@@ -27,8 +27,17 @@ namespace ARMeilleure.State
// Since EL2 isn't implemented, CNTVOFF_EL2 = 0
public ulong CntvctEl0 => CntpctEl0;
- public long TpidrEl0 { get; set; }
- public long TpidrroEl0 { get; set; }
+ public long TpidrEl0
+ {
+ get => _nativeContext.GetTpidrEl0();
+ set => _nativeContext.SetTpidrEl0(value);
+ }
+
+ public long TpidrroEl0
+ {
+ get => _nativeContext.GetTpidrroEl0();
+ set => _nativeContext.SetTpidrroEl0(value);
+ }
public uint Pstate
{
diff --git a/ARMeilleure/State/NativeContext.cs b/ARMeilleure/State/NativeContext.cs
index 89e875d1..3189bdd8 100644
--- a/ARMeilleure/State/NativeContext.cs
+++ b/ARMeilleure/State/NativeContext.cs
@@ -13,6 +13,8 @@ namespace ARMeilleure.State
public fixed ulong V[RegisterConsts.VecRegsCount * 2];
public fixed uint Flags[RegisterConsts.FlagsCount];
public fixed uint FpFlags[RegisterConsts.FpFlagsCount];
+ public long TpidrEl0;
+ public long TpidrroEl0;
public int Counter;
public ulong DispatchAddress;
public ulong ExclusiveAddress;
@@ -168,6 +170,12 @@ namespace ARMeilleure.State
}
}
+ public long GetTpidrEl0() => GetStorage().TpidrEl0;
+ public void SetTpidrEl0(long value) => GetStorage().TpidrEl0 = value;
+
+ public long GetTpidrroEl0() => GetStorage().TpidrroEl0;
+ public void SetTpidrroEl0(long value) => GetStorage().TpidrroEl0 = value;
+
public int GetCounter() => GetStorage().Counter;
public void SetCounter(int value) => GetStorage().Counter = value;
@@ -214,6 +222,16 @@ namespace ARMeilleure.State
}
}
+ public static int GetTpidrEl0Offset()
+ {
+ return StorageOffset(ref _dummyStorage, ref _dummyStorage.TpidrEl0);
+ }
+
+ public static int GetTpidrroEl0Offset()
+ {
+ return StorageOffset(ref _dummyStorage, ref _dummyStorage.TpidrroEl0);
+ }
+
public static int GetCounterOffset()
{
return StorageOffset(ref _dummyStorage, ref _dummyStorage.Counter);