Skip to content

Instantly share code, notes, and snippets.

View neobrain's full-sized avatar

Tony Wasserka neobrain

View GitHub Profile
@neobrain
neobrain / kernel_scheduling.md
Created December 3, 2016 18:01 — forked from Subv/kernel_scheduling.md
Nintendo 3DS Kernel scheduler findings

Kernel synchronization

  • Each core has its own KScheduler instance.

KObject waitlists

Each KObject manages a list of threads that are waiting on it. This list is iterated over each time the KObject is signaled.

The KObject will try to retrieve the KThread with the highest priority from this list, check if it is ready to run (See KThread waitlist), and append it to the scheduler's queue if it is ready.

This awakening operation is performed for every KThread that is ready to run.

if ( !levelHighActive_ )
{
LABEL_10:
if ( interruptID == 15 )
{
if ( sub_FFF0D1F8(&stru_FFF2E0A0.threadPairsPerPriority[3].last, 0, 1) )
{
res = 0xD8A007F0;
}