3 Copyright (c) 2006, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
27 IN OUT UINTN
*ReadSize
,
34 Support routine for the PE/COFF Loader that reads a buffer from a PE/COFF file
38 FileHandle - The handle to the PE/COFF file
40 FileOffset - The offset, in bytes, into the file to read
42 ReadSize - The number of bytes to read from the file starting at FileOffset
44 Buffer - A pointer to the buffer to read the data into.
48 EFI_SUCCESS - ReadSize bytes of data were read into Buffer from the PE/COFF file starting at FileOffset
56 Destination8
= Buffer
;
57 Source8
= (CHAR8
*) ((UINTN
) FileHandle
+ FileOffset
);
60 *(Destination8
++) = *(Source8
++);
67 GetImageReadFunction (
68 IN PE_COFF_LOADER_IMAGE_CONTEXT
*ImageContext
74 Support routine to return the PE32 Image Reader.
75 If the PeiImageRead() function is less than a page
76 in legnth. If the function is more than a page the DXE IPL will crash!!!!
79 ImageContext - The context of the image being loaded
83 EFI_SUCCESS - If Image function location is found
90 ImageContext
->ImageRead
= PeiImageRead
;
95 // BugBug; This code assumes PeiImageRead() is less than a page in size!
96 // Allocate a page so we can shaddow the read function from FLASH into
97 // memory to increase performance.
100 MemoryBuffer
= AllocateCopyPool (0x400, (VOID
*)(UINTN
) PeiImageRead
);
101 ASSERT (MemoryBuffer
!= NULL
);
103 ImageContext
->ImageRead
= (PE_COFF_LOADER_READ_FILE
) (UINTN
) MemoryBuffer
;