summaryrefslogtreecommitdiffstats
path: root/EdkShellBinPkg/GenBin/Shell_HotFix.diff
blob: c023a7759a95bd00852946439c2398d809e8c210 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
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]