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/State/AThreadState.cs | |
| 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/State/AThreadState.cs')
| -rw-r--r-- | ChocolArm64/State/AThreadState.cs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/ChocolArm64/State/AThreadState.cs b/ChocolArm64/State/AThreadState.cs index 7b69d817..783f5a12 100644 --- a/ChocolArm64/State/AThreadState.cs +++ b/ChocolArm64/State/AThreadState.cs @@ -41,6 +41,9 @@ namespace ChocolArm64.State public bool Negative; public bool Running { get; set; } + public int Core { get; set; } + + private bool Interrupted; public long TpidrEl0 { get; set; } public long Tpidr { get; set; } @@ -73,6 +76,7 @@ namespace ChocolArm64.State } } + public event EventHandler<EventArgs> Interrupt; public event EventHandler<AInstExceptionEventArgs> Break; public event EventHandler<AInstExceptionEventArgs> SvcCall; public event EventHandler<AInstUndefinedEventArgs> Undefined; @@ -99,9 +103,26 @@ namespace ChocolArm64.State internal bool Synchronize() { + if (Interrupted) + { + Interrupted = false; + + OnInterrupt(); + } + return Running; } + internal void RequestInterrupt() + { + Interrupted = true; + } + + private void OnInterrupt() + { + Interrupt?.Invoke(this, EventArgs.Empty); + } + internal void OnBreak(long Position, int Imm) { Break?.Invoke(this, new AInstExceptionEventArgs(Position, Imm)); |
