MiUnmapImageForEnclaveUse

VOID __stdcall MiUnmapImageForEnclaveUse(PVOID BaseAddress){
  _KAPC_STATE ApcState; 
  memset(&ApcState, 0, sizeof(ApcState));
  KiStackAttachProcess((_KPROCESS *)PsSecureSystemProcess, 0i64, &ApcState);
  MiUnmapViewOfSection(PsSecureSystemProcess, (unsigned __int64)BaseAddress, 0, 0);
  KiUnstackDetachProcess(&ApcState, 0i64);
}

Referenced by:

MiInitializeVsmEnclave
MiLoadSectionIntoVsmEnclave