KiIpiEnlightenedGuestPriorityKick

VOID **__fastcall KiIpiEnlightenedGuestPriorityKick(INT64 a1){
  VOID **result; 
  struct _KPRCB *CurrentPrcb; 
  unsigned __int16 *v4; 
  __int64 v5; 
  int *v6; 
  int v7; 
  int v8; 
  bool v9; 
  __int64 v10; 
  __int64 v11; 
  unsigned __int16 *v12[2]; 
  __int16 v13; 
  int v14; 
  __int16 v15; 
  void *retaddr; 
  unsigned int v17; 
  result = &retaddr;
  CurrentPrcb = KeGetCurrentPrcb();
  v14 = 0;
  v15 = 0;
  v17 = 0;
  if( *((_QWORD *)CurrentPrcb + 4247) )
  {
    result = (VOID **)KeIsEmptyAffinityEx((_WORD *)a1);
    if( !(_DWORD)result )
    {
      v4 = *(unsigned __int16 **)(a1 + 8);
      v12[0] = (unsigned __int16 *)a1;
      v12[1] = v4;
      v13 = 0;
      while( 1 )
      {
        result = (VOID **)KeEnumerateNextProcessor(&v17, v12);
        if( (_DWORD)result )
          break;
        v5 = (__int64)*(&KiProcessorBlock + v17);
        if( (struct _KPRCB *)v5 != CurrentPrcb && (KiVelocityFlags & 2) != 0 )
        {
          v6 = *(int **)(v5 + 33976);
          if( v6 )
          {
            if( *((_QWORD *)CurrentPrcb + 4247) )
            {
              if( (int)KiVpThreadSystemWorkPriority >= 8 )
              {
                v7 = *v6;
                v8 = *v6 & 0x40000;
                if( (v7 & 0x100000) != 0 || v8 && (unsigned __int8)v7 < (int)KiVpThreadSystemWorkPriority )
                {
                  v9 = HvlpVirtualProcessorsIdentityMapped == 0;
                  v10 = *((_QWORD *)CurrentPrcb + 4247);
                  *(_DWORD *)(v10 + 12) = 2;
                  v11 = *(unsigned int *)(v5 + 36);
                  if( v9 )
                    LODWORD(v11) = (unsigned __int8)byte_140CFF6C1[2 * v11] | ((unsigned __int8)HvlpVirtualProcessorMapping[2 * v11] << 6);
                  *(_DWORD *)(v10 + 8) = v11;
                  __writemsr(0x400000C2u, (unsigned int)v11);
                }
              }
            }
          }
        }
      }
    }
  }
  return result;
}

Referenced by:

KiIpiSendRequest