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
This commit is contained in:
gdkchan
2018-09-18 20:36:43 -03:00
committed by GitHub
parent 33e2810ef3
commit b8133c1997
57 changed files with 3262 additions and 1540 deletions

View File

@ -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));