KiSystemService

VOID __fastcall KiSystemService(INT64 a1, UINT64 a2){
  unsigned __int64 v2; 
  unsigned __int64 v3; 
  unsigned __int64 v4; 
  unsigned __int64 v5; 
  unsigned __int64 v6; 
  _KTRAP_FRAME *__shifted(_KTRAP_FRAME,0x80) TrapFrame; 
  unsigned __int8 BpbKernelSpecCtrl; 
  unsigned __int8 BpbState; 
  __int16 v10; 

  if( v10 != 35 )
  {
    if( (KiKvaShadow & 1) == 0 )
      __swapgs();
    _mm_lfence();
    TrapFrame = KeGetTrapFrame();
    ADJ(TrapFrame)->_Rbx = v3;
    ADJ(TrapFrame)->_Rdi = v4;
    ADJ(TrapFrame)->_Rsi = v5;
    if( (_BYTE)KeSmapEnabled && (ADJ(TrapFrame)->SegCs & 1) != 0 )
      __stac();
    ADJ(TrapFrame)->_Rax = v2;
    ADJ(TrapFrame)->_Rcx = v6;
    ADJ(TrapFrame)->_Rdx = a2;
    __writegsqword(0x270u, KeGetCurrentThread()->Process->SecurityDomain);
    __writegsbyte(0x851u, KeGetPcr()->Prcb.BpbRetpolineExitSpecCtrl);
    __writegsbyte(0x852u, KeGetPcr()->Prcb.BpbState);
    BpbKernelSpecCtrl = KeGetPcr()->Prcb.BpbKernelSpecCtrl;
    if( KeGetPcr()->Prcb.BpbCurrentSpecCtrl != BpbKernelSpecCtrl )
    {
      __writegsbyte(0x27Au, BpbKernelSpecCtrl);
      __writemsr(0x48u, BpbKernelSpecCtrl);
    }
    BpbState = KeGetPcr()->Prcb.BpbState;
    if( (BpbState & 8) != 0 )
    {
      __writemsr(0x49u, 1ui64);
      BpbState = KeGetPcr()->Prcb.BpbState;
    }
    if( (BpbState & 2) != 0 )
      __flush_rsb();
    _mm_lfence();
    __writegsbyte(0x853u, 0);
    JUMPOUT(0x14040D63Ai64);
  }
  JUMPOUT(0x14040CF67i64);
}

Referenced by:

KiSystemServiceShadow