]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Core/DxeIplPeim/Ia32/ImageRead.c
Code scrub DxeIpl, Runtime, DevicePath, FvbServicesLib, DiskIo, Partition, English...
[mirror_edk2.git] / MdeModulePkg / Core / DxeIplPeim / Ia32 / ImageRead.c
CommitLineData
96226baa 1/** @file\r
2 This module loads an image to memory for IA32 Cpu architecture.\r
95276127 3\r
96226baa 4Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r
5All rights reserved. This program and the accompanying materials\r
6are licensed and made available under the terms and conditions of the BSD License\r
7which accompanies this distribution. The full text of the license may be found at\r
8http://opensource.org/licenses/bsd-license.php\r
95276127 9\r
96226baa 10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
95276127 12\r
96226baa 13**/\r
95276127 14\r
95276127 15#include "DxeIpl.h"\r
16\r
91d92e25 17/**\r
18 Support routine for the PE/COFF Loader that reads a buffer from a PE/COFF file\r
19\r
20 @param FileHandle The handle to the PE/COFF file \r
21 @param FileOffset The offset, in bytes, into the file to read \r
22 @param ReadSize The number of bytes to read from the file starting at \r
23 FileOffset \r
24 @param Buffer A pointer to the buffer to read the data into. \r
25\r
26 @retval EFI_SUCCESS ReadSize bytes of data were read into Buffer from the \r
27 PE/COFF file starting at FileOffset\r
28\r
29**/\r
95276127 30EFI_STATUS\r
95276127 31PeiImageRead (\r
32 IN VOID *FileHandle,\r
33 IN UINTN FileOffset,\r
34 IN OUT UINTN *ReadSize,\r
35 OUT VOID *Buffer\r
36 )\r
95276127 37{\r
38 UINT8 *Destination32;\r
39 UINT8 *Source32;\r
40 UINTN Length;\r
41\r
42 \r
43 Destination32 = Buffer;\r
44 Source32 = (UINT8 *) ((UINTN) FileHandle + FileOffset);\r
45\r
46 //\r
47 // This function assumes 32-bit alignment to increase performance\r
48 //\r
95276127 49\r
50 Length = *ReadSize;\r
708919be 51 while (Length-- != 0) {\r
95276127 52 *(Destination32++) = *(Source32++);\r
53 }\r
54\r
55 return EFI_SUCCESS;\r
56}\r