KiAbSetMinimumThreadPriority
VOID __fastcall KiAbSetMinimumThreadPriority(
_KLOCK_ENTRY *Entry,
_AB_PRIORITY *Priority,
_SINGLE_LIST_ENTRY *ReadyList,
_SINGLE_LIST_ENTRY *PropagateBoostsList,
_SINGLE_LIST_ENTRY *SelfBoostsList,
UINT64 *BoostOutstandingIOsRequired){
char *v7;
int v8;
INT8 CpuPriorityKey;
char *v10;
void *v11;
_IO_PRIORITY_HINT BaseIoPriorityThread;
UINT64 *v13;
__int64 v14;
char v15;
int v16;
int v17;
__int64 SpinCount[10];
v7 = (char *)Entry - 16 * Entry->EntryOffset;
PsGetIoPriorityThread((_ETHREAD *)v7);
v8 = 0;
*(_DWORD *)BoostOutstandingIOsRequired = 0;
CpuPriorityKey = KiAbEntryGetCpuPriorityKey(Entry);
v11 = (void *)*v10;
if( CpuPriorityKey < (char)v11 )
{
Entry->BoostBitmap._bf_0 ^= (Entry->BoostBitmap._bf_0 ^ (Entry->BoostBitmap._bf_0 & 0x7FFF | (1 << ((_BYTE)v11 - 1)))) & 0x7FFF;
LODWORD(SpinCount[0]) = 0;
while( _interlockedbittestandset64((volatile signed __int32 *)v7 + 16, 0i64) )
{
do
KeYieldProcessorEx((UINT64 *)SpinCount);
while( *((_QWORD *)v7 + 8) );
}
v15 = v7[(_QWORD)v11 + 824];
if( v15 == -1 )
KeBugCheckEx(0x157u, v7, v11, (PVOID)1, 0i64);
v7[(_QWORD)v11 + 824] = v15 + 1;
v8 = 0;
*((_DWORD *)v7 + 214) |= 1 << (char)v11;
if( v7[195] < (char)v11 )
{
KiSetPriorityThread((_KTHREAD *)v7, ReadyList, (unsigned int)v11);
v8 = 1;
}
KiReleaseThreadLockSafe((INT64)v7);
}
BaseIoPriorityThread = PsGetBaseIoPriorityThread((_ETHREAD *)v7);
if( BaseIoPriorityThread < *(char *)(v14 + 1) && Entry->BoostBitmap._bf_0 >= 0 )
{
KiAbThreadBoostIoPriority((_ETHREAD *)v7, SelfBoostsList, 0i64, v13);
if( v16 )
{
Entry->BoostBitmap._bf_0 |= 0x8000u;
v8 = 1;
}
}
if( (*((_DWORD *)v7 + 342) == 0) < Priority->IoQoSPriority && (Entry->BoostBitmap._bf_0 & 0x10000) == 0 )
{
KiAbThreadBoostIoPriority((_ETHREAD *)v7, SelfBoostsList, 1ui64, BoostOutstandingIOsRequired);
if( v17 )
{
Entry->BoostBitmap._bf_2 |= 1u;
v8 = 1;
}
}
if( PropagateBoostsList && v8 )
{
if( v7[793] )
KiAbThreadInsertList((_ETHREAD *)v7, PropagateBoostsList, (_SINGLE_LIST_ENTRY *)v7 + 101);
}
}Referenced by:
KiAbCpuBoostOwners
KiAbIoBoostOwners
KiAbProcessContextSwitch
KiAbProcessThreadLocks