Made initial implementation of the thread scheduler, refactor Svc to avoid passing many arguments

This commit is contained in:
gdkchan 2018-02-13 23:43:08 -03:00
parent 598d1fd3ae
commit f68696dc4a
19 changed files with 740 additions and 252 deletions

View file

@ -1,5 +1,6 @@
using System.IO;
using System.Text;
using System.Threading;
namespace ChocolArm64.Memory
{
@ -20,6 +21,32 @@ namespace ChocolArm64.Memory
}
}
public static int ReadInt32Exclusive(AMemory Memory, long Position)
{
while (!Memory.AcquireAddress(Position))
{
Thread.Yield();
}
int Value = Memory.ReadInt32(Position);
Memory.ReleaseAddress(Position);
return Value;
}
public static void WriteInt32Exclusive(AMemory Memory, long Position, int Value)
{
while (!Memory.AcquireAddress(Position))
{
Thread.Yield();
}
Memory.WriteInt32(Position, Value);
Memory.ReleaseAddress(Position);
}
public static byte[] ReadBytes(AMemory Memory, long Position, int Size)
{
byte[] Data = new byte[Size];