]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Core/DxeIplPeim/Ipf/ImageRead.c
Code Scrub DxeIpl module.
[mirror_edk2.git] / MdeModulePkg / Core / DxeIplPeim / Ipf / ImageRead.c
CommitLineData
96226baa 1/** @file\r
2 This module loads an image to memory for IPF Cpu architecture.\r
95276127 3\r
96226baa 4Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r
31528f0c 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
9\r
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\r
19/**\r
20 Support routine for the PE/COFF Loader that reads a buffer from a PE/COFF file\r
21\r
22 @param FileHandle The handle to the PE/COFF file \r
23 @param FileOffset The offset, in bytes, into the file to read \r
24 @param ReadSize The number of bytes to read from the file starting at \r
25 FileOffset \r
26 @param Buffer A pointer to the buffer to read the data into. \r
27\r
28 @retval EFI_SUCCESS ReadSize bytes of data were read into Buffer from the \r
29 PE/COFF file starting at FileOffset\r
30\r
31**/\r
95276127 32EFI_STATUS\r
33PeiImageRead (\r
34 IN VOID *FileHandle,\r
35 IN UINTN FileOffset,\r
36 IN OUT UINTN *ReadSize,\r
37 OUT VOID *Buffer\r
38 )\r
95276127 39{\r
40 CHAR8 *Destination8;\r
41 CHAR8 *Source8;\r
42 volatile UINTN Length;\r
43\r
44 Destination8 = Buffer;\r
45 Source8 = (CHAR8 *) ((UINTN) FileHandle + FileOffset);\r
46 Length = *ReadSize;\r
31528f0c 47 CopyMem (Destination8, Source8, Length);\r
95276127 48\r
49 return EFI_SUCCESS;\r
50}\r
51\r
91d92e25 52\r
53/**\r
54 This function simply retrieves the function pointer of ImageRead in\r
55 ImageContext structure.\r
56 \r
57 @param ImageContext A pointer to the structure of \r
58 PE_COFF_LOADER_IMAGE_CONTEXT\r
59 \r
b98da1b1 60 @retval EFI_SUCCESS This function always returns EFI_SUCCESS.\r
91d92e25 61\r
62**/\r
95276127 63EFI_STATUS\r
64GetImageReadFunction (\r
65 IN PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext\r
66 )\r
67{\r
68 ImageContext->ImageRead = PeiImageRead;\r
69 return EFI_SUCCESS;\r
70}\r