]>
Commit | Line | Data |
---|---|---|
96226baa | 1 | /** @file\r |
2 | This module loads an image to memory for IA32 Cpu architecture.\r | |
95276127 | 3 | \r |
6d3ea23f | 4 | Copyright (c) 2006 - 2009, Intel Corporation. <BR>\r |
96226baa | 5 | All rights reserved. This program and the accompanying materials\r |
6 | are licensed and made available under the terms and conditions of the BSD License\r | |
7 | which accompanies this distribution. The full text of the license may be found at\r | |
8 | http://opensource.org/licenses/bsd-license.php\r | |
95276127 | 9 | \r |
96226baa | 10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r |
11 | WITHOUT 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 | 30 | EFI_STATUS\r |
6d3ea23f | 31 | EFIAPI\r |
95276127 | 32 | PeiImageRead (\r |
33 | IN VOID *FileHandle,\r | |
34 | IN UINTN FileOffset,\r | |
35 | IN OUT UINTN *ReadSize,\r | |
36 | OUT VOID *Buffer\r | |
37 | )\r | |
95276127 | 38 | {\r |
39 | UINT8 *Destination32;\r | |
40 | UINT8 *Source32;\r | |
41 | UINTN Length;\r | |
42 | \r | |
43 | \r | |
44 | Destination32 = Buffer;\r | |
45 | Source32 = (UINT8 *) ((UINTN) FileHandle + FileOffset);\r | |
46 | \r | |
47 | //\r | |
48 | // This function assumes 32-bit alignment to increase performance\r | |
49 | //\r | |
95276127 | 50 | \r |
51 | Length = *ReadSize;\r | |
708919be | 52 | while (Length-- != 0) {\r |
95276127 | 53 | *(Destination32++) = *(Source32++);\r |
54 | }\r | |
55 | \r | |
56 | return EFI_SUCCESS;\r | |
57 | }\r |