/* Support routine for the PE/COFF Loader that reads a buffer from a PE/COFF file. The function is used for XIP code to have optimized memory copy. */
EFI_STATUS EFIAPI PeiImageRead(IN VOID *FileHandle, IN UINTN FileOffset, IN UINTN *ReadSize, OUT VOID *Buffer)
/* Support routine for the PE/COFF Loader that reads a buffer from a PE/COFF file. The function is used for XIP code to have optimized memory copy. */
EFI_STATUS EFIAPI PeiImageRead(IN VOID *FileHandle, IN UINTN FileOffset, IN UINTN *ReadSize, OUT VOID *Buffer)
{
  CHAR8  *Destination8;
  CHAR8  *Source8;
  Destination8 = Buffer;
  Source8      = (CHAR8 *)((UINTN)FileHandle + FileOffset);
  if (Destination8 != Source8) {
    CopyMem (Destination8, Source8, *ReadSize);
  }
  return EFI_SUCCESS;
}