/* This function is the entry point for a Standalone MM Driver. This function must call ProcessLibraryConstructorList() and ProcessModuleEntryPointList(). If the return status from ProcessModuleEntryPointList() is an error status, then ProcessLibraryDestructorList() must be called. The return value from ProcessModuleEntryPointList() is returned. If _gMmRevision is not zero and SystemTable->Hdr.Revision is less than _gMmRevision, then return EFI_INCOMPATIBLE_VERSION. */
EFI_STATUS EFIAPI _ModuleEntryPoint(IN EFI_HANDLE ImageHandle, IN IN EFI_MM_SYSTEM_TABLE *MmSystemTable)
/* This function is the entry point for a Standalone MM Driver. This function must call ProcessLibraryConstructorList() and ProcessModuleEntryPointList(). If the return status from ProcessModuleEntryPointList() is an error status, then ProcessLibraryDestructorList() must be called. The return value from ProcessModuleEntryPointList() is returned. If _gMmRevision is not zero and SystemTable->Hdr.Revision is less than _gMmRevision, then return EFI_INCOMPATIBLE_VERSION. */
EFI_STATUS EFIAPI _ModuleEntryPoint(IN EFI_HANDLE ImageHandle, IN IN EFI_MM_SYSTEM_TABLE *MmSystemTable)
{
  EFI_STATUS                 Status;
  EFI_LOADED_IMAGE_PROTOCOL  *LoadedImage;
  if (_gMmRevision != 0) {
    if (MmSystemTable->Hdr.Revision < _gMmRevision) {
      return EFI_INCOMPATIBLE_VERSION;
    }
  }
  ProcessLibraryConstructorList (ImageHandle, MmSystemTable);
  if (_gDriverUnloadImageCount != 0) {
    Status = gMmst->MmHandleProtocol (
                      ImageHandle,
                      &gEfiLoadedImageProtocolGuid,
                      (VOID **)&LoadedImage
                      );
    ASSERT_EFI_ERROR (Status);
    LoadedImage->Unload = _DriverUnloadHandler;
  }
  Status = ProcessModuleEntryPointList (ImageHandle, MmSystemTable);
  if (EFI_ERROR (Status)) {
    ProcessLibraryDestructorList (ImageHandle, MmSystemTable);
  }
  return Status;
}