diff options
| author | gdkchan <gab.dark.100@gmail.com> | 2018-09-18 20:36:43 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-09-18 20:36:43 -0300 |
| commit | b8133c19971c7a2026af803003fafedbdb70488e (patch) | |
| tree | 84f4630e897ccd3f77b86051241a22a6cf45193d /ChocolArm64/Memory | |
| parent | 33e2810ef36fe0cf613aecd4c609f425aed02539 (diff) | |
Thread scheduler rewrite (#393)
* Started to rewrite the thread scheduler
* Add a single core-like scheduling mode, enabled by default
* Clear exclusive monitor on context switch
* Add SetThreadActivity, misc fixes
* Implement WaitForAddress and SignalToAddress svcs, misc fixes
* Misc fixes (on SetActivity and Arbiter), other tweaks
* Rebased
* Add missing null check
* Rename multicore key on config, fix UpdatePriorityInheritance
* Make scheduling data MLQs private
* nit: Ordering
Diffstat (limited to 'ChocolArm64/Memory')
| -rw-r--r-- | ChocolArm64/Memory/AMemory.cs | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/ChocolArm64/Memory/AMemory.cs b/ChocolArm64/Memory/AMemory.cs index 806a0b86..2cb9b16c 100644 --- a/ChocolArm64/Memory/AMemory.cs +++ b/ChocolArm64/Memory/AMemory.cs @@ -41,7 +41,7 @@ namespace ChocolArm64.Memory } } - private Dictionary<AThreadState, ArmMonitor> Monitors; + private Dictionary<int, ArmMonitor> Monitors; private ConcurrentDictionary<long, IntPtr> ObservedPages; @@ -53,7 +53,7 @@ namespace ChocolArm64.Memory public AMemory(IntPtr Ram) { - Monitors = new Dictionary<AThreadState, ArmMonitor>(); + Monitors = new Dictionary<int, ArmMonitor>(); ObservedPages = new ConcurrentDictionary<long, IntPtr>(); @@ -69,17 +69,17 @@ namespace ChocolArm64.Memory } } - public void RemoveMonitor(AThreadState State) + public void RemoveMonitor(int Core) { lock (Monitors) { - ClearExclusive(State); + ClearExclusive(Core); - Monitors.Remove(State); + Monitors.Remove(Core); } } - public void SetExclusive(AThreadState ThreadState, long Position) + public void SetExclusive(int Core, long Position) { Position &= ~ErgMask; @@ -93,11 +93,11 @@ namespace ChocolArm64.Memory } } - if (!Monitors.TryGetValue(ThreadState, out ArmMonitor ThreadMon)) + if (!Monitors.TryGetValue(Core, out ArmMonitor ThreadMon)) { ThreadMon = new ArmMonitor(); - Monitors.Add(ThreadState, ThreadMon); + Monitors.Add(Core, ThreadMon); } ThreadMon.Position = Position; @@ -105,7 +105,7 @@ namespace ChocolArm64.Memory } } - public bool TestExclusive(AThreadState ThreadState, long Position) + public bool TestExclusive(int Core, long Position) { //Note: Any call to this method also should be followed by a //call to ClearExclusiveForStore if this method returns true. @@ -113,7 +113,7 @@ namespace ChocolArm64.Memory Monitor.Enter(Monitors); - if (!Monitors.TryGetValue(ThreadState, out ArmMonitor ThreadMon)) + if (!Monitors.TryGetValue(Core, out ArmMonitor ThreadMon)) { return false; } @@ -128,9 +128,9 @@ namespace ChocolArm64.Memory return ExState; } - public void ClearExclusiveForStore(AThreadState ThreadState) + public void ClearExclusiveForStore(int Core) { - if (Monitors.TryGetValue(ThreadState, out ArmMonitor ThreadMon)) + if (Monitors.TryGetValue(Core, out ArmMonitor ThreadMon)) { ThreadMon.ExState = false; } @@ -138,11 +138,11 @@ namespace ChocolArm64.Memory Monitor.Exit(Monitors); } - public void ClearExclusive(AThreadState ThreadState) + public void ClearExclusive(int Core) { lock (Monitors) { - if (Monitors.TryGetValue(ThreadState, out ArmMonitor ThreadMon)) + if (Monitors.TryGetValue(Core, out ArmMonitor ThreadMon)) { ThreadMon.ExState = false; } |
