/** @file\r
Pei Core Load Image Support\r
\r
-Copyright (c) 2006 - 2010, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
+Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
http://opensource.org/licenses/bsd-license.php\r
OUT VOID *Buffer\r
)\r
{\r
- CHAR8 *Destination8;\r
- CHAR8 *Source8;\r
- UINTN Length;\r
+ volatile CHAR8 *Destination8;\r
+ CHAR8 *Source8;\r
+ UINTN Length;\r
\r
Destination8 = Buffer;\r
Source8 = (CHAR8 *) ((UINTN) FileHandle + FileOffset);\r
VOID* MemoryBuffer;\r
\r
Private = PEI_CORE_INSTANCE_FROM_PS_THIS (GetPeiServicesTablePointer ());\r
-\r
- if (!Private->PeiMemoryInstalled || (Private->HobList.HandoffInformationTable->BootMode == BOOT_ON_S3_RESUME)) {\r
- ImageContext->ImageRead = PeiImageRead;\r
- } else {\r
+ \r
+ if ((Private->PeiMemoryInstalled && !(Private->HobList.HandoffInformationTable->BootMode == BOOT_ON_S3_RESUME)) &&\r
+ (EFI_IMAGE_MACHINE_TYPE_SUPPORTED(EFI_IMAGE_MACHINE_X64) || EFI_IMAGE_MACHINE_TYPE_SUPPORTED(EFI_IMAGE_MACHINE_IA32))) {\r
+ // \r
+ // Shadow algorithm makes lots of non ANSI C assumptions and only works for IA32 and X64 \r
+ // compilers that have been tested\r
+ //\r
if (Private->ShadowedImageRead == NULL) {\r
MemoryBuffer = AllocatePages (0x400 / EFI_PAGE_SIZE + 1);\r
ASSERT (MemoryBuffer != NULL);\r
}\r
\r
ImageContext->ImageRead = Private->ShadowedImageRead;\r
+ } else {\r
+ ImageContext->ImageRead = PeiImageRead;\r
}\r
\r
return EFI_SUCCESS;\r