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