aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Tests.Unicorn/UnicornAArch32.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Ryujinx.Tests.Unicorn/UnicornAArch32.cs')
-rw-r--r--src/Ryujinx.Tests.Unicorn/UnicornAArch32.cs42
1 files changed, 22 insertions, 20 deletions
diff --git a/src/Ryujinx.Tests.Unicorn/UnicornAArch32.cs b/src/Ryujinx.Tests.Unicorn/UnicornAArch32.cs
index a095e664..6532beab 100644
--- a/src/Ryujinx.Tests.Unicorn/UnicornAArch32.cs
+++ b/src/Ryujinx.Tests.Unicorn/UnicornAArch32.cs
@@ -5,7 +5,7 @@ namespace Ryujinx.Tests.Unicorn
{
public class UnicornAArch32 : IDisposable
{
- internal readonly UnicornEngine.Unicorn uc;
+ internal readonly UnicornEngine.Unicorn Uc;
private bool _isDisposed;
public IndexedProperty<int, uint> R => new(GetX, SetX);
@@ -84,7 +84,7 @@ namespace Ryujinx.Tests.Unicorn
public UnicornAArch32()
{
- uc = new UnicornEngine.Unicorn(Common.UC_ARCH_ARM, Common.UC_MODE_LITTLE_ENDIAN);
+ Uc = new UnicornEngine.Unicorn(Common.UC_ARCH_ARM, Common.UC_MODE_LITTLE_ENDIAN);
SetRegister(Arm.UC_ARM_REG_C1_C0_2, GetRegister(Arm.UC_ARM_REG_C1_C0_2) | 0xf00000);
SetRegister(Arm.UC_ARM_REG_FPEXC, 0x40000000);
@@ -105,7 +105,7 @@ namespace Ryujinx.Tests.Unicorn
{
if (!_isDisposed)
{
- uc.Close();
+ Uc.Close();
_isDisposed = true;
}
}
@@ -113,7 +113,7 @@ namespace Ryujinx.Tests.Unicorn
public void RunForCount(ulong count)
{
// FIXME: untilAddr should be 0xFFFFFFFFFFFFFFFFu
- uc.EmuStart(this.PC, -1, 0, (long)count);
+ Uc.EmuStart(this.PC, -1, 0, (long)count);
}
public void Step()
@@ -121,7 +121,7 @@ namespace Ryujinx.Tests.Unicorn
RunForCount(1);
}
- private static int[] XRegisters =
+ private static readonly int[] _xRegisters =
{
Arm.UC_ARM_REG_R0,
Arm.UC_ARM_REG_R1,
@@ -141,7 +141,8 @@ namespace Ryujinx.Tests.Unicorn
Arm.UC_ARM_REG_R15,
};
- private static int[] QRegisters =
+#pragma warning disable IDE0051, IDE0052 // Remove unused private member
+ private static readonly int[] _qRegisters =
{
Arm.UC_ARM_REG_Q0,
Arm.UC_ARM_REG_Q1,
@@ -160,6 +161,7 @@ namespace Ryujinx.Tests.Unicorn
Arm.UC_ARM_REG_Q14,
Arm.UC_ARM_REG_Q15
};
+#pragma warning restore IDE0051, IDE0052
public uint GetX(int index)
{
@@ -168,7 +170,7 @@ namespace Ryujinx.Tests.Unicorn
throw new ArgumentOutOfRangeException(nameof(index));
}
- return GetRegister(XRegisters[index]);
+ return GetRegister(_xRegisters[index]);
}
public void SetX(int index, uint value)
@@ -178,7 +180,7 @@ namespace Ryujinx.Tests.Unicorn
throw new ArgumentOutOfRangeException(nameof(index));
}
- SetRegister(XRegisters[index], value);
+ SetRegister(_xRegisters[index], value);
}
public SimdValue GetQ(int index)
@@ -206,7 +208,7 @@ namespace Ryujinx.Tests.Unicorn
{
byte[] data = new byte[4];
- uc.RegRead(register, data);
+ Uc.RegRead(register, data);
return BitConverter.ToUInt32(data, 0);
}
@@ -215,16 +217,16 @@ namespace Ryujinx.Tests.Unicorn
{
byte[] data = BitConverter.GetBytes(value);
- uc.RegWrite(register, data);
+ Uc.RegWrite(register, data);
}
public SimdValue GetVector(int register)
{
byte[] data = new byte[8];
- uc.RegRead(register, data);
+ Uc.RegRead(register, data);
ulong lo = BitConverter.ToUInt64(data, 0);
- uc.RegRead(register + 1, data);
+ Uc.RegRead(register + 1, data);
ulong hi = BitConverter.ToUInt64(data, 0);
return new SimdValue(lo, hi);
@@ -233,16 +235,16 @@ namespace Ryujinx.Tests.Unicorn
private void SetVector(int register, SimdValue value)
{
byte[] data = BitConverter.GetBytes(value.GetUInt64(0));
- uc.RegWrite(register, data);
+ Uc.RegWrite(register, data);
data = BitConverter.GetBytes(value.GetUInt64(1));
- uc.RegWrite(register + 1, data);
+ Uc.RegWrite(register + 1, data);
}
public byte[] MemoryRead(ulong address, ulong size)
{
byte[] value = new byte[size];
- uc.MemRead((long)address, value);
+ Uc.MemRead((long)address, value);
return value;
}
@@ -254,7 +256,7 @@ namespace Ryujinx.Tests.Unicorn
public void MemoryWrite(ulong address, byte[] value)
{
- uc.MemWrite((long)address, value);
+ Uc.MemWrite((long)address, value);
}
public void MemoryWrite8(ulong address, byte value) => MemoryWrite(address, new[] { value });
@@ -267,17 +269,17 @@ namespace Ryujinx.Tests.Unicorn
public void MemoryMap(ulong address, ulong size, MemoryPermission permissions)
{
- uc.MemMap((long)address, (long)size, (int)permissions);
+ Uc.MemMap((long)address, (long)size, (int)permissions);
}
public void MemoryUnmap(ulong address, ulong size)
{
- uc.MemUnmap((long)address, (long)size);
+ Uc.MemUnmap((long)address, (long)size);
}
public void MemoryProtect(ulong address, ulong size, MemoryPermission permissions)
{
- uc.MemProtect((long)address, (long)size, (int)permissions);
+ Uc.MemProtect((long)address, (long)size, (int)permissions);
}
}
-} \ No newline at end of file
+}