KiUpdateSavedSupervisorState

INT64 __stdcall KiUpdateSavedSupervisorState(){
  unsigned int v0; 
  unsigned __int64 v1; 
  unsigned int v2; 
  _QWORD *PoolWithTag; 
  __int64 v4; 
  unsigned int v5; 
  _QWORD *v6; 
  VOID *v7; 
  PVOID *v8; 
  __int128 Context; 
  v0 = KeNumberProcessors_0;
  Context = 0i64;
  v1 = 8i64 * (unsigned int)KeNumberProcessors_0;
  if( v1 > 0xFFFFFFFF )
    return(unsigned int)-1073741675;
  v2 = 0;
  PoolWithTag = ExAllocatePoolWithTag(NonPagedPoolNx, (unsigned int)v1, 0x65687358ui64);
  if( !PoolWithTag )
    return(unsigned int)-1073741670;
  v4 = 0i64;
  v5 = KUSER_SHARED_DATA.XState.AllFeatureSize - KUSER_SHARED_DATA.XState.Size + KiIptSaveAreaLength + 127;
  if( !v0 )
  {
LABEL_11:
    *(_QWORD *)&Context = PoolWithTag;
    DWORD2(Context) = v0;
    KeIpiGenericCall((PKIPI_BROADCAST_WORKER)KiIpiUpdateExtendedSupervisorState, &Context);
    goto LABEL_12;
  }
  v6 = PoolWithTag;
  while( *(_QWORD *)(*(_QWORD *)((char *)v6 + (char *)&KiProcessorBlock - (char *)PoolWithTag) + 1728i64) )
  {
    *v6 = 0i64;
LABEL_10:
    v4 = (unsigned int)(v4 + 1);
    ++v6;
    if( (unsigned int)v4 >= v0 )
      goto LABEL_11;
  }
  v7 = ExAllocatePoolWithTag(NonPagedPoolNx, v5, 0x65707553ui64);
  *v6 = v7;
  if( v7 )
  {
    memset((INT64)v7, 0i64);
    goto LABEL_10;
  }
  if( (_DWORD)v4 )
  {
    v8 = (PVOID *)PoolWithTag;
    do
    {
      if( *v8 )
        ExFreePoolWithTag(*v8, 0);
      ++v8;
      --v4;
    }
    while( v4 );
  }
  v2 = -1073741670;
LABEL_12:
  ExFreePoolWithTag(PoolWithTag, 0);
  return v2;
}

Referenced by:

KiStartSavingSupervisorState