]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Core/DxeIplPeim/Ipf/ImageRead.c
f449ecad9a3583f611ab6e3356b3152043b25e67
[mirror_edk2.git] / MdeModulePkg / Core / DxeIplPeim / Ipf / ImageRead.c
1 /** @file
2 This module loads an image to memory for IPF Cpu architecture.
3
4 Copyright (c) 2006 - 2008, Intel Corporation. <BR>
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 **/
14
15 #include "DxeIpl.h"
16
17 EFI_STATUS
18 PeiImageRead (
19 IN VOID *FileHandle,
20 IN UINTN FileOffset,
21 IN OUT UINTN *ReadSize,
22 OUT VOID *Buffer
23 )
24 /*++
25
26 Routine Description:
27
28 Support routine for the PE/COFF Loader that reads a buffer from a PE/COFF file
29
30 Arguments:
31
32 FileHandle - The handle to the PE/COFF file
33
34 FileOffset - The offset, in bytes, into the file to read
35
36 ReadSize - The number of bytes to read from the file starting at FileOffset
37
38 Buffer - A pointer to the buffer to read the data into.
39
40 Returns:
41
42 EFI_SUCCESS - ReadSize bytes of data were read into Buffer from the PE/COFF file starting at FileOffset
43
44 --*/
45 {
46 CHAR8 *Destination8;
47 CHAR8 *Source8;
48 volatile UINTN Length;
49
50 Destination8 = Buffer;
51 Source8 = (CHAR8 *) ((UINTN) FileHandle + FileOffset);
52 Length = *ReadSize;
53 CopyMem (Destination8, Source8, Length);
54
55 return EFI_SUCCESS;
56 }
57
58 EFI_STATUS
59 GetImageReadFunction (
60 IN PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
61 )
62 {
63 ImageContext->ImageRead = PeiImageRead;
64 return EFI_SUCCESS;
65 }