HvlPhase2Initialize
NTSTATUS __stdcall HvlPhase2Initialize(_LOADER_PARAMETER_BLOCK *LoaderBlock){
UINT64 v1;
_LOADER_PARAMETER_EXTENSION *Extension;
unsigned __int64 v3;
unsigned __int64 HypervisorLaunchStatusArg1;
unsigned __int64 HypervisorLaunchStatusArg2;
unsigned __int64 HypervisorLaunchStatusArg3;
unsigned __int64 HypervisorLaunchStatusArg4;
INT64 v8;
INT64 v9;
volatile CCHAR v10;
NTSTATUS result;
UINT64 v12;
_BYTE *v13;
UINT64 *v14;
int v15;
_UNICODE_STRING DestinationString;
_HVL_STATUS HypervisorLaunchStatus;
_OBJECT_ATTRIBUTES ObjectAttributes;
PCALLBACK_OBJECT CallbackObject;
Extension = LoaderBlock->Extension;
*(&ObjectAttributes.Length + 1) = 0;
DestinationString = 0i64;
*(&ObjectAttributes.Attributes + 1) = 0;
v3 = Extension->HypervisorExtension.HypervisorLaunchStatus;
HypervisorLaunchStatusArg1 = Extension->HypervisorExtension.HypervisorLaunchStatusArg1;
HypervisorLaunchStatusArg2 = Extension->HypervisorExtension.HypervisorLaunchStatusArg2;
HypervisorLaunchStatusArg3 = Extension->HypervisorExtension.HypervisorLaunchStatusArg3;
HypervisorLaunchStatusArg4 = Extension->HypervisorExtension.HypervisorLaunchStatusArg4;
if( v3 )
{
HvlpEtwRegister(LoaderBlock, v1);
HypervisorLaunchStatus.Status = v3;
HypervisorLaunchStatus.Argument1 = HypervisorLaunchStatusArg1;
HypervisorLaunchStatus.Argument2 = HypervisorLaunchStatusArg2;
HypervisorLaunchStatus.Argument3 = HypervisorLaunchStatusArg3;
HypervisorLaunchStatus.Argument4 = HypervisorLaunchStatusArg4;
HvlpLogHypervisorLaunchError(&HypervisorLaunchStatus);
EtwUnregister(HvlGlobalSystemEventsHandle);
HvlGlobalSystemEventsHandle = 0i64;
}
if( !(_BYTE)HvlHypervisorConnected )
return 0;
if( (HvlpFlags & 2) == 0 )
goto LABEL_10;
HvlpDiscoverTopologyComplete((UINT64)LoaderBlock, v1);
HvlpSchedulerType = HvlpQueryHypervisorSchedulerType();
if( HvlpSchedulerType == 4 )
KeNumberProcessorsGroup0[3] = 1;
v10 = KeNumberProcessorsGroup0[3];
if( !v10
|| (result = HvlpInitializeSvmIommuSupport(
(INT64)LoaderBlock,
v1,
v8,
v9,
*(UINT8 **)&DestinationString.Length,
(_UNICODE_STRING *)DestinationString.Buffer,
(UINT8 *)HypervisorLaunchStatus.Status),
v1 = 0x80000000i64,
LoaderBlock = (_LOADER_PARAMETER_BLOCK *)(result + 0x80000000),
(int)LoaderBlock < 0)
|| result == -1073741637 )
{
LABEL_10:
HvlpInitializeHvCrashdumpPhase2((INT64)LoaderBlock, v1);
if( (HvlpRootFlags & 1) == 0 )
{
LABEL_19:
if( *(&ExBootDevicesRemovedEvent + 22) )
ExNotifyWithProcessing(*(&ExBootDevicesRemovedEvent + 22), 0i64, 0i64, 0i64);
HvlpRegisterPowerPolicyCallbacks();
return 0;
}
HvlpEtwRegister(v13, v12);
HvlpWriteEventLog((PCEVENT_DESCRIPTOR)&CmFcpWnfTypeId.TypeId[2], 0, 0i64);
HvlpLogHypervisorSchedulerType();
HvlpCheckTscSync();
HvlpLogIommuInitStatus();
HvlpLogGuestStateScrubbingStatus();
if( HvlpLogicalProcessorCount < 0x400 )
{
v14 = &HvlpLogicalProcessorRegions + 15 * HvlpLogicalProcessorCount;
if( !*(_DWORD *)v14 )
{
v15 = *((unsigned __int16 *)v14 + 28);
if( (_WORD)v15 )
HvlpLogProcessorStartupFailure(*((_DWORD *)v14 + 2), v15, (__int64)(v14 + 7));
}
}
HvlpLogMicrocodeUpdateStatus();
if( HvlpMinrootConfigurationError )
HvlpWriteEventLog((PCEVENT_DESCRIPTOR)&CmFcpWnfTypeId.TypeId[3], 0, 0i64);
RtlInitUnicodeString(&DestinationString, L"\\Callback\\PowerState");
ObjectAttributes.Length = 48;
ObjectAttributes.ObjectName = &DestinationString;
ObjectAttributes.RootDirectory = 0i64;
ObjectAttributes.Attributes = 80;
CallbackObject = 0i64;
*(_OWORD *)&ObjectAttributes.SecurityDescriptor = 0i64;
result = ExCreateCallback(&CallbackObject, &ObjectAttributes, 0, 1u);
if( result >= 0 )
{
ExRegisterCallback(CallbackObject, HvlpPowerStateCallback, 0i64);
goto LABEL_19;
}
}
return result;
}Referenced by:
IoInitSystemPreDrivers