KePrepareToDispatchVirtualProcessor
char __fastcall KePrepareToDispatchVirtualProcessor(char a1, _BYTE *a2, _BYTE *a3, _BYTE *a4, _BYTE *a5, _QWORD *a6){
void **v6;
struct _KPRCB *CurrentPrcb;
int v8;
unsigned __int64 SecurityDomain;
unsigned __int8 v10;
unsigned __int8 BpbState;
unsigned __int8 BpbRetpolineExitSpecCtrl;
unsigned __int8 BpbKernelSpecCtrl;
void *retaddr;
v6 = &retaddr;
CurrentPrcb = KeGetCurrentPrcb();
v8 = KiSpeculationFeatures;
*a2 = 0;
*a3 = 0;
*a4 = 0;
*a5 = 0;
*a6 = 0i64;
_disable();
if( a1 )
{
if( (v8 & 0x100000) == 0 )
{
*a3 = 1;
return(char)v6;
}
SecurityDomain = CurrentPrcb->CurrentThread->Tcb.Process->SecurityDomain;
if( !SecurityDomain )
{
*a3 = 1;
LABEL_12:
if( (CurrentPrcb->PairRegister & 2) != 0 )
{
KiUpdateStibpPairing(0i64);
}
else
{
BpbState = CurrentPrcb->BpbState;
if( (BpbState & 4) != 0 )
{
__writemsr(0x49u, 1ui64);
CurrentPrcb->BpbState &= ~4u;
*a2 = 1;
BpbState = CurrentPrcb->BpbState;
}
if( (BpbState & 0x20) != 0 )
{
KiFlushCurrentRsb();
CurrentPrcb->BpbState &= ~0x20u;
}
CurrentPrcb->TrappedSecurityDomain = SecurityDomain;
}
BpbRetpolineExitSpecCtrl = CurrentPrcb->BpbRetpolineExitSpecCtrl;
LOBYTE(v6) = CurrentPrcb->BpbState;
BpbKernelSpecCtrl = CurrentPrcb->BpbKernelSpecCtrl;
CurrentPrcb->BpbTrappedRetpolineExitSpecCtrl = BpbRetpolineExitSpecCtrl;
CurrentPrcb->BpbTrappedBpbState = (unsigned __int8)v6;
if( (v8 & 0x2000000) != 0 && (CurrentPrcb->BpbRetpolineState & 1) != 0 )
BpbKernelSpecCtrl = BpbRetpolineExitSpecCtrl;
if( CurrentPrcb->BpbCurrentSpecCtrl != BpbKernelSpecCtrl )
{
LOBYTE(v6) = BpbKernelSpecCtrl;
*a6 = BpbKernelSpecCtrl;
*a5 = 1;
CurrentPrcb->BpbCurrentSpecCtrl = BpbKernelSpecCtrl;
}
return(char)v6;
}
v10 = CurrentPrcb->BpbState;
if( (v10 & 8) == 0
&& ((CurrentPrcb->BpbRetpolineState & 1) == 0 || (v10 & 0x10) == 0)
&& ((v8 & 0x10) == 0 || (v8 & 0x1000) != 0) )
{
*a4 = 1;
goto LABEL_12;
}
}
LOBYTE(v6) = CurrentPrcb->BpbState;
if( ((unsigned __int8)v6 & 4) != 0 )
{
__writemsr(0x49u, 1ui64);
CurrentPrcb->BpbState &= ~4u;
*a2 = 1;
LOBYTE(v6) = CurrentPrcb->BpbState;
}
if( ((unsigned __int8)v6 & 0x20) != 0 )
{
LOBYTE(v6) = KiFlushCurrentRsb();
CurrentPrcb->BpbState &= ~4u;
}
return(char)v6;
}Referenced by:
No references.