KeSetSystemAllowedCpuSets

NTSTATUS __stdcall KeSetSystemAllowedCpuSets(UINT64 CpuSetCount, UINT64 *CpuSetMasks){
  int v2; 
  UINT64 *v3; 
  __int64 v4; 
  NTSTATUS result; 
  unsigned int v6; 
  UINT8 CurrentIrql; 
  unsigned int v8; 
  int v9; 
  unsigned int v10; 
  char *v11; 
  char *v12; 
  __int64 *v13; 
  __int64 v14; 
  UINT64 v15; 
  __int64 v16; 

  v3 = CpuSetMasks;
  v4 = v2;
  LOBYTE(result) = KiValidateCpuSetMasks((_GUID *)CpuSetMasks, (_IOBJECT_TYPE_LIST *)(unsigned int)CpuSetCount);
  if( result >= 0 )
  {
    CurrentIrql = KeGetCurrentIrql();
    __writecr8(2ui64);
    v8 = 20;
    if( v6 < 0x14 )
      v8 = v6;
    v9 = 0;
    KxAcquireSpinLock(&KiCpuSetLock);
    RtlWriteAcquireTickLock(&KiCpuSetSequence);
    v10 = 0;
    v11 = (char *)((char *)KeActiveProcessors.Bitmap - (char *)v3);
    v12 = (char *)(&KiReservedCpuSets - (_UNKNOWN *)v3);
    v13 = &KiSystemAllowedCpuSets[v4];
    do
    {
      v14 = *(UINT64 *)((char *)v3 + (_QWORD)v11);
      if( v10 < v8 )
      {
        v15 = *v3;
      }
      else
      {
        v15 = 0i64;
        if( !(_DWORD)v4 )
          v15 = *(UINT64 *)((char *)v3 + (_QWORD)v11);
      }
      v16 = ~*(UINT64 *)((char *)v3 + (_QWORD)v12) & v15;
      *v13 = v16;
      if( (v14 & v16) != v14 )
        v9 = 1;
      ++v10;
      ++v3;
      v13 += 2;
    }
    while( v10 < 0x14 );
    if( !(_DWORD)v4 )
      KiRestrictedSystemCpuSetsActive = v9;
    ++KiCpuSetSequence;
    KeCpuSetReportParkedProcessors(0i64, CurrentIrql);
    return 0;
  }
  return result;
}

Referenced by:

KiInitializeReservedCpuSets
NtSetSystemInformation