This file defines the thread scheduler task of PwnOS and associated functions.
| ThreadScheduler.asm | This file defines the thread scheduler task of PwnOS and associated functions. |
| Variables | |
| pThreadQueue | The main thread queue. |
| MillisecondCount | This holds the number of milliseconds since boot. |
| Functions | |
| ThreadScheduler | Saves the state of the previous task and jumps to the next task to run. |
| GetThreadScore | Gets a score of the specified thread based on priority, time waiting, and status (e.g. |
| QueueThread | Places the specified thread into the thread queue (see <pThreadQueue>). |
| GetMillisecondCount | This procedure returns the number of milliseconds since boot as a qword in edx:eax. |
pThreadQueue DWORD NULL
The main thread queue.
Contains the handle of the first thread in the queue. Accessing it requires the GET_THREAD_SCHEDULER_ACCESS and RELEASE_THREAD_SCHEDULER_ACCESS macros.
MillisecondCount QWORD 0
This holds the number of milliseconds since boot.
This is in Threads since it is used most extensively here.
Saves the state of the previous task and jumps to the next task to run.
Not Implemented
TODO: Cancel pending timeout timer if still active. TODO: Select threads based on score from GetThreadScore. TODO: Have busy flag cleared and release access when idling, because threads might finish on other processors.
This is not called directly, but accessed by the JMP_THREAD_SCHEDULER macro. Around the use of this macro, however, must be the GET_THREAD_SCHEDULER_ACCESS macro before, and RELEASE_THREAD_SCHEDULER_ACCESS after, with interrupts disabled.
Gets a score of the specified thread based on priority, time waiting, and status (e.g. other threads waiting for a lock to be released).
Not Implemented
| hThread | handle of thread for which to get the score |
Places the specified thread into the thread queue (see <pThreadQueue>).
| hThread | handle of thread to queue |
This procedure returns the number of milliseconds since boot as a qword in edx:eax.
The main thread queue.
pThreadQueue DWORD NULL
This holds the number of milliseconds since boot.
MillisecondCount QWORD 0