KeSetCurrentUmsTeb

UINT64 __stdcall KeSetCurrentUmsTeb(_ETHREAD *CurrentThread, UINT64 a2){
  UINT64 result; 

  if( !CurrentThread )
    CurrentThread = (_ETHREAD *)KeGetCurrentThread();
  if( (char)CurrentThread->Tcb.gap0[3] < 0 )
  {
    result = a2;
    __writemsr(0xC0000102, a2);
  }
  return result;
}

Referenced by:

KeUnInitializeUmsThread
KiSwapToUmsThread
PspDisassociateUmsThreadFromPrimary