From 0a779dbfd0366e65c27139269ad1c01b4a57b68b Mon Sep 17 00:00:00 2001 From: qhuang8 Date: Tue, 25 Mar 2008 07:13:18 +0000 Subject: Update Shell Binary to integrate an aligned issue in shell binaries. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4950 6f19259b-4bc3-4df7-8a09-765794883524 --- EdkShellBinPkg/GenBin/Shell_HotFix.diff | 189 ++++++++++++++++++++++++++++++++ 1 file changed, 189 insertions(+) create mode 100644 EdkShellBinPkg/GenBin/Shell_HotFix.diff (limited to 'EdkShellBinPkg/GenBin') diff --git a/EdkShellBinPkg/GenBin/Shell_HotFix.diff b/EdkShellBinPkg/GenBin/Shell_HotFix.diff new file mode 100644 index 0000000000..c023a7759a --- /dev/null +++ b/EdkShellBinPkg/GenBin/Shell_HotFix.diff @@ -0,0 +1,189 @@ +diff -urN Shell1.04\Shell/Library/DPath.c EdkCompatibilityPkg\Shell/Library/DPath.c +--- Shell1.04\Shell/Library/DPath.c 2007-11-15 14:38:52.000000000 +0800 ++++ EdkCompatibilityPkg\Shell/Library/DPath.c 2008-02-25 13:38:07.000000000 +0800 +@@ -1,6 +1,6 @@ + /*++ + +-Copyright (c) 2005 - 2007, Intel Corporation ++Copyright (c) 2005 - 2008, Intel Corporation + All rights reserved. This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the license may be found at +@@ -1294,17 +1294,8 @@ + ASSERT (Str != NULL); + ASSERT (DevPath != NULL); + +- if (ST->Hdr.Revision > 0x00020000) { +- FvPath = DevPath; +- CatPrint (Str, L"Fv(%g)", &FvPath->NameGuid); +- } else if (ST->Hdr.Revision < 0x00020000) { +- // +- // MEDIA_FV_FILEPATH_DP_EFI_1_10 == MEDIA_FV_DP == 0x06 +- // +- _DevPathFvFilePath (Str, DevPath); +- } else { +- _DevPathNodeUnknown (Str, DevPath); +- } ++ FvPath = DevPath; ++ CatPrint (Str, L"Fv(%g)", &FvPath->NameGuid); + } + #endif + +@@ -2006,16 +1997,11 @@ + #if (EFI_SPECIFICATION_VERSION > 0x00020000) + MEDIA_FW_VOL_FILEPATH_DEVICE_PATH_EFI_2_00 *FvDevicePathNodeUefi_2_00; + +- if (ST->Hdr.Revision > 0x00020000) { ++ if (ST->Hdr.Revision != 0x00020000) { + if (DevicePathType (&FvDevicePathNode->Header) == MEDIA_DEVICE_PATH && + DevicePathSubType (&FvDevicePathNode->Header) == MEDIA_FV_FILEPATH_DP) { + return &FvDevicePathNode->NameGuid; + } +- } else if (ST->Hdr.Revision < 0x00020000) { +- if (DevicePathType (&FvDevicePathNode->Header) == MEDIA_DEVICE_PATH && +- DevicePathSubType (&FvDevicePathNode->Header) == MEDIA_FV_FILEPATH_DP_EFI_1_10) { +- return &FvDevicePathNode->NameGuid; +- } + } else { + FvDevicePathNodeUefi_2_00 = (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH_EFI_2_00 *)FvDevicePathNode; + if (DevicePathType (&FvDevicePathNodeUefi_2_00->Piwg.Header) == MEDIA_DEVICE_PATH && +diff -urN Shell1.04\Shell/Library/DPath.h EdkCompatibilityPkg\Shell/Library/DPath.h +--- Shell1.04\Shell/Library/DPath.h 2007-11-14 22:48:14.000000000 +0800 ++++ EdkCompatibilityPkg\Shell/Library/DPath.h 2008-02-25 13:38:07.000000000 +0800 +@@ -1,6 +1,6 @@ + /*++ + +-Copyright (c) 2005 - 2007, Intel Corporation ++Copyright (c) 2005 - 2008, Intel Corporation + All rights reserved. This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the license may be found at +@@ -161,11 +161,6 @@ + + #if (EFI_SPECIFICATION_VERSION > 0x00020000) + // +-// For EFI1.10 FV file device path +-// +-#define MEDIA_FV_FILEPATH_DP_EFI_1_10 0x06 +- +-// + // For UEFI2.0 FV file device path + // + typedef struct { +diff -urN Shell1.04\Shell/Library/FileIO.c EdkCompatibilityPkg\Shell/Library/FileIO.c +--- Shell1.04\Shell/Library/FileIO.c 2006-03-15 11:54:44.000000000 +0800 ++++ EdkCompatibilityPkg\Shell/Library/FileIO.c 2008-03-24 13:44:52.000000000 +0800 +@@ -1,6 +1,6 @@ + /*++ + +-Copyright (c) 2005, Intel Corporation ++Copyright (c) 2005 - 2008, Intel Corporation + All rights reserved. This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the license may be found at +@@ -253,14 +253,16 @@ + + --*/ + { +- EFI_STATUS Status; +- EFI_FILE_HANDLE LastHandle; +- FILEPATH_DEVICE_PATH *FilePathNode; ++ EFI_STATUS Status; ++ EFI_FILE_HANDLE LastHandle; ++ FILEPATH_DEVICE_PATH *FilePathNode; ++ EFI_DEVICE_PATH_PROTOCOL *AlignedFilePath; + + ASSERT (FilePath != NULL); + ASSERT (DeviceHandle != NULL); + ASSERT (FileHandle != NULL); +- ++ ++ AlignedFilePath = NULL; + // + // File the file system for this file path + // +@@ -274,12 +276,26 @@ + *FileHandle = LibOpenRoot (*DeviceHandle); + Status = *FileHandle ? EFI_SUCCESS : EFI_UNSUPPORTED; + ++ if (EFI_ERROR (Status)) { ++ return Status; ++ } ++ ++ // ++ // Duplicate FilePath to make sure it is aligned so that ++ // FilePathNode->PathName below is 16-bit aligned. ++ // ++ AlignedFilePath = DuplicateDevicePath(*FilePath); ++ if (AlignedFilePath == NULL) { ++ (*FileHandle)->Close (*FileHandle); ++ *FileHandle = NULL; ++ return EFI_OUT_OF_RESOURCES; ++ } ++ FilePathNode = (FILEPATH_DEVICE_PATH *)AlignedFilePath; + // + // To access as a file system, the file path should only + // contain file path components. Follow the file path nodes + // and find the target file + // +- FilePathNode = (FILEPATH_DEVICE_PATH *) *FilePath; + while (!IsDevicePathEnd (&FilePathNode->Header)) { + // + // For file system access each node should be a file path component +@@ -332,6 +348,7 @@ + if (EFI_ERROR (Status)) { + *FileHandle = NULL; + } ++ FreePool(AlignedFilePath); + + return Status; + } +diff -urN Shell1.04\Shell/shellenv/var.c EdkCompatibilityPkg\Shell/shellenv/var.c +--- Shell1.04\Shell/shellenv/var.c 2006-03-07 16:20:44.000000000 +0800 ++++ EdkCompatibilityPkg\Shell/shellenv/var.c 2008-02-25 13:38:08.000000000 +0800 +@@ -389,8 +389,15 @@ + { + UINTN Size; + VARIABLE_ID *Var; ++ UINTN RoundUpValueSize; + +- Size = sizeof (VARIABLE_ID) + StrSize (Name) + ValueSize; ++ // ++ // Variable buffer layout: VARIABLE_ID + Value + Name ++ // We need to round up the variable size to make sure Name is aligned (for IPF). ++ // ++ RoundUpValueSize = (ValueSize % 2) ? (ValueSize + 1) : ValueSize; ++ ++ Size = sizeof (VARIABLE_ID) + StrSize (Name) + RoundUpValueSize; + Var = AllocateZeroPool (Size); + if (Var == NULL) { + return NULL; +@@ -398,7 +405,7 @@ + + Var->Signature = VARIABLE_SIGNATURE; + Var->u.Value = ((UINT8 *) Var) + sizeof (VARIABLE_ID); +- Var->Name = (CHAR16 *) (Var->u.Value + ValueSize); ++ Var->Name = (CHAR16 *) (Var->u.Value + RoundUpValueSize); + Var->ValueSize = ValueSize; + CopyMem (Var->u.Value, Value, ValueSize); + StrCpy (Var->Name, Name); +diff -urN Shell1.04\Shell/ver/Ver.inf EdkCompatibilityPkg\Shell/ver/Ver.inf +--- Shell1.04\Shell/ver/Ver.inf 2007-03-04 23:30:48.000000000 +0800 ++++ EdkCompatibilityPkg\Shell/ver/Ver.inf 2008-03-03 13:36:05.000000000 +0800 +@@ -1,6 +1,6 @@ + #/*++ + # +-# Copyright (c) 2005 - 2007, Intel Corporation ++# Copyright (c) 2005 - 2008, Intel Corporation + # All rights reserved. This program and the accompanying materials + # are licensed and made available under the terms and conditions of the BSD License + # which accompanies this distribution. The full text of the license may be found at +@@ -45,7 +45,7 @@ + Ver.c + Ver.h + +-[sources.ia32|x64] ++[sources.ia32,sources.x64] + ia32\ver32.c + + [sources.ipf] -- cgit v1.2.3