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:
parent
33e2810ef3
commit
b8133c1997
57 changed files with 3262 additions and 1540 deletions
67
Ryujinx.HLE/HOS/Kernel/KCoreContext.cs
Normal file
67
Ryujinx.HLE/HOS/Kernel/KCoreContext.cs
Normal file
|
@ -0,0 +1,67 @@
|
|||
using System;
|
||||
|
||||
namespace Ryujinx.HLE.HOS.Kernel
|
||||
{
|
||||
class KCoreContext
|
||||
{
|
||||
private KScheduler Scheduler;
|
||||
|
||||
private HleCoreManager CoreManager;
|
||||
|
||||
public bool ContextSwitchNeeded { get; private set; }
|
||||
|
||||
public KThread CurrentThread { get; private set; }
|
||||
public KThread SelectedThread { get; private set; }
|
||||
|
||||
public KCoreContext(KScheduler Scheduler, HleCoreManager CoreManager)
|
||||
{
|
||||
this.Scheduler = Scheduler;
|
||||
this.CoreManager = CoreManager;
|
||||
}
|
||||
|
||||
public void SelectThread(KThread Thread)
|
||||
{
|
||||
SelectedThread = Thread;
|
||||
|
||||
if (Thread != null)
|
||||
{
|
||||
Thread.LastScheduledTicks = (uint)Environment.TickCount;
|
||||
}
|
||||
|
||||
ContextSwitchNeeded = true;
|
||||
}
|
||||
|
||||
public void UpdateCurrentThread()
|
||||
{
|
||||
ContextSwitchNeeded = false;
|
||||
|
||||
CurrentThread = SelectedThread;
|
||||
}
|
||||
|
||||
public void ContextSwitch()
|
||||
{
|
||||
ContextSwitchNeeded = false;
|
||||
|
||||
if (CurrentThread != null)
|
||||
{
|
||||
CoreManager.GetThread(CurrentThread.Context.Work).Reset();
|
||||
}
|
||||
|
||||
CurrentThread = SelectedThread;
|
||||
|
||||
if (CurrentThread != null)
|
||||
{
|
||||
CurrentThread.ClearExclusive();
|
||||
|
||||
CoreManager.GetThread(CurrentThread.Context.Work).Set();
|
||||
|
||||
CurrentThread.Context.Execute();
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveThread(KThread Thread)
|
||||
{
|
||||
//TODO.
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue