MiInitNucleus
NTSTATUS __stdcall MiInitNucleus(PVOID BugCheckParameter2){
__int64 v2;
__int64 v3;
__int16 v4;
int *v5;
unsigned int i;
unsigned int v7;
__int64 *v8;
__int64 *v9;
__int64 v10;
UINT8 *v11;
unsigned int v12;
unsigned int v13;
__int64 v14;
_PHYSICAL_MEMORY_DESCRIPTOR *v15;
char v16;
INT64 v17;
UINT64 v18;
unsigned __int64 j;
__int64 v20;
char v21;
UINT8 *v22;
unsigned int v23;
UINT8 *v24;
UINT8 *v25;
unsigned int v26;
UINT8 *v27;
UINT8 *v28;
__int64 v30[2];
char IncludeType[48];
v30[1] = (__int64)&MiVisiblePartition;
MiInitializeSystemDefaults((INT64)BugCheckParameter2);
v2 = *(_QWORD *)MmGetPxeSelfRef();
v3 = *((_QWORD *)KeGetCurrentThread() + 23);
v4 = __readcr3();
*(_QWORD *)(v3 + 40) = v2 & 0xFFFFFFFFF000i64 | v4 & 0xFFF;
MiLowHalVa = (PVOID)MiExamineHalVa();
v5 = dword_140C4DCD8;
for( i = 0; i < 3; ++i )
{
*v5 = i;
v5[1] = i;
v5[2] = i;
v5[3] = i;
v5 += 4;
}
v7 = 0;
v8 = &qword_140C4DD08;
do
{
*(_DWORD *)v8 = v7++;
v8 = (__int64 *)((char *)v8 + 4);
}
while( v7 <= 3 );
dword_140C4DD14 = 1;
MiInitializeBootDefaults((_LOADER_PARAMETER_BLOCK *)BugCheckParameter2);
if( ((unsigned __int8)&xmmword_140C4E800 & 0xF) != 0 )
goto LABEL_67;
qword_140C4E810 = 0i64;
xmmword_140C4E800 = 0i64;
v9 = qword_140C4F570;
v10 = 16i64;
do
{
v9[1] = (__int64)v9;
*v9 = (__int64)v9;
v9 += 2;
--v10;
}
while( v10 );
qword_140C4E9E0 = 0i64;
qword_140C4E998 = 0i64;
qword_140C4E9A8 = (__int64)&qword_140C4E9A0;
qword_140C4E9A0 = (__int64)&qword_140C4E9A0;
xmmword_140C4E988 = 0i64;
MiInitializeDynamicVa();
if( dword_140CFA19C == 6881367 )
{
KUSER_SHARED_DATA.NtProductType = NtProductWinNt;
dword_140CFA19C = 0;
}
else
{
KUSER_SHARED_DATA.NtProductType = (dword_140CFA19C != 6357068) + 2;
dword_140CFA19C = 1;
}
v30[0] = 0i64;
qword_140C4DBF8 = -1i64;
if( ((int(__fastcall *)(__int64, __int64, __int64 *, _QWORD))off_140C00A68[0])(30i64, 16i64, v30, 0i64) >= 0
&& (v11 = (UINT8 *)v30[0]) != 0i64 )
{
v12 = 0;
if( *(_QWORD *)v30[0] != -1i64 )
{
v13 = (unsigned __int16)KeNumberNodes;
v14 = 0i64;
do
{
if( *(_DWORD *)&v11[v14 + 8] >= v13 )
{
*(_DWORD *)&v11[v14 + 8] = 0;
v11 = (UINT8 *)v30[0];
}
dword_140C4DBC8 = v12++;
v14 = 16i64 * v12;
}
while( *(_QWORD *)&v11[v14] != -1i64 );
}
}
else
{
v11 = (UINT8 *)qword_140C4DBE8;
v30[0] = (__int64)qword_140C4DBE8;
}
qword_140C4DC08 = v11;
MiInitializeChannelRangesTemporary();
MiMemoryLicense((_LOADER_PARAMETER_BLOCK *)BugCheckParameter2);
qword_140D577F8 = KeQueryPerformanceCounter(0i64).QuadPart;
MiRemoveLargeFreeLoaderDescriptors((INT64)BugCheckParameter2);
qword_140D57800 = KeQueryPerformanceCounter(0i64).QuadPart;
LODWORD(v15) = MiFindLargestLoaderDescriptor((_LOADER_PARAMETER_BLOCK *)BugCheckParameter2);
if( !(_DWORD)v15 )
{
byte_140C4E53A = 3;
LABEL_22:
LOBYTE(v15) = 0;
return(int)v15;
}
MiCheckLargePageOk((_LOADER_PARAMETER_BLOCK *)BugCheckParameter2);
qword_140C4DCD0 = -1i64;
MiProtectSharedUserPage();
MiCreateResidentPfnTemplate((INT64)&xmmword_140C4E2C0);
MiCreateResidentBasePfnTemplate((INT64)&xmmword_140C4E2F0);
qword_140D57808 = KeQueryPerformanceCounter(0i64).QuadPart;
LODWORD(v15) = MiCreatePfnDatabase((_LOADER_PARAMETER_BLOCK *)BugCheckParameter2);
if( !(_DWORD)v15 )
{
byte_140C4E53A = 6;
goto LABEL_22;
}
qword_140D57810 = KeQueryPerformanceCounter(0i64).QuadPart;
MiInitializePfnsForValidMappings((_LOADER_PARAMETER_BLOCK *)BugCheckParameter2);
qword_140D57818 = KeQueryPerformanceCounter(0i64).QuadPart;
MiSwitchToPfns((_LOADER_PARAMETER_BLOCK *)BugCheckParameter2);
qword_140D57820 = KeQueryPerformanceCounter(0i64).QuadPart;
MxRelocatePageTables((_LOADER_PARAMETER_BLOCK *)BugCheckParameter2);
qword_140D57828 = KeQueryPerformanceCounter(0i64).QuadPart;
MiZeroBootMappings();
MiInitializeDecayPfns();
if( ((unsigned __int8)&xmmword_140C4E750 & 0xF) != 0 )
LABEL_67:
RtlRaiseStatus(-2147483646);
xmmword_140C4E750 = 0i64;
MiInitializeSections((INT64)&MiSystemPartition);
MiInitializeCommitment((_MI_PARTITION *)&MiSystemPartition);
MiInitializeDummyPages();
LODWORD(v15) = MiInitializeSystemPtes();
if( !(_DWORD)v15 )
{
byte_140C4E53A = 9;
goto LABEL_22;
}
LODWORD(v15) = MiInitializeNonPagedPool();
if( !(_DWORD)v15 )
{
byte_140C4E53A = 7;
goto LABEL_22;
}
LODWORD(v15) = MiMapDummyPages();
if( !(_DWORD)v15 )
{
byte_140C4E53A = 5;
goto LABEL_22;
}
v16 = BYTE2(MiFlags);
qword_140D57830 = KeQueryPerformanceCounter(0i64).QuadPart;
LODWORD(v15) = ExInitializePoolHeapManagement((unsigned __int8)(v16 & 1) << 10);
if( (int)v15 < 0 )
{
byte_140C4E53A = 2;
goto LABEL_22;
}
LODWORD(v15) = MiInitializeKernelStacks();
if( !(_DWORD)v15 )
{
byte_140C4E53A = 20;
goto LABEL_22;
}
LODWORD(v15) = MiCreateTopLevelUltraMappings(v18, v17);
if( !(_DWORD)v15 )
goto LABEL_66;
LODWORD(v15) = MmInitializeProcessor((__int64)KeGetCurrentPrcb());
if( !(_DWORD)v15 )
{
byte_140C4E53A = 10;
goto LABEL_22;
}
v15 = (_PHYSICAL_MEMORY_DESCRIPTOR *)MiReservePtes((INT64)&qword_140C4EC80, 1ui64);
qword_140C4E5C8 = (UINT64)v15;
if( !v15 )
{
byte_140C4E53A = 11;
goto LABEL_22;
}
*(_QWORD *)&v15->NumberOfRuns = ZeroPte;
MiFreeUnusedPfnPages(0i64);
for( j = 0i64; j < 0x29; ++j )
{
v20 = 0x1C5C0C00048i64;
if( _bittest64(&v20, j) )
v21 = 0;
else
v21 = 1;
IncludeType[j] = v21;
}
qword_140D57838 = KeQueryPerformanceCounter(0i64).QuadPart;
v15 = MmInitializeMemoryLimits((_LOADER_PARAMETER_BLOCK *)BugCheckParameter2, (UINT8 *)IncludeType);
if( !v15
|| (v15 = MiConvertInitialMemoryBlock((_MI_PARTITION *)&MiSystemPartition, v15), (v22 = (UINT8 *)v15) == 0i64) )
{
byte_140C4E53A = 12;
goto LABEL_22;
}
MiCreateNodeLists((_MI_PARTITION *)&MiSystemPartition, v15);
*(_QWORD *)&qword_140C50AE0 = v15;
if( !v15 )
{
byte_140C4E53A = 13;
goto LABEL_22;
}
MiComputeNodeMemory((_MI_PARTITION *)&MiSystemPartition);
LODWORD(v15) = MiFillPfnGaps();
if( !(_DWORD)v15 )
{
byte_140C4E53A = 18;
goto LABEL_22;
}
LODWORD(v15) = MiInitializeGapFrames(0xFFFFFFFFFFFFFFFFui64, &GapFrames);
if( !(_DWORD)v15 )
{
LABEL_66:
byte_140C4E53A = 19;
goto LABEL_22;
}
qword_140D57840 = KeQueryPerformanceCounter(0i64).QuadPart;
LODWORD(v15) = MiInitializePageFaultResources();
if( !(_DWORD)v15 )
{
byte_140C4E53A = 21;
goto LABEL_22;
}
LODWORD(v15) = MiBuildPagedPool();
if( !(_DWORD)v15 )
goto LABEL_22;
MmPhysicalMemoryBlock = v22;
MiCreatePfnBitMaps();
if( !(_DWORD)v15 )
{
byte_140C4E53A = 15;
goto LABEL_22;
}
qword_140D57848 = KeQueryPerformanceCounter(0i64).QuadPart;
MiMarkLargePageRanges();
qword_140D57850 = KeQueryPerformanceCounter(0i64).QuadPart;
MiInitializeWsSwapping((_MI_PARTITION *)&MiSystemPartition);
if( qword_140C4DC08 != (UINT8 *)qword_140C4DBE8 )
{
v23 = 16 * (dword_140C4DBC8 + 2);
LODWORD(v24) = MiAllocatePool((struct _SLIST_ENTRY *)0x40);
v25 = v24;
if( v24 )
{
memmove(v24, qword_140C4DC08, v23);
qword_140C4DC08 = v25;
}
}
if( qword_140C4DC10 )
{
v26 = 16 * (dword_140C4DBD4 + 2);
LODWORD(v27) = MiAllocatePool((struct _SLIST_ENTRY *)0x40);
v28 = v27;
if( v27 )
{
memmove(v27, qword_140C4DC10, v26);
qword_140C4DC10 = v28;
}
}
v15 = (_PHYSICAL_MEMORY_DESCRIPTOR *)ExInitializeNPagedLookasideListInternal(
(__int64)qword_140C4E780,
0i64,
0i64,
512,
144,
1800170829,
0,
0);
LOBYTE(v15) = 1;
return(int)v15;
}Referenced by:
MmInitSystem