MiUnlockNestedPageTableWritePte
VOID __fastcall MiUnlockNestedPageTableWritePte(INT64 a1, volatile INT64 *a2, INT64 a3, INT64 a4){
int v5;
volatile INT64 *v6;
_MMPTE *PxeSelfRef;
int v9;
__int64 v10;
struct _KLOCK_QUEUE_HANDLE LockHandle;
memset(&LockHandle, 0, sizeof(LockHandle));
v5 = a4;
v6 = a2;
PxeSelfRef = MmGetPxeSelfRef();
if( (_MMPTE *)((char *)MmGetPteBase() + (((unsigned __int64)a2 >> 9) & 0x7FFFFFFFF8i64)) == PxeSelfRef )
{
v9 = 1;
if( !(_DWORD)a4 )
KeAcquireInStackQueuedSpinLock(&WorkerRoutine, &LockHandle);
}
else
{
v9 = 0;
}
v10 = 0i64;
if( (*(_BYTE *)(a1 + 184) & 7) == 0
&& v6 >= (volatile INT64 *)MmGetPml4eBase()
&& v6 <= (volatile INT64 *)MmGetPml4eLimit() )
{
v10 = *(_QWORD *)(*(_QWORD *)(*((_QWORD *)KeGetCurrentThread() + 23) + 1680i64) + 608i64);
}
if( v6 == (volatile INT64 *)PxeSelfRef )
{
MI_INTERLOCKED_EXCHANGE_PTE(v6, a3);
goto LABEL_9;
}
if( v10 )
{
if( (a3 & 1) != 0 )
goto LABEL_9;
goto LABEL_19;
}
if( !MiShouldLockPteDirectly(a1, (UINT64)v6) )
{
if( (a3 & 1) != 0 )
{
MiWriteValidPteNewProtection((INT64 *)v6, a3);
goto LABEL_9;
}
LABEL_19:
*v6 = a3;
goto LABEL_9;
}
_InterlockedExchange64(v6, a3);
v6 = 0i64;
LABEL_9:
if( v9 && !v5 )
{
KeReleaseInStackQueuedSpinLockFromDpcLevel(&LockHandle);
__writecr8(LockHandle.OldIrql);
}
if( v6 )
MiUnlockPageTableInternal(a1, (UINT64)v6);
}Referenced by:
MiClearPteAccessed
MiEvictPageTableLock
MiRewritePteWithLockBit
MiWsleFlush