KeExpandKernelStackAndCalloutInternal

NTSTATUS __fastcall KeExpandKernelStackAndCalloutInternal(
        PVOID BugCheckParameter2,
        PVOID BugCheckParameter3,
        UINT64 a3,
        CHAR a4,
        INT64 a5){
  NTSTATUS result; 
  unsigned __int8 CurrentIrql; 
  _ETHREAD *CurrentThread; 
  __int32 bf_0; 
  char v11; 
  unsigned __int8 v12; 

  result = KiExpandKernelStackAndCalloutSwitchStack((VOID(*)(void))BugCheckParameter2, BugCheckParameter3, a3, a4, a5);
  if( result == -1073740661 )
  {
    CurrentIrql = KeGetCurrentIrql();
    CurrentThread = (_ETHREAD *)KeGetCurrentThread();
    bf_0 = CurrentThread->Tcb._bf_0;
    if( (bf_0 & 0x1000) != 0 )
    {
      v11 = 1;
    }
    else
    {
      CurrentThread->Tcb._bf_0 = bf_0 | 0x1000;
      v11 = 0;
    }
    ((void(__fastcall *)(PVOID))BugCheckParameter2)(BugCheckParameter3);
    if( !v11 )
      CurrentThread->Tcb._bf_0 &= ~0x1000u;
    if( KeGetCurrentIrql() != CurrentIrql )
    {
      v12 = KeGetCurrentIrql();
      KeBugCheckEx(
        0xC8u,
        (PVOID)(((CurrentIrql | ((unsigned __int64)v12 << 8)) << 8) | 2),
        BugCheckParameter2,
        BugCheckParameter3,
        0i64);
    }
    return 0;
  }
  return result;
}

Referenced by:

KeExpandKernelStackAndCallout
KeExpandKernelStackAndCalloutEx
KeInitSystem
MiDoStackCopy
MiSwapStackPage
SMKM_STORE::SmStDirectRead